Fix #29577: repeat curve duplication not working in 2.60(as well as 2.61rc1)
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 15 Dec 2011 07:54:13 +0000 (07:54 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 15 Dec 2011 07:54:13 +0000 (07:54 +0000)
Issue was caused by direct call of transforn operator from extrude and duplicate,
made them macro of duplicate/exturde and transform, so now repeating works nicely.

source/blender/editors/curve/curve_ops.c
source/blender/editors/curve/editcurve.c
source/blender/editors/include/ED_curve.h
source/blender/editors/space_api/spacetypes.c

index 95f3bb55ba5907355ce63b2dc9acfcdab9b334e1..8df54670bd4a15905704766b091dfe1c8e154e06 100644 (file)
@@ -137,6 +137,27 @@ void ED_operatortypes_curve(void)
        WM_operatortype_append(CURVE_OT_cyclic_toggle);
 }
 
+void ED_operatormacros_curve(void)
+{
+       wmOperatorType *ot;
+       wmOperatorTypeMacro *otmacro;
+
+       ot= WM_operatortype_append_macro("CURVE_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+       ot->description = "Duplicate curve and move";
+       WM_operatortype_macro_define(ot, "CURVE_OT_duplicate");
+       otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+       RNA_enum_set(otmacro->ptr, "proportional", 0);
+       RNA_boolean_set(otmacro->ptr, "mirror", 0);
+
+       ot= WM_operatortype_append_macro("CURVE_OT_extrude_move", "Extrude Curve and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+       ot->description = "Extrude curve and move result";
+       otmacro= WM_operatortype_macro_define(ot, "CURVE_OT_extrude");
+       RNA_enum_set(otmacro->ptr, "type", 1);
+       otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+       RNA_enum_set(otmacro->ptr, "proportional", 0);
+       RNA_boolean_set(otmacro->ptr, "mirror", 0);
+}
+
 void ED_keymap_curve(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
@@ -214,8 +235,8 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
        RNA_boolean_set(WM_keymap_add_item(keymap, "CURVE_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1);
 
        WM_keymap_add_item(keymap, "CURVE_OT_separate", PKEY, KM_PRESS, 0, 0);
-       WM_keymap_add_item(keymap, "CURVE_OT_extrude", EKEY, KM_PRESS, 0, 0);
-       WM_keymap_add_item(keymap, "CURVE_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
+       WM_keymap_add_item(keymap, "CURVE_OT_extrude_move", EKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "CURVE_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
        WM_keymap_add_item(keymap, "CURVE_OT_make_segment", FKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "CURVE_OT_cyclic_toggle", CKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "CURVE_OT_delete", XKEY, KM_PRESS, 0, 0);
index 1415b8965fee1f817bf0f2889aa8f04e1813ab88..a679fa3e2bf4540627b870c625a87526345add5f 100644 (file)
@@ -4716,18 +4716,6 @@ static int extrude_exec(bContext *C, wmOperator *UNUSED(op))
        return OPERATOR_FINISHED;
 }
 
-static int extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
-{
-       if(extrude_exec(C, op) == OPERATOR_FINISHED) {
-               RNA_enum_set(op->ptr, "mode", TFM_TRANSLATION);
-               WM_operator_name_call(C, "TRANSFORM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
-
-               return OPERATOR_FINISHED;
-       }
-
-       return OPERATOR_CANCELLED;
-}
-
 void CURVE_OT_extrude(wmOperatorType *ot)
 {
        /* identifiers */
@@ -4737,7 +4725,6 @@ void CURVE_OT_extrude(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= extrude_exec;
-       ot->invoke= extrude_invoke;
        ot->poll= ED_operator_editsurfcurve;
 
        /* flags */
@@ -5599,16 +5586,6 @@ static int duplicate_exec(bContext *C, wmOperator *UNUSED(op))
        return OPERATOR_FINISHED;
 }
 
-static int duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
-{
-       duplicate_exec(C, op);
-
-       RNA_enum_set(op->ptr, "mode", TFM_TRANSLATION);
-       WM_operator_name_call(C, "TRANSFORM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
-
-       return OPERATOR_FINISHED;
-}
-
 void CURVE_OT_duplicate(wmOperatorType *ot)
 {
        /* identifiers */
@@ -5618,14 +5595,10 @@ void CURVE_OT_duplicate(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= duplicate_exec;
-       ot->invoke= duplicate_invoke;
        ot->poll= ED_operator_editsurfcurve;
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-       /* to give to transform */
-       RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
 }
 
 /********************** delete operator *********************/
index 8f97d1c8602829e6ddb6ce1eea589810bd304d82..7e7d60fdea812aaaf36dc314cf35e012a768c70b 100644 (file)
@@ -47,6 +47,7 @@ struct BPoint;
 
 /* curve_ops.c */
 void   ED_operatortypes_curve(void);
+void   ED_operatormacros_curve(void);
 void   ED_keymap_curve (struct wmKeyConfig *keyconf);
 
 /* editcurve.c */
index fbf8af514b679deeac5996bd5c1a740fff182df5..7c5361c8af0d69cff5ce054811343352aa9de5a8 100644 (file)
@@ -132,6 +132,7 @@ void ED_spacetypes_init(void)
        ED_operatormacros_graph();
        ED_operatormacros_action();
        ED_operatormacros_clip();
+       ED_operatormacros_curve();
        
        /* register dropboxes (can use macros) */
        spacetypes = BKE_spacetypes_list();