Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform.c
| Show First 20 Lines • Show All 932 Lines • ▼ Show 20 Lines | else if (!edit_2d) { | ||||
| if (cmode == axis) { | if (cmode == axis) { | ||||
| if (t->con.orientation != V3D_MANIP_GLOBAL) { | if (t->con.orientation != V3D_MANIP_GLOBAL) { | ||||
| stopConstraint(t); | stopConstraint(t); | ||||
| } | } | ||||
| else { | else { | ||||
| short orientation = (t->current_orientation != V3D_MANIP_GLOBAL ? | short orientation = (t->current_orientation != V3D_MANIP_GLOBAL ? | ||||
| t->current_orientation : V3D_MANIP_LOCAL); | t->current_orientation : V3D_MANIP_LOCAL); | ||||
| if (!(t->modifiers & MOD_CONSTRAINT_PLANE)) | if (!(t->modifiers & MOD_CONSTRAINT_PLANE)) | ||||
| if (!(orientation == V3D_MANIP_MULTI_TRANSF)) | |||||
| setUserConstraint(t, orientation, constraint_axis, msg2); | setUserConstraint(t, orientation, constraint_axis, msg2); | ||||
| else if (t->modifiers & MOD_CONSTRAINT_PLANE) | else { | ||||
| switch (t->mode) | |||||
| { | |||||
| case 1: | |||||
| setUserConstraintCustom(t, t->current_translation, constraint_axis, t->trans_spacemtx, msg2); | |||||
| break; | |||||
| case 2: | |||||
| setUserConstraintCustom(t, t->current_rotation, constraint_axis, t->rots_spacemtx, msg2); | |||||
| break; | |||||
| case 3: | |||||
| setUserConstraintCustom(t, t->current_scale, constraint_axis, t->scale_spacemtx, msg2); | |||||
| break; | |||||
| } | |||||
| } | |||||
| else if (t->modifiers & MOD_CONSTRAINT_PLANE) { | |||||
smellslikedonkey: Indentation messed up? | |||||
| if (!(orientation == V3D_MANIP_MULTI_TRANSF)) | |||||
| setUserConstraint(t, orientation, constraint_plane, msg3); | setUserConstraint(t, orientation, constraint_plane, msg3); | ||||
| else { | |||||
| switch (t->mode) | |||||
| { | |||||
| case 1: | |||||
| setUserConstraintCustom(t, t->current_translation, constraint_axis, t->trans_spacemtx, msg3); | |||||
| break; | |||||
| case 2: | |||||
| setUserConstraintCustom(t, t->current_rotation, constraint_axis, t->rots_spacemtx, msg3); | |||||
| break; | |||||
| case 3: | |||||
| setUserConstraintCustom(t, t->current_scale, constraint_axis, t->scale_spacemtx, msg3); | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
Done Inline ActionsI'd add some {} in here to make it more obvious which "if" the "elses" belong to smellslikedonkey: I'd add some {} in here to make it more obvious which "if" the "elses" belong to | |||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| if (!(t->modifiers & MOD_CONSTRAINT_PLANE)) | if (!(t->modifiers & MOD_CONSTRAINT_PLANE)) | ||||
| setUserConstraint(t, V3D_MANIP_GLOBAL, constraint_axis, msg2); | setUserConstraint(t, V3D_MANIP_GLOBAL, constraint_axis, msg2); | ||||
| else if (t->modifiers & MOD_CONSTRAINT_PLANE) | else if (t->modifiers & MOD_CONSTRAINT_PLANE) | ||||
| setUserConstraint(t, V3D_MANIP_GLOBAL, constraint_plane, msg3); | setUserConstraint(t, V3D_MANIP_GLOBAL, constraint_plane, msg3); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | switch (event->val) { | ||||
| } | } | ||||
| break; | break; | ||||
| case TFM_MODAL_PLANE_X: | case TFM_MODAL_PLANE_X: | ||||
| if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { | if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { | ||||
| if (cmode == 'X') { | if (cmode == 'X') { | ||||
| stopConstraint(t); | stopConstraint(t); | ||||
| } | } | ||||
| else { | else { | ||||
| if (!(t->current_orientation == V3D_MANIP_MULTI_TRANSF)) | |||||
| setUserConstraint(t, t->current_orientation, (CON_AXIS1 | CON_AXIS2), IFACE_("locking %s X")); | setUserConstraint(t, t->current_orientation, (CON_AXIS1 | CON_AXIS2), IFACE_("locking %s X")); | ||||
| else { | |||||
| setUserConstraint(t, t->current_translation, (CON_AXIS1 | CON_AXIS2), IFACE_("locking %s X")); | |||||
| setUserConstraint(t, t->current_rotation, (CON_AXIS1 | CON_AXIS2), IFACE_("locking %s X")); | |||||
| setUserConstraint(t, t->current_scale, (CON_AXIS1 | CON_AXIS2), IFACE_("locking %s X")); | |||||
| } | |||||
| } | } | ||||
| t->redraw |= TREDRAW_HARD; | t->redraw |= TREDRAW_HARD; | ||||
| handled = true; | handled = true; | ||||
| } | } | ||||
| break; | break; | ||||
| case TFM_MODAL_PLANE_Y: | case TFM_MODAL_PLANE_Y: | ||||
| if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { | if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { | ||||
| if (cmode == 'Y') { | if (cmode == 'Y') { | ||||
| stopConstraint(t); | stopConstraint(t); | ||||
| } | } | ||||
| else { | else { | ||||
| if (!(t->current_orientation == V3D_MANIP_MULTI_TRANSF)) | |||||
| setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS2), IFACE_("locking %s Y")); | setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS2), IFACE_("locking %s Y")); | ||||
| else { | |||||
| setUserConstraint(t, t->current_translation, (CON_AXIS0 | CON_AXIS2), IFACE_("locking %s Y")); | |||||
| setUserConstraint(t, t->current_rotation, (CON_AXIS0 | CON_AXIS2), IFACE_("locking %s Y")); | |||||
| setUserConstraint(t, t->current_scale, (CON_AXIS0 | CON_AXIS2), IFACE_("locking %s Y")); | |||||
| } | |||||
| } | } | ||||
| t->redraw |= TREDRAW_HARD; | t->redraw |= TREDRAW_HARD; | ||||
| handled = true; | handled = true; | ||||
| } | } | ||||
| break; | break; | ||||
| case TFM_MODAL_PLANE_Z: | case TFM_MODAL_PLANE_Z: | ||||
| if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { | if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { | ||||
| if (cmode == 'Z') { | if (cmode == 'Z') { | ||||
| stopConstraint(t); | stopConstraint(t); | ||||
| } | } | ||||
| else { | else { | ||||
| if (!(t->current_orientation == V3D_MANIP_MULTI_TRANSF)) | |||||
| setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS1), IFACE_("locking %s Z")); | setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS1), IFACE_("locking %s Z")); | ||||
| else { | |||||
| setUserConstraint(t, t->current_translation, (CON_AXIS0 | CON_AXIS1), IFACE_("locking %s Z")); | |||||
| setUserConstraint(t, t->current_rotation, (CON_AXIS0 | CON_AXIS1), IFACE_("locking %s Z")); | |||||
| setUserConstraint(t, t->current_scale, (CON_AXIS0 | CON_AXIS1), IFACE_("locking %s Z")); | |||||
| } | |||||
| } | } | ||||
| t->redraw |= TREDRAW_HARD; | t->redraw |= TREDRAW_HARD; | ||||
| handled = true; | handled = true; | ||||
| } | } | ||||
| break; | break; | ||||
| case TFM_MODAL_CONS_OFF: | case TFM_MODAL_CONS_OFF: | ||||
| if ((t->flag & T_NO_CONSTRAINT) == 0) { | if ((t->flag & T_NO_CONSTRAINT) == 0) { | ||||
| stopConstraint(t); | stopConstraint(t); | ||||
| ▲ Show 20 Lines • Show All 819 Lines • ▼ Show 20 Lines | void saveTransform(bContext *C, TransInfo *t, wmOperator *op) | ||||
| if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) { | if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) { | ||||
| /* constraint orientation can be global, event if user selects something else | /* constraint orientation can be global, event if user selects something else | ||||
| * so use the orientation in the constraint if set | * so use the orientation in the constraint if set | ||||
| * */ | * */ | ||||
| if (t->con.mode & CON_APPLY) { | if (t->con.mode & CON_APPLY) { | ||||
| RNA_enum_set(op->ptr, "constraint_orientation", t->con.orientation); | RNA_enum_set(op->ptr, "constraint_orientation", t->con.orientation); | ||||
| } | } | ||||
| else { | else { | ||||
| if (!(t->current_orientation == V3D_MANIP_MULTI_TRANSF)) | |||||
| RNA_enum_set(op->ptr, "constraint_orientation", t->current_orientation); | RNA_enum_set(op->ptr, "constraint_orientation", t->current_orientation); | ||||
| else { | |||||
| RNA_enum_set(op->ptr, "translate_orientation", t->current_translation); | |||||
| RNA_enum_set(op->ptr, "rotation_orientation", t->current_rotation); | |||||
| RNA_enum_set(op->ptr, "scale_orientation", t->current_scale); | |||||
| } | |||||
| } | } | ||||
| if (t->con.mode & CON_APPLY) { | if (t->con.mode & CON_APPLY) { | ||||
| if (t->con.mode & CON_AXIS0) { | if (t->con.mode & CON_AXIS0) { | ||||
| constraint_axis[0] = 1; | constraint_axis[0] = 1; | ||||
| } | } | ||||
| if (t->con.mode & CON_AXIS1) { | if (t->con.mode & CON_AXIS1) { | ||||
| constraint_axis[1] = 1; | constraint_axis[1] = 1; | ||||
| ▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event, int mode) | ||||
| // For manipulator only, so assume LEFTMOUSE | // For manipulator only, so assume LEFTMOUSE | ||||
| if (t->launch_event == 0) { | if (t->launch_event == 0) { | ||||
| t->launch_event = LEFTMOUSE; | t->launch_event = LEFTMOUSE; | ||||
| } | } | ||||
| unit_m3(t->spacemtx); | unit_m3(t->spacemtx); | ||||
| initTransInfo(C, t, op, event); | initTransInfo(C, t, op, event); | ||||
| if (!(t->current_orientation == V3D_MANIP_MULTI_TRANSF)) | |||||
| initTransformOrientation(C, t); | initTransformOrientation(C, t); | ||||
| else { | |||||
| initTransformOrientationCustom(C, t, t->current_translation, t->trans_spacemtx); | |||||
| initTransformOrientationCustom(C, t, t->current_rotation, t->rots_spacemtx); | |||||
| initTransformOrientationCustom(C, t, t->current_scale, t->scale_spacemtx); | |||||
| } | |||||
| if (t->spacetype == SPACE_VIEW3D) { | if (t->spacetype == SPACE_VIEW3D) { | ||||
| t->draw_handle_apply = ED_region_draw_cb_activate(t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW); | t->draw_handle_apply = ED_region_draw_cb_activate(t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW); | ||||
| t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); | t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); | ||||
| t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL); | t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL); | ||||
| t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t); | t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t); | ||||
| } | } | ||||
| else if (t->spacetype == SPACE_IMAGE) { | else if (t->spacetype == SPACE_IMAGE) { | ||||
| ▲ Show 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) { | ||||
| t->con.mode |= CON_AXIS0; | t->con.mode |= CON_AXIS0; | ||||
| } | } | ||||
| if (constraint_axis[1]) { | if (constraint_axis[1]) { | ||||
| t->con.mode |= CON_AXIS1; | t->con.mode |= CON_AXIS1; | ||||
| } | } | ||||
| if (constraint_axis[2]) { | if (constraint_axis[2]) { | ||||
| t->con.mode |= CON_AXIS2; | t->con.mode |= CON_AXIS2; | ||||
| } | } | ||||
| if (!(t->current_orientation == V3D_MANIP_MULTI_TRANSF)) | |||||
| setUserConstraint(t, t->current_orientation, t->con.mode, "%s"); | setUserConstraint(t, t->current_orientation, t->con.mode, "%s"); | ||||
| else { | |||||
| switch (t->mode) | |||||
| { | |||||
| case 1: | |||||
| setUserConstraintCustom(t, t->current_translation, t->con.mode, t->trans_spacemtx, "%s"); | |||||
| break; | |||||
| case 2: | |||||
| setUserConstraintCustom(t, t->current_rotation, t->con.mode, t->rots_spacemtx, "%s"); | |||||
| break; | |||||
| case 3: | |||||
| setUserConstraintCustom(t, t->current_scale, t->con.mode, t->scale_spacemtx, "%s"); | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| /* overwrite initial values if operator supplied a non-null vector | /* overwrite initial values if operator supplied a non-null vector | ||||
| * | * | ||||
| * keep last so we can apply the constraints space. | * keep last so we can apply the constraints space. | ||||
| */ | */ | ||||
| if ((prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) { | if ((prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) { | ||||
| ▲ Show 20 Lines • Show All 6,271 Lines • Show Last 20 Lines | |||||
Indentation messed up?