Fix #29101: 2D Tilt on Bezier Curve Bug?
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 1 Nov 2011 11:00:08 +0000 (11:00 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 1 Nov 2011 11:00:08 +0000 (11:00 +0000)
Changing tilt for 2D curves doesn't really hurt, just makes things not so
clear tosee what's going on because you're changing value which isn't used
at all for 2D curves. Disallwo to run TRANSFORM_OT_tilt operator for 2D curves.

Also made a correct fix for incorrect shortcut for tilt in 3D viewport toolbar,
it was really confusing to have almost the same operators (TRANSFORM_OT_tilt and
TRANSFORM_OT_transform with mode=tilt) in keymap. Better to use tilt operator
in toolbar.

release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/editors/curve/curve_ops.c
source/blender/editors/include/ED_screen.h
source/blender/editors/screen/screen_ops.c
source/blender/editors/transform/transform_ops.c

index 14774c2..9518ccb 100644 (file)
@@ -209,7 +209,7 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, Panel):
         col.operator("transform.resize", text="Scale")
 
         col = layout.column(align=True)
-        col.operator("transform.transform", text="Tilt").mode = 'TILT'
+        col.operator("transform.tilt", text="Tilt")
         col.operator("transform.transform", text="Shrink/Fatten").mode = 'CURVE_SHRINKFATTEN'
 
         col = layout.column(align=True)
index be6b322..95f3bb5 100644 (file)
@@ -223,7 +223,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
 
        WM_keymap_add_item(keymap, "CURVE_OT_tilt_clear", TKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "TRANSFORM_OT_tilt", TKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", TFM_TILT);
 
        RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_CURVE_SHRINKFATTEN);
 
index f92ee72..0553700 100644 (file)
@@ -159,6 +159,7 @@ int         ED_operator_editmesh_view3d(struct bContext *C);
 int            ED_operator_editmesh_region_view3d(struct bContext *C);
 int            ED_operator_editarmature(struct bContext *C);
 int            ED_operator_editcurve(struct bContext *C);
+int            ED_operator_editcurve_3d(struct bContext *C);
 int            ED_operator_editsurf(struct bContext *C);
 int            ED_operator_editsurfcurve(struct bContext *C);
 int            ED_operator_editsurfcurve_region_view3d(struct bContext *C);
index 0a7e3a2..171adc8 100644 (file)
@@ -406,6 +406,17 @@ int ED_operator_editcurve(bContext *C)
        return 0;
 }
 
+int ED_operator_editcurve_3d(bContext *C)
+{
+       Object *obedit= CTX_data_edit_object(C);
+       if(obedit && obedit->type==OB_CURVE) {
+               Curve *cu= (Curve *)obedit->data;
+
+               return (cu->flag&CU_3D) && (NULL != cu->editnurb);
+       }
+       return 0;
+}
+
 int ED_operator_editsurf(bContext *C)
 {
        Object *obedit= CTX_data_edit_object(C);
index 2d3c1d8..f926f44 100644 (file)
@@ -610,7 +610,7 @@ void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
        ot->exec   = transform_exec;
        ot->modal  = transform_modal;
        ot->cancel  = transform_cancel;
-       ot->poll   = ED_operator_editcurve;
+       ot->poll   = ED_operator_editcurve_3d;
 
        RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);