copying armature and mesh with shapekey drivers (to bone) doesn't change driver variables #46386

Closed
opened 2015-10-05 20:30:17 +02:00 by bassam kurdali · 14 comments
Member

System Information
GNU/Linux (Fedora 23) Intel and Nvidia GFX/ Intel CPU

Blender Version
Broken: Current Git
Worked: Probably never

Short description of error
If I have a simple rig - a mesh and armature - where the armature is driving mesh shapekeys, and I copy both, I'd expect the copy to be self-contained - i.e.the drivers on the copied mesh should reference the copied armature, instead, they remain tied to the original. I use python loops to fix this, but it would be painful otherwise

Exact steps for others to reproduce the error
First download the attached .blend.copy_driver.blend - it's very simple, only two objects, no python needed.
1- Open the file
2- Observe that Suzanne has a single shapekey with a driver based on Bone X-location - you could ctrl-tab the rig into pose mode and move the bone on the X axis if you want to see the effect
3- select both suzanne and armature (make sure it is in object mode) and shift D
4- now Suzanne.001 also has drivers! unfortunately they refer to Armature, not Armature.001

NOTE: If I didn't copy the armature I would fully expect and want the behavior above - but it's fair to say when copying a rig, the vast majority of times, we would want the drivers to 'remap' and the new rig to be self-contained.

Cheers,
Bassam

**System Information** GNU/Linux (Fedora 23) Intel and Nvidia GFX/ Intel CPU **Blender Version** Broken: Current Git Worked: Probably never **Short description of error** If I have a simple rig - a mesh and armature - where the armature is driving mesh shapekeys, and I copy both, I'd expect the copy to be self-contained - i.e.the drivers on the copied mesh should reference the copied armature, instead, they remain tied to the original. I use python loops to fix this, but it would be painful otherwise **Exact steps for others to reproduce the error** First download the attached .blend.[copy_driver.blend](https://archive.blender.org/developer/F242440/copy_driver.blend) - it's very simple, only two objects, no python needed. 1- Open the file 2- Observe that Suzanne has a single shapekey with a driver based on Bone X-location - you could ctrl-tab the rig into pose mode and move the bone on the X axis if you want to see the effect 3- select both suzanne and armature (make sure it is in object mode) and shift D 4- now Suzanne.001 also has drivers! unfortunately they refer to Armature, not Armature.001 NOTE: If I didn't copy the armature I would fully expect and want the behavior above - but it's fair to say when copying a rig, the vast majority of times, we would want the drivers to 'remap' and the new rig to be self-contained. Cheers, Bassam
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Joshua Leung was assigned by bassam kurdali 2015-10-05 20:30:17 +02:00
Author
Member

Added subscriber: @BassamKurdali

Added subscriber: @BassamKurdali
Member

Added subscriber: @LukasTonne

Added subscriber: @LukasTonne
Member

Problem here is the limited support for ID remapping on duplication. This is not an inherent part of copying some data, but rather an additional "service" of the operator to make life easier for artists. None of the remapping works automatic, it has to be done explicitly. This feature is currently limited to the Object datablock itself and does not include any attached data, like the Mesh or its associated Key (shapekey) datablock.

Here is where the Object data is remapped:
https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/object/object_add.c$2193

Note that none of the code inside this function deals with Mesh or Key data. I'm not sure if this is possible to support in a meaningful way (where to draw the line? it has to take into account all the potential data dependencies ... arguably shapekeys are important enough to make an exception perhaps).

For a slightly simpler example code-wise: try making a driver for the "auto smooth" property on the mesh. This is not part of the shapekey but just of the Mesh datablock, but has the same problem: references here don't get remapped on duplication.

Problem here is the limited support for ID remapping on duplication. This is not an inherent part of copying some data, but rather an additional "service" of the operator to make life easier for artists. None of the remapping works automatic, it has to be done explicitly. This feature is currently limited to the `Object` datablock itself and does not include any attached data, like the `Mesh` or its associated `Key` (shapekey) datablock. Here is where the `Object` data is remapped: https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/object/object_add.c$2193 Note that none of the code inside this function deals with `Mesh` or `Key` data. I'm not sure if this is possible to support in a meaningful way (where to draw the line? it has to take into account all the potential data dependencies ... arguably shapekeys are important enough to make an exception perhaps). For a slightly simpler example code-wise: try making a driver for the "auto smooth" property on the mesh. This is not part of the shapekey but just of the `Mesh` datablock, but has the same problem: references here don't get remapped on duplication.
Author
Member

I have an addon that works around this problem; perhaps I should polish up and submit to blender's addons? currently it has the following issues:

1- only works if the objects are in a group
2- has a very specific naming convention (adds _nn) to group name and object names
3- might fail on corner cases

I seem to remember from a chat on irc with joshua that this kind of stuff should 'just work' from a user perspective - but perhaps he was alluding only to object level stuff.

duplicate_group.py

I have an addon that works around this problem; perhaps I should polish up and submit to blender's addons? currently it has the following issues: 1- only works if the objects are in a group 2- has a very specific naming convention (adds _nn) to group name and object names 3- might fail on corner cases I seem to remember from a chat on irc with joshua that this kind of stuff should 'just work' from a user perspective - but perhaps he was alluding only to object level stuff. [duplicate_group.py](https://archive.blender.org/developer/F242854/duplicate_group.py)

Added subscriber: @koilz

Added subscriber: @koilz

There was an addon written a while back to solve this kinda problem.
http://blenderartists.org/forum/showthread.php?356354-Addon-replace-driver-targets

Its not as automated, but maybe its useful.
It works by replacing the objects the driver targets use.

There was an addon written a while back to solve this kinda problem. http://blenderartists.org/forum/showthread.php?356354-Addon-replace-driver-targets Its not as automated, but maybe its useful. It works by replacing the objects the driver targets use.
Author
Member

That's a good idea (I usually have been dropping in console and looping over my object's drivers, replacing the ids)
A smart copy addon might also be nice, however the worry is people will encounter the problem but not understand why it's happening... better than nothing tho.

That's a good idea (I usually have been dropping in console and looping over my object's drivers, replacing the ids) A smart copy addon might also be nice, however the worry is people will encounter the problem but not understand why it's happening... better than nothing tho.

Added subscriber: @AnnaCelarek

Added subscriber: @AnnaCelarek

Added subscribers: @JoshuaLeung, @ideasman42

Added subscribers: @JoshuaLeung, @ideasman42
Joshua Leung was unassigned by Campbell Barton 2015-10-08 10:49:46 +02:00
Campbell Barton self-assigned this 2015-10-08 10:49:46 +02:00

Will commit fix shortly

Will commit fix shortly

This issue was referenced by 97b6948181

This issue was referenced by 97b6948181df4ee97296ec45aebc75f31b7c790a

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author
Member

Thanks!!!!!

Thanks!!!!!
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#46386
No description provided.