Commit: f889050aea70c2ff3c36c8c8600dd2b02d5e9f91 Author: Campbell Barton Date: Wed Mar 20 16:41:00 2019 +1100 Branches: master https://developer.blender.org/rBf889050aea70c2ff3c36c8c8600dd2b02d5e9f91
Fix T62757: Mirror operator fails for non-modal execution Unlike most transform operators that use an orientation and values, Mirror uses the constraint axes to define which axes are mirrored. Now constraint axes are shown in this case. Other changes: - Use 'EXEC_DEFAULT' for mirror menu items. - Show mirror on local axis when not in edit-mode since this is useful in object mode too. - Remove mirror vertex groups since this is in the vertex group menu and this menu isn't currently used for general symmetry operators which are currently in other menus. =================================================================== M release/scripts/startup/bl_ui/space_view3d.py M source/blender/editors/transform/transform.c M source/blender/editors/transform/transform_ops.c =================================================================== diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index c38c99676af..3c27cd03e1c 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -511,32 +511,16 @@ class VIEW3D_MT_mirror(Menu): layout.separator() - layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator_context = 'EXEC_REGION_WIN' - props = layout.operator("transform.mirror", text="X Global") - props.constraint_axis = (True, False, False) - props.orient_type = 'GLOBAL' - props = layout.operator("transform.mirror", text="Y Global") - props.constraint_axis = (False, True, False) - props.orient_type = 'GLOBAL' - props = layout.operator("transform.mirror", text="Z Global") - props.constraint_axis = (False, False, True) - props.orient_type = 'GLOBAL' - - if context.edit_object: - layout.separator() + for (space_name, space_id) in (("Global", 'GLOBAL'), ("Local", 'LOCAL')): + for axis_index, axis_name in enumerate("XYZ"): + props = layout.operator("transform.mirror", text=f"{axis_name!s} {space_name!s}") + props.constraint_axis[axis_index] = True + props.orient_type = 'GLOBAL' - props = layout.operator("transform.mirror", text="X Local") - props.constraint_axis = (True, False, False) - props.orient_type = 'LOCAL' - props = layout.operator("transform.mirror", text="Y Local") - props.constraint_axis = (False, True, False) - props.orient_type = 'LOCAL' - props = layout.operator("transform.mirror", text="Z Local") - props.constraint_axis = (False, False, True) - props.orient_type = 'LOCAL' - - layout.operator("object.vertex_group_mirror") + if space_id == 'GLOBAL': + layout.separator() class VIEW3D_MT_snap(Menu): diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index c447d75657b..dd71084c51f 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2633,7 +2633,10 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } /* Constraint init from operator */ - if (t->flag & T_MODAL) { + if ((t->flag & T_MODAL) || + /* For mirror operator the constraint axes are effectively the values. */ + (RNA_struct_find_property(op->ptr, "values") == NULL)) + { if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) { @@ -2644,21 +2647,14 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) { t->con.mode |= CON_APPLY; - /* Only for interactive operation, when redoing, ignore these values since the numbers - * will be constrainted already. */ - if (t->flag & T_MODAL) { - if (constraint_axis[0]) { - t->con.mode |= CON_AXIS0; - } - if (constraint_axis[1]) { - t->con.mode |= CON_AXIS1; - } - if (constraint_axis[2]) { - t->con.mode |= CON_AXIS2; - } + if (constraint_axis[0]) { + t->con.mode |= CON_AXIS0; } - else { - t->con.mode |= CON_AXIS0 | CON_AXIS1 | CON_AXIS2; + if (constraint_axis[1]) { + t->con.mode |= CON_AXIS1; + } + if (constraint_axis[2]) { + t->con.mode |= CON_AXIS2; } setUserConstraint(t, t->orientation.user, t->con.mode, "%s"); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 8886a0d49e5..648e616a27c 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -521,6 +521,15 @@ static bool transform_poll_property(const bContext *UNUSED(C), wmOperator *op, c PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "orient_type"); if (prop_con != NULL && (prop_con != prop)) { if (STRPREFIX(prop_id, "constraint")) { + + /* Special case: show constraint axis if we don't have values, + * needed for mirror operator. */ + if (STREQ(prop_id, "constraint_axis") && + (RNA_struct_find_property(op->ptr, "value") == NULL)) + { + return true; + } + return false; } } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs