1
$\begingroup$

I have created a UI Panel with some properties of type IntProperty().

bpy.types.Scene.myint = bpy.props.IntProperty(name="My Int Prop", default=9)

How can I reset this value to default value '9' on each run script. So, when I change this value in UI Panel to some other value (let's say 10, for example). It remains a changed value (i.e. 10), if I re run the script.

$\endgroup$
2
$\begingroup$

To return a property to its default value, use property_unset(propname)

Python console code

>>> bpy.types.Scene.x = bpy.props.IntProperty(default=3)
>>> C.scene.x
3

>>> C.scene.x = 4
>>> C.scene.x
4

>>> C.scene.property_unset(
property_unset(property)
.. method:: property_unset(property)
Unset a property, will use default value afterward.
>>> C.scene.property_unset("x")
>>> C.scene.x
3
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.