Register an Operator#
Examples#
Basic Operator function-like#
from ..addon_utils import Register, Property
@Register.OPS.GENERIC
class TestOperator:
def action(self, context):
print(f"{context.active_object.name}: Hello, I'm the active object! :-)")
Operator with properties that invokes as a pop-up#
from ..addon_utils import Register, Property
@Register.OPS.INVOKE_PROPS
class TestOperatorInvokeProps:
test_filepath: Property.FILEPATH()
test_color: Property.COLOR_RGB(default=(1, 0, 1))
test_bool: Property.BOOL()
def action(self, context):
print("Hello!", self.test_filepath, self.test_color, self.test_bool)