I have a string property, when it is updated it runs a function which runs an operator, the operator clears the string at the end to reset it. This makes the function (string_update) loop to infinite recursion. As I understand, order of events should be:
update string
run function once
run operator
finish
What am I missing?
import bpy
def string_update(self, context):
bpy.ops.test.test()
print("Ran")
return None
class test_vars(bpy.types.PropertyGroup):
test_update_string = bpy.props.StringProperty(
name = "",
default = "",
update = string_update
)
class Test_Op(bpy.types.Operator):
""""""
bl_idname = "test.test"
bl_label = "test"
def execute(self, context):
bpy.context.scene.test_vars.test_update_string = ""
return {'FINISHED'}
def register():
bpy.utils.register_module(__name__)
bpy.types.Scene.test_vars = bpy.props.PointerProperty(type = test_vars)
def unregister():
bpy.utils.unregister_module(__name__)
bpy.utils.unregister_class(test_vars)
del bpy.types.Scene.test_vars