Base: update localview, however ...

Local view will not be supported in 2.8, at least not at first. This updates the code anyways.
This commit is contained in:
Dalai Felinto
2017-03-29 22:13:46 +02:00
parent 08875452b0
commit 61134dc02c

View File

@@ -1287,11 +1287,11 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active)
static bool view3d_localview_init( static bool view3d_localview_init(
wmWindowManager *wm, wmWindow *win, wmWindowManager *wm, wmWindow *win,
Main *bmain, Scene *scene, ScrArea *sa, const int smooth_viewtx, Main *bmain, Scene *scene, SceneLayer *sl, ScrArea *sa, const int smooth_viewtx,
ReportList *reports) ReportList *reports)
{ {
View3D *v3d = sa->spacedata.first; View3D *v3d = sa->spacedata.first;
BaseLegacy *base; Base *base;
float min[3], max[3], box[3], mid[3]; float min[3], max[3], box[3], mid[3];
float size = 0.0f; float size = 0.0f;
unsigned int locallay; unsigned int locallay;
@@ -1315,12 +1315,12 @@ static bool view3d_localview_init(
ok = true; ok = true;
BASACT->lay |= locallay; BASACT_NEW->lay |= locallay;
scene->obedit->lay = BASACT->lay; scene->obedit->lay = BASACT_NEW->lay;
} }
else { else {
for (base = FIRSTBASE; base; base = base->next) { for (base = FIRSTBASE_NEW; base; base = base->next) {
if (TESTBASE(v3d, base)) { if (TESTBASE_NEW(base)) {
BKE_object_minmax(base->object, min, max, false); BKE_object_minmax(base->object, min, max, false);
base->lay |= locallay; base->lay |= locallay;
base->object->lay = base->lay; base->object->lay = base->lay;
@@ -1390,11 +1390,11 @@ static bool view3d_localview_init(
} }
else { else {
/* clear flags */ /* clear flags */
for (base = FIRSTBASE; base; base = base->next) { for (base = FIRSTBASE_NEW; base; base = base->next) {
if (base->lay & locallay) { if (base->lay & locallay) {
base->lay -= locallay; base->lay -= locallay;
if (base->lay == 0) base->lay = v3d->layact; if (base->lay == 0) base->lay = v3d->layact;
if (base->object != scene->obedit) base->flag_legacy |= SELECT; if (base->object != scene->obedit) base->flag |= BASE_SELECTED;
base->object->lay = base->lay; base->object->lay = base->lay;
} }
} }
@@ -1505,6 +1505,7 @@ static int localview_exec(bContext *C, wmOperator *op)
wmWindow *win = CTX_wm_window(C); wmWindow *win = CTX_wm_window(C);
Main *bmain = CTX_data_main(C); Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C); Scene *scene = CTX_data_scene(C);
SceneLayer *sl = CTX_data_scene_layer(C);
ScrArea *sa = CTX_wm_area(C); ScrArea *sa = CTX_wm_area(C);
View3D *v3d = CTX_wm_view3d(C); View3D *v3d = CTX_wm_view3d(C);
bool changed; bool changed;
@@ -1513,7 +1514,7 @@ static int localview_exec(bContext *C, wmOperator *op)
changed = view3d_localview_exit(wm, win, bmain, scene, sa, smooth_viewtx); changed = view3d_localview_exit(wm, win, bmain, scene, sa, smooth_viewtx);
} }
else { else {
changed = view3d_localview_init(wm, win, bmain, scene, sa, smooth_viewtx, op->reports); changed = view3d_localview_init(wm, win, bmain, scene, sl, sa, smooth_viewtx, op->reports);
} }
if (changed) { if (changed) {