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:
authorCampbell Barton <ideasman42@gmail.com>2019-03-01 15:09:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-01 15:09:22 +0300
commit3c10de2c9b49589d2943ffb5b235e7930f3a4d17 (patch)
treea7afb84dec674deef90b9b324ff9180fcd8b7525 /source/blender/editors/physics/particle_edit.c
parent3982d3c171522ca730685dd7a14c7dca663d8fe3 (diff)
3D View: avoid redundant circle select updates
This refreshes on cursor motion so it's worth avoiding redundant updates, especially for multi-object edit-modes where many objects aren't even near the object being selected. This commit also moves to passing eSelectOp to circle select functions in preparation for adding a select mode tool option.
Diffstat (limited to 'source/blender/editors/physics/particle_edit.c')
-rw-r--r--source/blender/editors/physics/particle_edit.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index cc96fba6ba8..f9b30de5dc5 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -425,6 +425,7 @@ typedef struct PEData {
int select_action;
int select_toggle_action;
+ bool is_changed;
} PEData;
static void PE_set_data(bContext *C, PEData *data)
@@ -1516,6 +1517,7 @@ static void select_key(PEData *data, int point_index, int key_index, bool UNUSED
key->flag &= ~PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
+ data->is_changed = true;
}
static void select_key_op(PEData *data, int point_index, int key_index, bool is_inside)
@@ -1998,27 +2000,38 @@ int PE_box_select(bContext *C, const rcti *rect, const int sel_op)
/************************ circle select operator ************************/
-int PE_circle_select(bContext *C, int selecting, const int mval[2], float rad)
+bool PE_circle_select(bContext *C, const int sel_op, const int mval[2], float rad)
{
+ BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB));
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
PTCacheEdit *edit = PE_get_current(scene, ob);
PEData data;
- if (!PE_start_edit(edit))
- return OPERATOR_FINISHED;
+ if (!PE_start_edit(edit)) {
+ return false;
+ }
+
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ PE_deselect_all_visible(edit);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
PE_set_view3d_data(C, &data);
data.mval = mval;
data.rad = rad;
- data.select = selecting;
+ data.select = select;
for_mouse_hit_keys(&data, select_key, 0);
+ changed |= data.is_changed;
- PE_update_selection(data.depsgraph, scene, ob, 1);
- WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, ob);
-
- return OPERATOR_FINISHED;
+ if (changed) {
+ PE_update_selection(data.depsgraph, scene, ob, 1);
+ WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, ob);
+ }
+ return changed;
}
/************************ lasso select operator ************************/