Commit Graph

182 Commits

Author SHA1 Message Date
Bastien Montagne ab0bc65c24 Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.

Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!

As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).

Reviewers: brecht, campbellbarton, sergey

Differential Revision: https://developer.blender.org/D4407
2019-03-07 11:29:50 +01:00
Campbell Barton de13d0a80c doxygen: add newline after \file
While \file doesn't need an argument, it can't have another doxy
command after it.
2019-02-18 08:22:12 +11:00
Bastien Montagne 7cca0f9998 Fix T61391: MeshDeform Modifier does not work on a solidified planar mesh.
`BKE_modifier_get_evaluated_mesh_from_evaluated_object()` used by
modifiers needing access to other objects' geometry probably skipped out
of the radar when cage and final evaluated meshes were added to
BMEditMesh? In any case, we do not need to duplicate (and then free!) a
temp mesh from editdata anymore, and we can even add instead a parameter
to get cage instead of final. Also makes modifiers code a bit simpler.
2019-02-11 20:24:07 +01:00
Campbell Barton eef4077f18 Cleanup: remove redundant doxygen \file argument
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
2019-02-06 15:45:22 +11:00
Campbell Barton 65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
Campbell Barton c0f88ed8a8 Cleanup: sort forward declarations of enum & struct
Done using:
  source/tools/utils_maintenance/c_sort_blocks.py
2019-01-28 21:17:58 +11:00
Campbell Barton b8467273b8 Cleanup: redundant defines
Comment or remove unused defines.
2019-01-26 19:15:30 +11:00
Campbell Barton 49490e5cfb Merge branch 'master' into blender2.8 2018-12-12 13:02:09 +11:00
Bastien Montagne 1f1ea26d8c Fix typos. 2018-11-27 21:17:06 +01:00
Sergey Sharybin 91c6beb28a Cleanup: Remove unused modifiers callback
Was only used by subsurf in the past years, it is unlikely
other modifiers will every need this any time soon.
2018-10-24 14:04:29 +02:00
Campbell Barton b15123d279 Cleanup: remove unused derived mesh wrappers 2018-10-12 18:14:11 +11:00
Campbell Barton 75ac83610b Modifier: add non derived mesh modifier wrappers
Rename modifier_deformVerts_ensure_normals &
modifier_applyModifier_ensure_normals with wrappers that match 2.7x
convention.
2018-10-09 13:20:20 +11:00
Campbell Barton c8c3bbaade Cleanup: naming
Rename DerivedMesh modifier functions to make room for mesh versions.
2018-10-09 12:23:22 +11:00
Brecht Van Lommel 342e73f90f Spelling fixes in comments and descriptions (2.8 changes), patch by luzpaz.
Differential Revision: https://developer.blender.org/D3719
2018-09-24 18:48:29 +02:00
Jacques Lucke b5dbe43d3e Cleanup: move DerivedMesh wrappers for modifiers further down the hierarchy
The main goal of this patch is to cleanup the interface of every modifier. More specifically the interface of modifiers should be DerivedMesh-free.
Internally some modifiers still use DerivedMesh. However I think it is better when the wrappers are in the modifiers so that higher level functions can use the simplified interface.

This patch removes the applyModifier_DM and applyModifierEM_DM functions. In a previous patch (rB3614d9d) the other functions that used DerivedMesh have been removed.

Reviewers: brecht
2018-09-20 12:04:17 +02:00
Jacques Lucke 3614d9d2a2 Cleanup: Remove some DerivedMesh wrappers for modifiers
Specifically the deformVerts_DM, deformMatrices_DM, deformVertsEM_DM and deformMatricesEM_DM functions are not used anymore.

Reviewer: brecht
2018-09-19 17:33:03 +02:00
Sergey Sharybin 6a2305191f Cleanup: Remove unused modifier evaluation flag 2018-09-06 11:47:44 +02:00
Sergey Sharybin e4ce5fd8d2 Modifiers: Use bool for boolean flag in isDisabled 2018-07-10 12:14:33 +02:00
Sybren A. Stüvel 60b9d413db Pass copy flag to modifier copyData function
This will allow modifiers to decide whether to copy or share caches between
ModifierData copies.
2018-07-04 14:52:14 +02:00
Campbell Barton 18d87e79e9 Merge branch 'master' into blender2.8 2018-06-29 09:25:40 +02:00
Campbell Barton b372766816 Cleanup: trailing newlines 2018-06-29 09:23:51 +02:00
Sergey Sharybin 6427141f7b Modifiers: Stop using md->scene in isDisabled() callback
This is first commit in series of changes to get rid of md->scene.
2018-06-21 18:04:05 +02:00
Campbell Barton 06a1a66a9b Merge branch 'master' into blender2.8 2018-06-17 17:10:19 +02:00
Campbell Barton 6fc8a74886 Cleanup: trailing space for blenkernel 2018-06-17 17:05:51 +02:00
Bastien Montagne 70f8eaf1b7 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/editors/space_view3d/drawobject.c
2018-06-09 15:18:21 +02:00
Bastien Montagne 638de72277 Cleanup: remove some G.main usages. 2018-06-09 15:17:04 +02:00
Bastien Montagne b809340960 Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/blender_curves.cpp
	source/blender/blenkernel/BKE_particle.h
	source/blender/blenkernel/intern/modifier.c
	source/blender/blenkernel/intern/object_update.c
	source/blender/blenkernel/intern/particle_system.c
	source/blender/editors/object/object_modifier.c
	source/blender/editors/physics/physics_fluid.c
	source/blender/makesrna/intern/rna_particle.c
	source/blender/modifiers/intern/MOD_particlesystem.c
2018-05-31 15:37:15 +02:00
Bastien Montagne b53d358261 Cleanup: remove G.main from BKE modifier. 2018-05-31 15:24:30 +02:00
Bastien Montagne 72f4ac99c7 Cleanup/fix wrong modifiers targets handling in COW context.
Modifiers stack only get COW/evaluated IDs, so no need to go auery again
DEG for those. Further more, now unified handling of EditBMesh case (was
done on case-by-case basis in a few modifiers, not all for some reason).

We are still missing the ability to get final and cage deformed meshes
when in Edit mode though, this is to be defined/implemented in depsgraph.
2018-05-30 12:04:06 +02:00
Dalai Felinto e8c8ff4f86 Fix all modifiers that depended on BKE_modifier_get_evaluated_mesh_from_object
This fix applying the following modifiers:
* Boolean (working already)
* Array
* Mesh Deform
* Surface Deform
* Vertex Weight Proximity

This function was to return evaluated mesh. So it should get the evaluated
object at all times. So in this case it makes more sense to simply pass the
depsgraph (or in this case the ModifierEvalContext that contains both the
depsgraph and the flag.

Solution discussed with Bastien Montagne.
2018-05-24 16:43:21 +02:00
Mai Lavelle c43dbc2bc2 Add modifier_deformVerts_ensure_normals, modifier_applyModifier_ensure_normals
Same as `modwrap_deformVerts` and `modwrap_applyModifier` but for `Mesh`.
2018-05-16 06:07:50 -04:00
Jeroen Bakker 6d155dc462 T54983: Bone selection overlay
Bone selection overlay is only available in pose mode.
and when active overrules the selection buffer.

This is currently `tricked` by switching the draw engines, but this is
an exception. Not sure how to solve this in a better way.

After this is solved we can look at how to localize the dim effect to only the objects connected to the active armatures. Currently it dims the whole screen (including background).

@campbellbarton I added you as reviewer as it you have done a lot in the DRW_draw_select_loop

Reviewers: campbellbarton, fclem

Reviewed By: fclem

Subscribers: campbellbarton

Tags: #bf_blender_2.8, #code_quest

Maniphest Tasks: T54983

Differential Revision: https://developer.blender.org/D3241
2018-05-11 08:17:05 +02:00
Bastien Montagne e53cf14280 Cleanup/refactor: Move get_mesh_eval_for_modifier from MOD_util to BKE_modifier.
Because some modifiers' actual code is in BKE... Also renamed to more
BKE-valid name BKE_modifier_get_evaluated_mesh_from_object.
2018-05-09 12:47:23 +02:00
Bastien Montagne 53a56b7b6c Merge branch 'master' into blender2.8 2018-05-08 15:20:18 +02:00
Bastien Montagne 3740f7593d Cleanup: Nuke empty dummy wrappers around modifier_copyData_generic().
This also changes signature of modifier copy callback, first (source)
parameter is now a const, which is saner anyway!
2018-05-08 15:04:10 +02:00
Sybren A. Stüvel 334b55fd2e Extract common modifier parameters into ModifierEvalContext struct
The contents of the ModifierEvalContext struct are constant while iterating
over the modifier stack. The struct thus should be only created once, outside
any loop over the modifiers.
2018-05-01 18:02:17 +02:00
Sybren A. Stüvel 6b9f1ffe6e Formatting 2018-05-01 18:02:17 +02:00
Mai Lavelle be4df85919 Modifiers: Add wrapper functions with Mesh / DerivedMesh conversion
Makes the follow changes:

- Add new `deform*` and `apply*` function pointers to `ModifierTypeInfo` that take `Mesh`, and rename the old functions to indicate that they take `DerivedMesh`. These new functions are currently set to `NULL` for all modifiers.
- Add wrapper `modifier_deform*` and `modifier_apply*` functions in two variants: one that works with `Mesh` and the other which works with `DerivedMesh` that is named with `*_DM_depercated`. These functions check which type of data the modifier supports and converts if necessary
- Update the rest of Blender to be aware and make use of these new functions

The goal of these changes is to make it possible to port to using `Mesh` incrementally without ever needing to enter into a state where modifiers don't work. After everything has been ported over the old functions and wrappers could be removed.

Reviewers: campbellbarton, sergey, mont29

Subscribers: sybren

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D3155
2018-05-01 18:02:17 +02:00
Brecht Van Lommel 34ab90f546 Depsgraph: remove EvaluationContext, pass Depsgraph instead.
The depsgraph was always created within a fixed evaluation context. Passing
both risks the depsgraph and evaluation context not matching, and it
complicates the Python API where we'd have to expose both which is not so
easy to understand.

This also removes the global evaluation context in main, which assumed there
to be a single active scene and view layer.

Differential Revision: https://developer.blender.org/D3152
2018-04-16 19:55:33 +02:00
Campbell Barton 1c24c04e60 Remove workspace object mode, reverts changes w/ 2.8
This caused too many problems syncing object modes
with multiple objects/windows/workspaces, see: D3130 for details.
2018-04-05 18:21:14 +02:00
Bastien Montagne 160e62b88c Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/BKE_object.h
2018-04-04 15:03:55 +02:00
Bastien Montagne d59c2d12b1 Fix modifier freeing code re. ID refcounting.
Free code should not handle ID refcounting at all. This has to be done
at higher level, since in some case we want to free (temp) data that
actually did not refcount at all its IDs.

This change seems to be working OK, but as usual in that area, only
lots of testing in real-case situation will say whether there are some
hidden bugs or not.
2018-04-04 14:58:52 +02:00
Campbell Barton 171c756f20 Merge branch 'master' into blender2.8 2018-02-23 13:10:39 +11:00
Campbell Barton dd77e45151 Cleanup: header guards & style 2018-02-23 12:59:55 +11:00
Sergey Sharybin 4a0d8f92f6 Remove old depsgraph from modifiers relations update context 2018-02-22 14:09:45 +01:00
Sergey Sharybin 539987766b Merge branch 'master' into blender2.8 2018-02-22 14:08:27 +01:00
Sergey Sharybin 3d1c0afe0e Depsgraph: Remove unused bmain from modifiers relations update context 2018-02-22 14:07:08 +01:00
Sergey Sharybin 6e860bef28 Merge branch 'master' into blender2.8 2018-02-22 13:05:00 +01:00
Sergey Sharybin df04520602 Depsgraph: Wrap all arguments foe modifiers relations update into a struct
Makes it easier to add or remove fields needed to update relations.
2018-02-22 12:54:06 +01:00
Campbell Barton ce0cb4de8d Object Mode: use eval_ctx for modifiers_isCorrectableDeformed
Some other minor changes from D3037 as well
2018-02-06 19:35:06 +11:00