# Correct syntax for “mirror” pie operator in UV Editor as one operator

What is the correct way to in the UV editor perform an X or Y mirror as one command for a pie operator?

pie.operator("transform.mirror()", text="Mirror").constraint_axis='True, False, False'


Based on what I saw in the console:

bpy.ops.transform.mirror(constraint_axis=(True, False, False), constraint_orientation='GLOBAL', proportional='DISABLED', proportional_edit_falloff='SPHERE', proportional_size=0.0323492)


I struggle to understand the logic because I was able to successfully do this with a different snapping command

bpy.ops.uv.snap_cursor(target='SELECTED')


has to be written as

pie.operator("uv.snap_cursor", text="Snap Cursor to Selected").target='SELECTED'


Alternatively I could just define an operator and call the name via a pie button but I feel this makes the script longer than needed

• lose the parentheses and add ones at the end pie.operator("transform.mirror", text="Mirror").constraint_axis=(True, False, False) – Chebhou Jan 18 '16 at 0:30
• Actually I tried this. What happens is that you start the mirror command and have to press x or y for the direction. the constraint definition will be ignored. – Claas Kuhnen Jan 18 '16 at 0:50
• try clicking the leftMouse without specifying the axis and read the executed command in blender you'll see it is not ignored – Chebhou Jan 18 '16 at 0:54
• My eyes fool me. True without the constraint it goes into asking you. With the data it executes what you define and still enables you to overwrite it via X or Y or press LMB. – Claas Kuhnen Jan 18 '16 at 0:59

The description of the operator can be found here.

bpy.types.UILayout.operator returns an bpy.types.OperatorProperties object.

So if you need to assign multiple presets, assign it to a local variable first

op_props = pie.operator("transform.mirror", text="Mirror")
op_props.constraint_axis = True, False, True
#...


When the operator's invoke method is called the operator may use user input to set its properties or run modal, before finally running its execute method.

To skip the invocation you might try:

#...
pie.operator_context = "EXEC_DEFAULT"
pie.operator("transform.mirror").constraint_axis = True, False, True

pie.operator_context = "INVOKE_DEFAULT"
#...


See UILayout.operator_context for the available options