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
path: root/source
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-08-24 17:44:10 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-08-24 17:45:43 +0300
commitc899f21800533f0d188c505e3909a3e1f2a0c7f2 (patch)
tree8c2a00b91b61107f1d9335d648a816a700e2af41 /source
parentce34f9348fa35a66a1ffebdaef6e007c5e39eb25 (diff)
Multi-Objects: MESH_OT_select_axis
Now that this operator is working properly (in world space axis), it can be ported for multi object support. The issue of only running on redo is still present though, to be investigated later.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/mesh/editmesh_select.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 4da25be5e95..395943dd4f5 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -4345,10 +4345,10 @@ enum {
/* BMESH_TODO - some way to select on an arbitrary axis */
static int edbm_select_axis_exec(bContext *C, wmOperator *op)
{
+ ViewLayer *view_layer = CTX_data_view_layer(C);
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
- BMesh *bm = em->bm;
- BMVert *v_act = BM_mesh_active_vert_get(bm);
+ BMVert *v_act = BM_mesh_active_vert_get(em->bm);
const int axis = RNA_enum_get(op->ptr, "axis");
const int mode = RNA_enum_get(op->ptr, "mode");
@@ -4356,28 +4356,35 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "This operator requires an active vertex (last selected)");
return OPERATOR_CANCELLED;
}
- else {
- BMVert *v;
- BMIter iter;
- const float limit = RNA_float_get(op->ptr, "threshold");
- float value;
- float vertex_world[3];
+ BMVert *v;
+ BMIter iter;
+ const float limit = RNA_float_get(op->ptr, "threshold");
- mul_v3_m4v3(vertex_world, obedit->obmat, v_act->co);
- value = vertex_world[axis];
+ float value;
+ float vertex_world[3];
- if (mode == SELECT_AXIS_NEGATIVE) {
- value += limit;
- }
- else if (mode == SELECT_AXIS_POSITIVE) {
- value -= limit;
- }
+ mul_v3_m4v3(vertex_world, obedit->obmat, v_act->co);
+ value = vertex_world[axis];
+
+ if (mode == SELECT_AXIS_NEGATIVE) {
+ value += limit;
+ }
+ else if (mode == SELECT_AXIS_POSITIVE) {
+ value -= limit;
+ }
+
+ uint objects_len = 0;
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+ Object *obedit_iter = objects[ob_index];
+ BMEditMesh *em_iter = BKE_editmesh_from_object(obedit_iter);
+ BMesh *bm = em_iter->bm;
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN)) {
float v_iter_world[3];
- mul_v3_m4v3(v_iter_world, obedit->obmat, v->co);
+ mul_v3_m4v3(v_iter_world, obedit_iter->obmat, v->co);
switch (mode) {
case SELECT_AXIS_ALIGNED:
if (fabsf(v_iter_world[axis] - value) < limit) {
@@ -4397,11 +4404,10 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op)
}
}
}
+ EDBM_selectmode_flush(em);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit_iter->data);
}
-
- EDBM_selectmode_flush(em);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
-
+ MEM_freeN(objects);
return OPERATOR_FINISHED;
}