|
Blender
V2.93
|
#include <stdlib.h>#include <string.h>#include "DNA_camera_types.h"#include "DNA_listBase.h"#include "DNA_object_types.h"#include "DNA_screen_types.h"#include "DNA_userdef_types.h"#include "DNA_view3d_types.h"#include "DNA_windowmanager_types.h"#include "MEM_guardedalloc.h"#include "BLI_blenlib.h"#include "BLI_utildefines.h"#include "BKE_context.h"#include "BKE_image.h"#include "BKE_main.h"#include "BKE_scene.h"#include "BKE_screen.h"#include "GHOST_C-api.h"#include "ED_node.h"#include "ED_screen.h"#include "ED_view3d.h"#include "GPU_batch_presets.h"#include "GPU_context.h"#include "GPU_debug.h"#include "GPU_framebuffer.h"#include "GPU_immediate.h"#include "GPU_state.h"#include "GPU_texture.h"#include "GPU_viewport.h"#include "RE_engine.h"#include "WM_api.h"#include "WM_toolsystem.h"#include "WM_types.h"#include "wm.h"#include "wm_draw.h"#include "wm_event_system.h"#include "wm_surface.h"#include "wm_window.h"#include "UI_resources.h"Go to the source code of this file.
Classes | |
| struct | WindowDrawCB |
Macros | |
| #define | SPACE_NAME(space) |
Functions | |
Draw Paint Cursor | |
| static void | wm_paintcursor_draw (bContext *C, ScrArea *area, ARegion *region) |
Post Draw Region on display handlers | |
| static void | wm_region_draw_overlay (bContext *C, ScrArea *area, ARegion *region) |
Internal Utilities | |
| static bool | wm_draw_region_stereo_set (Main *bmain, ScrArea *area, ARegion *region, eStereoViews sview) |
| static void | wm_region_test_gizmo_do_draw (bContext *C, ScrArea *area, ARegion *region, bool tag_redraw) |
| static void | wm_region_test_render_do_draw (const Scene *scene, struct Depsgraph *depsgraph, ScrArea *area, ARegion *region) |
| static bool | wm_region_use_viewport_by_type (short space_type, short region_type) |
| bool | WM_region_use_viewport (ScrArea *area, ARegion *region) |
| static const char * | wm_area_name (ScrArea *area) |
Region Drawing | |
Each region draws into its own frame-buffer, which is then blit on the window draw buffer. This helps with fast redrawing if only some regions change. It also means we can share a single context for multiple windows, so that for example VAOs can be shared between windows. | |
| static void | wm_draw_region_buffer_free (ARegion *region) |
| static void | wm_draw_offscreen_texture_parameters (GPUOffScreen *offscreen) |
| static void | wm_draw_region_buffer_create (ARegion *region, bool stereo, bool use_viewport) |
| static void | wm_draw_region_bind (ARegion *region, int view) |
| static void | wm_draw_region_unbind (ARegion *region) |
| static void | wm_draw_region_blit (ARegion *region, int view) |
| GPUTexture * | wm_draw_region_texture (ARegion *region, int view) |
| void | wm_draw_region_blend (ARegion *region, int view, bool blend) |
| GPUViewport * | WM_draw_region_get_viewport (ARegion *region) |
| GPUViewport * | WM_draw_region_get_bound_viewport (ARegion *region) |
| static void | wm_draw_window_offscreen (bContext *C, wmWindow *win, bool stereo) |
| static void | wm_draw_window_onscreen (bContext *C, wmWindow *win, int view) |
| static void | wm_draw_window (bContext *C, wmWindow *win) |
| static void | wm_draw_surface (bContext *C, wmSurface *surface) |
Main Update Call | |
| static bool | wm_draw_update_test_window (Main *bmain, bContext *C, wmWindow *win) |
| static void | wm_draw_update_clear_window (bContext *C, wmWindow *win) |
| void | WM_paint_cursor_tag_redraw (wmWindow *win, ARegion *UNUSED(region)) |
| void | wm_draw_update (bContext *C) |
| void | wm_draw_region_clear (wmWindow *win, ARegion *UNUSED(region)) |
| void | WM_draw_region_free (ARegion *region, bool hide) |
| void | wm_draw_region_test (bContext *C, ScrArea *area, ARegion *region) |
| void | WM_redraw_windows (bContext *C) |
Region Viewport Drawing | |
This is needed for viewport drawing for operator use (where the viewport may not have drawn yet). Otherwise avoid using these sine they're exposing low level logic externally. | |
| void | WM_draw_region_viewport_ensure (ARegion *region, short space_type) |
| void | WM_draw_region_viewport_bind (ARegion *region) |
| void | WM_draw_region_viewport_unbind (ARegion *region) |
Window Drawing (Draw All) | |
| typedef struct WindowDrawCB | WindowDrawCB |
| void * | WM_draw_cb_activate (wmWindow *win, void(*draw)(const struct wmWindow *, void *), void *customdata) |
| void | WM_draw_cb_exit (wmWindow *win, void *handle) |
| static void | wm_draw_callbacks (wmWindow *win) |
Handle OpenGL buffers for windowing, also paint cursor.
Definition in file wm_draw.c.
| #define SPACE_NAME | ( | space | ) |
| typedef struct WindowDrawCB WindowDrawCB |
|
static |
Definition at line 315 of file wm_draw.c.
References blender::compositor::area(), SPACE_ACTION, SPACE_CLIP, SPACE_CONSOLE, SPACE_EMPTY, SPACE_FILE, SPACE_GRAPH, SPACE_IMAGE, SPACE_INFO, SPACE_NAME, SPACE_NLA, SPACE_NODE, SPACE_OUTLINER, SPACE_PROPERTIES, SPACE_SCRIPT, SPACE_SEQ, SPACE_STATUSBAR, SPACE_TEXT, SPACE_TOPBAR, SPACE_USERPREF, and SPACE_VIEW3D.
Referenced by wm_draw_window_offscreen().
|
static |
Definition at line 386 of file wm_draw.c.
References wmWindow::drawcalls, and LISTBASE_FOREACH.
Referenced by wm_draw_window_onscreen().
| void* WM_draw_cb_activate | ( | wmWindow * | win, |
| void(*)(const struct wmWindow *, void *) | draw, | ||
| void * | customdata | ||
| ) |
Definition at line 362 of file wm_draw.c.
References BLI_addtail(), WindowDrawCB::customdata, WindowDrawCB::draw, wmWindow::drawcalls, and MEM_callocN.
Referenced by area_join_init(), area_split_invoke(), and eyedropper_init().
| void WM_draw_cb_exit | ( | wmWindow * | win, |
| void * | handle | ||
| ) |
Definition at line 375 of file wm_draw.c.
References BLI_remlink(), wmWindow::drawcalls, LISTBASE_FOREACH, and MEM_freeN.
Referenced by area_join_exit(), area_split_exit(), and eyedropper_exit().
|
static |
Definition at line 419 of file wm_draw.c.
References GPU_offscreen_color_texture(), and GPU_texture_mipmap_mode().
Referenced by wm_draw_region_buffer_create(), and wm_draw_window().
|
static |
Definition at line 474 of file wm_draw.c.
References wmDrawBuffer::bound_view, ARegion::draw_buffer, GPU_offscreen_bind(), GPU_scissor(), GPU_scissor_test(), GPU_viewport_bind(), wmDrawBuffer::offscreen, view, wmDrawBuffer::viewport, ARegion::winrct, ARegion::winx, and ARegion::winy.
Referenced by wm_draw_region_test(), WM_draw_region_viewport_bind(), and wm_draw_window_offscreen().
| void wm_draw_region_blend | ( | ARegion * | region, |
| int | view, | ||
| bool | blend | ||
| ) |
Definition at line 551 of file wm_draw.c.
References ARegion::alignment, alpha, blend(), BLI_rcti_size_x(), BLI_rcti_size_y(), ARegion::draw_buffer, ED_region_blend_alpha(), GPU_batch_draw(), GPU_batch_preset_quad(), GPU_batch_set_shader(), GPU_blend(), GPU_BLEND_ALPHA_PREMULT, GPU_BLEND_NONE, GPU_SHADER_2D_IMAGE_RECT_COLOR, GPU_shader_bind(), GPU_shader_get_builtin_shader(), GPU_shader_get_builtin_uniform(), GPU_shader_get_texture_binding(), GPU_shader_get_uniform(), GPU_shader_uniform_vector(), GPU_texture_bind(), GPU_texture_unbind(), GPU_UNIFORM_COLOR, GPUBatch, quad, RGN_ALIGN_ENUM_FROM_MASK, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, shader(), view, ARegion::winrct, wm_draw_region_texture(), rcti::xmax, rctf::xmax, rcti::xmin, rctf::xmin, rcti::ymax, rctf::ymax, rcti::ymin, and rctf::ymin.
Referenced by wm_draw_window_onscreen().
|
static |
Definition at line 512 of file wm_draw.c.
References ARegion::draw_buffer, GPU_offscreen_draw_to_screen(), GPU_viewport_draw_to_screen(), NULL, wmDrawBuffer::offscreen, view, wmDrawBuffer::viewport, ARegion::winrct, rcti::xmin, and rcti::ymin.
Referenced by wm_draw_window_onscreen().
|
static |
Definition at line 428 of file wm_draw.c.
References wmDrawBuffer::bound_view, ARegion::draw_buffer, GPU_offscreen_create(), GPU_offscreen_height(), GPU_offscreen_width(), GPU_viewport_create(), GPU_viewport_stereo_create(), MEM_callocN, NULL, wmDrawBuffer::offscreen, wmDrawBuffer::stereo, wmDrawBuffer::viewport, ARegion::winx, ARegion::winy, wm_draw_offscreen_texture_parameters(), and wm_draw_region_buffer_free().
Referenced by wm_draw_region_test(), WM_draw_region_viewport_ensure(), and wm_draw_window_offscreen().
|
static |
Definition at line 404 of file wm_draw.c.
References ARegion::draw_buffer, GPU_offscreen_free(), GPU_viewport_free(), MEM_freeN, NULL, wmDrawBuffer::offscreen, and wmDrawBuffer::viewport.
Referenced by wm_draw_region_buffer_create(), and WM_draw_region_free().
Definition at line 1080 of file wm_draw.c.
References bScreen::do_draw, and WM_window_get_active_screen().
Referenced by ui_region_temp_remove().
| void WM_draw_region_free | ( | ARegion * | region, |
| bool | hide | ||
| ) |
Definition at line 1086 of file wm_draw.c.
References ARegion::visible, and wm_draw_region_buffer_free().
Referenced by ED_region_exit(), and ED_view3d_stop_render_preview().
| GPUViewport* WM_draw_region_get_bound_viewport | ( | ARegion * | region | ) |
Definition at line 644 of file wm_draw.c.
References wmDrawBuffer::bound_view, ARegion::draw_buffer, NULL, and wmDrawBuffer::viewport.
Referenced by DRW_draw_render_loop_2d_ex(), DRW_draw_render_loop_ex(), DRW_draw_view(), and sequencer_ibuf_get().
| GPUViewport* WM_draw_region_get_viewport | ( | ARegion * | region | ) |
Definition at line 634 of file wm_draw.c.
References ARegion::draw_buffer, NULL, and wmDrawBuffer::viewport.
Referenced by draw_timeline_seq(), DRW_draw_select_id(), DRW_notify_view_update(), ED_view3d_depth_override(), node_draw_space(), sequencer_draw_preview(), view3d_depth_cache_update(), view3d_update_depths_rect(), and wm_region_test_render_do_draw().
|
static |
Definition at line 153 of file wm_draw.c.
References blender::compositor::area(), Camera::bg_images, BKE_image_ensure_viewer(), View3D::camera, Object::data, SpaceSeq::draw_flag, ED_node_is_compositor(), ELEM, Image::eye, ListBase::first, SpaceNode::flag, RenderEngineType::flag, IMA_TYPE_COMPOSITE, CameraBGImage::iuser, SpaceImage::iuser, ImageUser::multiview_eye, SpaceSeq::multiview_eye, View3D::multiview_eye, OB_CAMERA, RE_USE_STEREO_VIEWPORT, ARegion::regiondata, ARegion::regiontype, RegionView3D::render_engine, RGN_TYPE_PREVIEW, RGN_TYPE_WINDOW, SEQ_DRAW_BACKDROP, SNODE_BACKDRAW, SPACE_IMAGE, SPACE_NODE, SPACE_SEQ, SPACE_VIEW3D, Object::type, and RenderEngine::type.
Referenced by wm_draw_window_offscreen().
Definition at line 1094 of file wm_draw.c.
References blender::compositor::area(), C, ARegion::do_draw, ED_region_do_draw(), wm_draw_region_bind(), wm_draw_region_buffer_create(), wm_draw_region_unbind(), and WM_region_use_viewport().
Referenced by redraw_timer_step().
| GPUTexture* wm_draw_region_texture | ( | ARegion * | region, |
| int | view | ||
| ) |
Definition at line 538 of file wm_draw.c.
References ARegion::draw_buffer, GPU_offscreen_color_texture(), GPU_viewport_color_texture(), NULL, wmDrawBuffer::offscreen, view, and wmDrawBuffer::viewport.
Referenced by wm_draw_region_blend().
|
static |
Definition at line 495 of file wm_draw.c.
References wmDrawBuffer::bound_view, ARegion::draw_buffer, GPU_offscreen_unbind(), GPU_scissor_test(), GPU_viewport_unbind(), wmDrawBuffer::offscreen, and wmDrawBuffer::viewport.
Referenced by wm_draw_region_test(), WM_draw_region_viewport_unbind(), and wm_draw_window_offscreen().
| void WM_draw_region_viewport_bind | ( | ARegion * | region | ) |
Definition at line 1136 of file wm_draw.c.
References wm_draw_region_bind().
Referenced by ED_view3d_depth_override().
| void WM_draw_region_viewport_ensure | ( | ARegion * | region, |
| short | space_type | ||
| ) |
Definition at line 1130 of file wm_draw.c.
References ARegion::regiontype, wm_draw_region_buffer_create(), and wm_region_use_viewport_by_type().
Referenced by ED_view3d_depth_override().
| void WM_draw_region_viewport_unbind | ( | ARegion * | region | ) |
Definition at line 1141 of file wm_draw.c.
References wm_draw_region_unbind().
Referenced by ED_view3d_depth_override().
Draw offscreen contexts not bound to a specific window.
Definition at line 930 of file wm_draw.c.
References C, CTX_wm_manager(), surface, wm_surface_clear_drawable(), wm_surface_make_drawable(), and wm_window_clear_drawable().
Referenced by wm_draw_update().
| void wm_draw_update | ( | bContext * | C | ) |
Definition at line 1033 of file wm_draw.c.
References BKE_image_free_unused_gpu_textures(), C, CTX_data_main(), CTX_wm_manager(), CTX_wm_window_set(), ED_screen_ensure_updated(), GHOST_GetWindowState(), GHOST_kWindowStateMinimized, wmWindow::ghostwin, GPU_context_main_lock(), GPU_context_main_unlock(), LISTBASE_FOREACH, NULL, state, wmWindowManager::windows, wm_draw_surface(), wm_draw_update_clear_window(), wm_draw_update_test_window(), wm_draw_window(), wm_surfaces_iter(), WM_window_get_active_screen(), wm_window_make_drawable(), and wm_window_swap_buffers().
Referenced by ghost_event_proc(), redraw_timer_step(), redraw_timer_window_swap(), WM_main(), and WM_redraw_windows().
Definition at line 1010 of file wm_draw.c.
References blender::compositor::area(), C, bScreen::do_draw_drag, bScreen::do_draw_gesture, bScreen::do_draw_paintcursor, ED_screen_areas_iter, LISTBASE_FOREACH, wm_region_test_gizmo_do_draw(), and WM_window_get_active_screen().
Referenced by wm_draw_update().
Definition at line 948 of file wm_draw.c.
References blender::compositor::area(), BKE_scene_ensure_depsgraph(), C, CTX_wm_manager(), depsgraph, bScreen::do_draw, ARegion::do_draw, bScreen::do_draw_drag, bScreen::do_draw_gesture, bScreen::do_draw_paintcursor, ARegion::do_draw_paintcursor, bScreen::do_refresh, ED_screen_areas_iter, LISTBASE_FOREACH, bScreen::regionbase, scene, UNUSED_VARS, ARegion::visible, wm_region_test_gizmo_do_draw(), wm_region_test_render_do_draw(), WM_window_get_active_scene(), WM_window_get_active_screen(), and WM_window_get_active_view_layer().
Referenced by wm_draw_update().
Definition at line 854 of file wm_draw.c.
References C, Stereo3dFormat::display_mode, bScreen::do_draw, ELEM, GPU_backbuffer_bind(), GPU_BACKBUFFER_LEFT, GPU_BACKBUFFER_RIGHT, GPU_bgl_end(), GPU_offscreen_bind(), GPU_offscreen_color_texture(), GPU_offscreen_create(), GPU_offscreen_free(), GPU_offscreen_unbind(), GPU_texture_bind(), GPU_texture_unbind(), height, NULL, S3D_DISPLAY_ANAGLYPH, S3D_DISPLAY_INTERLACE, S3D_DISPLAY_PAGEFLIP, S3D_DISPLAY_SIDEBYSIDE, wmWindow::stereo3d_format, view, width, wm_draw_offscreen_texture_parameters(), wm_draw_window_offscreen(), wm_draw_window_onscreen(), wm_stereo3d_draw_sidebyside(), wm_stereo3d_draw_topbottom(), WM_stereo3d_enabled(), WM_window_get_active_screen(), WM_window_pixels_x(), WM_window_pixels_y(), and wmWindowViewport().
Referenced by wm_draw_update().
Definition at line 654 of file wm_draw.c.
References blender::compositor::area(), AREA_FLAG_ACTIVE_TOOL_UPDATE, C, CTX_data_main(), CTX_data_view_layer(), CTX_wm_area_set(), CTX_wm_manager(), CTX_wm_menu_set(), CTX_wm_region_set(), CTX_wm_workspace(), ARegion::do_draw, ARegion::draw_buffer, ED_area_update_region_sizes(), ED_region_do_draw(), ED_region_do_layout(), ED_screen_areas_iter, ARegion::flag, GPU_clear_color(), GPU_debug_group_begin(), GPU_debug_group_end(), GPU_viewport_stereo_composite(), ARegionType::layout, LISTBASE_FOREACH, NULL, bScreen::regionbase, RGN_FLAG_DYNAMIC_SIZE, RGN_FLAG_HIDDEN, RGN_FLAG_TOO_SMALL, wmWindow::stereo3d_format, STEREO_LEFT_ID, STEREO_RIGHT_ID, ARegion::type, view, wmDrawBuffer::viewport, ARegion::visible, ARegion::winrct, wm_area_name(), wm_draw_region_bind(), wm_draw_region_buffer_create(), wm_draw_region_stereo_set(), wm_draw_region_unbind(), WM_region_use_viewport(), WM_TOOLSYSTEM_SPACE_MASK, WM_toolsystem_update_from_context(), WM_window_get_active_screen(), and wmViewport().
Referenced by wm_draw_window().
Definition at line 768 of file wm_draw.c.
References bScreen::active_region, blender::compositor::area(), C, CTX_wm_area_set(), CTX_wm_manager(), CTX_wm_region_set(), wmWindowManager::drags, ARegionType::draw_overlay, ED_screen_areas_iter, ED_screen_draw_edges(), ListBase::first, wmWindow::gesture, GPU_clear_color(), GPU_debug_group_begin(), GPU_debug_group_end(), LISTBASE_FOREACH, NULL, ARegion::overlap, wmWindowManager::paintcursors, bScreen::regionbase, ARegion::type, view, ARegion::visible, wm_drags_draw(), wm_draw_callbacks(), wm_draw_region_blend(), wm_draw_region_blit(), wm_gesture_draw(), wm_paintcursor_draw(), wm_region_draw_overlay(), WM_window_get_active_screen(), and wmWindowViewport().
Referenced by wm_draw_window().
Definition at line 1025 of file wm_draw.c.
References bScreen::do_draw_paintcursor, and WM_window_get_active_screen().
Referenced by paint_stroke_modal(), paintcurve_delete_point_exec(), paintcurve_point_add(), paintcurve_point_select(), paintcurve_slide_invoke(), paintcurve_slide_modal(), sample_color_exec(), sample_color_invoke(), viewRedrawForce(), and wm_paintcursor_tag().
Definition at line 84 of file wm_draw.c.
References bScreen::active_region, blender::compositor::area(), BLI_rcti_size_x(), BLI_rcti_size_y(), C, CTX_wm_manager(), CTX_wm_window(), ELEM, wmWindow::eventstate, GHOST_kGrabHide, GHOST_kGrabWrap, GPU_scissor(), GPU_scissor_test(), wmWindow::grabcursor, wmWindowManager::is_interface_locked, LISTBASE_FOREACH_MUTABLE, NULL, wmWindowManager::paintcursors, ARegion::regiontype, RGN_TYPE_ANY, SPACE_TYPE_ANY, ARegion::visible, ARegion::winrct, wm_cursor_position_get(), WM_window_get_active_screen(), x, wmEvent::x, rcti::xmin, y, wmEvent::y, and rcti::ymin.
Referenced by wm_draw_window_onscreen().
| void WM_redraw_windows | ( | bContext * | C | ) |
Definition at line 1105 of file wm_draw.c.
References C, CTX_wm_area(), CTX_wm_area_set(), CTX_wm_region(), CTX_wm_region_set(), CTX_wm_window(), CTX_wm_window_set(), and wm_draw_update().
Referenced by sample_color_exec(), sample_color_invoke(), and screenshot_data_create().
Definition at line 138 of file wm_draw.c.
References blender::compositor::area(), C, CTX_wm_window(), ARegionType::draw_overlay, ARegion::regiontype, ARegion::type, UI_SetTheme(), ARegion::winrct, wmViewport(), and wmWindowViewport().
Referenced by wm_draw_window_onscreen().
|
static |
Definition at line 221 of file wm_draw.c.
References blender::compositor::area(), C, CTX_wm_area(), CTX_wm_area_set(), CTX_wm_region(), CTX_wm_region_set(), ED_region_tag_redraw_editor_overlays(), ARegion::gizmo_map, LISTBASE_FOREACH, NULL, WM_gizmo_group_type_poll(), WM_GIZMOGROUPTYPE_VR_REDRAWS, and WM_gizmomap_group_list().
Referenced by wm_draw_update_clear_window(), and wm_draw_update_test_window().
|
static |
Definition at line 259 of file wm_draw.c.
References blender::compositor::area(), depsgraph, ED_region_tag_redraw_no_rebuild(), ED_region_tag_redraw_partial(), ED_view3d_calc_render_border(), RenderEngine::flag, GPU_viewport_do_update(), RE_ENGINE_DO_DRAW, ARegion::regiondata, ARegion::regiontype, RegionView3D::render_engine, RGN_TYPE_WINDOW, scene, SPACE_VIEW3D, and WM_draw_region_get_viewport().
Referenced by wm_draw_update_test_window().
Definition at line 310 of file wm_draw.c.
References blender::compositor::area(), ARegion::regiontype, and wm_region_use_viewport_by_type().
Referenced by region_draw_azone_tab_arrow(), wm_draw_region_test(), and wm_draw_window_offscreen().
|
static |
Definition at line 303 of file wm_draw.c.
References ELEM, RGN_TYPE_PREVIEW, RGN_TYPE_WINDOW, SPACE_IMAGE, SPACE_NODE, SPACE_SEQ, and SPACE_VIEW3D.
Referenced by WM_draw_region_viewport_ensure(), and WM_region_use_viewport().