Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-06-20 06:54:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-06-20 06:54:56 +0400
commit97a85fe1000b727e0b6c04e0978e22d986125358 (patch)
treee09320f79b3e54e369437bd58884dc48d000256b /doc
parent6d7e3509a9feb6d7259ad395d46ca20fa0b5234e (diff)
- add example for python rna property update
- edit the copyright for blender specific cmake find modules
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/examples/bpy.props.4.py20
1 files changed, 20 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..d44f8947cb4
--- /dev/null
+++ b/doc/python_api/examples/bpy.props.4.py
@@ -0,0 +1,20 @@
+"""
+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")>