Skip to main content
2 of 2
added 30 characters in body
batFINGER
  • 85.2k
  • 10
  • 114
  • 244

How to edit a custom property in a python script?

I am creating a custom property on an Empty in a script, and then editing the property's data such as the name, limits, and Tooltip description. I am using the commands echo'ed from the info panel when I perform these operations in the Blender UI. While the object is selected and active I get these commands...

bpy.ops.wm.properties_add(data_path="object")
bpy.ops.wm.properties_edit(data_path="object", property="Scale", value="1.0", default="1.0", min=0, max=10, use_soft_limits=False, is_overridable_library=False, soft_min=0, soft_max=10, description="")

When using these commands in the script or Python console, the first "add" command succeeds, but the edit command fails. I get this error message...

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/private/var/folders/z4/pm8ygsf16f1_kw3dsfpttthm0000gn/T/AppTranslocation/66464DE9-7039-455C-8E08-0581D47CFD84/d/Blender.app/Contents/Resources/2.80/scripts/modules/bpy/ops.py", line 201, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Direct execution not supported

Is it possible to edit a custom property from a script, and what is the proper command, please. Thanks.

zippy
  • 167
  • 2
  • 8