[Bf-blender-cvs] [c973e8d2da] blender2.8: Partial "fix" for objects not being selected
Dalai Felinto
noreply at git.blender.org
Tue Feb 7 19:11:30 CET 2017
Commit: c973e8d2da5cf3f615256269128a07390f8c06a9
Author: Dalai Felinto
Date: Tue Feb 7 19:11:17 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBc973e8d2da5cf3f615256269128a07390f8c06a9
Partial "fix" for objects not being selected
To bring this fix a step further we need to address all the BA_WAS_SEL instances, and make sure they follow the new design.
This commit allow you to see the object selected (its center anyways) when you do select all.
Note: in the clay engine selection (a) was already working fine.
===================================================================
M source/blender/blenloader/intern/versioning_280.c
M source/blender/editors/space_view3d/drawobject.c
M source/blender/editors/space_view3d/view3d_draw_legacy.c
M source/blender/editors/space_view3d/view3d_edit.c
M source/blender/editors/space_view3d/view3d_select.c
M source/blender/makesdna/DNA_scene_types.h
===================================================================
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 89ee05ee3e..72859b0b94 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -138,7 +138,7 @@ void do_versions_after_linking_280(Main *main)
/* convert selected bases */
for (BaseLegacy *base = scene->base.first; base; base = base->next) {
Base *ob_base = BKE_scene_layer_base_find(sl, base->object);
- if ((base->flag_legacy & SELECT) != 0) {
+ if ((base->flag & SELECT) != 0) {
if ((ob_base->flag & BASE_SELECTABLED) != 0) {
ob_base->flag |= BASE_SELECTED;
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 44de13c95f..23cbe840c9 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -4254,7 +4254,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
if ((v3d->flag & V3D_SELECT_OUTLINE) &&
((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
- (base->flag_legacy & SELECT) &&
+ (base->flag & BASE_SELECTED) &&
!(G.f & G_PICKSEL || (draw_flags & DRAW_FACE_SELECT)) &&
(draw_wire == OBDRAW_WIRE_OFF))
{
@@ -4325,7 +4325,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
/* draw outline */
if ((v3d->flag & V3D_SELECT_OUTLINE) &&
((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
- (base->flag_legacy & SELECT) &&
+ (base->flag & BASE_SELECTED) &&
(draw_wire == OBDRAW_WIRE_OFF) &&
(ob->sculpt == NULL))
{
@@ -4349,7 +4349,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
if ((v3d->flag & V3D_SELECT_OUTLINE) &&
((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
- (base->flag_legacy & SELECT) &&
+ (base->flag & BASE_SELECTED) &&
(draw_wire == OBDRAW_WIRE_OFF) &&
(ob->sculpt == NULL))
{
@@ -4731,7 +4731,7 @@ static void draw_mesh_fancy_new(Scene *scene, ARegion *ar, View3D *v3d, RegionVi
if ((v3d->flag & V3D_SELECT_OUTLINE) &&
((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
- (base->flag_legacy & SELECT) &&
+ (base->flag & BASE_SELECTED) &&
!(G.f & G_PICKSEL || (draw_flags & DRAW_FACE_SELECT)) &&
(draw_wire == OBDRAW_WIRE_OFF))
{
@@ -4798,7 +4798,7 @@ static void draw_mesh_fancy_new(Scene *scene, ARegion *ar, View3D *v3d, RegionVi
/* TODO: move this into a separate pass */
if ((v3d->flag & V3D_SELECT_OUTLINE) &&
((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
- (base->flag_legacy & SELECT) &&
+ (base->flag & BASE_SELECTED) &&
(draw_wire == OBDRAW_WIRE_OFF) &&
(ob->sculpt == NULL))
{
@@ -4822,7 +4822,7 @@ static void draw_mesh_fancy_new(Scene *scene, ARegion *ar, View3D *v3d, RegionVi
if ((v3d->flag & V3D_SELECT_OUTLINE) &&
((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
- (base->flag_legacy & SELECT) &&
+ (base->flag & BASE_SELECTED) &&
(draw_wire == OBDRAW_WIRE_OFF) &&
(ob->sculpt == NULL))
{
@@ -8109,19 +8109,20 @@ void draw_object_wire_color(Scene *scene, BaseLegacy *base, unsigned char r_ob_w
if ((scene->obedit == NULL) &&
(G.moving & G_TRANSFORM_OBJ) &&
- (base->flag_legacy & (SELECT + BA_WAS_SEL)))
+ (base->flag & BASE_SELECTED) &&
+ (base->flag_legacy & BA_WAS_SEL))
{
theme_id = TH_TRANSFORM;
}
else {
/* Sets the 'colindex' */
if (ID_IS_LINKED_DATABLOCK(ob)) {
- colindex = (base->flag_legacy & (SELECT + BA_WAS_SEL)) ? 2 : 1;
+ colindex = ((base->flag & BASE_SELECTED) && (base->flag_legacy & BA_WAS_SEL)) ? 2 : 1;
}
/* Sets the 'theme_id' or fallback to wire */
else {
if ((ob->flag & OB_FROMGROUP) != 0) {
- if (base->flag_legacy & (SELECT + BA_WAS_SEL)) {
+ if ((base->flag & BASE_SELECTED) && (base->flag_legacy & BA_WAS_SEL)) {
/* uses darker active color for non-active + selected */
theme_id = TH_GROUP_ACTIVE;
@@ -8134,7 +8135,7 @@ void draw_object_wire_color(Scene *scene, BaseLegacy *base, unsigned char r_ob_w
}
}
else {
- if (base->flag_legacy & (SELECT + BA_WAS_SEL)) {
+ if ((base->flag & BASE_SELECTED) && (base->flag_legacy & BA_WAS_SEL)) {
theme_id = scene->basact == base ? TH_ACTIVE : TH_SELECT;
}
else {
@@ -8819,7 +8820,7 @@ afterdraw:
}
else if (is_obact)
do_draw_center = ACTIVE;
- else if (base->flag_legacy & SELECT)
+ else if (base->flag & BASE_SELECTED)
do_draw_center = SELECT;
else if (empty_object || (v3d->flag & V3D_DRAW_CENTERS))
do_draw_center = DESELECT;
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index e75e15c02c..d3cf7cabb9 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -1299,7 +1299,7 @@ void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, BaseLegacy *base
/* define the color here so draw_dupli_objects_color can be called
* from the set loop */
- int color = (base->flag_legacy & SELECT) ? TH_SELECT : TH_WIRE;
+ int color = (base->flag & BASE_SELECTED) ? TH_SELECT : TH_WIRE;
/* debug */
if (base->object->dup_group && base->object->dup_group->id.us < 1)
color = TH_REDALERT;
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 902be0e839..fe6dabe671 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -3540,7 +3540,6 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
Scene *scene = CTX_data_scene(C);
- SceneLayer *sl = CTX_data_scene_layer(C);
int gesture_mode;
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index e7c8cd340c..3d767f9720 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -1075,14 +1075,12 @@ void VIEW3D_OT_select_menu(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "toggle", 0, "Toggle", "Toggle selection instead of deselecting everything first");
}
-static void deselectall_except(Scene *scene, BaseLegacy *b) /* deselect all except b */
+static void deselectall_except(SceneLayer *sl, Base *b) /* deselect all except b */
{
- BaseLegacy *base;
-
- for (base = FIRSTBASE; base; base = base->next) {
+ for (Base *base = sl->object_bases.first; base; base = base->next) {
if (base->flag_legacy & SELECT) {
if (b != base) {
- ED_base_object_select(base, BA_DESELECT);
+ ED_object_base_select(base, BA_DESELECT);
}
}
}
@@ -1095,9 +1093,6 @@ static BaseLegacy *object_mouse_select_menu(bContext *C, ViewContext *vc, unsign
LinkNode *linklist = NULL;
/* handle base->selcol */
- TODO_LAYER_BASE;
-#if 0
-
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
ok = false;
@@ -1169,19 +1164,6 @@ static BaseLegacy *object_mouse_select_menu(bContext *C, ViewContext *vc, unsign
BLI_linklist_free(linklist, NULL);
return NULL;
}
-#else
-
- (void)C;
- (void)vc,
- (void)buffer;
- (void)hits;
- (void)mval;
- (void)toggle;
- (void)baseCount;
- (void)ok;
- (void)linklist;
- return NULL;
-#endif
}
static bool selectbuffer_has_bones(const unsigned int *buffer, const unsigned int hits)
@@ -1424,9 +1406,9 @@ static bool ed_object_select_pick(
{
ViewContext vc;
ARegion *ar = CTX_wm_region(C);
- View3D *v3d = CTX_wm_view3d(C);
Scene *scene = CTX_data_scene(C);
- BaseLegacy *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL;
+ SceneLayer *sl = CTX_data_scene_layer(C);
+ Base *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL;
bool is_obedit;
float dist = ED_view3d_select_dist_px() * 1.3333f;
bool retval = false;
@@ -1444,8 +1426,8 @@ static bool ed_object_select_pick(
}
/* always start list from basact in wire mode */
- startbase = FIRSTBASE;
- if (BASACT && BASACT->next) startbase = BASACT->next;
+ startbase = FIRSTBASE_NEW;
+ if (BASACT_NEW && BASACT_NEW->next) startbase = BASACT_NEW->next;
/* This block uses the control key to make the object selected by its center point rather than its contents */
/* in editmode do not activate */
@@ -1458,13 +1440,13 @@ static bool ed_object_select_pick(
else {
base = startbase;
while (base) {
- if (BASE_SELECTABLE(v3d, base)) {
+ if (BASE_SELECTABLE_NEW(base)) {
float screen_co[2];
if (ED_view3d_project_float_global(ar, base->object->obmat[3], screen_co,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
float dist_temp = len_manhattan_v2v2(mval_fl, screen_co);
- if (base == BASACT) dist_temp += 10.0f;
+ if (base == BASACT_NEW) dist_temp += 10.0f;
if (dist_temp < dist) {
dist = dist_temp;
basact = base;
@@ -1473,7 +1455,7 @@ static bool ed_object_select_pick(
}
base = base->next;
- if (base == NULL) base = FIRSTBASE;
+ if (base == NULL) base = FIRSTBASE_NEW;
if (base == startbase) break;
}
}
@@ -1500,7 +1482,7 @@ static bool ed_object_select_pick(
if (has_bones && basact) {
if (basact->object->type == OB_CAMERA) {
- if (BASACT == basact) {
+ if (BASACT_NEW == basact) {
int i, hitresult;
bool changed = false;
@@ -1538,7 +1520,7 @@ static bool ed_object_select_pick(
changed = true;
}
- basact->flag_legacy |= SELECT;
+ basact->flag |= BASE_SELECTED;
basact->object->flag = basact->flag_legacy;
retval = true;
@@ -1562,22 +1544,22 @@ static bool ed_object_select_pick(
/* we make the armature selected:
* not-selected active object in posemode won
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list