Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/builder/deg_builder_rna.cc
| Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, | ||||
| } | } | ||||
| /* Set default values for returns. */ | /* Set default values for returns. */ | ||||
| node_identifier.id = ptr->owner_id; | node_identifier.id = ptr->owner_id; | ||||
| node_identifier.component_name = ""; | node_identifier.component_name = ""; | ||||
| node_identifier.operation_code = OperationCode::OPERATION; | node_identifier.operation_code = OperationCode::OPERATION; | ||||
| node_identifier.operation_name = ""; | node_identifier.operation_name = ""; | ||||
| node_identifier.operation_name_tag = -1; | node_identifier.operation_name_tag = -1; | ||||
| /* Handling of commonly known scenarios. */ | /* Handling of commonly known scenarios. */ | ||||
| if (ptr->type == &RNA_PoseBone) { | |||||
| const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr->data); | |||||
| if (prop != NULL && RNA_property_is_idprop(prop)) { | if (prop != NULL && RNA_property_is_idprop(prop)) { | ||||
| node_identifier.type = NodeType::PARAMETERS; | node_identifier.type = NodeType::PARAMETERS; | ||||
| node_identifier.operation_code = OperationCode::ID_PROPERTY; | node_identifier.operation_code = OperationCode::ID_PROPERTY; | ||||
| node_identifier.operation_name = RNA_property_identifier( | node_identifier.operation_name = RNA_property_identifier( | ||||
| reinterpret_cast<const PropertyRNA *>(prop)); | reinterpret_cast<const PropertyRNA *>(prop)); | ||||
| node_identifier.operation_name_tag = -1; | return node_identifier; | ||||
| } | } | ||||
| else { | else if (ptr->type == &RNA_PoseBone) { | ||||
| const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr->data); | |||||
| /* Bone - generally, we just want the bone component. */ | /* Bone - generally, we just want the bone component. */ | ||||
| node_identifier.type = NodeType::BONE; | node_identifier.type = NodeType::BONE; | ||||
| node_identifier.component_name = pchan->name; | node_identifier.component_name = pchan->name; | ||||
| /* However check property name for special handling. */ | /* However check property name for special handling. */ | ||||
| if (prop != NULL) { | if (prop != NULL) { | ||||
| Object *object = reinterpret_cast<Object *>(node_identifier.id); | Object *object = reinterpret_cast<Object *>(node_identifier.id); | ||||
| const char *prop_name = RNA_property_identifier(prop); | const char *prop_name = RNA_property_identifier(prop); | ||||
| /* B-Bone properties should connect to the final operation. */ | /* B-Bone properties should connect to the final operation. */ | ||||
| if (STRPREFIX(prop_name, "bbone_")) { | if (STRPREFIX(prop_name, "bbone_")) { | ||||
| if (builder_->check_pchan_has_bbone_segments(object, pchan)) { | if (builder_->check_pchan_has_bbone_segments(object, pchan)) { | ||||
| node_identifier.operation_code = OperationCode::BONE_SEGMENTS; | node_identifier.operation_code = OperationCode::BONE_SEGMENTS; | ||||
| } | } | ||||
| else { | else { | ||||
| node_identifier.operation_code = OperationCode::BONE_DONE; | node_identifier.operation_code = OperationCode::BONE_DONE; | ||||
| } | } | ||||
| } | } | ||||
| /* Final transform properties go to the Done node for the exit. */ | /* Final transform properties go to the Done node for the exit. */ | ||||
| else if (STREQ(prop_name, "head") || STREQ(prop_name, "tail") || | else if (STREQ(prop_name, "head") || STREQ(prop_name, "tail") || | ||||
| STREQ(prop_name, "length") || STRPREFIX(prop_name, "matrix")) { | STREQ(prop_name, "length") || STRPREFIX(prop_name, "matrix")) { | ||||
| if (source == RNAPointerSource::EXIT) { | if (source == RNAPointerSource::EXIT) { | ||||
| node_identifier.operation_code = OperationCode::BONE_DONE; | node_identifier.operation_code = OperationCode::BONE_DONE; | ||||
| } | } | ||||
| } | } | ||||
| /* And other properties can always go to the entry operation. */ | /* And other properties can always go to the entry operation. */ | ||||
| else { | else { | ||||
| node_identifier.operation_code = OperationCode::BONE_LOCAL; | node_identifier.operation_code = OperationCode::BONE_LOCAL; | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| return node_identifier; | return node_identifier; | ||||
| } | } | ||||
| else if (ptr->type == &RNA_Bone) { | else if (ptr->type == &RNA_Bone) { | ||||
| /* Armature-level bone mapped to Armature Eval, and thus Pose Init. | /* Armature-level bone mapped to Armature Eval, and thus Pose Init. | ||||
| * Drivers have special code elsewhere that links them to the pose | * Drivers have special code elsewhere that links them to the pose | ||||
| * bone components, instead of using this generic code. */ | * bone components, instead of using this generic code. */ | ||||
| node_identifier.type = NodeType::ARMATURE; | node_identifier.type = NodeType::ARMATURE; | ||||
| node_identifier.operation_code = OperationCode::ARMATURE_EVAL; | node_identifier.operation_code = OperationCode::ARMATURE_EVAL; | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | else if (RNA_struct_is_a(ptr->type, &RNA_Mesh) || RNA_struct_is_a(ptr->type, &RNA_Modifier) || | ||||
| RNA_struct_is_a(ptr->type, &RNA_MeshUVLoop) || | RNA_struct_is_a(ptr->type, &RNA_MeshUVLoop) || | ||||
| RNA_struct_is_a(ptr->type, &RNA_MeshLoopColor) || | RNA_struct_is_a(ptr->type, &RNA_MeshLoopColor) || | ||||
| RNA_struct_is_a(ptr->type, &RNA_VertexGroupElement)) { | RNA_struct_is_a(ptr->type, &RNA_VertexGroupElement)) { | ||||
| /* When modifier is used as FROM operation this is likely referencing to | /* When modifier is used as FROM operation this is likely referencing to | ||||
| * the property (for example, modifier's influence). | * the property (for example, modifier's influence). | ||||
| * But when it's used as TO operation, this is geometry component. */ | * But when it's used as TO operation, this is geometry component. */ | ||||
| switch (source) { | switch (source) { | ||||
| case RNAPointerSource::ENTRY: | case RNAPointerSource::ENTRY: | ||||
| node_identifier.type = NodeType::GEOMETRY; | node_identifier.type = NodeType::GEOMETRY; | ||||
sergey: Can be `DEG_DEBUG_PRINTF`, or removed. Shouldn't be bare `printf`. | |||||
| break; | break; | ||||
| case RNAPointerSource::EXIT: | case RNAPointerSource::EXIT: | ||||
| node_identifier.type = NodeType::PARAMETERS; | node_identifier.type = NodeType::PARAMETERS; | ||||
| node_identifier.operation_code = OperationCode::PARAMETERS_EVAL; | node_identifier.operation_code = OperationCode::PARAMETERS_EVAL; | ||||
| break; | break; | ||||
| } | } | ||||
| return node_identifier; | return node_identifier; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | else if (RNA_struct_is_a(ptr->type, &RNA_ImageUser)) { | ||||
| } | } | ||||
| } | } | ||||
| else if (ELEM(ptr->type, &RNA_MeshVertex, &RNA_MeshEdge, &RNA_MeshLoop, &RNA_MeshPolygon)) { | else if (ELEM(ptr->type, &RNA_MeshVertex, &RNA_MeshEdge, &RNA_MeshLoop, &RNA_MeshPolygon)) { | ||||
| node_identifier.type = NodeType::GEOMETRY; | node_identifier.type = NodeType::GEOMETRY; | ||||
| return node_identifier; | return node_identifier; | ||||
| } | } | ||||
| if (prop != NULL) { | if (prop != NULL) { | ||||
| /* All unknown data effectively falls under "parameter evaluation". */ | /* All unknown data effectively falls under "parameter evaluation". */ | ||||
| if (RNA_property_is_idprop(prop)) { | |||||
| node_identifier.type = NodeType::PARAMETERS; | |||||
| node_identifier.operation_code = OperationCode::ID_PROPERTY; | |||||
| node_identifier.operation_name = RNA_property_identifier((PropertyRNA *)prop); | |||||
| node_identifier.operation_name_tag = -1; | |||||
| } | |||||
| else { | |||||
| node_identifier.type = NodeType::PARAMETERS; | node_identifier.type = NodeType::PARAMETERS; | ||||
| node_identifier.operation_code = OperationCode::PARAMETERS_EVAL; | node_identifier.operation_code = OperationCode::PARAMETERS_EVAL; | ||||
| node_identifier.operation_name = ""; | node_identifier.operation_name = ""; | ||||
| node_identifier.operation_name_tag = -1; | node_identifier.operation_name_tag = -1; | ||||
| } | |||||
| return node_identifier; | return node_identifier; | ||||
| } | } | ||||
| return node_identifier; | return node_identifier; | ||||
| } | } | ||||
| RNANodeQueryIDData *RNANodeQuery::ensure_id_data(const ID *id) | RNANodeQueryIDData *RNANodeQuery::ensure_id_data(const ID *id) | ||||
| { | { | ||||
| RNANodeQueryIDData **id_data_ptr; | RNANodeQueryIDData **id_data_ptr; | ||||
| if (!BLI_ghash_ensure_p( | if (!BLI_ghash_ensure_p( | ||||
| id_data_map_, const_cast<ID *>(id), reinterpret_cast<void ***>(&id_data_ptr))) { | id_data_map_, const_cast<ID *>(id), reinterpret_cast<void ***>(&id_data_ptr))) { | ||||
| *id_data_ptr = OBJECT_GUARDED_NEW(RNANodeQueryIDData, id); | *id_data_ptr = OBJECT_GUARDED_NEW(RNANodeQueryIDData, id); | ||||
| } | } | ||||
| return *id_data_ptr; | return *id_data_ptr; | ||||
| } | } | ||||
| } // namespace DEG | } // namespace DEG | ||||
Can be DEG_DEBUG_PRINTF, or removed. Shouldn't be bare printf.