0
$\begingroup$

How do I change the name of a custom property that already has been assigned to Armature object?

As an example, I know that I can assign a new property in the selected armature in edit or pose mode by quickly running this operator:

import bpy

bpy.ops.wm.properties_add(data_path="object.data")
# this will create a new custom property with the default name 'prop'

Also, I know that I can change it's type and value by accessing data module and running this:

import bpy
bpy.data.armatures['Armature']['prop'] = 'DEF'
# this will assign a string value 'DEF' to my custom property 'prop'

But I really want to know how do I actually change the name of armatures custom property name from default 'prop' to something else, say like 'layer_1'.

Naturally, when I try running bpy.ops.wm.properties_edit() It won't let me do it, of course as it relies on the window manager. So how do I do it through code most efficiently? How do I change the name of armature's custom property directly?

How do I turn this -> bpy.data.armatures['Armature']['prop'] Into this -> bpy.data.armatures['Armature']['layer_1']

How do I get it and assign a new value to it?

Thank you!

$\endgroup$

1 Answer 1

0
$\begingroup$

The answer turned out to be quite simple. Just don't use operator, assign the custom property with a simple line of code like this:

bpy.data.armatures['Armature']['YourPropertyName'] = "StringPropertyValue"
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .