Rigify - saving pbone custom properties to metarig #104695
@ -427,7 +427,7 @@ def write_metarig(obj: ArmatureObject, layers=False, func_name="create",
|
||||
props_data = pbone.id_properties_ui(custom_property).as_dict()
|
||||
code.append(f" rna_idprop_ui_create(")
|
||||
code.append(f" pbone, ")
|
||||
code.append(f" '{custom_property}', ")
|
||||
code.append(f" {custom_property!r}, ")
|
||||
code.append(f" default={props_data['default']}, ")
|
||||
|
||||
if 'min' in props_data:
|
||||
code.append(f" min={props_data['min']}, ")
|
||||
@ -438,7 +438,7 @@ def write_metarig(obj: ArmatureObject, layers=False, func_name="create",
|
||||
if 'soft_max' in props_data:
|
||||
code.append(f" soft_max={props_data['soft_max']}, ")
|
||||
if 'description' in props_data:
|
||||
code.append(f" description='{props_data['description']}'")
|
||||
code.append(f" description={props_data['description']!r}")
|
||||
Alexander Gavrilov
commented
Rather than doing Rather than doing `'{foo}'`, use `{repr(foo)}`. Manual quoting could be barely tolerated for property names, but for the description it is simply unacceptable.
Andrej
commented
that's really neat thing about that's really neat thing about `repr`, didn't know it can be used that way!
resolved in e2b63e1a4b07ffa8ca59eef5b4b2be17189f49ff
|
||||
code.append(f" )")
|
||||
if 'precision' in props_data:
|
||||
code.append(f" pbone.id_properties_ui('{custom_property}').update(precision={props_data['precision']})")
|
||||
|
Loading…
Reference in New Issue
Block a user
What if the default isn't equal to the current value? This code doesn't preserve the value anywhere.
resolved in
3677cc4549
I'd quote default with repr too. Also, get rid of trailing spaces.
resolved in
076763507e