diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-09-04 16:08:57 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-09-04 17:11:27 +0300 |
commit | fc115e1ab23a9c458ea1496f160e14009e68cd54 (patch) | |
tree | f61d7a4d8c09d5ebf6839299ec00998976f31f3f /source/blender/editors/space_view3d | |
parent | 0f50caf5560f9c2f9af393eefdf2b209210dbfba (diff) |
Cleanup: remove legacy layer and dupli code.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 24 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_header.c | 154 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_ops.c | 1 |
4 files changed, 0 insertions, 180 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 674f4e1f778..a8e530540a1 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -316,9 +316,7 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene) v3d = MEM_callocN(sizeof(View3D), "initview3d"); v3d->spacetype = SPACE_VIEW3D; - v3d->lay = v3d->layact = 1; if (scene) { - v3d->lay = v3d->layact = scene->lay; v3d->camera = scene->camera; } v3d->scenelock = true; @@ -432,7 +430,6 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl) if (v3dn->localvd) { v3dn->localvd = NULL; v3dn->properties_storage = NULL; - v3dn->lay = v3do->localvd->lay & 0xFFFFFF; } if (v3dn->shading.type == OB_RENDER) @@ -766,25 +763,6 @@ static void *view3d_main_region_duplicate(void *poin) return NULL; } -static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, const Scene *UNUSED(scene)) -{ - wmWindow *win = wmn->wm->winactive; - unsigned int lay_used = 0; - - if (!win) return; - - const bScreen *screen = WM_window_get_active_screen(win); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->spacetype == SPACE_VIEW3D) { - if (BLI_findindex(&sa->regionbase, ar) != -1) { - View3D *v3d = sa->spacedata.first; - v3d->lay_used = lay_used; - break; - } - } - } -} - static void view3d_main_region_listener( wmWindow *UNUSED(win), ScrArea *sa, ARegion *ar, wmNotifier *wmn, const Scene *scene) @@ -821,8 +799,6 @@ static void view3d_main_region_listener( switch (wmn->data) { case ND_SCENEBROWSE: case ND_LAYER_CONTENT: - if (wmn->reference) - view3d_recalc_used_layers(ar, wmn, wmn->reference); ED_region_tag_redraw(ar); WM_gizmomap_tag_refresh(gzmap); break; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index fe1877f62fa..1091b7a7f63 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1598,7 +1598,6 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple( ar.regiontype = RGN_TYPE_WINDOW; v3d.camera = camera; - v3d.lay = scene->lay; v3d.shading.type = drawtype; v3d.flag2 = V3D_RENDER_OVERRIDE; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 83cabd2a60e..854bf01b158 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -69,160 +69,6 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event); #define B_SEL_EDGE 111 #define B_SEL_FACE 112 -/* XXX quickly ported across */ -static void handle_view3d_lock(bContext *C) -{ - Scene *scene = CTX_data_scene(C); - ScrArea *sa = CTX_wm_area(C); - View3D *v3d = CTX_wm_view3d(C); - - if (v3d != NULL && sa != NULL) { - if (v3d->localvd == NULL && v3d->scenelock && sa->spacetype == SPACE_VIEW3D) { - /* copy to scene */ - scene->lay = v3d->lay; - scene->layact = v3d->layact; - scene->camera = v3d->camera; - - /* notifiers for scene update */ - WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); - } - } -} - -/** - * layer code is on three levels actually: - * - here for operator - * - uiTemplateLayers in interface/ code for buttons - * - ED_view3d_view_layer_set for RNA - */ -static void view3d_layers_editmode_ensure(View3D *v3d, Object *obedit) -{ - /* sanity check - when in editmode disallow switching the editmode layer off since its confusing - * an alternative would be to always draw the editmode object. */ - if (obedit && (obedit->lay & v3d->lay) == 0) { - int bit; - for (bit = 0; bit < 32; bit++) { - if (obedit->lay & (1u << bit)) { - v3d->lay |= (1u << bit); - break; - } - } - } -} - -static int view3d_layers_exec(bContext *C, wmOperator *op) -{ - ScrArea *sa = CTX_wm_area(C); - View3D *v3d = sa->spacedata.first; - Object *obedit = CTX_data_edit_object(C); - int nr = RNA_int_get(op->ptr, "nr"); - const bool toggle = RNA_boolean_get(op->ptr, "toggle"); - - if (nr < 0) - return OPERATOR_CANCELLED; - - if (nr == 0) { - /* all layers */ - if (!v3d->lay_prev) - v3d->lay_prev = 1; - - if (toggle && v3d->lay == ((1 << 20) - 1)) { - /* return to active layer only */ - v3d->lay = v3d->lay_prev; - - view3d_layers_editmode_ensure(v3d, obedit); - } - else { - v3d->lay_prev = v3d->lay; - v3d->lay |= (1 << 20) - 1; - } - } - else { - int bit; - nr--; - - if (RNA_boolean_get(op->ptr, "extend")) { - if (toggle && v3d->lay & (1 << nr) && (v3d->lay & ~(1 << nr))) - v3d->lay &= ~(1 << nr); - else - v3d->lay |= (1 << nr); - } - else { - v3d->lay = (1 << nr); - } - - view3d_layers_editmode_ensure(v3d, obedit); - - /* set active layer, ensure to always have one */ - if (v3d->lay & (1 << nr)) - v3d->layact = 1 << nr; - else if ((v3d->lay & v3d->layact) == 0) { - for (bit = 0; bit < 32; bit++) { - if (v3d->lay & (1u << bit)) { - v3d->layact = (1u << bit); - break; - } - } - } - } - - if (v3d->scenelock) handle_view3d_lock(C); - - DEG_on_visible_update(CTX_data_main(C), false); - - ED_area_tag_redraw(sa); - - return OPERATOR_FINISHED; -} - -/* applies shift and alt, lazy coding or ok? :) */ -/* the local per-keymap-entry keymap will solve it */ -static int view3d_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event) -{ - if (event->ctrl || event->oskey) - return OPERATOR_PASS_THROUGH; - - if (event->shift) - RNA_boolean_set(op->ptr, "extend", true); - else - RNA_boolean_set(op->ptr, "extend", false); - - if (event->alt) { - const int nr = RNA_int_get(op->ptr, "nr") + 10; - RNA_int_set(op->ptr, "nr", nr); - } - view3d_layers_exec(C, op); - - return OPERATOR_FINISHED; -} - -static bool view3d_layers_poll(bContext *C) -{ - return (ED_operator_view3d_active(C) && CTX_wm_view3d(C)->localvd == NULL); -} - -void VIEW3D_OT_layers(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Layers"; - ot->description = "Toggle layer(s) visibility"; - ot->idname = "VIEW3D_OT_layers"; - - /* api callbacks */ - ot->invoke = view3d_layers_invoke; - ot->exec = view3d_layers_exec; - ot->poll = view3d_layers_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - RNA_def_int(ot->srna, "nr", 1, 0, 20, "Number", "The layer number to set, zero for all layers", 0, 20); - RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Add this layer to the current view layers"); - RNA_def_boolean(ot->srna, "toggle", 1, "Toggle", "Toggle the layer"); -} - -/** \} */ - /* -------------------------------------------------------------------- */ /** \name Toggle Matcap Flip Operator * \{ */ diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index c53382a60ad..bda3c337d04 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -208,7 +208,6 @@ void view3d_operatortypes(void) WM_operatortype_append(VIEW3D_OT_walk); WM_operatortype_append(VIEW3D_OT_navigate); WM_operatortype_append(VIEW3D_OT_ruler); - WM_operatortype_append(VIEW3D_OT_layers); WM_operatortype_append(VIEW3D_OT_copybuffer); WM_operatortype_append(VIEW3D_OT_pastebuffer); |