WM: Don't save mouse-paths to operator history
authorCampbell Barton <ideasman42@gmail.com>
Mon, 16 Oct 2017 05:11:04 +0000 (16:11 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 16 Oct 2017 05:14:07 +0000 (16:14 +1100)
In preparation for modal operators storing their properties,
no need to keep mouse-paths around.

Also use generic function for lasso properties.

19 files changed:
source/blender/editors/gpencil/gpencil_brush.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/gpencil/gpencil_select.c
source/blender/editors/mask/mask_select.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/sculpt_paint/paint_mask.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/space_action/action_select.c
source/blender/editors/space_clip/tracking_select.c
source/blender/editors/space_graph/graph_select.c
source/blender/editors/space_logic/logic_buttons.c
source/blender/editors/space_node/node_add.c
source/blender/editors/space_node/node_relationships.c
source/blender/editors/space_node/node_select.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_operator_props.c

index e5fb162a96cef8750c1185fe9b8bef4303bc4e60..bb3800941ab73853edfe4234fd801c064ad9a6b8 100644 (file)
@@ -1851,8 +1851,6 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
 
 void GPENCIL_OT_brush_paint(wmOperatorType *ot)
 {
-       PropertyRNA *prop;
-       
        /* identifiers */
        ot->name = "Stroke Sculpt";
        ot->idname = "GPENCIL_OT_brush_paint";
@@ -1869,7 +1867,9 @@ void GPENCIL_OT_brush_paint(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* properties */
-       RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
+       PropertyRNA *prop;
+       prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
        
        prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input",
                               "Enter a mini 'sculpt-mode' if enabled, otherwise, exit after drawing a single stroke");
index eb49060b629cce0fe6b1f627d97dfa54211e1f65..ea87364d67f32cc9c1f4d3d538201e90b93c8450 100644 (file)
@@ -2761,8 +2761,10 @@ void GPENCIL_OT_draw(wmOperatorType *ot)
        ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING;
        
        /* settings for drawing */
+       PropertyRNA *prop;
        ot->prop = RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to interpret mouse movements");
-       RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
+       prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
        
        /* NOTE: wait for input is enabled by default, so that all UI code can work properly without needing users to know about this */
        RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "Wait for first click instead of painting immediately");
index 700a1dc943976b1659eeb51f5faea42477b16ef5..b552a1c99f8fe6c5abe0b30b240a786b65c8b7c0 100644 (file)
@@ -1053,9 +1053,8 @@ void GPENCIL_OT_select_lasso(wmOperatorType *ot)
        /* flags */
        ot->flag = OPTYPE_UNDO;
        
-       RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
-       RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items");
-       RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
+       /* properties */
+       WM_operator_properties_gesture_lasso(ot);
 }
 
 /* ********************************************** */
index 990b07066b16cf3f36c359471dc6ca267d70f8c3..a7215a4b653098889ef39936cab38be411d171d7 100644 (file)
@@ -580,9 +580,7 @@ void MASK_OT_select_lasso(wmOperatorType *ot)
        ot->flag = OPTYPE_UNDO;
 
        /* properties */
-       RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
-       RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items");
-       RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
+       WM_operator_properties_gesture_lasso(ot);
 }
 
 /********************** circle select operator *********************/
index c513c49aa8eb8c0bbdfd0db5925c8fcf3d6da832..b1af1837a746a64573ef92cd8fc0aa043601dbb5 100644 (file)
@@ -2978,8 +2978,6 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
 
 void MESH_OT_knife_cut(wmOperatorType *ot)
 {
-       PropertyRNA *prop;
-       
        ot->name = "Knife Cut";
        ot->description = "Cut selected edges and faces into parts";
        ot->idname = "MESH_OT_knife_cut";
@@ -2992,10 +2990,13 @@ void MESH_OT_knife_cut(wmOperatorType *ot)
        
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-       
+
+       /* properties */
+       PropertyRNA *prop;
+       prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+
        RNA_def_enum(ot->srna, "type", knife_items, KNIFE_EXACT, "Type", "");
-       prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
        
        /* internal */
        RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, BC_NUMCURSORS, "Cursor", "", 0, BC_NUMCURSORS);
index 72c5a74aee97512caff500b8c6fc77507e829d7b..615a0f9b74d1e231bbc3f8d034a8fb5ed5901c2d 100644 (file)
@@ -4066,7 +4066,9 @@ void PARTICLE_OT_brush_edit(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
        /* properties */
-       RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
+       PropertyRNA *prop;
+       prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 }
 
 /*********************** cut shape ***************************/
index a4887c579ace7c6af6a4e7ae0e2e5beae372dadd..ed7030c01d11777889d8769b06bc9888a9e753ac 100644 (file)
@@ -506,8 +506,6 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
 
 void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot)
 {
-       PropertyRNA *prop;
-
        ot->name = "Mask Lasso Gesture";
        ot->idname = "PAINT_OT_mask_lasso_gesture";
        ot->description = "Add mask within the lasso as you move the brush";
@@ -520,8 +518,8 @@ void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot)
 
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-       prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
+       /* properties */
+       WM_operator_properties_gesture_lasso_ex(ot, false, false);
 
        RNA_def_enum(ot->srna, "mode", mode_items, PAINT_MASK_FLOOD_VALUE, "Mode", NULL);
        RNA_def_float(ot->srna, "value", 1.0, 0, 1.0, "Value",
index 7668b8ebd995e14ce3c141f5be92f91131702ec5..b02e547d0dfb5719a2a5b37a5da327174ebd3207 100644 (file)
@@ -217,7 +217,10 @@ void paint_stroke_operator_properties(wmOperatorType *ot)
                {0}
        };
 
-       RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
+       PropertyRNA *prop;
+
+       prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 
        RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL, 
                     "Stroke Mode",
index 6d785e1f7dfb6fd5ea2dcb23880cf5ee3344da22..22b7b1da77f71ae894eebcffd61ccb2b9f54d3d5 100644 (file)
@@ -572,9 +572,7 @@ void ACTION_OT_select_lasso(wmOperatorType *ot)
        ot->flag = OPTYPE_UNDO;
        
        /* properties */
-       RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
-       RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Deselect rather than select items");
-       RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection instead of deselecting everything first");
+       WM_operator_properties_gesture_lasso(ot);
 }
 
 /* ------------------- */
index 3cbf1cf4e0cab6bb8f10bd72936a52063c58c41d..6077379d4200fd793bcdd57b68f92fbe10b2ed5e 100644 (file)
@@ -656,9 +656,7 @@ void CLIP_OT_select_lasso(wmOperatorType *ot)
        ot->flag = OPTYPE_UNDO;
 
        /* properties */
-       RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
-       RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items");
-       RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
+       WM_operator_properties_gesture_lasso(ot);
 }
 
 /********************** circle select operator *********************/
index dd4449b77f712c358a34aa55076b629019c80490..2d60946a20046e043591d2097ef1420cdb07ae92 100644 (file)
@@ -486,9 +486,7 @@ void GRAPH_OT_select_lasso(wmOperatorType *ot)
        ot->flag = OPTYPE_UNDO;
        
        /* properties */
-       RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
-       RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Deselect rather than select items");
-       RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection instead of deselecting everything first");
+       WM_operator_properties_gesture_lasso(ot);
 }
 
 /* ------------------- */
index e5eee21ed085cc7601098c80837682aa11edd83b..54e6e217b77d5e48db5dd807b1f08e6c3741c825 100644 (file)
@@ -142,8 +142,6 @@ static int cut_links_exec(bContext *C, wmOperator *op)
 
 void LOGIC_OT_links_cut(wmOperatorType *ot)
 {
-       PropertyRNA *prop;
-       
        ot->name = "Cut Links";
        ot->idname = "LOGIC_OT_links_cut";
        ot->description = "Remove logic brick connections";
@@ -158,8 +156,10 @@ void LOGIC_OT_links_cut(wmOperatorType *ot)
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
        
-       prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
+       /* properties */
+       PropertyRNA *prop;
+       prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
        /* internal */
        RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
 }
index dc6b06790e049590b8b41d60f952743c09de7bee..1c11ee1f98caa8691f5cc8ac4f417bce937cda99 100644 (file)
@@ -277,8 +277,6 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
 
 void NODE_OT_add_reroute(wmOperatorType *ot)
 {
-       PropertyRNA *prop;
-
        ot->name = "Add Reroute";
        ot->idname = "NODE_OT_add_reroute";
        ot->description = "Add a reroute node";
@@ -293,8 +291,10 @@ void NODE_OT_add_reroute(wmOperatorType *ot)
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-       prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
+       /* properties */
+       PropertyRNA *prop;
+       prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
        /* internal */
        RNA_def_int(ot->srna, "cursor", BC_CROSSCURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
 }
index 3b03399a5e779e086c35b88e4900cf245684771c..64c019d12a302e4a23748a25abdac666d0b4bd6d 100644 (file)
@@ -1007,8 +1007,6 @@ static int cut_links_exec(bContext *C, wmOperator *op)
 
 void NODE_OT_links_cut(wmOperatorType *ot)
 {
-       PropertyRNA *prop;
-
        ot->name = "Cut Links";
        ot->idname = "NODE_OT_links_cut";
        ot->description = "Use the mouse to cut (remove) some links";
@@ -1023,8 +1021,11 @@ void NODE_OT_links_cut(wmOperatorType *ot)
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-       prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
+       /* properties */
+       PropertyRNA *prop;
+       prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+
        /* internal */
        RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
 }
index f7b8f53a63f16c3b946516b9a4c292fb4722a29a..98ba46fc87a591d351277292aed82624e6a6123c 100644 (file)
@@ -725,9 +725,7 @@ void NODE_OT_select_lasso(wmOperatorType *ot)
        ot->flag = OPTYPE_UNDO;
 
        /* properties */
-       RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
-       RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items");
-       RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
+       WM_operator_properties_gesture_lasso(ot);
 }
 
 /* ****** Select/Deselect All ****** */
index 7f99a81ba994c8bd15d76c0f1387e0a1dc7ce545..5945c7497da0361d03ea6dd33cb687ff073217b0 100644 (file)
@@ -914,9 +914,8 @@ void VIEW3D_OT_select_lasso(wmOperatorType *ot)
        /* flags */
        ot->flag = OPTYPE_UNDO;
        
-       RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
-       RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items");
-       RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
+       /* properties */
+       WM_operator_properties_gesture_lasso(ot);
 }
 
 
index 8dbe22b7ffe824fe98c17738fed073d7179c0076..6056b3acdc3c59cb657231b1ed40be8d72ac1be9 100644 (file)
@@ -3221,9 +3221,8 @@ static void UV_OT_select_lasso(wmOperatorType *ot)
        /* flags */
        ot->flag = OPTYPE_UNDO;
 
-       RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
-       RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items");
-       RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
+       /* properties */
+       WM_operator_properties_gesture_lasso(ot);
 }
 
 
index d91c4a4efe0a845edb462b045bcda64e4d7c389f..40722736d5811489800466e619d8ca0441f08142 100644 (file)
@@ -309,6 +309,8 @@ void        WM_operator_properties_border(struct wmOperatorType *ot);
 void        WM_operator_properties_border_to_rcti(struct wmOperator *op, struct rcti *rect);
 void        WM_operator_properties_border_to_rctf(struct wmOperator *op, rctf *rect);
 void        WM_operator_properties_gesture_border(struct wmOperatorType *ot, bool extend);
+void        WM_operator_properties_gesture_lasso_ex(struct wmOperatorType *ot, bool deselect, bool extend);
+void        WM_operator_properties_gesture_lasso(struct wmOperatorType *ot);
 void        WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor);
 void        WM_operator_properties_gesture_circle(struct wmOperatorType *ot);
 void        WM_operator_properties_mouse_select(struct wmOperatorType *ot);
index 2a44b4997a297c633fdb417c6899313c19299abb..569cd43a52446bec34683e68ffb934b4b6d1cb51 100644 (file)
@@ -238,6 +238,28 @@ void WM_operator_properties_gesture_border(wmOperatorType *ot, bool extend)
        }
 }
 
+/**
+ * Use with #WM_gesture_lasso_invoke
+ */
+void WM_operator_properties_gesture_lasso_ex(wmOperatorType *ot, bool deselect, bool extend)
+{
+       PropertyRNA *prop;
+       prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+
+       if (deselect) {
+               RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Deselect rather than select items");
+       }
+       if (extend) {
+               RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection instead of deselecting everything first");
+       }
+}
+
+void WM_operator_properties_gesture_lasso(wmOperatorType *ot)
+{
+       WM_operator_properties_gesture_lasso_ex(ot, true, true);
+}
+
 /**
  * Use with #WM_gesture_straightline_invoke
  */