Blender V5.3
blender::DRWContext Struct Reference

#include <DRW_render.hh>

Classes

struct  [struct].options

Public Types

enum  Mode {
  VIEWPORT = 0 , VIEWPORT_XR , VIEWPORT_OFFSCREEN , VIEWPORT_RENDER ,
  SELECT_OBJECT , SELECT_OBJECT_MATERIAL , SELECT_EDIT_MESH , DEPTH ,
  DEPTH_ACTIVE_OBJECT , RENDER , CUSTOM
}
using iter_callback_t

Public Member Functions

gpu::FrameBuffer * default_framebuffer ()
DefaultFramebufferList * viewport_framebuffer_list_get () const
DefaultTextureList * viewport_texture_list_get () const
 DRWContext (Mode mode, Depsgraph *depsgraph, GPUViewport *viewport, const bContext *C=nullptr, ARegion *region=nullptr, View3D *v3d=nullptr)
 DRWContext (Mode mode, Depsgraph *depsgraph, const int2 size={1, 1}, const bContext *C=nullptr, ARegion *region=nullptr, View3D *v3d=nullptr)
 ~DRWContext ()
float2 viewport_size_get () const
bool is_select () const
bool is_material_select () const
bool is_depth () const
bool is_image_render () const
bool is_scene_render () const
bool is_viewport_image_render () const
bool is_viewport_xr () const
float last_sync_time () const
float last_submission_time () const
Viewport (DRW_viewport)
void acquire_data ()
void release_data ()
Rendering (DRW_engines)
void enable_engines (bool gpencil_engine_needed=false, RenderEngineType *render_engine_type=nullptr)
void engines_data_validate ()
void sync (iter_callback_t iter_callback)
void engines_init_and_sync (iter_callback_t iter_callback)
void engines_draw_scene ()
Draw Manager State
bool is_playback () const
bool is_navigating () const
bool is_painting () const
bool is_transforming () const
bool is_viewport_compositor_used () const

Static Public Member Functions

static DRWContext & get_active ()
static bool is_active ()

Public Attributes

DRWData * data = nullptr
DRWViewData * view_data_active = nullptr
GPUViewport * viewport = nullptr
float2 size = {0, 0}
float2 inv_size = {0, 0}
enum blender::DRWContext::Mode mode
struct  options
DRWTextStore ** text_store_p = nullptr
Set< Object * > delayed_extraction
Depsgraph * depsgraph = nullptr
Scene * scene = nullptr
ViewLayer * view_layer = nullptr
const bContext * evil_C = nullptr
ARegion * region = nullptr
SpaceLink * space_data = nullptr
RegionView3D * rv3d = nullptr
View3D * v3d = nullptr
bToolRef * active_tool = nullptr
Object * obact = nullptr
Object * object_pose = nullptr
Object * object_edit = nullptr
eObjectMode object_mode = OB_MODE_OBJECT

Detailed Description

Definition at line 236 of file DRW_render.hh.

Member Typedef Documentation

◆ iter_callback_t

Initial value:

Definition at line 390 of file DRW_render.hh.

Member Enumeration Documentation

◆ Mode

Enumerator
VIEWPORT 

Render for display of 2D or 3D area. Runs on main thread.

VIEWPORT_XR 

Render for a 3D viewport in XR. Runs on main thread.

VIEWPORT_OFFSCREEN 

Render for a 3D viewport offscreen render (python). Runs on main thread.

VIEWPORT_RENDER 

Render for a 3D viewport image render (Render Viewport Preview, also VSE scene strips). Runs on main thread.

SELECT_OBJECT 

Render for object mode selection. Runs on main thread.

SELECT_OBJECT_MATERIAL 

Render for object material selection. Runs on main thread.

SELECT_EDIT_MESH 

Render for edit mesh selection. Runs on main thread.

DEPTH 

Render for depth picking (auto-depth). Runs on main thread.

DEPTH_ACTIVE_OBJECT 
RENDER 

Render for F12 final render. Can run in any thread.

CUSTOM 

Used by custom pipeline. Can run in any thread.

Definition at line 265 of file DRW_render.hh.

Constructor & Destructor Documentation

◆ DRWContext() [1/2]

blender::DRWContext::DRWContext ( Mode mode,
Depsgraph * depsgraph,
GPUViewport * viewport,
const bContext * C = nullptr,
ARegion * region = nullptr,
View3D * v3d = nullptr )

If viewport is not specified, DRWData will be considered temporary and discarded on exit. If C is nullptr, it means that the context is not associated with any UI or operator. If region is nullptr, it will be sourced from the context C or left as nullptr otherwise. If v3d is nullptr, it will be sourced from the context C or left as nullptr otherwise.

Definition at line 180 of file draw_context.cc.

References C, depsgraph, DRWContext(), blender::GPU_texture_height(), blender::GPU_texture_width(), blender::GPU_viewport_color_texture(), region, v3d, viewport, and blender::draw::color_management::viewport_color_management_set().

Referenced by DRWContext(), and get_active().

◆ DRWContext() [2/2]

◆ ~DRWContext()

blender::DRWContext::~DRWContext ( )

Definition at line 199 of file draw_context.cc.

References blender::BLI_assert().

Member Function Documentation

◆ acquire_data()

◆ default_framebuffer()

gpu::FrameBuffer * blender::DRWContext::default_framebuffer ( )

Returns the viewport's default frame-buffer.

Definition at line 205 of file draw_context.cc.

References blender::DefaultFramebufferList::default_fb, blender::DRWViewData::dfbl, and view_data_active.

Referenced by blender::drw_draw_render_loop_2d(), and blender::drw_draw_render_loop_3d().

◆ enable_engines()

void blender::DRWContext::enable_engines ( bool gpencil_engine_needed = false,
RenderEngineType * render_engine_type = nullptr )

◆ engines_data_validate()

void blender::DRWContext::engines_data_validate ( )

◆ engines_draw_scene()

◆ engines_init_and_sync()

◆ get_active()

DRWContext & blender::DRWContext::get_active ( )
inlinestatic

Definition at line 400 of file DRW_render.hh.

References DRWContext().

Referenced by blender::drw_get().

◆ is_active()

bool blender::DRWContext::is_active ( )
inlinestatic

Return true if any DRWContext is active on this thread.

Definition at line 411 of file DRW_render.hh.

Referenced by blender::DRW_draw_in_progress().

◆ is_depth()

bool blender::DRWContext::is_depth ( ) const
inline

Definition at line 424 of file DRW_render.hh.

References DEPTH, DEPTH_ACTIVE_OBJECT, ELEM, and mode.

Referenced by blender::draw::overlay::Instance::init().

◆ is_image_render()

◆ is_material_select()

bool blender::DRWContext::is_material_select ( ) const
inline

Definition at line 420 of file DRW_render.hh.

References ELEM, mode, and SELECT_OBJECT_MATERIAL.

Referenced by blender::draw::overlay::Instance::init().

◆ is_navigating()

bool blender::DRWContext::is_navigating ( ) const

True if current viewport is drawn during navigation operator.

Definition at line 2488 of file draw_context.cc.

References blender::RegionView3D::rflag, rv3d, blender::RV3D_NAVIGATING, and blender::RV3D_PAINTING.

Referenced by blender::eevee::Instance::init().

◆ is_painting()

bool blender::DRWContext::is_painting ( ) const

True if current viewport is drawn during painting operator.

Definition at line 2493 of file draw_context.cc.

References blender::RegionView3D::rflag, rv3d, and blender::RV3D_PAINTING.

Referenced by blender::eevee::Instance::init().

◆ is_playback()

bool blender::DRWContext::is_playback ( ) const

True if current viewport is drawn during playback.

Definition at line 2479 of file draw_context.cc.

References blender::CTX_wm_manager(), blender::ED_screen_animation_playing(), and evil_C.

Referenced by blender::eevee::Instance::init().

◆ is_scene_render()

◆ is_select()

bool blender::DRWContext::is_select ( ) const
inline

Definition at line 416 of file DRW_render.hh.

References ELEM, mode, SELECT_EDIT_MESH, SELECT_OBJECT, and SELECT_OBJECT_MATERIAL.

◆ is_transforming()

bool blender::DRWContext::is_transforming ( ) const

True if current viewport is drawn during transforming operator.

Definition at line 2498 of file draw_context.cc.

References blender::G, blender::G_TRANSFORM_EDIT, and blender::G_TRANSFORM_OBJ.

Referenced by blender::eevee::Instance::init().

◆ is_viewport_compositor_used()

bool blender::DRWContext::is_viewport_compositor_used ( ) const

◆ is_viewport_image_render()

◆ is_viewport_xr()

bool blender::DRWContext::is_viewport_xr ( ) const
inline

Definition at line 440 of file DRW_render.hh.

References ELEM, mode, and VIEWPORT_XR.

Referenced by blender::eevee::Instance::init(), and blender::eevee::Instance::init().

◆ last_submission_time()

float blender::DRWContext::last_submission_time ( ) const
inline

Definition at line 448 of file DRW_render.hh.

Referenced by blender::DRW_draw_view().

◆ last_sync_time()

float blender::DRWContext::last_sync_time ( ) const
inline

Definition at line 444 of file DRW_render.hh.

Referenced by blender::DRW_draw_view().

◆ release_data()

◆ sync()

◆ viewport_framebuffer_list_get()

◆ viewport_size_get()

◆ viewport_texture_list_get()

Member Data Documentation

◆ active_tool

bToolRef* blender::DRWContext::active_tool = nullptr

Definition at line 333 of file DRW_render.hh.

Referenced by DRWContext(), and blender::draw::overlay::Instance::init().

◆ data

◆ delayed_extraction

Set<Object *> blender::DRWContext::delayed_extraction

Contains list of objects that needs to be extracted from other objects.

Definition at line 306 of file DRW_render.hh.

Referenced by blender::draw::drw_batch_cache_generate_requested_delayed(), and sync().

◆ depsgraph

◆ evil_C

◆ inv_size

float2 blender::DRWContext::inv_size = {0, 0}

Definition at line 256 of file DRW_render.hh.

Referenced by DRWContext().

◆ mode

◆ obact

◆ object_edit

◆ object_mode

◆ object_pose

Object* blender::DRWContext::object_pose = nullptr

◆ options

◆ region

◆ rv3d

◆ scene

◆ size

float2 blender::DRWContext::size = {0, 0}

Size of the viewport or the final render frame.

Definition at line 255 of file DRW_render.hh.

Referenced by acquire_data(), blender::drw_render_border_mask(), blender::DRW_render_gpencil(), blender::DRW_render_to_image(), DRWContext(), and viewport_size_get().

◆ space_data

◆ text_store_p

DRWTextStore** blender::DRWContext::text_store_p = nullptr

Convenience pointer to text_store owned by the viewport

Definition at line 303 of file DRW_render.hh.

Referenced by blender::DRW_text_cache_ensure().

◆ v3d

◆ view_data_active

◆ view_layer

◆ viewport

GPUViewport* blender::DRWContext::viewport = nullptr

Optional associated viewport. Can be nullptr.

Definition at line 253 of file DRW_render.hh.

Referenced by acquire_data(), DRWContext(), and release_data().


The documentation for this struct was generated from the following files: