[Bf-blender-cvs] [233ef82] depsgraph_refactor: Depsgraph: Fix tweaking animated custom property doesn't work
Sergey Sharybin
noreply at git.blender.org
Wed Mar 18 11:53:08 CET 2015
Commit: 233ef825cecc8e581f525e5ee473b547d4124517
Author: Sergey Sharybin
Date: Wed Mar 18 15:51:31 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB233ef825cecc8e581f525e5ee473b547d4124517
Depsgraph: Fix tweaking animated custom property doesn't work
It was not totally correct logic around when to tag animation component
for update.
Now its tagging when adt->recalc is set to ADT_RECALC_ANIM, which means
for now setting this flag should happen prior to DAG_id_tag_update() call,
but in the future we can wrap this into an utility function.
===================================================================
M source/blender/depsgraph/intern/depsgraph_build.cpp
M source/blender/depsgraph/intern/depsgraph_tag.cpp
M source/blender/depsgraph/intern/depsnode.cpp
M source/blender/depsgraph/intern/depsnode.h
===================================================================
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index a0bb272..9743a32 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -248,14 +248,10 @@ static void deg_graph_build_finalize(Depsgraph *graph)
if (id->flag & LIB_ID_RECALC_ALL &&
id->flag & LIB_DOIT)
{
- bool do_time = false;
if (GS(id->name) == ID_OB) {
Object *object = (Object *)id;
- if (object->recalc & OB_RECALC_TIME) {
- do_time = true;
- }
}
- id_node->tag_update(graph, do_time);
+ id_node->tag_update(graph);
id->flag &= ~LIB_DOIT;
}
}
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cpp b/source/blender/depsgraph/intern/depsgraph_tag.cpp
index e84a08e..d40b3e2 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cpp
@@ -101,17 +101,6 @@ static void lib_id_recalc_tag_flag(Main *bmain, ID *id, int flag)
}
}
-static void anim_data_tag_update(Depsgraph *graph, ID *id)
-{
- IDDepsNode *id_node = graph->find_id_node(id);
- if (id_node != NULL) {
- ComponentDepsNode *anim_comp = id_node->find_component(DEPSNODE_TYPE_ANIMATION);
- if (anim_comp != NULL) {
- anim_comp->tag_update(graph);
- }
- }
-}
-
/* Tag all nodes in ID-block for update.
* This is a crude measure, but is most convenient for old code.
*/
@@ -187,16 +176,10 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, short flag)
graph,
(ID*)object->data);
}
- if (flag & OB_RECALC_TIME) {
- anim_data_tag_update(graph, (ID*)object->data);
- }
}
if (flag & (OB_RECALC_OB|OB_RECALC_DATA)) {
DEG_graph_id_tag_update(bmain, graph, id);
}
- if (flag & OB_RECALC_TIME) {
- anim_data_tag_update(graph, id);
- }
}
}
}
@@ -276,6 +259,27 @@ void DEG_graph_flush_updates(Main *bmain, Depsgraph *graph)
/* TODO(sergey): For until we've got proper data nodes in the graph. */
lib_id_recalc_data_tag(bmain, id_node->id);
+ ID *id = id_node->id;
+ /* This code is used to preserve those areas which does direct
+ * object update,
+ *
+ * Plus it ensures visibility changes and relations and layers
+ * visibility update has proper flags to work with.
+ */
+ if (GS(id->name) == ID_OB) {
+ Object *object = (Object *)id;
+ ComponentDepsNode *comp_node = node->owner;
+ if (comp_node->type == DEPSNODE_TYPE_ANIMATION) {
+ object->recalc |= OB_RECALC_TIME;
+ }
+ else if (comp_node->type == DEPSNODE_TYPE_TRANSFORM) {
+ object->recalc |= OB_RECALC_OB;
+ }
+ else {
+ object->recalc |= OB_RECALC_DATA;
+ }
+ }
+
/* Flush to nodes along links... */
for (OperationDepsNode::Relations::const_iterator it = node->outlinks.begin();
it != node->outlinks.end();
@@ -283,28 +287,7 @@ void DEG_graph_flush_updates(Main *bmain, Depsgraph *graph)
{
DepsRelation *rel = *it;
OperationDepsNode *to_node = (OperationDepsNode *)rel->to;
- IDDepsNode *id_node = to_node->owner->owner;
if (to_node->scheduled == false) {
- ID *id = id_node->id;
- /* This code is used to preserve those areas which does direct
- * object update,
- *
- * Plus it ensures visibility changes and relations and layers
- * visibility update has proper flags to work with.
- */
- if (GS(id->name) == ID_OB) {
- Object *object = (Object *)id;
- ComponentDepsNode *comp_node = to_node->owner;
- if (comp_node->type == DEPSNODE_TYPE_ANIMATION) {
- object->recalc |= OB_RECALC_TIME;
- }
- else if (comp_node->type == DEPSNODE_TYPE_TRANSFORM) {
- object->recalc |= OB_RECALC_OB;
- }
- else {
- object->recalc |= OB_RECALC_DATA;
- }
- }
to_node->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
queue.push(to_node);
to_node->scheduled = true;
@@ -416,8 +399,12 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
if ((id->flag & LIB_ID_RECALC_ALL) == 0 &&
(object->recalc & OB_RECALC_ALL) != 0)
{
- id_node->tag_update(graph,
- (object->recalc & OB_RECALC_TIME) != 0);
+ id_node->tag_update(graph);
+ ComponentDepsNode *anim_comp =
+ id_node->find_component(DEPSNODE_TYPE_ANIMATION);
+ if (anim_comp != NULL && object->recalc & OB_RECALC_TIME) {
+ anim_comp->tag_update(graph);
+ }
}
}
}
diff --git a/source/blender/depsgraph/intern/depsnode.cpp b/source/blender/depsgraph/intern/depsnode.cpp
index 3206058..c06db09 100644
--- a/source/blender/depsgraph/intern/depsnode.cpp
+++ b/source/blender/depsgraph/intern/depsnode.cpp
@@ -31,6 +31,10 @@
extern "C" {
#include "DNA_ID.h"
+#include "DNA_anim_types.h"
+
+#include "BKE_animsys.h"
+
#include "DEG_depsgraph.h"
}
@@ -227,17 +231,23 @@ void IDDepsNode::clear_components()
components.clear();
}
-void IDDepsNode::tag_update(Depsgraph *graph, bool do_time)
+void IDDepsNode::tag_update(Depsgraph *graph)
{
for (ComponentMap::const_iterator it = components.begin();
it != components.end();
++it)
{
ComponentDepsNode *comp_node = it->second;
- /* Animation component should only be tagged for update by the time
- * updates or by tagging the animation itself.
- */
- if (do_time || comp_node->type != DEPSNODE_TYPE_ANIMATION) {
+ /* TODO(sergey): What about drievrs? */
+ bool do_component_tag = comp_node->type != DEPSNODE_TYPE_ANIMATION;
+ if (comp_node->type == DEPSNODE_TYPE_ANIMATION) {
+ AnimData *adt = BKE_animdata_from_id(id);
+ BLI_assert(adt != NULL);
+ if (adt->recalc & ADT_RECALC_ANIM) {
+ do_component_tag = true;
+ }
+ }
+ if (do_component_tag) {
comp_node->tag_update(graph);
}
}
diff --git a/source/blender/depsgraph/intern/depsnode.h b/source/blender/depsgraph/intern/depsnode.h
index 77acfdd..7050826 100644
--- a/source/blender/depsgraph/intern/depsnode.h
+++ b/source/blender/depsgraph/intern/depsnode.h
@@ -182,7 +182,7 @@ struct IDDepsNode : public DepsNode {
void remove_component(eDepsNode_Type type, const string &name = "");
void clear_components();
- void tag_update(Depsgraph *graph, bool do_time = false);
+ void tag_update(Depsgraph *graph);
/* ID Block referenced. */
ID *id;
More information about the Bf-blender-cvs
mailing list