diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-08-22 15:40:10 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-08-22 15:46:37 +0300 |
commit | 8f578150eaf494a03bed7389046e44f2bdf7d748 (patch) | |
tree | 5370042609d04907eff0a154e8a4b6ae858af182 /source/blender/editors/interface/interface_ops.c | |
parent | 443586f34d3a0730c67b5d8787e519bec2af3656 (diff) |
Fix T68971: Copy As New Driver from Material node creates a bad reference.
NodeTree structures of materials and some other data blocks are
effectively node group data block objects that are contained inside
the parent block. Thus, direct references to them are only valid
while blender is running, and are lost on save.
Fix Copy As New Driver to create a reference that goes through
the owner data block, by adding a new runtime field to bNodeTree.
Diffstat (limited to 'source/blender/editors/interface/interface_ops.c')
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index c7ce66cfcf6..f8df8966297 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -195,11 +195,11 @@ static int copy_as_driver_button_exec(bContext *C, wmOperator *UNUSED(op)) UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop) { - int dim = RNA_property_array_dimension(&ptr, prop, NULL); - char *path = RNA_path_from_ID_to_property_index(&ptr, prop, dim, index); + ID *id; + char *path; - if (path) { - ANIM_copy_as_driver(ptr.id.data, path, RNA_property_identifier(prop)); + if (ANIM_get_target_ID_and_path_to_property(&ptr, prop, index, &id, &path)) { + ANIM_copy_as_driver(id, path, RNA_property_identifier(prop)); MEM_freeN(path); return OPERATOR_FINISHED; } |