From 97fa7974daad5334508fffc825484e1942068d16 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 1 Feb 2019 13:43:14 +0100 Subject: Cleanup: Shuffle arguments in most used order Quite often we need to create nodes which defines various evaluation stages. --- .../depsgraph/intern/builder/deg_builder_nodes.cc | 282 ++++++++------------- .../depsgraph/intern/builder/deg_builder_nodes.h | 8 +- .../intern/builder/deg_builder_nodes_rig.cc | 95 ++++--- .../intern/builder/deg_builder_nodes_view_layer.cc | 10 +- 4 files changed, 174 insertions(+), 221 deletions(-) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index b0d06a30924..25174c996fe 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -210,14 +210,12 @@ ComponentNode *DepsgraphNodeBuilder::add_component_node( OperationNode *DepsgraphNodeBuilder::add_operation_node( ComponentNode *comp_node, - const DepsEvalOperationCb& op, OperationCode opcode, + const DepsEvalOperationCb& op, const char *name, int name_tag) { - OperationNode *op_node = comp_node->find_operation(opcode, - name, - name_tag); + OperationNode *op_node = comp_node->find_operation(opcode, name, name_tag); if (op_node == NULL) { op_node = comp_node->add_operation(op, opcode, name, name_tag); graph_->operations.push_back(op_node); @@ -237,37 +235,32 @@ OperationNode *DepsgraphNodeBuilder::add_operation_node( ID *id, NodeType comp_type, const char *comp_name, - const DepsEvalOperationCb& op, OperationCode opcode, + const DepsEvalOperationCb& op, const char *name, int name_tag) { ComponentNode *comp_node = add_component_node(id, comp_type, comp_name); - return add_operation_node(comp_node, op, opcode, name, name_tag); + return add_operation_node(comp_node, opcode, op, name, name_tag); } OperationNode *DepsgraphNodeBuilder::add_operation_node( ID *id, NodeType comp_type, - const DepsEvalOperationCb& op, OperationCode opcode, + const DepsEvalOperationCb& op, const char *name, int name_tag) { - return add_operation_node(id, - comp_type, - "", - op, - opcode, - name, - name_tag); + return add_operation_node( + id, comp_type, "", opcode, op, name, name_tag); } OperationNode *DepsgraphNodeBuilder::ensure_operation_node( ID *id, NodeType comp_type, - const DepsEvalOperationCb& op, OperationCode opcode, + const DepsEvalOperationCb& op, const char *name, int name_tag) { @@ -276,7 +269,7 @@ OperationNode *DepsgraphNodeBuilder::ensure_operation_node( if (operation != NULL) { return operation; } - return add_operation_node(id, comp_type, op, opcode, name, name_tag); + return add_operation_node(id, comp_type, opcode, op, name, name_tag); } bool DepsgraphNodeBuilder::has_operation_node(ID *id, @@ -286,12 +279,8 @@ bool DepsgraphNodeBuilder::has_operation_node(ID *id, const char *name, int name_tag) { - return find_operation_node(id, - comp_type, - comp_name, - opcode, - name, - name_tag) != NULL; + return find_operation_node( + id, comp_type, comp_name, opcode, name, name_tag) != NULL; } OperationNode *DepsgraphNodeBuilder::find_operation_node( @@ -618,10 +607,8 @@ void DepsgraphNodeBuilder::build_object(int base_index, * Do it now because it's possible object data will affect * on object's level animation, for example in case of rebuilding * pose for proxy. */ - OperationNode *op_node = add_operation_node(&object->id, - NodeType::PARAMETERS, - NULL, - OperationCode::PARAMETERS_EVAL); + OperationNode *op_node = add_operation_node( + &object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); op_node->set_as_exit(); build_animdata(&object->id); /* Particle systems. */ @@ -644,18 +631,16 @@ void DepsgraphNodeBuilder::build_object(int base_index, is_parent_collection_visible_ = is_visible; build_collection(NULL, object->dup_group); is_parent_collection_visible_ = is_current_parent_collection_visible; - add_operation_node(&object->id, - NodeType::DUPLI, - NULL, - OperationCode::DUPLI); + add_operation_node( + &object->id, NodeType::DUPLI, OperationCode::DUPLI); } /* Syncronization back to original object. */ add_operation_node(&object->id, NodeType::SYNCHRONIZATION, + OperationCode::SYNCHRONIZE_TO_ORIGINAL, function_bind(BKE_object_synchronize_to_original, _1, - object_cow), - OperationCode::SYNCHRONIZE_TO_ORIGINAL); + object_cow)); } void DepsgraphNodeBuilder::build_object_flags( @@ -672,13 +657,13 @@ void DepsgraphNodeBuilder::build_object_flags( /* TODO(sergey): Is this really best component to be used? */ add_operation_node(&object->id, NodeType::OBJECT_FROM_LAYER, + OperationCode::OBJECT_BASE_FLAGS, function_bind(BKE_object_eval_flush_base_flags, _1, scene_cow, view_layer_index_, object_cow, base_index, - is_from_set), - OperationCode::OBJECT_BASE_FLAGS); + is_from_set)); } void DepsgraphNodeBuilder::build_object_data( @@ -745,62 +730,51 @@ void DepsgraphNodeBuilder::build_object_data_lightprobe(Object *object) { LightProbe *probe = (LightProbe *)object->data; build_lightprobe(probe); - add_operation_node(&object->id, - NodeType::PARAMETERS, - NULL, - OperationCode::LIGHT_PROBE_EVAL); + add_operation_node( + &object->id, NodeType::PARAMETERS, OperationCode::LIGHT_PROBE_EVAL); } void DepsgraphNodeBuilder::build_object_data_speaker(Object *object) { Speaker *speaker = (Speaker *)object->data; build_speaker(speaker); - add_operation_node(&object->id, - NodeType::PARAMETERS, - NULL, - OperationCode::SPEAKER_EVAL); + add_operation_node( + &object->id, NodeType::PARAMETERS, OperationCode::SPEAKER_EVAL); } void DepsgraphNodeBuilder::build_object_transform(Object *object) { OperationNode *op_node; Object *ob_cow = get_cow_datablock(object); - - /* local transforms (from transform channels - loc/rot/scale + deltas) */ + /* Local transforms (from transform channels - loc/rot/scale + deltas). */ op_node = add_operation_node(&object->id, NodeType::TRANSFORM, + OperationCode::TRANSFORM_LOCAL, function_bind(BKE_object_eval_local_transform, _1, - ob_cow), - OperationCode::TRANSFORM_LOCAL); + ob_cow)); op_node->set_as_entry(); - - /* object parent */ + /* Object parent. */ if (object->parent != NULL) { add_operation_node(&object->id, NodeType::TRANSFORM, - function_bind(BKE_object_eval_parent, - _1, - ob_cow), - OperationCode::TRANSFORM_PARENT); + OperationCode::TRANSFORM_PARENT, + function_bind(BKE_object_eval_parent, _1, ob_cow)); } - - /* object constraints */ + /* Object constraints. */ if (object->constraints.first != NULL) { build_object_constraints(object); } - /* Rest of transformation update. */ add_operation_node(&object->id, NodeType::TRANSFORM, + OperationCode::TRANSFORM_OBJECT_UBEREVAL, function_bind(BKE_object_eval_uber_transform, _1, - ob_cow), - OperationCode::TRANSFORM_OBJECT_UBEREVAL); - - /* object transform is done */ + ob_cow)); + /* Object transform is done. */ op_node = add_operation_node(&object->id, NodeType::TRANSFORM, + OperationCode::TRANSFORM_FINAL, function_bind(BKE_object_eval_transform_final, _1, - ob_cow), - OperationCode::TRANSFORM_FINAL); + ob_cow)); op_node->set_as_exit(); } @@ -825,11 +799,11 @@ void DepsgraphNodeBuilder::build_object_constraints(Object *object) { /* create node for constraint stack */ add_operation_node(&object->id, NodeType::TRANSFORM, + OperationCode::TRANSFORM_CONSTRAINTS, function_bind(BKE_object_eval_constraints, _1, get_cow_datablock(scene_), - get_cow_datablock(object)), - OperationCode::TRANSFORM_CONSTRAINTS); + get_cow_datablock(object))); } void DepsgraphNodeBuilder::build_object_pointcache(Object *object) @@ -841,11 +815,11 @@ void DepsgraphNodeBuilder::build_object_pointcache(Object *object) Object *object_cow = get_cow_datablock(object); add_operation_node(&object->id, NodeType::POINT_CACHE, + OperationCode::POINT_CACHE_RESET, function_bind(BKE_object_eval_ptcache_reset, _1, scene_cow, - object_cow), - OperationCode::POINT_CACHE_RESET); + object_cow)); } /** @@ -874,12 +848,11 @@ void DepsgraphNodeBuilder::build_animdata(ID *id) if ((adt->action) || (adt->nla_tracks.first)) { /* create the node */ add_operation_node(id, NodeType::ANIMATION, + OperationCode::ANIMATION, function_bind(BKE_animsys_eval_animdata, _1, id_cow), - OperationCode::ANIMATION, id->name); - /* TODO: for each channel affected, we might also want to add some * support for running RNA update callbacks on them * (which will be needed for proper handling of drivers later) */ @@ -916,10 +889,8 @@ void DepsgraphNodeBuilder::build_action(bAction *action) if (built_map_.checkIsBuiltAndTag(action)) { return; } - add_operation_node(&action->id, - NodeType::ANIMATION, - NULL, - OperationCode::ANIMATION); + add_operation_node( + &action->id, NodeType::ANIMATION, OperationCode::ANIMATION); } /** @@ -940,8 +911,8 @@ void DepsgraphNodeBuilder::build_driver(ID *id, FCurve *fcurve, int driver_index * with the driver index. */ ensure_operation_node(id, NodeType::PARAMETERS, - function_bind(BKE_animsys_eval_driver, _1, id_cow, driver_index, driver_orig), OperationCode::DRIVER, + function_bind(BKE_animsys_eval_driver, _1, id_cow, driver_index, driver_orig), fcurve->rna_path ? fcurve->rna_path : "", fcurve->array_index); build_driver_variables(id, fcurve); @@ -992,8 +963,8 @@ void DepsgraphNodeBuilder::build_driver_id_property(ID *id, const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop); ensure_operation_node(id, NodeType::PARAMETERS, - NULL, OperationCode::ID_PROPERTY, + NULL, prop_identifier); } @@ -1009,10 +980,8 @@ void DepsgraphNodeBuilder::build_world(World *world) /* Shading update. */ add_operation_node(&world->id, NodeType::SHADING, - function_bind(BKE_world_eval, - _1, - world_cow), - OperationCode::WORLD_UPDATE); + OperationCode::WORLD_UPDATE, + function_bind(BKE_world_eval, _1, world_cow)); /* Animation. */ build_animdata(&world->id); /* World's nodetree. */ @@ -1047,13 +1016,13 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene) /* Init/rebuild operation. */ add_operation_node(&scene->id, NodeType::TRANSFORM, - function_bind(BKE_rigidbody_rebuild_sim, _1, scene_cow), - OperationCode::RIGIDBODY_REBUILD); + OperationCode::RIGIDBODY_REBUILD, + function_bind(BKE_rigidbody_rebuild_sim, _1, scene_cow)); /* Do-sim operation. */ OperationNode *sim_node = add_operation_node( &scene->id, NodeType::TRANSFORM, - function_bind(BKE_rigidbody_eval_simulation, _1, scene_cow), - OperationCode::RIGIDBODY_SIM); + OperationCode::RIGIDBODY_SIM, + function_bind(BKE_rigidbody_eval_simulation, _1, scene_cow)); sim_node->set_as_entry(); sim_node->set_as_exit(); sim_node->owner->entry_operation = sim_node; @@ -1068,13 +1037,14 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene) /* 2) create operation for flushing results */ /* object's transform component - where the rigidbody operation * lives. */ - add_operation_node(&object->id, NodeType::TRANSFORM, + add_operation_node(&object->id, + NodeType::TRANSFORM, + OperationCode::RIGIDBODY_TRANSFORM_COPY, function_bind( BKE_rigidbody_object_sync_transforms, _1, scene_cow, - get_cow_datablock(object)), - OperationCode::RIGIDBODY_TRANSFORM_COPY); + get_cow_datablock(object))); } FOREACH_COLLECTION_OBJECT_RECURSIVE_END; } @@ -1119,10 +1089,10 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object, Object *ob_cow = get_cow_datablock(object); OperationNode *op_node; op_node = add_operation_node(psys_comp, + OperationCode::PARTICLE_SYSTEM_INIT, function_bind(BKE_particle_system_eval_init, _1, - ob_cow), - OperationCode::PARTICLE_SYSTEM_INIT); + ob_cow)); op_node->set_as_entry(); /* Build all particle systems. */ LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) { @@ -1133,8 +1103,8 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object, build_particle_settings(part); /* Particle system evaluation. */ add_operation_node(psys_comp, - NULL, OperationCode::PARTICLE_SYSTEM_EVAL, + NULL, psys->name); /* Keyed particle targets. */ if (part->phystype == PART_PHYS_KEYED) { @@ -1167,9 +1137,8 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object, break; } } - op_node = add_operation_node(psys_comp, - NULL, - OperationCode::PARTICLE_SYSTEM_DONE); + op_node = add_operation_node( + psys_comp, OperationCode::PARTICLE_SYSTEM_DONE); op_node->set_as_exit(); } @@ -1188,18 +1157,16 @@ void DepsgraphNodeBuilder::build_particle_settings( OperationNode *op_node; op_node = add_operation_node(&particle_settings->id, NodeType::PARTICLE_SETTINGS, - NULL, OperationCode::PARTICLE_SETTINGS_INIT); op_node->set_as_entry(); add_operation_node(&particle_settings->id, NodeType::PARTICLE_SETTINGS, + OperationCode::PARTICLE_SETTINGS_RESET, function_bind(BKE_particle_settings_eval_reset, _1, - particle_settings_cow), - OperationCode::PARTICLE_SETTINGS_RESET); + particle_settings_cow)); op_node = add_operation_node(&particle_settings->id, NodeType::PARTICLE_SETTINGS, - NULL, OperationCode::PARTICLE_SETTINGS_EVAL); op_node->set_as_exit(); /* Texture slots. */ @@ -1221,17 +1188,15 @@ void DepsgraphNodeBuilder::build_shapekeys(Key *key) build_animdata(&key->id); /* This is an exit operation for the entire key datablock, is what is used * as dependency for modifiers evaluation. */ - add_operation_node(&key->id, - NodeType::GEOMETRY, - NULL, - OperationCode::GEOMETRY_SHAPEKEY); + add_operation_node( + &key->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_SHAPEKEY); /* Create per-key block properties, allowing tricky inter-dependnecies for * drivers evaluation. */ LISTBASE_FOREACH (KeyBlock *, key_block, &key->block) { add_operation_node(&key->id, NodeType::PARAMETERS, - NULL, OperationCode::PARAMETERS_EVAL, + NULL, key_block->name); } } @@ -1247,29 +1212,27 @@ void DepsgraphNodeBuilder::build_object_data_geometry( Object *object_cow = get_cow_datablock(object); /* 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 = add_operation_node( + &object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT); op_node->set_as_entry(); /* Geometry evaluation. */ op_node = add_operation_node(&object->id, NodeType::GEOMETRY, + OperationCode::GEOMETRY_EVAL, function_bind(BKE_object_eval_uber_data, _1, scene_cow, - object_cow), - OperationCode::GEOMETRY_EVAL); + object_cow)); op_node->set_as_exit(); /* Materials. */ if (object->totcol != 0) { if (object->type == OB_MESH) { add_operation_node(&object->id, NodeType::SHADING, + OperationCode::SHADING, function_bind(BKE_object_eval_update_shading, _1, - object_cow), - OperationCode::SHADING); + object_cow)); } for (int a = 1; a <= object->totcol; a++) { Material *ma = give_current_material(object, a); @@ -1310,19 +1273,17 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( { op_node = add_operation_node(obdata, NodeType::GEOMETRY, + OperationCode::GEOMETRY_EVAL, function_bind(BKE_mesh_eval_geometry, _1, - (Mesh *)obdata_cow), - OperationCode::GEOMETRY_EVAL); + (Mesh *)obdata_cow)); op_node->set_as_entry(); break; } case ID_MB: { - op_node = add_operation_node(obdata, - NodeType::GEOMETRY, - NULL, - OperationCode::GEOMETRY_EVAL); + op_node = add_operation_node( + obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); op_node->set_as_entry(); break; } @@ -1330,10 +1291,10 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( { op_node = add_operation_node(obdata, NodeType::GEOMETRY, + OperationCode::GEOMETRY_EVAL, function_bind(BKE_curve_eval_geometry, _1, - (Curve *)obdata_cow), - OperationCode::GEOMETRY_EVAL); + (Curve *)obdata_cow)); op_node->set_as_entry(); /* Make sure objects used for bevel.taper are in the graph. * NOTE: This objects might be not linked to the scene. */ @@ -1362,10 +1323,10 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( { op_node = add_operation_node(obdata, NodeType::GEOMETRY, + OperationCode::GEOMETRY_EVAL, function_bind(BKE_lattice_eval_geometry, _1, - (Lattice *)obdata_cow), - OperationCode::GEOMETRY_EVAL); + (Lattice *)obdata_cow)); op_node->set_as_entry(); break; } @@ -1375,10 +1336,10 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( /* GPencil evaluation operations. */ op_node = add_operation_node(obdata, NodeType::GEOMETRY, + OperationCode::GEOMETRY_EVAL, function_bind(BKE_gpencil_eval_geometry, _1, - (bGPdata *)obdata_cow), - OperationCode::GEOMETRY_EVAL); + (bGPdata *)obdata_cow)); op_node->set_as_entry(); break; } @@ -1386,23 +1347,19 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( BLI_assert(!"Should not happen"); break; } - op_node = add_operation_node(obdata, - NodeType::GEOMETRY, - NULL, - OperationCode::GEOMETRY_EVAL_DONE); + op_node = add_operation_node( + obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_DONE); op_node->set_as_exit(); /* Parameters for driver sources. */ - add_operation_node(obdata, - NodeType::PARAMETERS, - NULL, - OperationCode::PARAMETERS_EVAL); + add_operation_node( + obdata, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); /* Batch cache. */ add_operation_node(obdata, NodeType::BATCH_CACHE, + OperationCode::GEOMETRY_SELECT_UPDATE, function_bind(BKE_object_data_select_update, _1, - obdata_cow), - OperationCode::GEOMETRY_SELECT_UPDATE); + obdata_cow)); } void DepsgraphNodeBuilder::build_armature(bArmature *armature) @@ -1412,10 +1369,8 @@ void DepsgraphNodeBuilder::build_armature(bArmature *armature) } build_animdata(&armature->id); /* Make sure pose is up-to-date with armature updates. */ - add_operation_node(&armature->id, - NodeType::PARAMETERS, - NULL, - OperationCode::ARMATURE_EVAL); + add_operation_node( + &armature->id, NodeType::PARAMETERS, OperationCode::ARMATURE_EVAL); } void DepsgraphNodeBuilder::build_camera(Camera *camera) @@ -1425,10 +1380,8 @@ void DepsgraphNodeBuilder::build_camera(Camera *camera) } OperationNode *op_node; build_animdata(&camera->id); - op_node = add_operation_node(&camera->id, - NodeType::PARAMETERS, - NULL, - OperationCode::PARAMETERS_EVAL); + op_node = add_operation_node( + &camera->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); op_node->set_as_exit(); } @@ -1439,10 +1392,8 @@ void DepsgraphNodeBuilder::build_lamp(Lamp *lamp) } OperationNode *op_node; build_animdata(&lamp->id); - op_node = add_operation_node(&lamp->id, - NodeType::PARAMETERS, - NULL, - OperationCode::PARAMETERS_EVAL); + op_node = add_operation_node( + &lamp->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); /* NOTE: We mark this node as both entry and exit. This way we have a * node to link all dependencies for shading (which includes relation to the * lamp object, and incldues relation from node tree) without adding a @@ -1467,19 +1418,17 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) /* Animation, */ build_animdata(&ntree->id); /* Shading update. */ - add_operation_node(&ntree->id, - NodeType::SHADING, - NULL, - OperationCode::MATERIAL_UPDATE); + add_operation_node( + &ntree->id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE); /* NOTE: We really pass original and CoW node trees here, this is how the * callback works. Ideally we need to find a better way for that. */ add_operation_node(&ntree->id, NodeType::SHADING_PARAMETERS, + OperationCode::MATERIAL_UPDATE, function_bind(BKE_nodetree_shading_params_eval, _1, ntree_cow, - ntree), - OperationCode::MATERIAL_UPDATE); + ntree)); /* nodetree's nodes... */ LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { ID *id = bnode->id; @@ -1537,10 +1486,10 @@ void DepsgraphNodeBuilder::build_material(Material *material) /* Shading update. */ add_operation_node(&material->id, NodeType::SHADING, + OperationCode::MATERIAL_UPDATE, function_bind(BKE_material_eval, _1, - material_cow), - OperationCode::MATERIAL_UPDATE); + material_cow)); /* Material animation. */ build_animdata(&material->id); /* Material's nodetree. */ @@ -1565,7 +1514,6 @@ void DepsgraphNodeBuilder::build_texture(Tex *texture) } add_operation_node(&texture->id, NodeType::GENERIC_DATABLOCK, - NULL, OperationCode::GENERIC_DATABLOCK_UPDATE); } @@ -1575,7 +1523,6 @@ void DepsgraphNodeBuilder::build_image(Image *image) { } add_operation_node(&image->id, NodeType::GENERIC_DATABLOCK, - NULL, OperationCode::GENERIC_DATABLOCK_UPDATE); } @@ -1616,8 +1563,8 @@ void DepsgraphNodeBuilder::build_cachefile(CacheFile *cache_file) /* Animation, */ build_animdata(cache_file_id); /* Cache evaluation itself. */ - add_operation_node(cache_file_id, NodeType::CACHE, NULL, - OperationCode::FILE_CACHE_UPDATE); + add_operation_node( + cache_file_id, NodeType::CACHE, OperationCode::FILE_CACHE_UPDATE); } void DepsgraphNodeBuilder::build_mask(Mask *mask) @@ -1632,13 +1579,13 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask) /* Animation based on mask's shapes. */ add_operation_node(mask_id, NodeType::ANIMATION, - function_bind(BKE_mask_eval_animation, _1, mask_cow), - OperationCode::MASK_ANIMATION); + OperationCode::MASK_ANIMATION, + function_bind(BKE_mask_eval_animation, _1, mask_cow)); /* Final mask evaluation. */ add_operation_node(mask_id, NodeType::PARAMETERS, - function_bind(BKE_mask_eval_update, _1, mask_cow), - OperationCode::MASK_EVAL); + OperationCode::MASK_EVAL, + function_bind(BKE_mask_eval_update, _1, mask_cow)); } void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) @@ -1653,13 +1600,13 @@ void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) /* Movie clip evaluation. */ add_operation_node(clip_id, NodeType::PARAMETERS, - function_bind(BKE_movieclip_eval_update, _1, clip_cow), - OperationCode::MOVIECLIP_EVAL); + OperationCode::MOVIECLIP_EVAL, + function_bind(BKE_movieclip_eval_update, _1, clip_cow)); add_operation_node(clip_id, NodeType::BATCH_CACHE, - function_bind(BKE_movieclip_eval_selection_update, _1, clip_cow), - OperationCode::MOVIECLIP_SELECT_UPDATE); + OperationCode::MOVIECLIP_SELECT_UPDATE, + function_bind(BKE_movieclip_eval_selection_update, _1, clip_cow)); } void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe) @@ -1668,11 +1615,8 @@ void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe) return; } /* Placeholder so we can add relations and tag ID node for update. */ - add_operation_node(&probe->id, - NodeType::PARAMETERS, - NULL, - OperationCode::LIGHT_PROBE_EVAL); - + add_operation_node( + &probe->id, NodeType::PARAMETERS, OperationCode::LIGHT_PROBE_EVAL); build_animdata(&probe->id); } @@ -1682,10 +1626,8 @@ void DepsgraphNodeBuilder::build_speaker(Speaker *speaker) return; } /* Placeholder so we can add relations and tag ID node for update. */ - add_operation_node(&speaker->id, - NodeType::PARAMETERS, - NULL, - OperationCode::SPEAKER_EVAL); + add_operation_node( + &speaker->id, NodeType::PARAMETERS, OperationCode::SPEAKER_EVAL); build_animdata(&speaker->id); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 1be8661d05d..887ebb3401b 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -110,28 +110,28 @@ struct DepsgraphNodeBuilder { const char *comp_name = ""); OperationNode *add_operation_node(ComponentNode *comp_node, - const DepsEvalOperationCb& op, OperationCode opcode, + const DepsEvalOperationCb& op = NULL, const char *name = "", int name_tag = -1); OperationNode *add_operation_node(ID *id, NodeType comp_type, const char *comp_name, - const DepsEvalOperationCb& op, OperationCode opcode, + const DepsEvalOperationCb& op = NULL, const char *name = "", int name_tag = -1); OperationNode *add_operation_node(ID *id, NodeType comp_type, - const DepsEvalOperationCb& op, OperationCode opcode, + const DepsEvalOperationCb& op = NULL, const char *name = "", int name_tag = -1); OperationNode *ensure_operation_node(ID *id, NodeType comp_type, - const DepsEvalOperationCb& op, OperationCode opcode, + const DepsEvalOperationCb& op = NULL, const char *name = "", int name_tag = -1); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index c2b2bcf7f30..913af489a44 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -72,13 +72,15 @@ void DepsgraphNodeBuilder::build_pose_constraints( data.is_parent_visible = is_object_visible; BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data); /* Create node for constraint stack. */ - add_operation_node(&object->id, NodeType::BONE, pchan->name, + add_operation_node(&object->id, + NodeType::BONE, + pchan->name, + OperationCode::BONE_CONSTRAINTS, function_bind(BKE_pose_constraints_evaluate, _1, get_cow_datablock(scene_), get_cow_datablock(object), - pchan_index), - OperationCode::BONE_CONSTRAINTS); + pchan_index)); } /* IK Solver Eval Steps */ @@ -103,13 +105,15 @@ void DepsgraphNodeBuilder::build_ik_pose(Object *object, int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan); BLI_assert(rootchan_index != -1); /* Operation node for evaluating/running IK Solver. */ - add_operation_node(&object->id, NodeType::EVAL_POSE, rootchan->name, + add_operation_node(&object->id, + NodeType::EVAL_POSE, + rootchan->name, + OperationCode::POSE_IK_SOLVER, function_bind(BKE_pose_iktree_evaluate, _1, get_cow_datablock(scene_), get_cow_datablock(object), - rootchan_index), - OperationCode::POSE_IK_SOLVER); + rootchan_index)); } /* Spline IK Eval Steps */ @@ -127,13 +131,15 @@ void DepsgraphNodeBuilder::build_splineik_pose(Object *object, * start. */ int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan); BLI_assert(rootchan_index != -1); - add_operation_node(&object->id, NodeType::EVAL_POSE, rootchan->name, + add_operation_node(&object->id, + NodeType::EVAL_POSE, + rootchan->name, + OperationCode::POSE_SPLINE_IK_SOLVER, function_bind(BKE_pose_splineik_evaluate, _1, get_cow_datablock(scene_), get_cow_datablock(object), - rootchan_index), - OperationCode::POSE_SPLINE_IK_SOLVER); + rootchan_index)); } /* Pose/Armature Bones Graph */ @@ -188,70 +194,79 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) /* Pose eval context. */ op_node = add_operation_node(&object->id, NodeType::EVAL_POSE, + OperationCode::POSE_INIT, function_bind(BKE_pose_eval_init, _1, scene_cow, - object_cow), - OperationCode::POSE_INIT); + object_cow)); op_node->set_as_entry(); op_node = add_operation_node(&object->id, NodeType::EVAL_POSE, + OperationCode::POSE_INIT_IK, function_bind(BKE_pose_eval_init_ik, _1, scene_cow, - object_cow), - OperationCode::POSE_INIT_IK); + object_cow)); add_operation_node(&object->id, NodeType::EVAL_POSE, + OperationCode::POSE_CLEANUP, function_bind(BKE_pose_eval_cleanup, _1, scene_cow, - object_cow), - OperationCode::POSE_CLEANUP); + object_cow)); op_node = add_operation_node(&object->id, NodeType::EVAL_POSE, + OperationCode::POSE_DONE, function_bind(BKE_pose_eval_done, _1, - object_cow), - OperationCode::POSE_DONE); + object_cow)); op_node->set_as_exit(); /* Bones. */ int pchan_index = 0; LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { /* Node for bone evaluation. */ - op_node = add_operation_node(&object->id, NodeType::BONE, pchan->name, NULL, + op_node = add_operation_node(&object->id, + NodeType::BONE, + pchan->name, OperationCode::BONE_LOCAL); op_node->set_as_entry(); - add_operation_node(&object->id, NodeType::BONE, pchan->name, + add_operation_node(&object->id, + NodeType::BONE, + pchan->name, + OperationCode::BONE_POSE_PARENT, function_bind(BKE_pose_eval_bone, _1, scene_cow, object_cow, - pchan_index), - OperationCode::BONE_POSE_PARENT); + pchan_index)); /* NOTE: Dedicated noop for easier relationship construction. */ - add_operation_node(&object->id, NodeType::BONE, pchan->name, - NULL, + add_operation_node(&object->id, + NodeType::BONE, + pchan->name, OperationCode::BONE_READY); - op_node = add_operation_node(&object->id, NodeType::BONE, pchan->name, + op_node = add_operation_node(&object->id, + NodeType::BONE, + pchan->name, + OperationCode::BONE_DONE, function_bind(BKE_pose_bone_done, _1, object_cow, - pchan_index), - OperationCode::BONE_DONE); + pchan_index)); /* B-Bone shape computation - the real last step if present. */ if (pchan->bone != NULL && pchan->bone->segments > 1) { - op_node = add_operation_node(&object->id, NodeType::BONE, pchan->name, + op_node = add_operation_node(&object->id, + NodeType::BONE, + pchan->name, + OperationCode::BONE_SEGMENTS, function_bind(BKE_pose_eval_bbone_segments, _1, object_cow, - pchan_index), - OperationCode::BONE_SEGMENTS); + pchan_index)); } op_node->set_as_exit(); @@ -260,8 +275,8 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) if (pchan->prop != NULL) { add_operation_node(&object->id, NodeType::PARAMETERS, - NULL, OperationCode::PARAMETERS_EVAL, + NULL, pchan->name); } /* Build constraints. */ @@ -323,10 +338,10 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) } op_node = add_operation_node(&object->id, NodeType::EVAL_POSE, + OperationCode::POSE_INIT, function_bind(BKE_pose_eval_proxy_init, _1, - object_cow), - OperationCode::POSE_INIT); + object_cow)); op_node->set_as_entry(); int pchan_index = 0; @@ -334,33 +349,31 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) op_node = add_operation_node(&object->id, NodeType::BONE, pchan->name, - NULL, OperationCode::BONE_LOCAL); op_node->set_as_entry(); /* Bone is ready for solvers. */ add_operation_node(&object->id, NodeType::BONE, pchan->name, - NULL, OperationCode::BONE_READY); /* Bone is fully evaluated. */ op_node = add_operation_node( &object->id, NodeType::BONE, pchan->name, + OperationCode::BONE_DONE, function_bind(BKE_pose_eval_proxy_copy_bone, _1, object_cow, - pchan_index), - OperationCode::BONE_DONE); + pchan_index)); op_node->set_as_exit(); /* Custom properties. */ if (pchan->prop != NULL) { add_operation_node(&object->id, NodeType::PARAMETERS, - NULL, OperationCode::PARAMETERS_EVAL, + NULL, pchan->name); } @@ -368,16 +381,16 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) } op_node = add_operation_node(&object->id, NodeType::EVAL_POSE, + OperationCode::POSE_CLEANUP, function_bind(BKE_pose_eval_proxy_cleanup, _1, - object_cow), - OperationCode::POSE_CLEANUP); + object_cow)); op_node = add_operation_node(&object->id, NodeType::EVAL_POSE, + OperationCode::POSE_DONE, function_bind(BKE_pose_eval_proxy_done, _1, - object_cow), - OperationCode::POSE_DONE); + object_cow)); op_node->set_as_exit(); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc index fb02a6219db..3a66eab8f2e 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc @@ -158,16 +158,14 @@ void DepsgraphNodeBuilder::build_view_layer( /* Collections. */ add_operation_node(&scene->id, NodeType::LAYER_COLLECTIONS, + OperationCode::VIEW_LAYER_EVAL, function_bind(BKE_layer_eval_view_layer_indexed, _1, scene_cow, - view_layer_index_), - OperationCode::VIEW_LAYER_EVAL); + view_layer_index_)); /* Parameters evaluation for scene relations mainly. */ - add_operation_node(&scene->id, - NodeType::PARAMETERS, - NULL, - OperationCode::SCENE_EVAL); + add_operation_node( + &scene->id, NodeType::PARAMETERS, OperationCode::SCENE_EVAL); /* Build all set scenes. */ if (scene->set != NULL) { ViewLayer *set_view_layer = BKE_view_layer_default_render(scene->set); -- cgit v1.2.3