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:
authorDalai Felinto <dfelinto@gmail.com>2018-11-09 19:26:58 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-11-09 21:40:43 +0300
commit221d07864128687858634aebcfb27798a494557a (patch)
tree98b2dd0bafce927616716b8a0c33f0c9ca0612e9 /source/blender/draw/modes/edit_metaball_mode.c
parent983a928e1d481dd91c36f597e2c39daba6d0f8ad (diff)
Multi-Objects Metaball: Selection refactor - fix pick and box selection
This is inspired/based on the code we use for armature bone selection. Both pick selection, and box selection should be working now.
Diffstat (limited to 'source/blender/draw/modes/edit_metaball_mode.c')
-rw-r--r--source/blender/draw/modes/edit_metaball_mode.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/draw/modes/edit_metaball_mode.c b/source/blender/draw/modes/edit_metaball_mode.c
index 9e27ed7bd17..912c30c1482 100644
--- a/source/blender/draw/modes/edit_metaball_mode.c
+++ b/source/blender/draw/modes/edit_metaball_mode.c
@@ -31,6 +31,8 @@
#include "BKE_object.h"
#include "BKE_mball.h"
+#include "ED_mball.h"
+
/* If builtin shaders are needed */
#include "GPU_shader.h"
#include "GPU_select.h"
@@ -147,8 +149,6 @@ static void EDIT_METABALL_cache_populate(void *vedata, Object *ob)
const bool is_select = DRW_state_is_select();
- int selection_id = 0;
-
float draw_scale_xform[3][4]; /* Matrix of Scale and Translation */
{
float scamat[3][3];
@@ -165,7 +165,8 @@ static void EDIT_METABALL_cache_populate(void *vedata, Object *ob)
copy_v3_v3(draw_scale_xform[2], scamat[2]);
}
- for (MetaElem *ml = mb->editelems->first; ml != NULL; ml = ml->next) {
+ int selection_id = ob->select_color;
+ for (MetaElem *ml = mb->editelems->first; ml != NULL; ml = ml->next, selection_id += 0x10000) {
float world_pos[3];
mul_v3_m4v3(world_pos, ob->obmat, &ml->x);
draw_scale_xform[0][3] = world_pos[0];
@@ -178,8 +179,7 @@ static void EDIT_METABALL_cache_populate(void *vedata, Object *ob)
else color = col_radius;
if (is_select) {
- ml->selcol1 = ++selection_id;
- DRW_select_load_id(selection_id);
+ DRW_select_load_id(selection_id | MBALLSEL_RADIUS);
}
DRW_shgroup_call_dynamic_add(group, draw_scale_xform, &ml->rad, color);
@@ -188,8 +188,7 @@ static void EDIT_METABALL_cache_populate(void *vedata, Object *ob)
else color = col_stiffness;
if (is_select) {
- ml->selcol2 = ++selection_id;
- DRW_select_load_id(selection_id);
+ DRW_select_load_id(selection_id | MBALLSEL_STIFF);
}
DRW_shgroup_call_dynamic_add(group, draw_scale_xform, &draw_stiffness_radius, color);