Skip to main content
added 76 characters in body
Source Link
batFINGER
  • 85.2k
  • 10
  • 114
  • 244

Use a property switch

Declare a boolean property with an update method.

def toggle_op(self, context):
    if self.toggle:
        bpy.ops.foo.bar()  # start the operator

bpy.types.Scene.toggle = BoolProperty(update=toggle_op)

In your modal

if not scene.toggle:
    return {'CANCELLED'} # or self.cancel(context) to do some clean up

Related example for 2.7x

https://blender.stackexchange.com/questions/69578/link-selection-between-vse-strip-and-object/69599?r=SearchResults&s=6|4.8939#69599

Use a property switch

Declare a boolean property with an update method.

def toggle_op(self, context):
    if self.toggle:
        bpy.ops.foo.bar()  # start the operator

bpy.types.Scene.toggle = BoolProperty(update=toggle_op)

In your modal

if not scene.toggle:
    return {'CANCELLED'} # or self.cancel(context) to do some clean up

Use a property switch

Declare a boolean property with an update method.

def toggle_op(self, context):
    if self.toggle:
        bpy.ops.foo.bar()  # start the operator

bpy.types.Scene.toggle = BoolProperty(update=toggle_op)

In your modal

if not scene.toggle:
    return {'CANCELLED'} # or self.cancel(context) to do some clean up

Related example for 2.7x

https://blender.stackexchange.com/questions/69578/link-selection-between-vse-strip-and-object/69599?r=SearchResults&s=6|4.8939#69599

Source Link
batFINGER
  • 85.2k
  • 10
  • 114
  • 244

Use a property switch

Declare a boolean property with an update method.

def toggle_op(self, context):
    if self.toggle:
        bpy.ops.foo.bar()  # start the operator

bpy.types.Scene.toggle = BoolProperty(update=toggle_op)

In your modal

if not scene.toggle:
    return {'CANCELLED'} # or self.cancel(context) to do some clean up