Commit: 3cb4d8d03c9fed2e11f0a45781b1fa291aebed19
Author: João Araújo
Date:   Tue Jan 3 21:23:45 2017 +0000
Branches: gsoc2016-improved_extrusion
https://developer.blender.org/rB3cb4d8d03c9fed2e11f0a45781b1fa291aebed19

Curves: Chamfer and fillet operators

Fixed some inconsistency on user interaction:

 - Chamfer and fillet only enter modal when the selected handle is vector type
 - Commented all the tools implemented from the Specials menu. They were not 
being called on modal.

===================================================================

M       release/scripts/startup/bl_ui/space_view3d.py
M       source/blender/editors/curve/editcurve.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 56b9264..83c4624 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2766,17 +2766,17 @@ class VIEW3D_MT_edit_curve_specials(Menu):
         layout.operator("curve.smooth_radius")
         layout.operator("curve.smooth_tilt")
 
-        layout.separator()
-
-        layout.operator("curve.extend_curve")
-        layout.operator("curve.batch_extend")
-        layout.operator("curve.trim_curve")
-        layout.operator("curve.offset_curve")
-
-        layout.separator()
-
-        layout.operator("curve.curve_chamfer")
-        layout.operator("curve.curve_fillet")
+#        layout.separator()
+#
+#        layout.operator("curve.extend_curve")
+#        layout.operator("curve.batch_extend")
+#        layout.operator("curve.trim_curve")
+#        layout.operator("curve.offset_curve")
+#
+#        layout.separator()
+#
+#        layout.operator("curve.curve_chamfer")
+#        layout.operator("curve.curve_fillet")
 
 
 class VIEW3D_MT_edit_curve_delete(Menu):
diff --git a/source/blender/editors/curve/editcurve.c 
b/source/blender/editors/curve/editcurve.c
index 48753cd..200810d 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -8323,7 +8323,6 @@ static int curve_chamfer_modal(bContext *C, wmOperator 
*op, const wmEvent *event
        EditNurb *editnurb = cu->editnurb;
        ListBase *nubase = object_editcurve_get(obedit);
        Nurb *nu;
-       BezTriple *bezt, *bezt1, *bezt2, *helper;
        CD *cd = op->customdata;
        OffsetData *opdata = cd->data;
        float *init_mouse = cd->data->mcenter;
@@ -8431,7 +8430,7 @@ static int curve_chamfer_invoke(bContext *C, wmOperator 
*op, const wmEvent *UNUS
        int selected = 0;
        for (int i = 1; i < nu->pntsu - 1; i++) {
                bezt = &nu->bezt[i];
-               if (BEZT_ISSEL_ANY(bezt)) {
+               if (BEZT_ISSEL_ANY(bezt) && (bezt->h1 == HD_VECT)) {
                        sub_v3_v3v3(v1, bezt->vec[1], bezt->vec[0]);
                        normalize_v3(v1);
                        sub_v3_v3v3(v2, bezt->vec[1], bezt->vec[2]);
@@ -8465,12 +8464,19 @@ static int curve_chamfer_invoke(bContext *C, wmOperator 
*op, const wmEvent *UNUS
                initNumInput(&cd->data->num_input[i]);
        }
 
-       op->customdata = cd;
+       if (cd->selected_points) {
+               op->customdata = cd;
 
-       /* add modal handler */
-       WM_event_add_modal_handler(C, op);
+               /* add modal handler */
+               WM_event_add_modal_handler(C, op);
 
-       return OPERATOR_RUNNING_MODAL;
+               return OPERATOR_RUNNING_MODAL;
+       }
+
+       MEM_freeN(cd->data);
+       MEM_freeN(cd);
+
+       return OPERATOR_FINISHED;
 }
 
 void CURVE_OT_curve_chamfer(wmOperatorType *ot)
@@ -8496,8 +8502,6 @@ void CURVE_OT_curve_chamfer(wmOperatorType *ot)
 }
 
 /******************** Fillet operator ********************/
-/* In an ideal world, chamfer and fillet would be the same operator, since 
they share 90% of the code
- * TODO: Make the above true */
 
 static void fillet_handle(BezTriple *bezt, BezTriple *r_new_bezt1, BezTriple 
*r_new_bezt2, float theta, float r)
 {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to