-
Notifications
You must be signed in to change notification settings - Fork 5
Modular UI: driver namespaces and custom types #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: rigify_0.6_beta
Are you sure you want to change the base?
Modular UI: driver namespaces and custom types #9
Conversation
About the bpy.types thing, I'm not sure how prudent adding that is, given that 2.8 actually removed non-UI non-builtin stuff from there: https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Addons#Access_.28bpy.types.29 |
I saw that, but I thought it only applied to new types, and not properties, e.g. I figured I'd wait for more add-ons to be updated to see how it's done, but I'd be glad to know if you have the answer. |
9e500a0
to
7704280
Compare
Is that for properties? It's not obvious from the code what it's for - it's just "%s". |
Yes, for properties. My script looks like this: I don't really know how to make this more concise and readable, since properties can be registered in many # ui_register_props contains ('Type.name', 'TypeProperty()') tuples, e.g.:
# [('Object.my_prop', 'bpy.props.IntProperty()')]
ui_register_props = [] |
Yes, I think renaming would probably make the intended purpose clearer. With the original naming I thought you were adding your classes there for some reason. Out of curiosity, what kind of driver functions are you adding? |
The cutout rigs are flat, all bones are on the same plane in rest mode. In order to Z sort them, I use a driver on each DEF bone's location, which depends on the Rig as well as individual bones, and a specified offset for those components. There is also a way to flip the whole character by rotating it 180° in the vertical axis, but then the Z sorting has to be inverted, so it's one of the function's arguments. def z_index(member_index, flip, bone_index, extra_offset=0.0):
"""This bone changes sides when the rig is flipped (eg. limbs)"""
if flip:
return member_index * MEMBER_OFFSET - bone_index * BONE_OFFSET - extra_offset * MEMBER_OFFSET
else:
return member_index * MEMBER_OFFSET + bone_index * BONE_OFFSET + extra_offset * MEMBER_OFFSET |
7704280
to
17ab5ab
Compare
17ab5ab
to
279fa39
Compare
Btw, in 2.8 simple expressions in drivers are evaluated without Python, so expression drivers aren't nearly as slow. What do you think about my utilities in #11? |
Oh yes, I saw the simple expressions. Great job on that! About #11, this structure is much easier to understand and more logical, including your point about drivers: I can't think of a situation where it would make sense not to create them at the same time as the constraints. But then again I don't know the rigs' code inside and out. |
In order for my cutout rigs to work, I need to add functions to the driver namespace, as well as register custom Blender types.
This PR enables both these possibilities. It doesn't change anything for the current rigs.
I don't know if it's too specific...
This PR is based on and includes #8.