[Bf-blender-cvs] [ccdf65f] depsgraph_refactor: Depsgraph: Initial move towards animation support
Sergey Sharybin
noreply at git.blender.org
Mon Nov 10 17:54:45 CET 2014
Commit: ccdf65f55e042130a8321a343011f77e407bc064
Author: Sergey Sharybin
Date: Mon Nov 10 17:54:10 2014 +0100
Branches: depsgraph_refactor
https://developer.blender.org/rBccdf65f55e042130a8321a343011f77e407bc064
Depsgraph: Initial move towards animation support
It kinda works now, but gives issues with threaded update.
Plus it' really need to be cleaned up. Committing mainly to
have a starting point which does something.
===================================================================
M source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
M source/blender/depsgraph/intern/depsgraph_build_relations.cpp
M source/blender/depsgraph/intern/depsgraph_type_defines.cpp
M source/blender/depsgraph/intern/depsgraph_types.h
M source/blender/depsgraph/intern/stubs.h
===================================================================
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 79306c8..8534605 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -346,12 +346,23 @@ void DepsgraphNodeBuilder::build_animdata(ID *id)
/* animation */
if (adt->action || adt->nla_tracks.first || adt->drivers.first) {
// XXX: Hook up specific update callbacks for special properties which may need it...
-
+
+ /* actions */
+ if (adt->action != NULL) {
+ for (FCurve *fcu = (FCurve *)adt->action->curves.first; fcu; fcu = fcu->next) {
+ TimeSourceDepsNode *time_src = m_graph->find_time_source();
+ add_operation_node(id, DEPSNODE_TYPE_ANIMATION,
+ DEPSOP_TYPE_EXEC, bind(BKE_animsys_eval_driver, _1, id, fcu, time_src),
+ deg_op_name_action_fcurve(adt->action, fcu));
+ }
+ /* TODO(sergey): Action groups. */
+ }
+
/* drivers */
for (FCurve *fcu = (FCurve *)adt->drivers.first; fcu; fcu = fcu->next) {
/* create driver */
/*OperationDepsNode *driver_node =*/ build_driver(id, fcu);
-
+
/* hook up update callback associated with F-Curve */
// ...
}
@@ -367,8 +378,9 @@ OperationDepsNode *DepsgraphNodeBuilder::build_driver(ID *id, FCurve *fcurve)
ChannelDriver *driver = fcurve->driver;
/* create data node for this driver ..................................... */
+ TimeSourceDepsNode *time_src = m_graph->find_time_source();
OperationDepsNode *driver_op = add_operation_node(id, DEPSNODE_TYPE_PARAMETERS,
- DEPSOP_TYPE_EXEC, bind(BKE_animsys_eval_driver, _1, id, fcurve),
+ DEPSOP_TYPE_EXEC, bind(BKE_animsys_eval_driver, _1, id, fcurve, time_src),
deg_op_name_driver(driver));
/* tag "scripted expression" drivers as needing Python (due to GIL issues, etc.) */
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index 005eb41..1644995 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -209,6 +209,7 @@ void DepsgraphRelationBuilder::build_object(Scene *scene, Object *ob)
* time source.
*/
if (object_modifiers_use_time(ob)) {
+ /* TODO(sergey): Replace with time relation. */
m_graph->add_new_time_relation(m_graph->find_id_node(&ob->id));
}
@@ -451,9 +452,12 @@ void DepsgraphRelationBuilder::build_animdata(ID *id)
/* animation */
if (adt->action || adt->nla_tracks.first) {
/* wire up dependency to time source */
- TimeSourceKey time_src_key;
- add_relation(time_src_key, adt_key, DEPSREL_TYPE_TIME, "[TimeSrc -> Animation] DepsRel");
-
+ //TimeSourceKey time_src_key;
+ //add_relation(time_src_key, adt_key, DEPSREL_TYPE_TIME, "[TimeSrc -> Animation] DepsRel");
+
+ /* TODO(sergey): Replace with time relation. */
+ m_graph->add_new_time_relation(m_graph->find_id_node(id));
+
// XXX: Hook up specific update callbacks for special properties which may need it...
}
@@ -990,10 +994,15 @@ void DepsgraphRelationBuilder::build_obdata_geom(Scene *scene, Object *ob)
if (ob->modifiers.last) {
ModifierData *md = (ModifierData *)ob->modifiers.last;
OperationKey mod_key(&ob->id, DEPSNODE_TYPE_GEOMETRY, deg_op_name_modifier(md));
- add_relation(mod_key, obdata_ubereval_key, DEPSREL_TYPE_GEOMETRY_EVAL, "Object Geometry UberEval");
+ add_relation(mod_key, obdata_ubereval_key, DEPSREL_TYPE_OPERATION, "Object Geometry UberEval");
}
else {
- add_relation(geom_eval_key, obdata_ubereval_key, DEPSREL_TYPE_GEOMETRY_EVAL, "Object Geometry UberEval");
+ add_relation(geom_eval_key, obdata_ubereval_key, DEPSREL_TYPE_OPERATION, "Object Geometry UberEval");
+ }
+
+ if (ob->adt) {
+ ComponentKey adt_key(&ob->id, DEPSNODE_TYPE_ANIMATION);
+ add_relation(adt_key, obdata_ubereval_key, DEPSREL_TYPE_OPERATION, "Object Geometry UberEval");
}
}
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cpp b/source/blender/depsgraph/intern/depsgraph_type_defines.cpp
index 44e5adb..4e10824 100644
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cpp
@@ -62,7 +62,15 @@ extern "C" {
#include "stubs.h" // XXX: THIS MUST BE REMOVED WHEN THE DEPSGRAPH REFACTOR IS DONE
-void BKE_animsys_eval_driver(EvaluationContext *eval_ctx, ID *id, FCurve *fcurve) {}
+void BKE_animsys_eval_driver(EvaluationContext *eval_ctx, ID *id, FCurve *fcurve, TimeSourceDepsNode *time_src)
+{
+ printf("%s on %s\n", __func__, id->name);
+ if (ID_REAL_USERS(id) > 0) {
+ AnimData *adt = BKE_animdata_from_id(id);
+ float ctime = time_src->cfra;
+ BKE_animsys_evaluate_animdata(NULL, id, adt, ctime, ADT_RECALC_ANIM);
+ }
+}
void BKE_pose_constraints_evaluate(EvaluationContext *eval_ctx, Object *ob, bPoseChannel *pchan) {}
@@ -100,6 +108,15 @@ const string deg_op_name_pose_eval_flush = "Flush Pose Eval";
const string deg_op_name_ik_solver = "IK Solver";
const string deg_op_name_spline_ik_solver = "Spline IK Solver";
const string deg_op_name_psys_eval = "PSys Eval";
+string deg_op_name_action_fcurve(const bAction *action, const FCurve *fcu)
+{
+ if (fcu->rna_path != NULL) {
+ return string_format("Action FCurve @ %s:%s[%d]", action->id.name + 2, fcu->rna_path, fcu->array_index);
+ }
+ else {
+ return string_format("Action FCurve @ %s:%p", action->id.name, fcu);
+ }
+}
string deg_op_name_driver(const ChannelDriver *driver)
{
return string_format("Driver @ %p", driver);
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index 55b24a8..b283565 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -36,10 +36,12 @@
#include "depsgraph_util_function.h"
#include "depsgraph_util_string.h"
+struct bAction;
struct ChannelDriver;
struct ModifierData;
struct PointerRNA;
struct EvaluationContext;
+struct FCurve;
/* Evaluation Operation for atomic operation */
// XXX: move this to another header that can be exposed?
@@ -97,6 +99,7 @@ extern const string deg_op_name_pose_eval_flush;
extern const string deg_op_name_ik_solver;
extern const string deg_op_name_spline_ik_solver;
extern const string deg_op_name_psys_eval;
+string deg_op_name_action_fcurve(const bAction *action, const FCurve *fcu);
string deg_op_name_driver(const ChannelDriver *driver);
string deg_op_name_modifier(const ModifierData *md);
diff --git a/source/blender/depsgraph/intern/stubs.h b/source/blender/depsgraph/intern/stubs.h
index 8485914..86783cb 100644
--- a/source/blender/depsgraph/intern/stubs.h
+++ b/source/blender/depsgraph/intern/stubs.h
@@ -23,8 +23,9 @@ struct Lattice;
struct ModifierData;
struct ParticleSystem;
struct EvaluationContext;
+struct TimeSourceDepsNode;
-void BKE_animsys_eval_driver(struct EvaluationContext *eval_ctx, ID *id, FCurve *fcurve);
+void BKE_animsys_eval_driver(struct EvaluationContext *eval_ctx, ID *id, FCurve *fcurve, TimeSourceDepsNode *time_src);
void BKE_pose_constraints_evaluate(struct EvaluationContext *eval_ctx, Object *ob, bPoseChannel *pchan);
More information about the Bf-blender-cvs
mailing list