Depsgraph: Use operation code for geometry evaluation init

Makes it more explicit and avoids strings comparisons during build.
This commit is contained in:
2019-02-01 10:37:14 +01:00
parent 6a54f3bb49
commit 700e3cc2a8
4 changed files with 17 additions and 22 deletions

View File

@@ -1246,12 +1246,14 @@ void DepsgraphNodeBuilder::build_object_data_geometry(
OperationNode *op_node;
Scene *scene_cow = get_cow_datablock(scene_);
Object *object_cow = get_cow_datablock(object);
/* Temporary uber-update node, which does everything.
* It is for the being we're porting old dependencies into the new system.
* We'll get rid of this node as soon as all the granular update functions
* are filled in.
*
* TODO(sergey): Get rid of this node. */
/* Entry operation, takes care of initialization, and some other
* relations which needs to be run prior actual geometry evaluation. */
op_node = add_operation_node(&object->id,
NodeType::GEOMETRY,
NULL,
OperationCode::GEOMETRY_EVAL_INIT);
op_node->set_as_entry();
/* Geometry evaluation. */
op_node = add_operation_node(&object->id,
NodeType::GEOMETRY,
function_bind(BKE_object_eval_uber_data,
@@ -1260,13 +1262,6 @@ void DepsgraphNodeBuilder::build_object_data_geometry(
object_cow),
OperationCode::GEOMETRY_EVAL);
op_node->set_as_exit();
op_node = add_operation_node(&object->id,
NodeType::GEOMETRY,
NULL,
OperationCode::PLACEHOLDER,
"Eval Init");
op_node->set_as_entry();
/* Materials. */
if (object->totcol != 0) {
if (object->type == OB_MESH) {

View File

@@ -1936,16 +1936,14 @@ void DepsgraphRelationBuilder::build_shapekeys(Key *key)
* and also for the links coming from the shapekey datablocks
* - Animation/Drivers affecting the parameters of the geometry are made to
* trigger updates on the obdata geometry component, which then trigger
* downstream re-evaluation of the individual instances of this geometry.
*/
* downstream re-evaluation of the individual instances of this geometry. */
void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
{
ID *obdata = (ID *)object->data;
/* Init operation of object-level geometry evaluation. */
OperationKey geom_init_key(&object->id,
NodeType::GEOMETRY,
OperationCode::PLACEHOLDER,
"Eval Init");
OperationCode::GEOMETRY_EVAL_INIT);
/* Get nodes for result of obdata's evaluation, and geometry evaluation
* on object. */
ComponentKey obdata_geom_key(obdata, NodeType::GEOMETRY);
@@ -1981,7 +1979,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
}
}
}
/* Grease Pencil Modifiers */
/* Grease Pencil Modifiers. */
if (object->greasepencil_modifiers.first != NULL) {
ModifierUpdateDepsgraphContext ctx = {};
ctx.scene = scene_;
@@ -1999,7 +1997,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
}
}
}
/* Shader FX */
/* Shader FX. */
if (object->shader_fx.first != NULL) {
ModifierUpdateDepsgraphContext ctx = {};
ctx.scene = scene_;
@@ -2040,9 +2038,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
if (ELEM(object->type, OB_MESH, OB_CURVE, OB_LATTICE)) {
// add geometry collider relations
}
/* Make sure uber update is the last in the dependencies.
*
* TODO(sergey): Get rid of this node. */
/* Make sure uber update is the last in the dependencies. */
if (object->type != OB_ARMATURE) {
/* Armatures does no longer require uber node. */
OperationKey obdata_ubereval_key(&object->id,

View File

@@ -64,6 +64,7 @@ const char *operationCodeAsString(OperationCode opcode)
case OperationCode::RIGIDBODY_TRANSFORM_COPY:
return "RIGIDBODY_TRANSFORM_COPY";
/* Geometry. */
case OperationCode::GEOMETRY_EVAL_INIT: return "GEOMETRY_EVAL_INIT";
case OperationCode::GEOMETRY_EVAL: return "GEOMETRY_EVAL";
case OperationCode::GEOMETRY_SHAPEKEY: return "GEOMETRY_SHAPEKEY";
/* Object data. */

View File

@@ -84,6 +84,9 @@ enum class OperationCode {
/* Geometry. ------------------------------------------------------------ */
/* Initialize evaluation of the geometry. Is an entry operation of geometry
* component. */
GEOMETRY_EVAL_INIT,
/* Evaluate the whole geometry, including modifiers. */
GEOMETRY_EVAL,
/* Evaluation of a shape key. */