Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_draw.c
| Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_anim.h" | #include "BKE_anim.h" | ||||
| #include "BKE_camera.h" | #include "BKE_camera.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_customdata.h" | #include "BKE_customdata.h" | ||||
| #include "BKE_DerivedMesh.h" | #include "BKE_DerivedMesh.h" | ||||
| #include "BKE_image.h" | #include "BKE_image.h" | ||||
| #include "BKE_key.h" | #include "BKE_key.h" | ||||
| #include "BKE_localview.h" | |||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_paint.h" | #include "BKE_paint.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "BKE_unit.h" | #include "BKE_unit.h" | ||||
| #include "BKE_movieclip.h" | #include "BKE_movieclip.h" | ||||
| ▲ Show 20 Lines • Show All 764 Lines • ▼ Show 20 Lines | static void draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect) | ||||
| const char *name = view3d_get_name(v3d, rv3d); | const char *name = view3d_get_name(v3d, rv3d); | ||||
| /* increase size for unicode languages (Chinese in utf-8...) */ | /* increase size for unicode languages (Chinese in utf-8...) */ | ||||
| #ifdef WITH_INTERNATIONAL | #ifdef WITH_INTERNATIONAL | ||||
| char tmpstr[96]; | char tmpstr[96]; | ||||
| #else | #else | ||||
| char tmpstr[32]; | char tmpstr[32]; | ||||
| #endif | #endif | ||||
| if (v3d->localvd) { | if (v3d->localviewd) { | ||||
| BLI_snprintf(tmpstr, sizeof(tmpstr), IFACE_("%s (Local)"), name); | BLI_snprintf(tmpstr, sizeof(tmpstr), IFACE_("%s (Local)"), name); | ||||
| name = tmpstr; | name = tmpstr; | ||||
| } | } | ||||
| UI_ThemeColor(TH_TEXT_HI); | UI_ThemeColor(TH_TEXT_HI); | ||||
| #ifdef WITH_INTERNATIONAL | #ifdef WITH_INTERNATIONAL | ||||
| BLF_draw_default(U.widget_unit + rect->xmin, rect->ymax - U.widget_unit, 0.0f, name, sizeof(tmpstr)); | BLF_draw_default(U.widget_unit + rect->xmin, rect->ymax - U.widget_unit, 0.0f, name, sizeof(tmpstr)); | ||||
| #else | #else | ||||
| ▲ Show 20 Lines • Show All 554 Lines • ▼ Show 20 Lines | else { | ||||
| glClear(GL_COLOR_BUFFER_BIT); | glClear(GL_COLOR_BUFFER_BIT); | ||||
| glDisable(GL_DEPTH_TEST); | glDisable(GL_DEPTH_TEST); | ||||
| } | } | ||||
| if (rv3d->rflag & RV3D_CLIPPING) | if (rv3d->rflag & RV3D_CLIPPING) | ||||
| ED_view3d_clipping_set(rv3d); | ED_view3d_clipping_set(rv3d); | ||||
| G.f |= G_BACKBUFSEL; | G.f |= G_BACKBUFSEL; | ||||
| if (base && (base->lay & v3d->lay)) | if (base && (base->lay & v3d->lay) && BKE_localview_is_object_visible(v3d, base->object)) { | ||||
| draw_object_backbufsel(scene, v3d, rv3d, base->object); | draw_object_backbufsel(scene, v3d, rv3d, base->object); | ||||
| } | |||||
| if (rv3d->gpuoffscreen) | if (rv3d->gpuoffscreen) | ||||
| GPU_offscreen_unbind(rv3d->gpuoffscreen, true); | GPU_offscreen_unbind(rv3d->gpuoffscreen, true); | ||||
| else | else | ||||
| ar->swap = 0; /* mark invalid backbuf for wm draw */ | ar->swap = 0; /* mark invalid backbuf for wm draw */ | ||||
| v3d->flag &= ~V3D_INVALID_BACKBUF; | v3d->flag &= ~V3D_INVALID_BACKBUF; | ||||
| G.f &= ~G_BACKBUFSEL; | G.f &= ~G_BACKBUFSEL; | ||||
| ▲ Show 20 Lines • Show All 969 Lines • ▼ Show 20 Lines | void ED_view3d_draw_depth(Scene *scene, ARegion *ar, View3D *v3d, bool alphaoverride) | ||||
| v3d->zbuf = true; | v3d->zbuf = true; | ||||
| glEnable(GL_DEPTH_TEST); | glEnable(GL_DEPTH_TEST); | ||||
| /* draw set first */ | /* draw set first */ | ||||
| if (scene->set) { | if (scene->set) { | ||||
| Scene *sce_iter; | Scene *sce_iter; | ||||
| for (SETLOOPER(scene->set, sce_iter, base)) { | for (SETLOOPER(scene->set, sce_iter, base)) { | ||||
| if (v3d->lay & base->lay) { | if (v3d->lay & base->lay && BKE_localview_is_object_visible(v3d, base->object)) { | ||||
| draw_object(scene, ar, v3d, base, 0); | draw_object(scene, ar, v3d, base, 0); | ||||
| if (base->object->transflag & OB_DUPLI) { | if (base->object->transflag & OB_DUPLI) { | ||||
| draw_dupli_objects_color(scene, ar, v3d, base, dflag_depth, TH_UNDEFINED); | draw_dupli_objects_color(scene, ar, v3d, base, dflag_depth, TH_UNDEFINED); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| for (base = scene->base.first; base; base = base->next) { | for (base = scene->base.first; base; base = base->next) { | ||||
| if (v3d->lay & base->lay) { | if (v3d->lay & base->lay && BKE_localview_is_object_visible(v3d, base->object)) { | ||||
| /* dupli drawing */ | /* dupli drawing */ | ||||
| if (base->object->transflag & OB_DUPLI) { | if (base->object->transflag & OB_DUPLI) { | ||||
| draw_dupli_objects_color(scene, ar, v3d, base, dflag_depth, TH_UNDEFINED); | draw_dupli_objects_color(scene, ar, v3d, base, dflag_depth, TH_UNDEFINED); | ||||
| } | } | ||||
| draw_object(scene, ar, v3d, base, dflag_depth); | draw_object(scene, ar, v3d, base, dflag_depth); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 370 Lines • ▼ Show 20 Lines | if (rv3d->rflag & RV3D_CLIPPING) { | ||||
| ED_view3d_clipping_set(rv3d); | ED_view3d_clipping_set(rv3d); | ||||
| } | } | ||||
| /* draw set first */ | /* draw set first */ | ||||
| if (scene->set) { | if (scene->set) { | ||||
| const short dflag = DRAW_CONSTCOLOR | DRAW_SCENESET; | const short dflag = DRAW_CONSTCOLOR | DRAW_SCENESET; | ||||
| Scene *sce_iter; | Scene *sce_iter; | ||||
| for (SETLOOPER(scene->set, sce_iter, base)) { | for (SETLOOPER(scene->set, sce_iter, base)) { | ||||
| if (v3d->lay & base->lay) { | if (v3d->lay & base->lay && BKE_localview_is_object_visible(v3d, base->object)) { | ||||
| UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f); | UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f); | ||||
| draw_object(scene, ar, v3d, base, dflag); | draw_object(scene, ar, v3d, base, dflag); | ||||
| if (base->object->transflag & OB_DUPLI) { | if (base->object->transflag & OB_DUPLI) { | ||||
| draw_dupli_objects_color(scene, ar, v3d, base, dflag, TH_UNDEFINED); | draw_dupli_objects_color(scene, ar, v3d, base, dflag, TH_UNDEFINED); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Transp and X-ray afterdraw stuff for sets is done later */ | /* Transp and X-ray afterdraw stuff for sets is done later */ | ||||
| } | } | ||||
| if (draw_offscreen) { | if (draw_offscreen) { | ||||
| for (base = scene->base.first; base; base = base->next) { | for (base = scene->base.first; base; base = base->next) { | ||||
| if (v3d->lay & base->lay) { | if (v3d->lay & base->lay && BKE_localview_is_object_visible(v3d, base->object)) { | ||||
| /* dupli drawing */ | /* dupli drawing */ | ||||
| if (base->object->transflag & OB_DUPLI) | if (base->object->transflag & OB_DUPLI) | ||||
| draw_dupli_objects(scene, ar, v3d, base); | draw_dupli_objects(scene, ar, v3d, base); | ||||
| draw_object(scene, ar, v3d, base, 0); | draw_object(scene, ar, v3d, base, 0); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| unsigned int lay_used = 0; | unsigned int lay_used = 0; | ||||
| /* then draw not selected and the duplis, but skip editmode object */ | /* then draw not selected and the duplis, but skip editmode object */ | ||||
| for (base = scene->base.first; base; base = base->next) { | for (base = scene->base.first; base; base = base->next) { | ||||
| lay_used |= base->lay; | lay_used |= base->lay; | ||||
| if (v3d->lay & base->lay) { | if (v3d->lay & base->lay && BKE_localview_is_object_visible(v3d, base->object)) { | ||||
| /* dupli drawing */ | /* dupli drawing */ | ||||
| if (base->object->transflag & OB_DUPLI) { | if (base->object->transflag & OB_DUPLI) { | ||||
| draw_dupli_objects(scene, ar, v3d, base); | draw_dupli_objects(scene, ar, v3d, base); | ||||
| } | } | ||||
| if ((base->flag & SELECT) == 0) { | if ((base->flag & SELECT) == 0) { | ||||
| if (base->object != scene->obedit) | if (base->object != scene->obedit) | ||||
| draw_object(scene, ar, v3d, base, 0); | draw_object(scene, ar, v3d, base, 0); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* mask out localview */ | /* mask out localview */ | ||||
| v3d->lay_used = lay_used & ((1 << 20) - 1); | v3d->lay_used = lay_used; | ||||
| /* draw selected and editmode */ | /* draw selected and editmode */ | ||||
| for (base = scene->base.first; base; base = base->next) { | for (base = scene->base.first; base; base = base->next) { | ||||
| if (v3d->lay & base->lay) { | if (v3d->lay & base->lay && BKE_localview_is_object_visible(v3d, base->object)) { | ||||
| if (base->object == scene->obedit || (base->flag & SELECT)) { | if (base->object == scene->obedit || (base->flag & SELECT)) { | ||||
| draw_object(scene, ar, v3d, base, 0); | draw_object(scene, ar, v3d, base, 0); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* perspective floor goes last to use scene depth and avoid writing to depth buffer */ | /* perspective floor goes last to use scene depth and avoid writing to depth buffer */ | ||||
| ▲ Show 20 Lines • Show All 1,312 Lines • Show Last 20 Lines | |||||