bpy.props.4.py 496 B

1234567891011121314151617181920212223
  1. """
  2. Update Example
  3. ++++++++++++++
  4. It can be useful to perform an action when a property is changed and can be
  5. used to update other properties or synchronize with external data.
  6. All properties define update functions except for CollectionProperty.
  7. """
  8. import bpy
  9. def update_func(self, context):
  10. print("my test function", self)
  11. bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func)
  12. bpy.context.scene.testprop = 11.0
  13. # >>> my test function <bpy_struct, Scene("Scene")>