Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2020-02-12 19:08:35 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-02-14 13:37:17 +0300
commit5ca7c85e105d910f554db4855c099a6b74e59886 (patch)
tree2479e2730d57f741d26aa56488725d3ab02bd25a /source/blender/editors
parentd9e4f5a7e8e925a9bc35184cf1228240d93b83f8 (diff)
Particle editmode: add mouse independent "Select Linked" operator
The current "Select Linked" operator works based on mouse position and makes no sense to call from the menus and was removed in rBdd9dfadaac9b. This patch adds an operator independent from mouse position that just selects all keys to a corresponding point (and adds back menu entries, adds keymap entry). The original operator is renamed to 'select_linked_pick' internally (this is now more in line to how "Select Linked" works for meshes, curves etc) Differential Revision: https://developer.blender.org/D6823
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/physics/particle_edit.c45
-rw-r--r--source/blender/editors/physics/physics_intern.h1
-rw-r--r--source/blender/editors/physics/physics_ops.c1
3 files changed, 40 insertions, 7 deletions
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);