diff options
6 files changed, 53 insertions, 11 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 951c1aaaab9..929a400244b 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -4264,10 +4264,11 @@ def km_particle(params): *_template_items_select_actions(params, "particle.select_all"), ("particle.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True}, None), ("particle.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True}, None), - ("particle.select_linked", {"type": 'L', "value": 'PRESS'}, + ("particle.select_linked_pick", {"type": 'L', "value": 'PRESS'}, {"properties": [("deselect", False)]}), - ("particle.select_linked", {"type": 'L', "value": 'PRESS', "shift": True}, + ("particle.select_linked_pick", {"type": 'L', "value": 'PRESS', "shift": True}, {"properties": [("deselect", True)]}), + ("particle.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), ("particle.delete", {"type": 'X', "value": 'PRESS'}, None), ("particle.delete", {"type": 'DEL', "value": 'PRESS'}, None), ("particle.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py index 735aa560356..0498b3467e8 100644 --- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py +++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py @@ -3278,10 +3278,11 @@ def km_particle(params): ("particle.select_all", {"type": 'I', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'INVERT')]}), ("particle.select_more", {"type": 'UP_ARROW', "value": 'PRESS'}, None), ("particle.select_less", {"type": 'DOWN_ARROW', "value": 'PRESS'}, None), - ("particle.select_linked", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, + ("particle.select_linked_pick", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, {"properties": [("deselect", False)]}), - ("particle.select_linked", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "shift": True}, + ("particle.select_linked_pick", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "shift": True}, {"properties": [("deselect", True)]}), + ("particle.select_linked", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "ctrl": True}, None), ("particle.delete", {"type": 'BACK_SPACE', "value": 'PRESS'}, None), ("particle.delete", {"type": 'DEL', "value": 'PRESS'}, None), ("particle.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None), diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 349ed2d5621..7f053101bab 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1443,6 +1443,10 @@ class VIEW3D_MT_select_particle(Menu): layout.separator() + layout.operator("particle.select_linked", text="Select Linked") + + layout.separator() + layout.operator("particle.select_more") layout.operator("particle.select_less") @@ -3120,6 +3124,9 @@ class VIEW3D_MT_particle_context_menu(Menu): layout.operator("particle.select_more") layout.operator("particle.select_less") + layout.separator() + + layout.operator("particle.select_linked", text="Select Linked") class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu): _operator_name = "particle" diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index ca13133662f..92e76ab31fa 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -2075,7 +2075,38 @@ void PARTICLE_OT_select_random(wmOperatorType *ot) /************************ select linked operator ************************/ -static int select_linked_exec(bContext *C, wmOperator *op) +static int select_linked_exec(bContext *C, wmOperator *UNUSED(op)) +{ + PEData data; + PE_set_data(C, &data); + data.select = true; + + foreach_selected_key(&data, select_keys); + + PE_update_selection(data.depsgraph, data.scene, data.ob, 1); + WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, data.ob); + + return OPERATOR_FINISHED; +} + +void PARTICLE_OT_select_linked(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select Linked All"; + ot->idname = "PARTICLE_OT_select_linked"; + ot->description = "Select all keys linked to already selected ones"; + + /* api callbacks */ + ot->exec = select_linked_exec; + ot->poll = PE_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ +} + +static int select_linked_pick_exec(bContext *C, wmOperator *op) { PEData data; int mval[2]; @@ -2097,22 +2128,22 @@ static int select_linked_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int select_linked_invoke(bContext *C, wmOperator *op, const wmEvent *event) +static int select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event) { RNA_int_set_array(op->ptr, "location", event->mval); - return select_linked_exec(C, op); + return select_linked_pick_exec(C, op); } -void PARTICLE_OT_select_linked(wmOperatorType *ot) +void PARTICLE_OT_select_linked_pick(wmOperatorType *ot) { /* identifiers */ ot->name = "Select Linked"; - ot->idname = "PARTICLE_OT_select_linked"; + ot->idname = "PARTICLE_OT_select_linked_pick"; ot->description = "Select nearest particle from mouse pointer"; /* api callbacks */ - ot->exec = select_linked_exec; - ot->invoke = select_linked_invoke; + ot->exec = select_linked_pick_exec; + ot->invoke = select_linked_pick_invoke; ot->poll = PE_poll_view3d; /* flags */ diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h index 3af818b3a9d..87c3a709d47 100644 --- a/source/blender/editors/physics/physics_intern.h +++ b/source/blender/editors/physics/physics_intern.h @@ -38,6 +38,7 @@ void PARTICLE_OT_select_roots(struct wmOperatorType *ot); void PARTICLE_OT_select_tips(struct wmOperatorType *ot); void PARTICLE_OT_select_random(struct wmOperatorType *ot); void PARTICLE_OT_select_linked(struct wmOperatorType *ot); +void PARTICLE_OT_select_linked_pick(struct wmOperatorType *ot); void PARTICLE_OT_select_less(struct wmOperatorType *ot); void PARTICLE_OT_select_more(struct wmOperatorType *ot); diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index d1536733b9b..ea638a2fe44 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -43,6 +43,7 @@ static void operatortypes_particle(void) WM_operatortype_append(PARTICLE_OT_select_tips); WM_operatortype_append(PARTICLE_OT_select_random); WM_operatortype_append(PARTICLE_OT_select_linked); + WM_operatortype_append(PARTICLE_OT_select_linked_pick); WM_operatortype_append(PARTICLE_OT_select_less); WM_operatortype_append(PARTICLE_OT_select_more); |