Blender  V3.3
Classes
view3d_view.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BKE_action.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "DEG_depsgraph_query.h"
#include "UI_resources.h"
#include "GPU_matrix.h"
#include "GPU_select.h"
#include "GPU_state.h"
#include "WM_api.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "DRW_engine.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "view3d_intern.h"
#include "view3d_navigate.h"

Go to the source code of this file.

Classes

struct  DrawSelectLoopUserData
 

Functions

Camera to View Operator
static int view3d_camera_to_view_exec (bContext *C, wmOperator *UNUSED(op))
 
static bool view3d_camera_to_view_poll (bContext *C)
 
void VIEW3D_OT_camera_to_view (wmOperatorType *ot)
 
Camera Fit Frame to Selected Operator
static int view3d_camera_to_view_selected_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_camera_to_view_selected (wmOperatorType *ot)
 
Object as Camera Operator
static void sync_viewport_camera_smoothview (bContext *C, View3D *v3d, Object *ob, const int smooth_viewtx)
 
static int view3d_setobjectascamera_exec (bContext *C, wmOperator *op)
 
bool ED_operator_rv3d_user_region_poll (bContext *C)
 
void VIEW3D_OT_object_as_camera (wmOperatorType *ot)
 
Window and View Matrix Calculation
void view3d_winmatrix_set (Depsgraph *depsgraph, ARegion *region, const View3D *v3d, const rcti *rect)
 
static void obmat_to_viewmat (RegionView3D *rv3d, Object *ob)
 
void view3d_viewmatrix_set (Depsgraph *depsgraph, const Scene *scene, const View3D *v3d, RegionView3D *rv3d, const float rect_scale[2])
 
OpenGL Select Utilities
void view3d_opengl_select_cache_begin (void)
 
void view3d_opengl_select_cache_end (void)
 
static bool drw_select_loop_pass (eDRWSelectStage stage, void *user_data)
 
eV3DSelectObjectFilter ED_view3d_select_filter_from_mode (const Scene *scene, const Object *obact)
 
static bool drw_select_filter_object_mode_lock (Object *ob, void *user_data)
 
static bool drw_select_filter_object_mode_lock_for_weight_paint (Object *ob, void *user_data)
 
int view3d_opengl_select_ex (ViewContext *vc, GPUSelectResult *buffer, uint buffer_len, const rcti *input, eV3DSelectMode select_mode, eV3DSelectObjectFilter select_filter, const bool do_material_slot_selection)
 
int view3d_opengl_select (ViewContext *vc, GPUSelectResult *buffer, uint buffer_len, const rcti *input, eV3DSelectMode select_mode, eV3DSelectObjectFilter select_filter)
 
int view3d_opengl_select_with_id_filter (ViewContext *vc, GPUSelectResult *buffer, const uint buffer_len, const rcti *input, eV3DSelectMode select_mode, eV3DSelectObjectFilter select_filter, uint select_id)
 
Local View Operators
static uint free_localview_bit (Main *bmain)
 
static bool view3d_localview_init (const Depsgraph *depsgraph, wmWindowManager *wm, wmWindow *win, Main *bmain, ViewLayer *view_layer, ScrArea *area, const bool frame_selected, const int smooth_viewtx, ReportList *reports)
 
static void view3d_localview_exit (const Depsgraph *depsgraph, wmWindowManager *wm, wmWindow *win, ViewLayer *view_layer, ScrArea *area, const bool frame_selected, const int smooth_viewtx)
 
static int localview_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_localview (wmOperatorType *ot)
 
static int localview_remove_from_exec (bContext *C, wmOperator *op)
 
static bool localview_remove_from_poll (bContext *C)
 
void VIEW3D_OT_localview_remove_from (wmOperatorType *ot)
 
Local Collections
static uint free_localcollection_bit (Main *bmain, ushort local_collections_uuid, bool *r_reset)
 
static void local_collections_reset_uuid (LayerCollection *layer_collection, const ushort local_view_bit)
 
static void view3d_local_collections_reset (Main *bmain, const uint local_view_bit)
 
bool ED_view3d_local_collections_set (Main *bmain, struct View3D *v3d)
 
void ED_view3d_local_collections_reset (struct bContext *C, const bool reset_all)
 

Function Documentation

◆ drw_select_filter_object_mode_lock()

static bool drw_select_filter_object_mode_lock ( Object ob,
void user_data 
)
static

◆ drw_select_filter_object_mode_lock_for_weight_paint()

static bool drw_select_filter_object_mode_lock_for_weight_paint ( Object ob,
void user_data 
)
static

Implement VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK for special case when we want to select pose bones (this doesn't switch modes).

Definition at line 535 of file view3d_view.c.

References BLI_linklist_index(), DEG_get_original_object(), and user_data.

Referenced by view3d_opengl_select_ex().

◆ drw_select_loop_pass()

static bool drw_select_loop_pass ( eDRWSelectStage  stage,
void user_data 
)
static

◆ ED_operator_rv3d_user_region_poll()

bool ED_operator_rv3d_user_region_poll ( bContext C)

◆ ED_view3d_local_collections_reset()

void ED_view3d_local_collections_reset ( struct bContext C,
const bool  reset_all 
)

◆ ED_view3d_local_collections_set()

bool ED_view3d_local_collections_set ( struct Main bmain,
struct View3D v3d 
)

See if current UUID is valid, otherwise set a valid UUID to v3d, Try to keep the same UUID previously used to allow users to quickly toggle back and forth.

Definition at line 1215 of file view3d_view.c.

References View3D::flag, free_localcollection_bit(), View3D::local_collections_uuid, reset, V3D_LOCAL_COLLECTIONS, and view3d_local_collections_reset().

◆ ED_view3d_select_filter_from_mode()

eV3DSelectObjectFilter ED_view3d_select_filter_from_mode ( const Scene scene,
const Object obact 
)

◆ free_localcollection_bit()

static uint free_localcollection_bit ( Main bmain,
ushort  local_collections_uuid,
bool r_reset 
)
static

◆ free_localview_bit()

static uint free_localview_bit ( Main bmain)
static

◆ local_collections_reset_uuid()

static void local_collections_reset_uuid ( LayerCollection layer_collection,
const ushort  local_view_bit 
)
static

◆ localview_exec()

static int localview_exec ( bContext C,
wmOperator op 
)
static

◆ localview_remove_from_exec()

static int localview_remove_from_exec ( bContext C,
wmOperator op 
)
static

◆ localview_remove_from_poll()

static bool localview_remove_from_poll ( bContext C)
static

Definition at line 1122 of file view3d_view.c.

References C, CTX_data_edit_object(), CTX_wm_view3d(), View3D::localvd, and NULL.

Referenced by VIEW3D_OT_localview_remove_from().

◆ obmat_to_viewmat()

static void obmat_to_viewmat ( RegionView3D rv3d,
Object ob 
)
static

◆ sync_viewport_camera_smoothview()

static void sync_viewport_camera_smoothview ( bContext C,
View3D v3d,
Object ob,
const int  smooth_viewtx 
)
static

◆ view3d_camera_to_view_exec()

static int view3d_camera_to_view_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ view3d_camera_to_view_poll()

static bool view3d_camera_to_view_poll ( bContext C)
static

◆ view3d_camera_to_view_selected_exec()

static int view3d_camera_to_view_selected_exec ( bContext C,
wmOperator op 
)
static

◆ view3d_local_collections_reset()

static void view3d_local_collections_reset ( Main bmain,
const uint  local_view_bit 
)
static

◆ view3d_localview_exit()

static void view3d_localview_exit ( const Depsgraph depsgraph,
wmWindowManager wm,
wmWindow win,
ViewLayer view_layer,
ScrArea area,
const bool  frame_selected,
const int  smooth_viewtx 
)
static

◆ view3d_localview_init()

static bool view3d_localview_init ( const Depsgraph depsgraph,
wmWindowManager wm,
wmWindow win,
Main bmain,
ViewLayer view_layer,
ScrArea area,
const bool  frame_selected,
const int  smooth_viewtx,
ReportList reports 
)
static

◆ view3d_opengl_select()

int view3d_opengl_select ( ViewContext vc,
GPUSelectResult buffer,
uint  buffer_len,
const rcti input,
eV3DSelectMode  select_mode,
eV3DSelectObjectFilter  select_filter 
)

◆ view3d_opengl_select_cache_begin()

void view3d_opengl_select_cache_begin ( void  )

Optionally cache data for multiple calls to view3d_opengl_select

just avoid GPU_select headers outside this file

Definition at line 465 of file view3d_view.c.

References GPU_select_cache_begin().

Referenced by get_nearest_editbonepoint(), and mixed_bones_object_selectbuffer().

◆ view3d_opengl_select_cache_end()

void view3d_opengl_select_cache_end ( void  )

Definition at line 470 of file view3d_view.c.

References GPU_select_cache_end().

Referenced by get_nearest_editbonepoint(), and mixed_bones_object_selectbuffer().

◆ view3d_opengl_select_ex()

int view3d_opengl_select_ex ( ViewContext vc,
GPUSelectResult buffer,
uint  buffer_len,
const rcti input,
eV3DSelectMode  select_mode,
eV3DSelectObjectFilter  select_filter,
const bool  do_material_slot_selection 
)

Definition at line 541 of file view3d_view.c.

References BKE_gpencil_modifiers_get_virtual_modifierlist(), BKE_modifiers_get_virtual_modifierlist(), BLI_assert, BLI_linklist_prepend_alloca, BLI_rcti_init_pt_radius(), buffer, DrawSelectLoopUserData::buffer_len, ViewContext::C, CTX_wm_manager(), depsgraph, ViewContext::depsgraph, DRW_draw_select_loop(), DRW_opengl_context_disable(), DRW_opengl_context_enable(), drw_select_filter_object_mode_lock(), drw_select_filter_object_mode_lock_for_weight_paint(), drw_select_loop_pass(), ED_view3d_draw_setup_view(), eGpencilModifierType_Armature, eModifierType_Armature, G, G_FLAG_PICKSEL, GPU_DEPTH_LESS_EQUAL, GPU_DEPTH_NONE, GPU_depth_test(), GPU_SELECT_ALL, GPU_select_begin(), GPU_select_cache_end(), GPU_select_cache_load_id(), GPU_select_end(), GPU_select_is_cached(), DrawSelectLoopUserData::gpu_select_mode, GPU_SELECT_NEAREST_FIRST_PASS, GPU_SELECT_PICK_ALL, GPU_SELECT_PICK_NEAREST, DrawSelectLoopUserData::hits, input, Object::mode, GpencilModifierData::next, ModifierData::next, NULL, OB_GPENCIL, OB_MODE_ALL_WEIGHT_PAINT, OB_MODE_OBJECT, OB_MODE_POSE, OB_WIRE, ViewContext::obact, ViewContext::obedit, OBEDIT_FROM_VIEW_LAYER, ArmatureGpencilModifierData::object, ArmatureModifierData::object, DrawSelectLoopUserData::pass, DrawSelectLoopUserData::rect, ViewContext::region, RGN_TYPE_WINDOW, ViewContext::rv3d, scene, ViewContext::scene, View3D::shading, SPACE_VIEW3D, GpencilModifierData::type, ModifierData::type, Object::type, View3DShading::type, UI_SetTheme(), UI_Theme_Restore(), UI_Theme_Store(), user_data, USER_GPU_FLAG_NO_DEPT_PICK, ViewContext::v3d, VIEW3D_SELECT_FILTER_NOP, VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK, VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK, VIEW3D_SELECT_PICK_ALL, VIEW3D_SELECT_PICK_NEAREST, ViewContext::view_layer, RegionView3D::viewmat, ViewContext::win, XRAY_ACTIVE, and XRAY_ENABLED.

Referenced by view3d_opengl_select().

◆ view3d_opengl_select_with_id_filter()

int view3d_opengl_select_with_id_filter ( ViewContext vc,
GPUSelectResult buffer,
const uint  buffer_len,
const rcti input,
eV3DSelectMode  select_mode,
eV3DSelectObjectFilter  select_filter,
uint  select_id 
)

◆ VIEW3D_OT_camera_to_view()

void VIEW3D_OT_camera_to_view ( wmOperatorType ot)

◆ VIEW3D_OT_camera_to_view_selected()

void VIEW3D_OT_camera_to_view_selected ( wmOperatorType ot)

◆ VIEW3D_OT_localview()

void VIEW3D_OT_localview ( wmOperatorType ot)

◆ VIEW3D_OT_localview_remove_from()

void VIEW3D_OT_localview_remove_from ( wmOperatorType ot)

◆ VIEW3D_OT_object_as_camera()

void VIEW3D_OT_object_as_camera ( wmOperatorType ot)

◆ view3d_setobjectascamera_exec()

static int view3d_setobjectascamera_exec ( bContext C,
wmOperator op 
)
static

◆ view3d_viewmatrix_set()

void view3d_viewmatrix_set ( Depsgraph depsgraph,
const Scene scene,
const View3D v3d,
RegionView3D rv3d,
const float  rect_scale[2] 
)

◆ view3d_winmatrix_set()

void view3d_winmatrix_set ( struct Depsgraph depsgraph,
struct ARegion region,
const View3D v3d,
const rcti rect 
)