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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-11-28 14:13:07 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-11-28 16:24:56 +0300
commit86bfce6794a527e553b3a9a294dda89f035ed3b6 (patch)
treeeff38e467581c7f8bf8f9725402dbaee90160521 /source
parent604de7cbe8401ef781576eb587192a9d71ba35cf (diff)
Depsgraph: Don't call DEG ID update functions directly
There might be much more logic involved there, also we might not know proper evaluated CoW pointer there yet. So we leave this to dependency graph to decide what exactly to do here.
Diffstat (limited to 'source')
-rw-r--r--source/blender/depsgraph/DEG_depsgraph.h9
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc12
-rw-r--r--source/blender/editors/object/object_add.c11
3 files changed, 25 insertions, 7 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index 7b1f1fc8ca9..930794a1778 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -151,9 +151,9 @@ enum {
DEG_TAG_TIME = (1 << 2),
/* Particle system changed. */
- DEG_TAG_PSYSC_REDO = (1 << 3),
- DEG_TAG_PSYS_RESET = (1 << 4),
- DEG_TAG_PSYS_TYPE = (1 << 5),
+ DEG_TAG_PSYSC_REDO = (1 << 3),
+ DEG_TAG_PSYS_RESET = (1 << 4),
+ DEG_TAG_PSYS_TYPE = (1 << 5),
DEG_TAG_PSYS_CHILD = (1 << 6),
DEG_TAG_PSYS_PHYS = (1 << 7),
DEG_TAG_PSYS = ((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7)),
@@ -167,6 +167,9 @@ enum {
DEG_TAG_SHADING_UPDATE = (1 << 9),
DEG_TAG_SELECT_UPDATE = (1 << 10),
DEG_TAG_BASE_FLAGS_UPDATE = (1 << 11),
+
+ /* Only inform editors about the change. Don't modify datablock itself. */
+ DEG_TAG_EDITORS_UPDATE = (1 << 12),
};
void DEG_id_tag_update(struct ID *id, int flag);
void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag);
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index faaf3a828b2..b21a65c8273 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -352,6 +352,15 @@ void id_tag_update_base_flags(Depsgraph *graph, IDDepsNode *id_node)
}
}
+void id_tag_update_editors_update(Main *bmain, Depsgraph * /*graph*/, ID *id)
+{
+ /* NOTE: We handle this immediately, without delaying anything, to be
+ * sure we don't cause threading issues with OpenGL.
+ */
+ /* TODO(sergey): Make sure this works for CoW-ed datablocks as well. */
+ deg_editors_id_update(bmain, id);
+}
+
void id_tag_update_ntree_special(Main *bmain, Depsgraph *graph, ID *id, int flag)
{
bNodeTree *ntree = NULL;
@@ -421,6 +430,9 @@ void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag)
if (flag & DEG_TAG_BASE_FLAGS_UPDATE) {
id_tag_update_base_flags(graph, id_node);
}
+ if (flag & DEG_TAG_EDITORS_UPDATE) {
+ id_tag_update_editors_update(bmain, graph, id);
+ }
id_tag_update_ntree_special(bmain, graph, id, flag);
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 77b30951dee..649e4c7f221 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -449,10 +449,13 @@ Object *ED_object_add_type(
ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_OCCLUDER | OB_DYNAMIC | OB_NAVMESH); /* copied from rna_object.c */
}
+ /* TODO(sergey): This is weird to manually tag objects for update, better to
+ * use DEG_id_tag_update here perhaps.
+ */
DEG_id_type_tag(bmain, ID_OB);
DEG_relations_tag_update(bmain);
- if (ob->data) {
- ED_render_id_flush_update(bmain, ob->data);
+ if (ob->data != NULL) {
+ DEG_id_tag_update_ex(bmain, (ID *)ob->data, DEG_TAG_EDITORS_UPDATE);
}
if (enter_editmode)
@@ -2340,8 +2343,8 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, ViewLayer *view_layer,
/* DAG_relations_tag_update(bmain); */ /* caller must do */
- if (ob->data) {
- ED_render_id_flush_update(bmain, ob->data);
+ if (ob->data != NULL) {
+ DEG_id_tag_update_ex(bmain, (ID *)ob->data, DEG_TAG_EDITORS_UPDATE);
}
BKE_main_id_clear_newpoins(bmain);