Photox
(Tim Gregory)
January 20, 2016, 5:36am
1
In register I have an initialize function, which adds a boolproperty named key.median.
def initialize():
bpy.types.Scene.key_median = BoolProperty(
name="Median Point?",
description="pivot choice",
default=True)
and then it’s added to a panel with
layout.prop(context.scene, "key_median")
I want to attach a listener, or invoke, or execute, or onStateChange() – some way to run code when the checkbox is changed. Where should I look for that?
B.Y.O.B
(Node Preview and LuxCore Addon Developer)
January 20, 2016, 5:56am
2
https://www.blender.org/api/blender_python_api_2_76_2/bpy.props.html?highlight=boolproperty#bpy.props.BoolProperty
Note the update, get and set functions.
def test_update():
print(“updated”)
test = bpy.types.BoolProperty(name=“bla”, update=test_update)
Photox
(Tim Gregory)
January 20, 2016, 8:17am
3
Thanks you that works. In my case, the update method must include context and self as parameters.