Commit: 97a61002799eb134d7da5d05fa12486e8e5730d2
Author: Joshua Leung
Date:   Thu Nov 6 02:16:21 2014 +1300
Branches: GPencil_EditStrokes
https://developer.blender.org/rB97a61002799eb134d7da5d05fa12486e8e5730d2

Select Linked for GPencil Stroke Editing (Ctrl L)

This selects all the points in strokes which have selected points already.

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

M       release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M       source/blender/editors/gpencil/gpencil_intern.h
M       source/blender/editors/gpencil/gpencil_ops.c
M       source/blender/editors/gpencil/gpencil_select.c

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

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 5fafa8f..a913a19 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -110,6 +110,7 @@ class GreasePencilStrokeEditPanel():
         subcol = col.column(align=True)
         subcol.active = edit_ok
         subcol.operator("gpencil.select_all", text="Select All")
+        subcol.operator("gpencil.select_linked")
         subcol.operator("gpencil.select_border")
         subcol.operator("gpencil.select_circle")
 
@@ -167,6 +168,7 @@ class GPENCIL_PIE_tool_palette(Menu):
                 # S - Select
                 col = pie.column()
                 col.operator("gpencil.select_all", text="Select All", 
icon='PARTICLE_POINT')
+                col.operator("gpencil.select_linked", text="Select Linked", 
icon='LINKED')
                 col.operator("gpencil.select_border", text="Border Select", 
icon='BORDER_RECT')
                 col.operator("gpencil.select_circle", text="Circle Select", 
icon='META_EMPTY')
                 #col.operator("gpencil.select", text="Stroke Under 
Mouse").entire_strokes = True
@@ -181,7 +183,7 @@ class GPENCIL_PIE_tool_palette(Menu):
                 pie.operator("transform.resize", text="Scale", 
icon='MAN_SCALE').gpencil_strokes = True
 
                 # SW - Copy
-                pie.operator("gpencil.strokes_duplicate", icon='PARTICLE_PATH')
+                pie.operator("gpencil.duplicate_move", icon='PARTICLE_PATH')
 
                 # SE - Exit Edit Mode
                 pie.prop(gpd, "use_stroke_edit_mode", text="Exit Edit Mode", 
icon='EDIT')
diff --git a/source/blender/editors/gpencil/gpencil_intern.h 
b/source/blender/editors/gpencil/gpencil_intern.h
index 7e087d0..8c3cb1a 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -117,6 +117,7 @@ void GPENCIL_OT_select(struct wmOperatorType *ot);
 void GPENCIL_OT_select_all(struct wmOperatorType *ot);
 void GPENCIL_OT_select_circle(struct wmOperatorType *ot);
 void GPENCIL_OT_select_border(struct wmOperatorType *ot);
+void GPENCIL_OT_select_linked(struct wmOperatorType *ot);
 
 void GPENCIL_OT_duplicate(struct wmOperatorType *ot);
 void GPENCIL_OT_delete(struct wmOperatorType *ot);
diff --git a/source/blender/editors/gpencil/gpencil_ops.c 
b/source/blender/editors/gpencil/gpencil_ops.c
index 62383f9..f6df618 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -133,6 +133,9 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select", SELECTMOUSE, 
KM_PRESS, KM_ALT, 0);
        RNA_boolean_set(kmi->ptr, "entire_strokes", true);
        
+       /* select linked */
+       WM_keymap_add_item(keymap, "GPENCIL_OT_select_linked", LKEY, KM_PRESS, 
KM_CTRL, 0);
+       
        
        /* Editing ----------------------------------------- */
        
@@ -188,6 +191,7 @@ void ED_operatortypes_gpencil(void)
        WM_operatortype_append(GPENCIL_OT_select_all);
        WM_operatortype_append(GPENCIL_OT_select_circle);
        WM_operatortype_append(GPENCIL_OT_select_border);
+       WM_operatortype_append(GPENCIL_OT_select_linked);
        
        WM_operatortype_append(GPENCIL_OT_duplicate);
        WM_operatortype_append(GPENCIL_OT_delete);
diff --git a/source/blender/editors/gpencil/gpencil_select.c 
b/source/blender/editors/gpencil/gpencil_select.c
index 7065923..eeb12b8 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -203,6 +203,52 @@ void GPENCIL_OT_select_all(wmOperatorType *ot)
 }
 
 /* ********************************************** */
+/* Select Linked */
+
+static int gpencil_select_linked_exec(bContext *C, wmOperator *op)
+{
+       bGPdata *gpd = ED_gpencil_data_get_active(C);
+       
+       if (gpd == NULL) {
+               BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
+               return OPERATOR_CANCELLED;
+       }
+       
+       /* select all points in selected strokes */
+       CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
+       {
+               if (gps->flag & GP_STROKE_SELECT) {
+                       bGPDspoint *pt;
+                       int i;
+                       
+                       for (i = 0, pt = gps->points; i < gps->totpoints; i++, 
pt++) {
+                               pt->flag |= GP_SPOINT_SELECT;
+                       }
+               }
+       }
+       CTX_DATA_END;
+       
+       /* updates */
+       WM_event_add_notifier(C, NC_GPENCIL | NA_SELECTED, NULL);
+       return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_select_linked(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name = "Select Linked";
+       ot->idname = "GPENCIL_OT_select_linked";
+       ot->description = "Select all points in same strokes as already 
selected points";
+       
+       /* callbacks */
+       ot->exec = gpencil_select_linked_exec;
+       ot->poll = gpencil_select_poll;
+       
+       /* flags */
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+/* ********************************************** */
 /* Circle Select Operator */
 
 /* Helper to check if a given stroke is within the area */

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

Reply via email to