diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-05-04 20:12:19 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-05-05 10:44:41 +0300 |
commit | 1c58604070682a1fe01d6fd49820c1578f18580a (patch) | |
tree | e262df004c9a4102e960f9e7a5e2a5ca608044a4 /source/blender/depsgraph/intern/builder/deg_builder_rna.cc | |
parent | 47df163b6cd9074d1e41e268911cbab943fb6a80 (diff) |
Depsgraph: fix Bone property drivers stored in Object animdata.
This can easily happen if adding drivers through Python via
pose.bones[...].bone.driver_add(), e.g. in Rigify code: the
bone field doesn't change id_data, so the driver is associated
with the object ID.
To handle this it's necessary to skip from Object to data in
RNA_Bone-specific code both for generic RNA and in the custom
code for drivers. The latter also had to be changed to use the
proper parsed RNA pointer instead of string matching on paths.
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_rna.cc')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_rna.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc index 1238cdc70c6..ea5f86a31a8 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc @@ -211,6 +211,12 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, * bone components, instead of using this generic code. */ node_identifier.type = NodeType::PARAMETERS; node_identifier.operation_code = OperationCode::ARMATURE_EVAL; + /* If trying to look up via an Object, e.g. due to lookup via + * obj.pose.bones[].bone in a driver attached to the Object, + * redirect to its data. */ + if (GS(node_identifier.id->name) == ID_OB) { + node_identifier.id = (ID *)((Object *)node_identifier.id)->data; + } return node_identifier; } else if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) { |