Page MenuHome

DataTransfer modifier: Impossible to set multiple transfer modes by script (if they're on different properties)
Closed, ResolvedPublic


System Information
Ubuntu 15.04 / Nvidia GTX970 (irrelevant)

Blender Version
Broken: 2.76 e9b9b88
Worked: (Unknown - probably a long standing issue)

Short description of error

In the interface the DataTransfer modifier lets the user select multiple transfer options by shift-clicking,
it appears the way this was implemented prevents setting multiple transfer options by script if they're on different properties.

vvvvvv Easiest way to understand the problem is to read and run the script below vvvvvv

(A longer description and the prior effort to resolve this can be found in this Blender SE post (which lead to no solution and one recommendation to report this as a bug)

Exact steps for others to reproduce the error

In the default scene (with the cube still there) read and then run this script, observe what it prints:

import bpy

# Get the default cube, make it active, add DataTransfer modifier
cube =["Cube"] = cube

# Enable transfer of sharp edges and UV seams on the modifier
cube.modifiers["DataTransfer"].data_types_edges = {'SHARP_EDGE', 'SEAM'}

print(cube.modifiers["DataTransfer"].data_types_edges) # returns {'SHARP_EDGE', 'SEAM'}

# Additionally enable transfer of UV coordinates on the modifier
cube.modifiers["DataTransfer"].data_types_loops_uv = {'UV'}

print(cube.modifiers["DataTransfer"].data_types_edges) # returns an empty set() now (!)
print(cube.modifiers["DataTransfer"].data_types_loops_uv) # returns {'UV'}

Event Timeline

Simon Repp (simonrepp) raised the priority of this task from to Needs Triage by Developer.
Simon Repp (simonrepp) updated the task description. (Show Details)
Simon Repp (simonrepp) set Type to Bug.
Bastien Montagne (mont29) lowered the priority of this task from Needs Triage by Developer to Confirmed, Medium.Oct 18 2015, 11:45 AM

Yeah… The problem here is that, for UI reasons, we are creating several 'virtual' RNA properties out of a single real DNA var (data_types). Now, UI code (toggle buttons) is smart enough to only affect the bit matching the affected button, without changing the remaining part of the value (the other enum flags). Python/RNA direct setters always overwrite the whole 32bits, though.

@Campbell Barton (campbellbarton) need your advice here. We could be smart and ensure we only ever overwrite the bits actually 'used' by a given RNA enum, and not all 32 ones. Or we can take the easy road and simply add a 'all data types' RNA property here for scripts?

OK, have fix for this (we'll get rid of those stupid data_types_loops_uv, data_types_loops_vcol & co, those were added only for UI purpose.

Spent most of today on it, our UI 'align' computing code is actually broken currently for complex mixing of vertical and horizontal layouts (especially in column-major case), and we need such layout here… Hope to have working fix in coming days.

Hey Bastien - so quick, thank you so much for the effort!
All these different properties were quite a hassle to work with anyway, so them going away is a good prospect in two senses even :)