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:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-06-07 18:35:23 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-06-08 11:46:45 +0300
commit23c93873f4073e440d3817465252d8f86134654c (patch)
treea2d8d03ca46d21ef6bca1aff38a6b7f2139343a9 /source
parentd675415eef9f565b1828f48dfe874321af1c4af8 (diff)
Remove selection color from the base
Use indirect access to it via object. It was already flushing from base to object, now we can avoid such flushing. Still weird to have selection color filled in by dependency graph, but now there is no synchronization going on at least.
Diffstat (limited to 'source')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc4
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query.cc1
-rw-r--r--source/blender/draw/intern/draw_armature.c2
-rw-r--r--source/blender/draw/intern/draw_manager.c2
-rw-r--r--source/blender/editors/armature/armature_select.c2
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c8
-rw-r--r--source/blender/editors/space_view3d/drawobject.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c20
-rw-r--r--source/blender/makesdna/DNA_layer_types.h2
-rw-r--r--source/blender/makesdna/DNA_object_types.h2
11 files changed, 26 insertions, 27 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc
index 556db3bd651..71c74aad966 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc
@@ -81,12 +81,12 @@ void DepsgraphNodeBuilder::build_scene(Main *bmain, Scene *scene)
}
/* scene objects */
- int selection_color = 1;
+ int select_color = 1;
for (SceneLayer *sl = (SceneLayer *)scene->render_layers.first; sl; sl = sl->next) {
for (Base *base = (Base *)sl->object_bases.first; base; base = base->next) {
/* object itself */
build_object(scene, base->object);
- base->selcol = selection_color++;
+ base->object->select_color = select_color++;
}
}
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index 0661f24fb7b..8022a11818a 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -135,7 +135,6 @@ static void deg_flush_base_flags_and_settings(Object *ob, Base *base, const int
{
ob->base_flag = (base->flag | BASE_FLUSH_FLAGS) & flag;
ob->base_collection_properties = base->collection_properties;
- ob->base_selection_color = base->selcol;
}
static bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c
index bbb22ad2548..47af8a3c8a4 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -1297,7 +1297,7 @@ static void draw_armature_pose(Object *ob, const float const_color[4])
}
if (arm->flag & ARM_POSEMODE) {
- index = ob->base_selection_color;
+ index = ob->select_color;
}
}
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 7d6907ec318..08ff7b52a38 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -3052,7 +3052,7 @@ void DRW_draw_select_loop(
DEG_OBJECT_ITER(graph, ob, DEG_OBJECT_ITER_FLAG_DUPLI)
{
if ((ob->base_flag & BASE_SELECTABLED) != 0) {
- DRW_select_load_id(ob->base_selection_color);
+ DRW_select_load_id(ob->select_color);
DRW_engines_cache_populate(ob);
}
}
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 8db1cb7d6c0..17dc8eac38c 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -98,7 +98,7 @@ void *get_bone_from_selectbuffer(
/* Determine what the current bone is */
if (obedit == NULL || base->object != obedit) {
/* no singular posemode, so check for correct object */
- if (base->selcol == (hitresult & 0xFFFF)) {
+ if (base->object->select_color == (hitresult & 0xFFFF)) {
bone = get_indexed_bone(base->object, hitresult);
if (findunsel)
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 621c217fd89..2152d67e447 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -2001,7 +2001,7 @@ static void draw_pose_bones(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *
/* if solid we draw that first, with selection codes, but without names, axes etc */
if (dt > OB_WIRE) {
if (arm->flag & ARM_POSEMODE)
- index = base->selcol;
+ index = base->object->select_color;
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
bone = pchan->bone;
@@ -2104,7 +2104,7 @@ static void draw_pose_bones(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *
(draw_wire || (dt <= OB_WIRE)) )
{
if (arm->flag & ARM_POSEMODE)
- index = base->selcol;
+ index = base->object->select_color;
/* only draw custom bone shapes that need to be drawn as wires */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
@@ -2175,7 +2175,7 @@ static void draw_pose_bones(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *
/* draw line check first. we do selection indices */
if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
if (arm->flag & ARM_POSEMODE)
- index = base->selcol;
+ index = base->object->select_color;
}
/* if solid && posemode, we draw again with polygonoffset */
else if ((dt > OB_WIRE) && (arm->flag & ARM_POSEMODE)) {
@@ -2184,7 +2184,7 @@ static void draw_pose_bones(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *
else {
/* and we use selection indices if not done yet */
if (arm->flag & ARM_POSEMODE)
- index = base->selcol;
+ index = base->object->select_color;
}
if (is_cull_enabled == false) {
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 7bb95ba6d15..a86614c52fd 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1727,7 +1727,7 @@ static void draw_viewport_object_reconstruction(
continue;
if (dflag & DRAW_PICKING)
- GPU_select_load_id(base->selcol + (tracknr << 16));
+ GPU_select_load_id(base->object->select_color + (tracknr << 16));
gpuPushMatrix();
gpuTranslate3fv(track->bundle_pos);
@@ -1889,7 +1889,7 @@ static void draw_viewport_reconstruction(
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
if (dflag & DRAW_PICKING)
- GPU_select_load_id(base->selcol);
+ GPU_select_load_id(base->object->select_color);
}
/* camera frame */
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index a27c5df9128..4c15a291c9c 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -914,7 +914,7 @@ static void view3d_draw_xray_select(Scene *scene, SceneLayer *sl, ARegion *ar, V
v3d->xray = true;
while ((v3da = BLI_pophead(&v3d->afterdraw_xray))) {
- if (GPU_select_load_id(v3da->base->selcol)) {
+ if (GPU_select_load_id(v3da->base->object->select_color)) {
draw_object_select(scene, sl, ar, v3d, v3da->base, v3da->dflag);
}
MEM_freeN(v3da);
@@ -1301,10 +1301,10 @@ void ED_view3d_draw_select_loop(
if (((base->flag & BASE_SELECTABLED) == 0) ||
(use_obedit_skip && (scene->obedit->data == base->object->data)))
{
- base->selcol = 0;
+ base->object->select_color = 0;
}
else {
- base->selcol = code;
+ base->object->select_color = code;
if (use_nearest && (base->object->dtx & OB_DRAWXRAY)) {
ED_view3d_after_add(&v3d->afterdraw_xray, base, dflag);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 770e4050fd9..049c0367ce6 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -906,7 +906,7 @@ static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
base = LASTBASE;
if (base == 0) return 0;
- maxob = base->selcol;
+ maxob = base->object->select_color;
len = (size - 1) / 2;
rc = 0;
@@ -1068,7 +1068,7 @@ static Base *object_mouse_select_menu(
bool ok;
LinkNode *linklist = NULL;
- /* handle base->selcol */
+ /* handle base->object->select_color */
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
ok = false;
@@ -1077,7 +1077,7 @@ static Base *object_mouse_select_menu(
if (buffer) {
for (int a = 0; a < hits; a++) {
/* index was converted */
- if (base->selcol == (buffer[(4 * a) + 3] & ~0xFFFF0000)) {
+ if (base->object->select_color == (buffer[(4 * a) + 3] & ~0xFFFF0000)) {
ok = true;
break;
}
@@ -1286,7 +1286,9 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
}
else {
/* only exclude active object when it is selected... */
- if (BASACT_NEW && (BASACT_NEW->flag & BASE_SELECTED) && hits > 1) notcol = BASACT_NEW->selcol;
+ if (BASACT_NEW && (BASACT_NEW->flag & BASE_SELECTED) && hits > 1) {
+ notcol = BASACT_NEW->object->select_color;
+ }
for (a = 0; a < hits; a++) {
if (min > buffer[4 * a + 1] && notcol != (buffer[4 * a + 3] & 0xFFFF)) {
@@ -1299,7 +1301,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
base = FIRSTBASE_NEW;
while (base) {
if (BASE_SELECTABLE_NEW(base)) {
- if (base->selcol == selcol) break;
+ if (base->object->select_color == selcol) break;
}
base = base->next;
}
@@ -1322,12 +1324,12 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
if (has_bones) {
/* skip non-bone objects */
if ((buffer[4 * a + 3] & 0xFFFF0000)) {
- if (base->selcol == (buffer[(4 * a) + 3] & 0xFFFF))
+ if (base->object->select_color == (buffer[(4 * a) + 3] & 0xFFFF))
basact = base;
}
}
else {
- if (base->selcol == (buffer[(4 * a) + 3] & 0xFFFF))
+ if (base->object->select_color == (buffer[(4 * a) + 3] & 0xFFFF))
basact = base;
}
}
@@ -1481,7 +1483,7 @@ static bool ed_object_select_pick(
/* if there's bundles in buffer select bundles first,
* so non-camera elements should be ignored in buffer */
- if (basact->selcol != (hitresult & 0xFFFF)) {
+ if (basact->object->select_color != (hitresult & 0xFFFF)) {
continue;
}
@@ -2071,7 +2073,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
*/
for (base = vc->scene_layer->object_bases.first; base && hits; base = base->next) {
if (BASE_SELECTABLE_NEW(base)) {
- while (base->selcol == (*col & 0xFFFF)) { /* we got an object */
+ while (base->object->select_color == (*col & 0xFFFF)) { /* we got an object */
if (*col & 0xFFFF0000) { /* we got a bone */
bone = get_indexed_bone(base->object, *col & ~(BONESEL_ANY));
if (bone) {
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h
index 1e6657ae29c..03ca6cd8c5c 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -39,10 +39,8 @@ typedef struct Base {
short refcount;
short sx, sy;
struct Object *object;
- unsigned int selcol;
unsigned int lay;
int flag_legacy;
- int pad;
struct IDProperty *collection_properties; /* used by depsgraph, flushed from collection-tree */
} Base;
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 397781110b4..4840b453e09 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -325,7 +325,7 @@ typedef struct Object {
ListBase drawdata; /* runtime, ObjectEngineData */
int deg_update_flag; /* what has been updated in this object */
- int base_selection_color; /* flushed by depsgraph only */
+ int select_color;
int pad3[2];
} Object;