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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-12-06 19:52:37 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-12-07 13:37:38 +0300
commit79312c1912b4fdb830e38a856cf88bfca8e4703d (patch)
tree74d5b262de9cd5d044e1963df13f2cbe73c3b796 /source/blender/makesdna
parent989fbff16f49204ca31a67f56f87c2221e0246f4 (diff)
Depsgraph: Remove duplicated sets of recalc/update flags
There were at least three copies of those: - OB_RECALC* family of flags, which are rudiment of an old dependency graph system. - PSYS_RECALC* which were used by old dependency graph system as a separate set since the graph itself did not handle particle systems. - DEG_TAG_* which was used to tag IDs. Now there is a single set, which defines what can be tagged and queried for an update. It also has some aggregate flags to make queries simpler. Lets once and for all solve the madness of those flags, stick to a single set, which will not overlap with anything or require any extra conversion. Technically, shouldn't be measurable user difference, but some of the agregate flags for few dependency graph components did change. Fixes T58632: Particle don't update rotation settings
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_ID.h71
-rw-r--r--source/blender/makesdna/DNA_object_types.h13
-rw-r--r--source/blender/makesdna/DNA_particle_types.h18
3 files changed, 64 insertions, 38 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 9e5e822c4d5..bf2a6a727d3 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -502,22 +502,61 @@ enum {
LIB_TAG_NOT_ALLOCATED = 1 << 17,
};
-/* WARNING - when adding flags check on PSYS_RECALC */
-enum {
- /* RESET_AFTER_USE, used by update code (depsgraph). */
- ID_RECALC_NONE = 0,
- /* Generic recalc flag, when nothing else matches. */
- ID_RECALC = 1 << 0,
- /* Per-component update flags. */
- ID_RECALC_ANIMATION = 1 << 1,
- ID_RECALC_DRAW = 1 << 2,
- ID_RECALC_DRAW_CACHE = 1 << 3,
- ID_RECALC_GEOMETRY = 1 << 4,
- ID_RECALC_TRANSFORM = 1 << 5,
- ID_RECALC_COPY_ON_WRITE = 1 << 6,
- /* Special flag to check if SOMETHING was changed. */
- ID_RECALC_ALL = (~(int)0),
-};
+/* Tag given ID for an update in all the dependency graphs. */
+typedef enum IDRecalcFlag {
+ /* Individual update tags, this is what ID gets tagged for update with. */
+
+ /* Object transformation changed. */
+ ID_RECALC_TRANSFORM = (1 << 0),
+ /* Object geometry changed.
+ *
+ * When object of armature type gets tagged with this flag, it's 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 datablock to be updated. */
+ ID_RECALC_GEOMETRY = (1 << 1),
+ /* Animation or time changed and animation is to be re-evaluated. */
+ ID_RECALC_ANIMATION = (1 << 2),
+ /* Particle system changed; values are aligned with ID_RECALC_PSYS_xxx. */
+ ID_RECALC_PSYS_REDO = (1 << 3), /* Only do pathcache etc */
+ ID_RECALC_PSYS_RESET = (1 << 4), /* Reset everything including pointcache. */
+ ID_RECALC_PSYS_YPE = (1 << 5), /* Handle system type change. */
+ ID_RECALC_PSYS_CHILD = (1 << 6), /* Only child settings changed. */
+ ID_RECALC_PSYS_PHYS = (1 << 7), /* Physics type changed. */
+ /* Update copy on write component without flushing down the road. */
+ ID_RECALC_COPY_ON_WRITE = (1 << 8),
+ /* Tag shading components for update. Only parameters of material changed).
+ */
+ ID_RECALC_SHADING = (1 << 9),
+ /* Selection of the ID itself or its components (for example, vertices) did
+ * change, and all the drawing data is to eb updated. */
+ ID_RECALC_SELECT = (1 << 10),
+ /* Flags on the base did change, and is to be compied onto all the copies of
+ * corresponding objects. */
+ ID_RECALC_BASE_FLAGS = (1 << 11),
+ ID_RECALC_POINT_CACHE = (1 << 12),
+ /* Only inform editors about the change. Is used to force update of editors
+ * when datablock which is not a part of dependency graph did change.
+ *
+ * For example, brush texture did change and the preview is to be
+ * re-rendered. */
+ ID_RECALC_EDITORS = (1 << 13),
+
+ /* Aggregate flags, use only for checks on runtime.
+ * Do NOT use those for tagging. */
+
+ /* Identifies that SOMETHING has been changed in this ID. */
+ ID_RECALC_ALL = ~(0),
+ /* Identifies that something in particle system did change. */
+ ID_RECALC_PSYS_ALL = (ID_RECALC_PSYS_REDO |
+ ID_RECALC_PSYS_RESET |
+ ID_RECALC_PSYS_YPE |
+ ID_RECALC_PSYS_CHILD |
+ ID_RECALC_PSYS_PHYS),
+
+} IDRecalcFlag;
/* To filter ID types (filter_id) */
/* XXX We cannot put all needed IDs inside an enum...
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 9df511fab2e..639b68b141d 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -524,7 +524,7 @@ enum {
/* NOTE: BA_HAS_RECALC_DATA can be re-used later if freed in readfile.c. */
// BA_HAS_RECALC_OB = (1 << 2), /* DEPRECATED */
// BA_HAS_RECALC_DATA = (1 << 3), /* DEPRECATED */
- BA_SNAP_FIX_DEPS_FIASCO = (1 << 2), /* Yes, re-use deprecated bit, all fine since it's runtime only. */
+ BA_SNAP_FIX_DEPS_FIASCO = (1 << 2), /* DEPRECATED, was runtime only, but was reusing an older flag. */
};
/* NOTE: this was used as a proper setting in past, so nullify before using */
@@ -540,17 +540,6 @@ enum {
/* #define OB_RADIO (1 << 11) */ /* deprecated */
/* #define OB_FROMGROUP (1 << 12) */ /* deprecated */
-/* WARNING - when adding flags check on PSYS_RECALC */
-/* ob->recalc (flag bits!) */
-enum {
- OB_RECALC_OB = 1 << 0,
- OB_RECALC_DATA = 1 << 1,
-/* time flag is set when time changes need recalc, so baked systems can ignore it */
- OB_RECALC_TIME = 1 << 2,
-/* only use for matching any flag, NOT as an argument since more flags may be added. */
- OB_RECALC_ALL = OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME,
-};
-
/* controller state */
#define OB_MAX_STATES 30
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 5d830cf3d5f..fce6d6512a7 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -306,7 +306,14 @@ typedef struct ParticleSystem {
float cfra, tree_frame, bvhtree_frame;
int seed, child_seed;
int flag, totpart, totunexist, totchild, totcached, totchildcache;
- short recalc, target_psys, totkeyed, bakespace;
+ /* NOTE: Recalc is one of ID_RECALC_PSYS_ALL flags.
+ *
+ * TODO(sergey): Use part->id.recalc instead of this duplicated flag
+ * somehow. */
+ int recalc;
+ int pad1;
+ short target_psys, totkeyed, bakespace;
+ short pad2;
char bb_uvname[3][64]; /* billboard uv name, MAX_CUSTOMDATA_LAYER_NAME */
@@ -544,15 +551,6 @@ typedef enum eParticleShapeFlag {
#define PART_CHILD_PARTICLES 1
#define PART_CHILD_FACES 2
-/* psys->recalc */
-/* starts from (1 << 3) so that the first bits can be ob->recalc */
-#define PSYS_RECALC_REDO (1 << 3) /* only do pathcache etc */
-#define PSYS_RECALC_RESET (1 << 4) /* reset everything including pointcache */
-#define PSYS_RECALC_TYPE (1 << 5) /* handle system type change */
-#define PSYS_RECALC_CHILD (1 << 6) /* only child settings changed */
-#define PSYS_RECALC_PHYS (1 << 7) /* physics type changed */
-#define PSYS_RECALC (PSYS_RECALC_REDO | PSYS_RECALC_RESET | PSYS_RECALC_TYPE | PSYS_RECALC_CHILD | PSYS_RECALC_PHYS)
-
/* psys->flag */
#define PSYS_CURRENT 1
#define PSYS_GLOBAL_HAIR 2