Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-06-24 12:13:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-06-24 13:23:00 +0300
commit27da305a404f72a75a37892e1ac080c6531d059b (patch)
tree3fb809530c31b63882e95fa6c4ed1d9d6577e13f /source/blender/makesdna/DNA_ID.h
parent67b352f9c5317c81c8e862a49be656c56e8f0743 (diff)
Depsgraph: support flushing parameters without a full COW update
Avoid computationally expensive copying operations when only some settings have been modified. This is done by adding support for updating parameters without tagging for copy-on-write. Currently only mesh data blocks are supported, other data-blocks can be added individually. This prepares for changing values such as edit-mesh auto-smooth angle in edit-mode without duplicating all mesh-data. The benefit will only be seen when the user interface no longer tags all ID's for copy on write updates. ID_RECALC_GEOMETRY_ALL_MODES has been added to support situations where non edit-mode geometry is modified in edit-mode. While this isn't something user are likely to do, Python scripts may change the underlying mesh. Reviewed By: sergey Ref D11377
Diffstat (limited to 'source/blender/makesdna/DNA_ID.h')
-rw-r--r--source/blender/makesdna/DNA_ID.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 16f5f0b4ae8..15a4f8817fd 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -454,6 +454,10 @@ typedef struct PreviewImage {
#define ID_TYPE_IS_COW(_id_type) \
(!ELEM(_id_type, ID_LI, ID_IP, ID_SCR, ID_VF, ID_BR, ID_WM, ID_PAL, ID_PC, ID_WS, ID_IM))
+/* Check whether data-block type requires copy-on-write from #ID_RECALC_PARAMETERS.
+ * Keep in sync with #BKE_id_eval_properties_copy. */
+#define ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW(id_type) ELEM(id_type, ID_ME)
+
#ifdef GS
# undef GS
#endif
@@ -602,10 +606,18 @@ typedef enum IDRecalcFlag {
*
* When object of armature type gets tagged with this flag, its pose is
* re-evaluated.
+ *
* When object of other type is tagged with this flag it makes the modifier
* stack to be re-evaluated.
+ *
* When object data type (mesh, curve, ...) gets tagged with this flag it
* makes all objects which shares this data-block to be updated.
+ *
+ * Note that the evaluation depends on the object-mode.
+ * So edit-mesh data for example only reevaluate with the updated edit-mesh.
+ * When geometry in the original ID has been modified #ID_RECALC_GEOMETRY_ALL_MODES
+ * must be used instead.
+ *
* When a collection gets tagged with this flag, all objects depending on the geometry and
* transforms on any of the objects in the collection are updated. */
ID_RECALC_GEOMETRY = (1 << 1),
@@ -665,6 +677,10 @@ typedef enum IDRecalcFlag {
ID_RECALC_AUDIO = (1 << 20),
+ /* NOTE: This triggers copy on write for types that require it.
+ * Exceptions to this can be added using #ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW,
+ * this has the advantage that large arrays stored in the idea data don't
+ * have to be copied on every update. */
ID_RECALC_PARAMETERS = (1 << 21),
/* Input has changed and datablock is to be reload from disk.
@@ -689,6 +705,11 @@ typedef enum IDRecalcFlag {
* all dependent objects. */
ID_RECALC_ANIMATION_NO_FLUSH = ID_RECALC_COPY_ON_WRITE,
+ /* Ensure geometry of object and edit modes are both up-to-date in the evaluated data-block.
+ * Example usage is when mesh validation modifies the non-edit-mode data,
+ * which we want to be copied over to the evaluated data-block. */
+ ID_RECALC_GEOMETRY_ALL_MODES = ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE,
+
/***************************************************************************
* Aggregate flags, use only for checks on runtime.
* Do NOT use those for tagging. */