[Bf-blender-cvs] [9c106a5] depsgraph_refactor: Ported over build functions for object data (geometry, camera, lamp, shape keys).
Lukas Tönne
noreply at git.blender.org
Sat Apr 12 09:34:30 CEST 2014
Commit: 9c106a5351b203bbd22c34f18b0603a492c9ce5a
Author: Lukas Tönne
Date: Sat Apr 12 09:11:15 2014 +0200
https://developer.blender.org/rB9c106a5351b203bbd22c34f18b0603a492c9ce5a
Ported over build functions for object data (geometry, camera, lamp,
shape keys).
===================================================================
M source/blender/depsgraph/intern/depsgraph_build.cpp
M source/blender/depsgraph/intern/depsgraph_build.h
M source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
M source/blender/depsgraph/intern/depsgraph_build_relations.cpp
===================================================================
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index fbe903e..1b7940b 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -337,7 +337,6 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene)
BKE_main_id_tag_idcode(bmain, ID_WO, false);
BKE_main_id_tag_idcode(bmain, ID_TE, false);
-
DepsgraphNodeBuilder node_builder(bmain, graph);
/* create root node for scene first
* - this way it should be the first in the graph,
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index 1bf8160..3537a6a 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -38,6 +38,7 @@ struct ListBase;
struct ID;
struct FCurve;
struct Group;
+struct Key;
struct Main;
struct Material;
struct MTex;
@@ -70,7 +71,7 @@ struct DepsgraphNodeBuilder {
IDDepsNode *build_scene(Scene *scene);
SubgraphDepsNode *build_subgraph(Group *group);
- IDDepsNode *build_object(Object *ob);
+ IDDepsNode *build_object(Scene *scene, Object *ob);
ComponentDepsNode *build_object_transform(Object *ob, IDDepsNode *ob_node);
void build_constraints(ComponentDepsNode *comp_node, eDepsNode_Type constraint_op_type);
void build_rigidbody(IDDepsNode *scene_node, Scene *scene);
@@ -80,6 +81,10 @@ struct DepsgraphNodeBuilder {
void build_ik_pose(ComponentDepsNode *bone_node, Object *ob, bPoseChannel *pchan, bConstraint *con);
void build_splineik_pose(ComponentDepsNode *bone_node, Object *ob, bPoseChannel *pchan, bConstraint *con);
void build_rig(IDDepsNode *ob_node, Object *ob);
+ void build_shapekeys(Key *key);
+ void build_obdata_geom(IDDepsNode *ob_node, IDDepsNode *obdata_node, Scene *scene, Object *ob);
+ void build_camera(IDDepsNode *ob_node, IDDepsNode *obdata_node, Object *ob);
+ void build_lamp(IDDepsNode *ob_node, IDDepsNode *obdata_node, Object *ob);
void build_nodetree(DepsNode *owner_node, bNodeTree *ntree);
void build_material(DepsNode *owner_node, Material *ma);
void build_texture(DepsNode *owner_node, Tex *tex);
@@ -158,6 +163,10 @@ struct DepsgraphRelationBuilder {
void build_ik_pose(Object *ob, bPoseChannel *pchan, bConstraint *con);
void build_splineik_pose(Object *ob, bPoseChannel *pchan, bConstraint *con);
void build_rig(Scene *scene, Object *ob);
+ void build_shapekeys(IDPtr obdata, Key *key);
+ void build_obdata_geom(Scene *scene, Object *ob);
+ void build_camera(Object *ob);
+ void build_lamp(Object *ob);
void build_nodetree(IDPtr owner, bNodeTree *ntree);
void build_material(IDPtr owner, Material *ma);
void build_texture(IDPtr owner, Tex *tex);
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 968e2ef..e0d5717 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -122,12 +122,12 @@ IDDepsNode *DepsgraphNodeBuilder::build_scene(Scene *scene)
Object *ob = base->object;
/* object itself */
- build_object(ob);
+ build_object(scene, ob);
/* object that this is a proxy for */
// XXX: the way that proxies work needs to be completely reviewed!
if (ob->proxy) {
- build_object(ob->proxy);
+ build_object(scene, ob->proxy);
}
/* handled in next loop...
@@ -181,7 +181,7 @@ SubgraphDepsNode *DepsgraphNodeBuilder::build_subgraph(Group *group)
}
-IDDepsNode *DepsgraphNodeBuilder::build_object(Object *ob)
+IDDepsNode *DepsgraphNodeBuilder::build_object(Scene *scene, Object *ob)
{
/* create node for object itself */
IDDepsNode *ob_node = add_id_node(ob);
@@ -208,9 +208,10 @@ IDDepsNode *DepsgraphNodeBuilder::build_object(Object *ob)
/* object data */
if (ob->data) {
ID *obdata_id = (ID *)ob->data;
- IDDepsNode *obdata_node = NULL;
+ IDDepsNode *obdata_node = add_id_node(obdata_id);
+ /* ob data animation */
+ build_animdata(obdata_node);
-#if 0
/* type-specific data... */
switch (ob->type) {
case OB_MESH: /* Geometry */
@@ -220,30 +221,22 @@ IDDepsNode *DepsgraphNodeBuilder::build_object(Object *ob)
case OB_MBALL:
case OB_LATTICE:
{
- deg_build_obdata_geom_graph(graph, scene, ob);
+ build_obdata_geom(ob_node, obdata_node, scene, ob);
}
break;
-
case OB_ARMATURE: /* Pose */
- deg_build_rig_graph(graph, scene, ob);
+ build_rig(ob_node, ob);
break;
-
case OB_LAMP: /* Lamp */
- deg_build_lamp_graph(graph, scene, ob);
+ build_lamp(ob_node, obdata_node, ob);
break;
case OB_CAMERA: /* Camera */
- deg_build_camera_graph(graph, scene, ob);
+ build_camera(ob_node, obdata_node, ob);
break;
}
-#endif
-
- if (obdata_node) {
- /* ob data animation */
- build_animdata(obdata_node);
- }
}
/* particle systems */
@@ -603,6 +596,162 @@ void DepsgraphNodeBuilder::build_rig(IDDepsNode *ob_node, Object *ob)
}
}
+/* Shapekeys */
+void DepsgraphNodeBuilder::build_shapekeys(Key *key)
+{
+ /* create node for shapekeys block */
+ IDDepsNode *key_node = add_id_node(key);
+ build_animdata(key_node);
+
+ // XXX: assume geometry - that's where shapekeys get evaluated anyways...
+ add_component_node(key_node, DEPSNODE_TYPE_GEOMETRY);
+}
+
+/* ObData Geometry Evaluation */
+// XXX: what happens if the datablock is shared!
+void DepsgraphNodeBuilder::build_obdata_geom(IDDepsNode *ob_node, IDDepsNode *obdata_node, Scene *scene, Object *ob)
+{
+ ID *obdata = (ID *)ob->data;
+
+ /* get nodes for result of obdata's evaluation, and geometry evaluation on object */
+ ComponentDepsNode *geom_node = add_component_node(ob_node, DEPSNODE_TYPE_GEOMETRY);
+ ComponentDepsNode *obdata_geom_node = add_component_node(obdata_node, DEPSNODE_TYPE_GEOMETRY);
+
+ /* type-specific node/links */
+ switch (ob->type) {
+ case OB_MESH:
+ {
+ //Mesh *me = (Mesh *)ob->data;
+
+ /* evaluation operations */
+ add_operation_node(geom_node, DEPSNODE_TYPE_OP_GEOMETRY,
+ DEPSOP_TYPE_EXEC, BKE_mesh_eval_geometry,
+ "Geometry Eval", make_rna_id_pointer(obdata));
+ }
+ break;
+
+ case OB_MBALL:
+ {
+ Object *mom = BKE_mball_basis_find(scene, ob);
+
+ /* motherball - mom depends on children! */
+ if (mom == ob) {
+ /* metaball evaluation operations */
+ /* NOTE: only the motherball gets evaluated! */
+ add_operation_node(geom_node, DEPSNODE_TYPE_OP_GEOMETRY,
+ DEPSOP_TYPE_EXEC, BKE_mball_eval_geometry,
+ "Geometry Eval", make_rna_id_pointer(obdata));
+ }
+ }
+ break;
+
+ case OB_CURVE:
+ case OB_FONT:
+ {
+ /* curve evaluation operations */
+ /* - calculate curve geometry (including path) */
+ add_operation_node(geom_node, DEPSNODE_TYPE_OP_GEOMETRY,
+ DEPSOP_TYPE_EXEC, BKE_curve_eval_geometry,
+ "Geometry Eval", make_rna_id_pointer(obdata));
+
+ /* - calculate curve path - this is used by constraints, etc. */
+ add_operation_node(obdata_geom_node, DEPSNODE_TYPE_OP_GEOMETRY,
+ DEPSOP_TYPE_EXEC, BKE_curve_eval_path,
+ "Path", PointerRNA_NULL);
+ }
+ break;
+
+ case OB_SURF: /* Nurbs Surface */
+ {
+ /* nurbs evaluation operations */
+ add_operation_node(geom_node, DEPSNODE_TYPE_OP_GEOMETRY,
+ DEPSOP_TYPE_EXEC, BKE_curve_eval_geometry,
+ "Geometry Eval", make_rna_id_pointer(obdata));
+ }
+ break;
+
+ case OB_LATTICE: /* Lattice */
+ {
+ /* lattice evaluation operations */
+ add_operation_node(geom_node, DEPSNODE_TYPE_OP_GEOMETRY,
+ DEPSOP_TYPE_EXEC, BKE_lattice_eval_geometry,
+ "Geometry Eval", make_rna_id_pointer(obdata));
+ }
+ break;
+ }
+
+ /* ShapeKeys */
+ Key *key = BKE_key_from_object(ob);
+ if (key)
+ build_shapekeys(key);
+
+ /* Modifiers */
+ if (ob->modifiers.first) {
+ ModifierData *md;
+
+ for (md = (ModifierData *)ob->modifiers.first; md; md = md->next) {
+ ModifierTypeInfo *mti = modifierType_getInfo((ModifierType)md->type);
+
+ if (mti->updateDepgraph) {
+ #pragma message("ModifierTypeInfo->updateDepsgraph()")
+ //mti->updateDepgraph(md, graph, scene, ob);
+ }
+ }
+ }
+
+ /* materials */
+ if (ob->totcol) {
+ int a;
+
+ for (a = 1; a <= ob->totcol; a++) {
+ Material *ma = give_current_material(ob, a);
+
+ if (ma)
+ build_material(geom_node, ma);
+ }
+ }
+
+ /* geometry collision */
+ if (ELEM3(ob->type, OB_MESH, OB_CURVE, OB_LATTICE)) {
+ // add geometry collider relations
+ }
+}
+
+/* Cameras */
+// TODO: Link scene-camera links in somehow...
+void DepsgraphNodeBuilder::build_camera(IDDepsNode *ob_node, IDDepsNode *obdata_node, Object *ob)
+{
+ /* node for obdata */
+ add_component_node(obdata_node, DEPSNODE_TYPE_PARAMETERS);
+}
+
+/* Lamps */
+void DepsgraphNodeBuilder::build_lamp(IDDepsNode *ob_node, IDDepsNode *obdata_node, Object *ob)
+{
+ Lamp *la = (Lamp *)ob->data;
+
+ /* Prevent infinite recursion by checking (and tagging the lamp) as having been visited
+ * already. This assumes la->id.flag & LIB_DOIT isn't set by anything else
+ * in the meantime... [#32017]
+ */
+ if (id_is_tagged(la))
+ return;
+ id_tag_set(la);
+
+ /* node for obdata */
+ ComponentDepsNode *param_node = add_component_node(obdata_node, DEPSNODE_TYPE_PARAMETERS);
+
+ /* lamp's nodetree */
+ if (la->nodetree) {
+ build_nodetree(param_node, la->nodetree);
+ }
+
+ /* textures */
+ build_texture_stack(param_node, la->mtex);
+
+ id_tag_clear(la);
+}
+
void DepsgraphNodeBuilder::build_nodetree(DepsNode *owner_node, bNodeTree *ntree)
{
if (!ntree)
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index af78f4c..0dd110d 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -758,6 +758,159 @@ void DepsgraphRel
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list