diff options
Diffstat (limited to 'source/blender/editors/transform/transform_ops.c')
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 66 |
1 files changed, 51 insertions, 15 deletions
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 46bd83b5d35..d5d25888ec8 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -160,11 +160,12 @@ const EnumPropertyItem rna_enum_transform_mode_types[] = static int select_orientation_exec(bContext *C, wmOperator *op) { + View3D *v3d = CTX_wm_view3d(C); int orientation = RNA_enum_get(op->ptr, "orientation"); - BIF_selectTransformOrientationValue(C, orientation); + BIF_selectTransformOrientationValue(v3d, orientation); - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); return OPERATOR_FINISHED; } @@ -206,10 +207,9 @@ static void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot) static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); - int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); - BIF_removeTransformOrientationIndex(C, selected_index); - + BIF_removeTransformOrientationIndex(C, v3d->custom_orientation_index); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C)); @@ -223,18 +223,12 @@ static int delete_orientation_invoke(bContext *C, wmOperator *op, const wmEvent static int delete_orientation_poll(bContext *C) { - int selected_index = -1; View3D *v3d = CTX_wm_view3d(C); - + if (ED_operator_areaactive(C) == 0) return 0; - - - if (v3d) { - selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); - } - - return selected_index >= 0; + + return (v3d->twmode >= V3D_MANIP_CUSTOM) && (v3d->custom_orientation_index != -1); } static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot) @@ -289,6 +283,9 @@ static void TRANSFORM_OT_create_orientation(struct wmOperatorType *ot) RNA_def_string(ot->srna, "name", NULL, MAX_NAME, "Name", "Name of the new custom orientation"); RNA_def_boolean(ot->srna, "use_view", false, "Use View", "Use the current view instead of the active object to create the new orientation"); + + WM_operatortype_props_advanced_begin(ot); + RNA_def_boolean(ot->srna, "use", false, "Use after creation", "Select orientation after its creation"); RNA_def_boolean(ot->srna, "overwrite", false, "Overwrite previous", "Overwrite previously created orientation with same name"); @@ -319,7 +316,8 @@ static void transformops_loopsel_hack(bContext *C, wmOperator *op) /* still switch if we were originally in face select mode */ if ((ts->selectmode != selectmode_orig) && (selectmode_orig != SCE_SELECT_FACE)) { - BMEditMesh *em = BKE_editmesh_from_object(scene->obedit); + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BKE_editmesh_from_object(obedit); em->selectmode = ts->selectmode = selectmode_orig; EDBM_selectmode_set(em); } @@ -599,6 +597,8 @@ static void TRANSFORM_OT_translate(struct wmOperatorType *ot) RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | P_OPTIONS | P_GPENCIL_EDIT); } @@ -619,6 +619,8 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot) RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties( ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_GPENCIL_EDIT | P_CENTER); } @@ -650,6 +652,8 @@ static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot) RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_NO_TEXSPACE); } @@ -671,6 +675,8 @@ static void TRANSFORM_OT_trackball(struct wmOperatorType *ot) /* Maybe we could use float_vector_xyz here too? */ RNA_def_float_rotation(ot->srna, "value", 2, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT | P_CENTER); } @@ -691,6 +697,8 @@ static void TRANSFORM_OT_rotate(struct wmOperatorType *ot) RNA_def_float_rotation(ot->srna, "value", 0, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties( ot, P_AXIS | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_GPENCIL_EDIT | P_CENTER); } @@ -715,6 +723,8 @@ static void TRANSFORM_OT_tilt(struct wmOperatorType *ot) RNA_def_float_rotation(ot->srna, "value", 0, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP); } @@ -735,6 +745,8 @@ static void TRANSFORM_OT_bend(struct wmOperatorType *ot) RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT | P_CENTER); } @@ -755,6 +767,8 @@ static void TRANSFORM_OT_shear(struct wmOperatorType *ot) RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT); // XXX Shear axis? } @@ -776,6 +790,8 @@ static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot) RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_CENTER); } @@ -798,6 +814,8 @@ static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot) RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness"); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP); } @@ -819,6 +837,8 @@ static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot) RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT | P_CENTER); } @@ -863,6 +883,9 @@ static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot) RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); RNA_def_boolean(ot->srna, "use_even", false, "Even", "Make the edge loop match the shape of the adjacent edge loop"); + + WM_operatortype_props_advanced_begin(ot); + RNA_def_boolean(ot->srna, "flipped", false, "Flipped", "When Even mode is active, flips between the two adjacent edge loops"); RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", @@ -889,6 +912,9 @@ static void TRANSFORM_OT_vert_slide(struct wmOperatorType *ot) RNA_def_float_factor(ot->srna, "value", 0, -10.0f, 10.0f, "Factor", "", -1.0f, 1.0f); RNA_def_boolean(ot->srna, "use_even", false, "Even", "Make the edge loop match the shape of the adjacent edge loop"); + + WM_operatortype_props_advanced_begin(ot); + RNA_def_boolean(ot->srna, "flipped", false, "Flipped", "When Even mode is active, flips between the two adjacent edge loops"); RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", @@ -914,6 +940,8 @@ static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot) RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_SNAP); } @@ -955,6 +983,8 @@ static void TRANSFORM_OT_edge_bevelweight(struct wmOperatorType *ot) RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_SNAP); } @@ -975,6 +1005,8 @@ static void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot) RNA_def_float_vector_xyz(ot->srna, "value", 2, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties(ot, P_SNAP); } @@ -1000,6 +1032,8 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot) RNA_def_float_vector(ot->srna, "value", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX); + WM_operatortype_props_advanced_begin(ot); + Transform_Properties( ot, P_AXIS | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER); } @@ -1066,6 +1100,8 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac kmi = WM_keymap_add_item(keymap, "WM_OT_context_menu_enum", TABKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0); RNA_string_set(kmi->ptr, "data_path", "tool_settings.snap_element"); + /* Will fall-through to texture-space transform. */ + kmi = WM_keymap_add_item(keymap, "OBJECT_OT_transform_axis_target", TKEY, KM_PRESS, KM_SHIFT, 0); kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, TKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "texture_space", true); |