diff options
Diffstat (limited to 'doc/python_api/examples/bpy.props.4.py')
-rw-r--r-- | doc/python_api/examples/bpy.props.4.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/python_api/examples/bpy.props.4.py b/doc/python_api/examples/bpy.props.4.py new file mode 100644 index 00000000000..2b44d94f72a --- /dev/null +++ b/doc/python_api/examples/bpy.props.4.py @@ -0,0 +1,21 @@ +""" +Update Example +++++++++++++++ + +It can be useful to perform an action when a property is changed and can be +used to update other properties or synchronize with external data. + +All properties define update functions except for CollectionProperty. +""" + +import bpy + + +def update_func(self, context): + print("my test function", self) + +bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func) + +bpy.context.scene.testprop = 11.0 + +# >>> my test function <bpy_struct, Scene("Scene")> |