Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
| Show First 20 Lines • Show All 221 Lines • ▼ Show 20 Lines | if (op_node == nullptr) { | ||||
| graph_->operations.append(op_node); | graph_->operations.append(op_node); | ||||
| } | } | ||||
| else { | else { | ||||
| fprintf(stderr, | fprintf(stderr, | ||||
| "add_operation: Operation already exists - %s has %s at %p\n", | "add_operation: Operation already exists - %s has %s at %p\n", | ||||
| comp_node->identifier().c_str(), | comp_node->identifier().c_str(), | ||||
| op_node->identifier().c_str(), | op_node->identifier().c_str(), | ||||
| op_node); | op_node); | ||||
| BLI_assert(!"Should not happen!"); | BLI_assert_msg(0, "Should not happen!"); | ||||
| } | } | ||||
| return op_node; | return op_node; | ||||
| } | } | ||||
| OperationNode *DepsgraphNodeBuilder::add_operation_node(ID *id, | OperationNode *DepsgraphNodeBuilder::add_operation_node(ID *id, | ||||
| NodeType comp_type, | NodeType comp_type, | ||||
| const char *comp_name, | const char *comp_name, | ||||
| OperationCode opcode, | OperationCode opcode, | ||||
| ▲ Show 20 Lines • Show All 1,252 Lines • ▼ Show 20 Lines | void DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool is_object_visible) | ||||
| build_object_pointcache(object); | build_object_pointcache(object); | ||||
| /* Geometry. */ | /* Geometry. */ | ||||
| build_object_data_geometry_datablock((ID *)object->data, is_object_visible); | build_object_data_geometry_datablock((ID *)object->data, is_object_visible); | ||||
| build_dimensions(object); | build_dimensions(object); | ||||
| /* Batch cache. */ | /* Batch cache. */ | ||||
| add_operation_node( | add_operation_node( | ||||
| &object->id, | &object->id, | ||||
| NodeType::BATCH_CACHE, | NodeType::BATCH_CACHE, | ||||
| OperationCode::BATCH_UPDATE_SELECT, | OperationCode::GEOMETRY_SELECT_UPDATE, | ||||
| [object_cow](::Depsgraph *depsgraph) { BKE_object_select_update(depsgraph, object_cow); }); | [object_cow](::Depsgraph *depsgraph) { BKE_object_select_update(depsgraph, object_cow); }); | ||||
| } | } | ||||
| void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool is_object_visible) | void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool is_object_visible) | ||||
| { | { | ||||
| if (built_map_.checkIsBuiltAndTag(obdata)) { | if (built_map_.checkIsBuiltAndTag(obdata)) { | ||||
| return; | return; | ||||
| } | } | ||||
| OperationNode *op_node; | OperationNode *op_node; | ||||
| /* Make sure we've got an ID node before requesting CoW pointer. */ | /* Make sure we've got an ID node before requesting CoW pointer. */ | ||||
| (void)add_id_node((ID *)obdata); | (void)add_id_node((ID *)obdata); | ||||
| ID *obdata_cow = get_cow_id(obdata); | ID *obdata_cow = get_cow_id(obdata); | ||||
| build_idproperties(obdata->properties); | build_idproperties(obdata->properties); | ||||
| /* Animation. */ | /* Animation. */ | ||||
| build_animdata(obdata); | build_animdata(obdata); | ||||
| /* ShapeKeys */ | /* ShapeKeys */ | ||||
| Key *key = BKE_key_from_id(obdata); | Key *key = BKE_key_from_id(obdata); | ||||
| if (key) { | if (key) { | ||||
| build_shapekeys(key); | build_shapekeys(key); | ||||
| } | } | ||||
| /* Nodes for result of obdata's evaluation, and geometry | |||||
| /* Geometry evaluation. */ | * evaluation on object. */ | ||||
| /* Entry operation, takes care of initialization, and some other | |||||
| * relations which needs to be run prior to actual geometry evaluation. */ | |||||
| op_node = add_operation_node(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT); | |||||
| op_node->set_as_entry(); | |||||
| add_operation_node(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_DEFORM); | |||||
| const ID_Type id_type = GS(obdata->name); | const ID_Type id_type = GS(obdata->name); | ||||
| switch (id_type) { | switch (id_type) { | ||||
| case ID_ME: { | case ID_ME: { | ||||
| add_operation_node(obdata, | op_node = add_operation_node(obdata, | ||||
| NodeType::GEOMETRY, | NodeType::GEOMETRY, | ||||
| OperationCode::GEOMETRY_EVAL, | OperationCode::GEOMETRY_EVAL, | ||||
| [obdata_cow](::Depsgraph *depsgraph) { | [obdata_cow](::Depsgraph *depsgraph) { | ||||
| BKE_mesh_eval_geometry(depsgraph, (Mesh *)obdata_cow); | BKE_mesh_eval_geometry(depsgraph, (Mesh *)obdata_cow); | ||||
| }); | }); | ||||
| op_node->set_as_entry(); | |||||
| break; | break; | ||||
| } | } | ||||
| case ID_MB: { | case ID_MB: { | ||||
| add_operation_node(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | op_node = add_operation_node(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | ||||
| op_node->set_as_entry(); | |||||
| break; | break; | ||||
| } | } | ||||
| case ID_CU: { | case ID_CU: { | ||||
| add_operation_node(obdata, | op_node = add_operation_node(obdata, | ||||
| NodeType::GEOMETRY, | NodeType::GEOMETRY, | ||||
| OperationCode::GEOMETRY_EVAL, | OperationCode::GEOMETRY_EVAL, | ||||
| [obdata_cow](::Depsgraph *depsgraph) { | [obdata_cow](::Depsgraph *depsgraph) { | ||||
| BKE_curve_eval_geometry(depsgraph, (Curve *)obdata_cow); | BKE_curve_eval_geometry(depsgraph, (Curve *)obdata_cow); | ||||
| }); | }); | ||||
| op_node->set_as_entry(); | |||||
| /* Make sure objects used for bevel.taper are in the graph. | /* Make sure objects used for bevel.taper are in the graph. | ||||
| * NOTE: This objects might be not linked to the scene. */ | * NOTE: This objects might be not linked to the scene. */ | ||||
| Curve *cu = (Curve *)obdata; | Curve *cu = (Curve *)obdata; | ||||
| if (cu->bevobj != nullptr) { | if (cu->bevobj != nullptr) { | ||||
| build_object(-1, cu->bevobj, DEG_ID_LINKED_INDIRECTLY, is_object_visible); | build_object(-1, cu->bevobj, DEG_ID_LINKED_INDIRECTLY, is_object_visible); | ||||
| } | } | ||||
| if (cu->taperobj != nullptr) { | if (cu->taperobj != nullptr) { | ||||
| build_object(-1, cu->taperobj, DEG_ID_LINKED_INDIRECTLY, is_object_visible); | build_object(-1, cu->taperobj, DEG_ID_LINKED_INDIRECTLY, is_object_visible); | ||||
| } | } | ||||
| if (cu->textoncurve != nullptr) { | if (cu->textoncurve != nullptr) { | ||||
| build_object(-1, cu->textoncurve, DEG_ID_LINKED_INDIRECTLY, is_object_visible); | build_object(-1, cu->textoncurve, DEG_ID_LINKED_INDIRECTLY, is_object_visible); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| case ID_LT: { | case ID_LT: { | ||||
| add_operation_node(obdata, | op_node = add_operation_node(obdata, | ||||
| NodeType::GEOMETRY, | NodeType::GEOMETRY, | ||||
| OperationCode::GEOMETRY_EVAL, | OperationCode::GEOMETRY_EVAL, | ||||
| [obdata_cow](::Depsgraph *depsgraph) { | [obdata_cow](::Depsgraph *depsgraph) { | ||||
| BKE_lattice_eval_geometry(depsgraph, (Lattice *)obdata_cow); | BKE_lattice_eval_geometry(depsgraph, (Lattice *)obdata_cow); | ||||
| }); | }); | ||||
| op_node->set_as_entry(); | |||||
| break; | break; | ||||
| } | } | ||||
| case ID_GD: { | case ID_GD: { | ||||
| /* GPencil evaluation operations. */ | /* GPencil evaluation operations. */ | ||||
| add_operation_node(obdata, | op_node = add_operation_node(obdata, | ||||
| NodeType::GEOMETRY, | NodeType::GEOMETRY, | ||||
| OperationCode::GEOMETRY_EVAL, | OperationCode::GEOMETRY_EVAL, | ||||
| [obdata_cow](::Depsgraph *depsgraph) { | [obdata_cow](::Depsgraph *depsgraph) { | ||||
| BKE_gpencil_frame_active_set(depsgraph, (bGPdata *)obdata_cow); | BKE_gpencil_frame_active_set(depsgraph, | ||||
| (bGPdata *)obdata_cow); | |||||
| }); | }); | ||||
| op_node->set_as_entry(); | |||||
| break; | break; | ||||
| } | } | ||||
| case ID_HA: { | case ID_HA: { | ||||
| add_operation_node(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | op_node = add_operation_node(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | ||||
| op_node->set_as_entry(); | |||||
| break; | break; | ||||
| } | } | ||||
| case ID_PT: { | case ID_PT: { | ||||
| add_operation_node(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | op_node = add_operation_node(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | ||||
| op_node->set_as_entry(); | |||||
| break; | break; | ||||
| } | } | ||||
| case ID_VO: { | case ID_VO: { | ||||
| /* Volume frame update. */ | /* Volume frame update. */ | ||||
| add_operation_node(obdata, | op_node = add_operation_node(obdata, | ||||
| NodeType::GEOMETRY, | NodeType::GEOMETRY, | ||||
| OperationCode::GEOMETRY_EVAL, | OperationCode::GEOMETRY_EVAL, | ||||
| [obdata_cow](::Depsgraph *depsgraph) { | [obdata_cow](::Depsgraph *depsgraph) { | ||||
| BKE_volume_eval_geometry(depsgraph, (Volume *)obdata_cow); | BKE_volume_eval_geometry(depsgraph, (Volume *)obdata_cow); | ||||
| }); | }); | ||||
| op_node->set_as_entry(); | |||||
| break; | break; | ||||
| } | } | ||||
| default: | default: | ||||
| BLI_assert(!"Should not happen"); | BLI_assert_msg(0, "Should not happen"); | ||||
| break; | break; | ||||
| } | } | ||||
| op_node = add_operation_node(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_DONE); | op_node = add_operation_node(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_DONE); | ||||
| op_node->set_as_exit(); | op_node->set_as_exit(); | ||||
| /* Parameters for driver sources. */ | /* Parameters for driver sources. */ | ||||
| build_parameters(obdata); | build_parameters(obdata); | ||||
| /* Batch cache. */ | /* Batch cache. */ | ||||
| add_operation_node(obdata, | add_operation_node(obdata, | ||||
| NodeType::BATCH_CACHE, | NodeType::BATCH_CACHE, | ||||
| OperationCode::BATCH_UPDATE_SELECT, | OperationCode::GEOMETRY_SELECT_UPDATE, | ||||
| [obdata_cow](::Depsgraph *depsgraph) { | [obdata_cow](::Depsgraph *depsgraph) { | ||||
| BKE_object_data_select_update(depsgraph, obdata_cow); | BKE_object_data_select_update(depsgraph, obdata_cow); | ||||
| }); | }); | ||||
| add_operation_node(obdata, | |||||
| NodeType::BATCH_CACHE, | |||||
| OperationCode::BATCH_UPDATE_DEFORM, | |||||
| [obdata_cow](::Depsgraph *depsgraph) { | |||||
| BKE_object_data_eval_batch_cache_deform_tag(depsgraph, obdata_cow); | |||||
| }); | |||||
| add_operation_node(obdata, | |||||
| NodeType::BATCH_CACHE, | |||||
| OperationCode::BATCH_UPDATE_ALL, | |||||
| [obdata_cow](::Depsgraph *depsgraph) { | |||||
| BKE_object_data_eval_batch_cache_dirty_tag(depsgraph, obdata_cow); | |||||
| }); | |||||
| } | } | ||||
| void DepsgraphNodeBuilder::build_armature(bArmature *armature) | void DepsgraphNodeBuilder::build_armature(bArmature *armature) | ||||
| { | { | ||||
| if (built_map_.checkIsBuiltAndTag(armature)) { | if (built_map_.checkIsBuiltAndTag(armature)) { | ||||
| return; | return; | ||||
| } | } | ||||
| build_idproperties(armature->id.properties); | build_idproperties(armature->id.properties); | ||||
| ▲ Show 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { | ||||
| else if (id_type == ID_MC) { | else if (id_type == ID_MC) { | ||||
| build_movieclip((MovieClip *)id); | build_movieclip((MovieClip *)id); | ||||
| } | } | ||||
| else if (ELEM(bnode->type, NODE_GROUP, NODE_CUSTOM_GROUP)) { | else if (ELEM(bnode->type, NODE_GROUP, NODE_CUSTOM_GROUP)) { | ||||
| bNodeTree *group_ntree = (bNodeTree *)id; | bNodeTree *group_ntree = (bNodeTree *)id; | ||||
| build_nodetree(group_ntree); | build_nodetree(group_ntree); | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_assert(!"Unknown ID type used for node"); | BLI_assert_msg(0, "Unknown ID type used for node"); | ||||
| } | } | ||||
| } | } | ||||
| LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->inputs) { | LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->inputs) { | ||||
| build_idproperties(socket->prop); | build_idproperties(socket->prop); | ||||
| } | } | ||||
| LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->outputs) { | LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->outputs) { | ||||
| build_idproperties(socket->prop); | build_idproperties(socket->prop); | ||||
| ▲ Show 20 Lines • Show All 373 Lines • Show Last 20 Lines | |||||