Passing an argument to an operator

That would be ideal, if I can figure that bit out! But yeah, user-facing stuff comes next- I want to make the current stuff work first! :stuck_out_tongue_winking_eye:

Iā€™ve got the dynamic classes working, from there I can decide which route I want to go down.

DYNAMIC_CLASSES = []


def create_dynamic_classes():
    """Create classes from the colour enum"""
    for colour in Colours:
        idname = f"sequencer.set_text_colour_{colour.name.lower()}"
        label = f"Set Text Colour ({colour.name.title()})"

        operator_class = type(f"SetTextColour{colour.name.title()}",
                              (SetTextColour, ),
                              {"bl_idname": idname,
                               "bl_label": label,
                               "_colour": colour.value},
                              )

        DYNAMIC_CLASSES.append(operator_class)

lol yup! A single operator which reads a keystroke and sets the [colour/position/size/duration] feels neater, but I could just as easily create however many operators/classes dynamically, register them and let the user set hotkeys in Blender preferences like any other built-in operatorā€¦

1 Like