Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/builder/deg_builder_rna.cc
| Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | Node *RNANodeQuery::find_node(const PointerRNA *ptr, | ||||
| if (node_identifier.operation_code == OperationCode::OPERATION) { | if (node_identifier.operation_code == OperationCode::OPERATION) { | ||||
| return comp_node; | return comp_node; | ||||
| } | } | ||||
| return comp_node->find_operation(node_identifier.operation_code, | return comp_node->find_operation(node_identifier.operation_code, | ||||
| node_identifier.operation_name, | node_identifier.operation_name, | ||||
| node_identifier.operation_name_tag); | node_identifier.operation_name_tag); | ||||
| } | } | ||||
| bool RNANodeQuery::contains(const char *prop_identifier, const char *rna_path_component) | |||||
| { | |||||
| const char *substr = strstr(prop_identifier, rna_path_component); | |||||
| if (substr == nullptr) { | |||||
| return false; | |||||
| } | |||||
| // If substr != prop_identifier, it means that the substring is found further in prop_identifier, | |||||
| // and that thus index -1 is a valid memory location. | |||||
| const bool start_ok = substr == prop_identifier || substr[-1] == '.'; | |||||
| if (!start_ok) { | |||||
| return false; | |||||
| } | |||||
| const size_t component_len = strlen(rna_path_component); | |||||
| const bool end_ok = ELEM(substr[component_len], '\0', '.', '['); | |||||
| return end_ok; | |||||
| } | |||||
| RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, | RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, | ||||
| const PropertyRNA *prop, | const PropertyRNA *prop, | ||||
| RNAPointerSource source) | RNAPointerSource source) | ||||
| { | { | ||||
| RNANodeIdentifier node_identifier; | RNANodeIdentifier node_identifier; | ||||
| if (ptr->type == nullptr) { | if (ptr->type == nullptr) { | ||||
| return node_identifier; | return node_identifier; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | else if (RNA_struct_is_a(ptr->type, &RNA_Mesh) || RNA_struct_is_a(ptr->type, &RNA_Modifier) || | ||||
| } | } | ||||
| return node_identifier; | return node_identifier; | ||||
| } | } | ||||
| else if (ptr->type == &RNA_Object) { | else if (ptr->type == &RNA_Object) { | ||||
| /* Transforms props? */ | /* Transforms props? */ | ||||
| if (prop != nullptr) { | if (prop != nullptr) { | ||||
| const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop); | const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop); | ||||
| /* TODO(sergey): How to optimize this? */ | /* TODO(sergey): How to optimize this? */ | ||||
| if (strstr(prop_identifier, "location") || strstr(prop_identifier, "rotation") || | if (contains(prop_identifier, "location") || contains(prop_identifier, "matrix_basis") || | ||||
| strstr(prop_identifier, "scale") || strstr(prop_identifier, "matrix_")) { | contains(prop_identifier, "matrix_channel") || | ||||
| contains(prop_identifier, "matrix_inverse") || | |||||
| contains(prop_identifier, "matrix_local") || | |||||
| contains(prop_identifier, "matrix_parent_inverse") || | |||||
| contains(prop_identifier, "matrix_world") || | |||||
| contains(prop_identifier, "rotation_axis_angle") || | |||||
| contains(prop_identifier, "rotation_euler") || | |||||
| contains(prop_identifier, "rotation_mode") || | |||||
| contains(prop_identifier, "rotation_quaternion") || contains(prop_identifier, "scale")) { | |||||
| node_identifier.type = NodeType::TRANSFORM; | node_identifier.type = NodeType::TRANSFORM; | ||||
| return node_identifier; | return node_identifier; | ||||
| } | } | ||||
| else if (strstr(prop_identifier, "data")) { | else if (contains(prop_identifier, "data")) { | ||||
| /* We access object.data, most likely a geometry. | /* We access object.data, most likely a geometry. | ||||
| * Might be a bone tho. */ | * Might be a bone tho. */ | ||||
| node_identifier.type = NodeType::GEOMETRY; | node_identifier.type = NodeType::GEOMETRY; | ||||
| return node_identifier; | return node_identifier; | ||||
| } | } | ||||
| else if (STREQ(prop_identifier, "hide_viewport") || STREQ(prop_identifier, "hide_render")) { | else if (STREQ(prop_identifier, "hide_viewport") || STREQ(prop_identifier, "hide_render")) { | ||||
| node_identifier.type = NodeType::OBJECT_FROM_LAYER; | node_identifier.type = NodeType::OBJECT_FROM_LAYER; | ||||
| return node_identifier; | return node_identifier; | ||||
| ▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines | |||||