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:
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph_tag.cc')
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc61
1 files changed, 47 insertions, 14 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index e7c13083343..f63a4c90427 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -262,6 +262,47 @@ void depsgraph_update_editors_tag(Main *bmain, Depsgraph *graph, ID *id)
deg_editors_id_update(&update_ctx, id);
}
+void depsgraph_tag_component(Depsgraph *graph,
+ IDDepsNode *id_node,
+ eDepsNode_Type component_type,
+ eDepsOperation_Code operation_code)
+{
+ ComponentDepsNode *component_node =
+ id_node->find_component(component_type);
+ if (component_node == NULL) {
+ return;
+ }
+ if (operation_code == DEG_OPCODE_OPERATION) {
+ component_node->tag_update(graph);
+ }
+ else {
+ OperationDepsNode *operation_node =
+ component_node->find_operation(operation_code);
+ if (operation_node != NULL) {
+ operation_node->tag_update(graph);
+ }
+ }
+}
+
+/* This is a tag compatibility with legacy code.
+ *
+ * Mainly, old code was tagging object with OB_RECALC_DATA tag to inform
+ * that object's data datablock changed. Now API expects that ID is given
+ * explicitly, but not all areas are aware of this yet.
+ */
+void deg_graph_id_tag_legacy_compat(Main *bmain,
+ ID *id,
+ eDepsgraph_Tag tag)
+{
+ if (tag == DEG_TAG_GEOMETRY && GS(id->name) == ID_OB) {
+ Object *object = (Object *)id;
+ ID *data_id = (ID *)object->data;
+ if (data_id != NULL) {
+ DEG_id_tag_update_ex(bmain, data_id, 0);
+ }
+ }
+}
+
void deg_graph_id_tag_update_single_flag(Main *bmain,
Depsgraph *graph,
ID *id,
@@ -303,21 +344,13 @@ void deg_graph_id_tag_update_single_flag(Main *bmain,
id_node->tag_update(graph);
}
else {
- ComponentDepsNode *component_node =
- id_node->find_component(component_type);
- if (component_node != NULL) {
- if (operation_code == DEG_OPCODE_OPERATION) {
- component_node->tag_update(graph);
- }
- else {
- OperationDepsNode *operation_node =
- component_node->find_operation(operation_code);
- if (operation_node != NULL) {
- operation_node->tag_update(graph);
- }
- }
- }
+ depsgraph_tag_component(graph, id_node, component_type, operation_code);
}
+ /* TODO(sergey): Get rid of this once all areas are using proper data ID
+ * for tagging.
+ */
+ deg_graph_id_tag_legacy_compat(bmain, id, tag);
+
}
void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag)