Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_draw.cc
| Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | ||||||||||
| #include "ED_gpencil.h" | #include "ED_gpencil.h" | |||||||||
| #include "ED_info.h" | #include "ED_info.h" | |||||||||
| #include "ED_keyframing.h" | #include "ED_keyframing.h" | |||||||||
| #include "ED_screen.h" | #include "ED_screen.h" | |||||||||
| #include "ED_screen_types.h" | #include "ED_screen_types.h" | |||||||||
| #include "ED_transform.h" | #include "ED_transform.h" | |||||||||
| #include "ED_view3d_offscreen.h" | #include "ED_view3d_offscreen.h" | |||||||||
| #include "ED_viewer_path.hh" | ||||||||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | |||||||||
| #include "GPU_batch.h" | #include "GPU_batch.h" | |||||||||
| #include "GPU_batch_presets.h" | #include "GPU_batch_presets.h" | |||||||||
| #include "GPU_framebuffer.h" | #include "GPU_framebuffer.h" | |||||||||
| #include "GPU_immediate.h" | #include "GPU_immediate.h" | |||||||||
| #include "GPU_immediate_util.h" | #include "GPU_immediate_util.h" | |||||||||
| ▲ Show 20 Lines • Show All 1,223 Lines • ▼ Show 20 Lines | static void draw_viewport_name(ARegion *region, View3D *v3d, int xoffset, int *yoffset) | |||||||||
| BLF_disable(font_id, BLF_SHADOW); | BLF_disable(font_id, BLF_SHADOW); | |||||||||
| } | } | |||||||||
| /** | /** | |||||||||
| * Draw info beside axes in top-left corner: | * Draw info beside axes in top-left corner: | |||||||||
| * frame-number, collection, object name, bone name (if available), marker name (if available). | * frame-number, collection, object name, bone name (if available), marker name (if available). | |||||||||
| */ | */ | |||||||||
| static void draw_selected_name( | static void draw_selected_name( | |||||||||
| Scene *scene, ViewLayer *view_layer, Object *ob, int xoffset, int *yoffset) | const View3D *v3d, Scene *scene, ViewLayer *view_layer, Object *ob, int xoffset, int *yoffset) | |||||||||
HooglyBooglyUnsubmitted Done Inline Actions
HooglyBoogly: | ||||||||||
| { | { | |||||||||
| const int cfra = scene->r.cfra; | const int cfra = scene->r.cfra; | |||||||||
| const char *msg_pin = " (Pinned)"; | const char *msg_pin = " (Pinned)"; | |||||||||
| const char *msg_sep = " : "; | const char *msg_sep = " : "; | |||||||||
| const int font_id = BLF_default(); | const int font_id = BLF_default(); | |||||||||
| char info[300]; | char info[300]; | |||||||||
| ▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | else { | |||||||||
| UI_FontThemeColor(font_id, TH_TEXT_HI); | UI_FontThemeColor(font_id, TH_TEXT_HI); | |||||||||
| } | } | |||||||||
| } | } | |||||||||
| if (markern) { | if (markern) { | |||||||||
| s += sprintf(s, " <%s>", markern); | s += sprintf(s, " <%s>", markern); | |||||||||
| } | } | |||||||||
| if (v3d->flag2 & V3D_SHOW_VIEWER) { | ||||||||||
| if (!BLI_listbase_is_empty(&v3d->viewer_path.path)) { | ||||||||||
| s += sprintf(s, IFACE_(" (Viewer)")); | ||||||||||
| } | ||||||||||
| } | ||||||||||
| BLF_enable(font_id, BLF_SHADOW); | BLF_enable(font_id, BLF_SHADOW); | |||||||||
| BLF_shadow(font_id, 5, float4{0.0f, 0.0f, 0.0f, 1.0f}); | BLF_shadow(font_id, 5, float4{0.0f, 0.0f, 0.0f, 1.0f}); | |||||||||
| BLF_shadow_offset(font_id, 1, -1); | BLF_shadow_offset(font_id, 1, -1); | |||||||||
| *yoffset -= VIEW3D_OVERLAY_LINEHEIGHT; | *yoffset -= VIEW3D_OVERLAY_LINEHEIGHT; | |||||||||
| BLF_draw_default(xoffset, *yoffset, 0.0f, info, sizeof(info)); | BLF_draw_default(xoffset, *yoffset, 0.0f, info, sizeof(info)); | |||||||||
| BLF_disable(font_id, BLF_SHADOW); | BLF_disable(font_id, BLF_SHADOW); | |||||||||
| ▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | if ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0 && (v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) == 0) { | |||||||||
| } | } | |||||||||
| else if (U.uiflag & USER_SHOW_VIEWPORTNAME) { | else if (U.uiflag & USER_SHOW_VIEWPORTNAME) { | |||||||||
| draw_viewport_name(region, v3d, xoffset, &yoffset); | draw_viewport_name(region, v3d, xoffset, &yoffset); | |||||||||
| } | } | |||||||||
| if (U.uiflag & USER_DRAWVIEWINFO) { | if (U.uiflag & USER_DRAWVIEWINFO) { | |||||||||
| BKE_view_layer_synced_ensure(scene, view_layer); | BKE_view_layer_synced_ensure(scene, view_layer); | |||||||||
| Object *ob = BKE_view_layer_active_object_get(view_layer); | Object *ob = BKE_view_layer_active_object_get(view_layer); | |||||||||
| draw_selected_name(scene, view_layer, ob, xoffset, &yoffset); | draw_selected_name(v3d, scene, view_layer, ob, xoffset, &yoffset); | |||||||||
| } | } | |||||||||
| if (v3d->gridflag & (V3D_SHOW_FLOOR | V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) { | if (v3d->gridflag & (V3D_SHOW_FLOOR | V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) { | |||||||||
| /* draw below the viewport name */ | /* draw below the viewport name */ | |||||||||
| draw_grid_unit_name(scene, region, v3d, xoffset, &yoffset); | draw_grid_unit_name(scene, region, v3d, xoffset, &yoffset); | |||||||||
| } | } | |||||||||
| DRW_draw_region_engine_info(xoffset, &yoffset, VIEW3D_OVERLAY_LINEHEIGHT); | DRW_draw_region_engine_info(xoffset, &yoffset, VIEW3D_OVERLAY_LINEHEIGHT); | |||||||||
| Show All 39 Lines | RenderEngineType *ED_view3d_engine_type(const Scene *scene, int drawtype) | |||||||||
| */ | */ | |||||||||
| RenderEngineType *type = RE_engines_find(scene->r.engine); | RenderEngineType *type = RE_engines_find(scene->r.engine); | |||||||||
| if (drawtype == OB_MATERIAL && (type->flag & RE_USE_EEVEE_VIEWPORT)) { | if (drawtype == OB_MATERIAL && (type->flag & RE_USE_EEVEE_VIEWPORT)) { | |||||||||
| return RE_engines_find(RE_engine_id_BLENDER_EEVEE); | return RE_engines_find(RE_engine_id_BLENDER_EEVEE); | |||||||||
| } | } | |||||||||
| return type; | return type; | |||||||||
| } | } | |||||||||
| static void view3d_update_viewer_path(const bContext *C) | ||||||||||
| { | ||||||||||
| View3D *v3d = CTX_wm_view3d(C); | ||||||||||
| WorkSpace *workspace = CTX_wm_workspace(C); | ||||||||||
| /* Always use viewer path from workspace, pinning is not supported currently. */ | ||||||||||
| if (!BKE_viewer_path_equal(&v3d->viewer_path, &workspace->viewer_path)) { | ||||||||||
| BKE_viewer_path_clear(&v3d->viewer_path); | ||||||||||
| BKE_viewer_path_copy(&v3d->viewer_path, &workspace->viewer_path); | ||||||||||
| } | ||||||||||
| } | ||||||||||
| void view3d_main_region_draw(const bContext *C, ARegion *region) | void view3d_main_region_draw(const bContext *C, ARegion *region) | |||||||||
| { | { | |||||||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | |||||||||
| View3D *v3d = CTX_wm_view3d(C); | View3D *v3d = CTX_wm_view3d(C); | |||||||||
| view3d_update_viewer_path(C); | ||||||||||
| view3d_draw_view(C, region); | view3d_draw_view(C, region); | |||||||||
| DRW_cache_free_old_subdiv(); | DRW_cache_free_old_subdiv(); | |||||||||
| DRW_cache_free_old_batches(bmain); | DRW_cache_free_old_batches(bmain); | |||||||||
| BKE_image_free_old_gputextures(bmain); | BKE_image_free_old_gputextures(bmain); | |||||||||
| GPU_pass_cache_garbage_collect(); | GPU_pass_cache_garbage_collect(); | |||||||||
| /* No depth test for drawing action zones afterwards. */ | /* No depth test for drawing action zones afterwards. */ | |||||||||
| ▲ Show 20 Lines • Show All 1,023 Lines • Show Last 20 Lines | ||||||||||