[Feature Request] Add QOL Script for renaming Outfit Custom Properties #116

Closed
opened 2023-08-29 15:37:27 +02:00 by ThaliaSolari · 4 comments
ThaliaSolari commented 2023-08-29 15:37:27 +02:00 (Migrated from gitlab.com)

Properties for use with the outfit selector require an underscore before their name in order to properly set the values when an outfit is chosen. If an outfit needs to set the values of many properties (One of my characters requires 23 props set per outfit), that's a lot of manual renaming.

My current solution:

import bpy

bones = bpy.context.selected_pose_bones

if bones:
    for b in bones:
        for custom_prop in list(b.keys()):
            if not "rigify_parameters" in custom_prop:
                if not "rigify_type" in custom_prop:
                    old_prop = b[custom_prop]
                    b["_" + custom_prop] = old_prop
                    b.id_properties_ui("_" + custom_prop).update_from(b.id_properties_ui(custom_prop))
                    del b[custom_prop]
            

I think this would be of benefit to others as well. One click, all the props are properly renamed.

Now I think in reality, this probably indicates more of a problem with Blender itself, it should have a "Custom Property" option in the batch renaming operator, as well as several other types of data. But this is a suitable work around for the time being I think. Maybe not the best way of handling it, idk I'm not that knowledgeable about python and stuff.

There might be a proper way to detect whether or not a property is API Defined, as those props will never need to be renamed. Idk if I've ever seen anything other than rigify_parameters or rigify_type there though. It'll also throw errors with python props, but those can be deleted before running the script.

Properties for use with the outfit selector require an underscore before their name in order to properly set the values when an outfit is chosen. If an outfit needs to set the values of many properties (One of my characters requires 23 props set per outfit), that's a lot of manual renaming. My current solution: ``` import bpy bones = bpy.context.selected_pose_bones if bones: for b in bones: for custom_prop in list(b.keys()): if not "rigify_parameters" in custom_prop: if not "rigify_type" in custom_prop: old_prop = b[custom_prop] b["_" + custom_prop] = old_prop b.id_properties_ui("_" + custom_prop).update_from(b.id_properties_ui(custom_prop)) del b[custom_prop] ``` I think this would be of benefit to others as well. One click, all the props are properly renamed. Now I think in reality, this probably indicates more of a problem with Blender itself, it should have a "Custom Property" option in the batch renaming operator, as well as several other types of data. But this is a suitable work around for the time being I think. Maybe not the best way of handling it, idk I'm not that knowledgeable about python and stuff. There might be a proper way to detect whether or not a property is API Defined, as those props will never need to be renamed. Idk if I've ever seen anything other than rigify_parameters or rigify_type there though. It'll also throw errors with python props, but those can be deleted before running the script.
ThaliaSolari commented 2023-08-29 15:39:54 +02:00 (Migrated from gitlab.com)

changed the description

changed the description
ThaliaSolari commented 2023-08-29 22:20:42 +02:00 (Migrated from gitlab.com)

mentioned in issue #115

mentioned in issue #115
Demeter Dzadik added the
feature
label 2024-05-24 17:45:10 +02:00

I would like to tackle this one day as part of a bigger redesign to make the outfit system more usable instead of sort of duct-taped together with users having to understand arcane naming conventions and python syntaxes (for prop_hierarchy). One day!

(This would essentially mean adding an arbitrary UI editor to CloudRig, even though such things are full-blown add-ons all by themselves. But hey, I love reinventing wheels!)

I would like to tackle this one day as part of a bigger redesign to make the outfit system more usable instead of sort of duct-taped together with users having to understand arcane naming conventions and python syntaxes (for prop_hierarchy). One day! (This would essentially mean adding an arbitrary UI editor to CloudRig, even though such things are full-blown add-ons all by themselves. But hey, I love reinventing wheels!)

It turns out that "one day" meant immediately. The new Rig UI building system is in place, and has already been through a ton of testing and iteration thanks to your live and continuous feedback over Discord. I think we did an epic job. I will write documentation for it soon. Thanks again.

It turns out that "one day" meant immediately. The new Rig UI building system is in place, and has already been through a ton of testing and iteration thanks to your live and continuous feedback over Discord. I think we did an epic job. I will write documentation for it soon. Thanks again.
Sign in to join this conversation.
No description provided.