103 ot->
name =
"Align Camera to View";
105 ot->
idname =
"VIEW3D_OT_camera_to_view";
131 if (camera_ob ==
NULL) {
146 ot->
name =
"Camera Fit Frame to Selected";
147 ot->
description =
"Move the camera so selected objects are framed";
148 ot->
idname =
"VIEW3D_OT_camera_to_view_selected";
167 const int smooth_viewtx)
173 space_link = space_link->next) {
176 if (other_v3d == v3d) {
179 if (other_v3d->
camera == ob) {
185 &space_link->regionbase;
187 other_region = other_region->next) {
189 if (other_region->regiondata) {
200 .camera_old = other_camera_old,
201 .camera = other_v3d->
camera,
202 .ofs = other_rv3d->
ofs,
204 .dist = &other_rv3d->
dist,
205 .lens = &other_v3d->
lens,
248 if (camera_old != ob) {
256 .camera_old = camera_old,
288 ot->
name =
"Set Active Object as Camera";
289 ot->
description =
"Set the active object as the active camera for this view or scene";
290 ot->
idname =
"VIEW3D_OT_object_as_camera";
313 float clipsta, clipend;
321 printf(
"%s: %d %d %f %f %f %f %f %f\n",
337 viewplane.
xmin = full_viewplane.
xmin +
339 viewplane.
ymin = full_viewplane.
ymin +
341 viewplane.
xmax = full_viewplane.
xmin +
343 viewplane.
ymax = full_viewplane.
ymin +
347 viewplane = full_viewplane;
352 viewplane.
xmin, viewplane.
xmax, viewplane.
ymin, viewplane.
ymax, clipsta, clipend);
356 viewplane.
xmin, viewplane.
xmax, viewplane.
ymin, viewplane.
ymax, clipsta, clipend);
380 const float rect_scale[2])
393 bool use_lock_ofs =
false;
431 float persmat[4][4], persinv[4][4];
448 vec[0] /= rect_scale[0];
449 vec[1] /= rect_scale[1];
486 bool continue_pass =
false;
492 continue_pass =
true;
496 if (
data->pass == 0) {
502 continue_pass = (
hits > 0);
509 return continue_pass;
547 const bool do_material_slot_selection)
560 const bool do_passes = ((is_pick_select ==
false) &&
563 bool draw_surface =
true;
576 if (is_pick_select) {
611 switch (select_filter) {
616 object_filter.user_data = obact;
629 obact, &virtualModifierData);
630 for (; md; md = md->
next) {
642 &virtualModifierData);
643 for (; md; md = md->
next) {
653 object_filter.user_data = ob_pose_list;
690 draw_surface =
false;
697 do_material_slot_selection,
700 &drw_select_loop_user_data,
702 object_filter.user_data);
703 hits = drw_select_loop_user_data.
hits;
728 do_material_slot_selection,
731 &drw_select_loop_user_data,
733 object_filter.user_data);
734 hits = drw_select_loop_user_data.
hits;
752 printf(
"Too many objects in select buffer\n");
797 ushort local_view_bits = 0;
804 for (; sl; sl = sl->
next) {
815 for (
int i = 0; i < 16; i++) {
816 if ((local_view_bits & (1 << i)) == 0) {
830 const bool frame_selected,
831 const int smooth_viewtx,
836 float min[3],
max[3], box[3];
849 if (local_view_bit == 0) {
858 for (base =
FIRSTBASE(view_layer); base; base = base->
next) {
863 base_iter->local_view_bits |= local_view_bit;
869 for (base =
FIRSTBASE(view_layer); base; base = base->
next) {
896 for (region =
area->regionbase.first; region; region = region->
next) {
903 float dist_new, ofs_new[3];
908 if (frame_selected) {
919 if (
size < 0.0001f) {
942 .camera_old = camera_old,
945 .dist = ok_dist ? &dist_new :
NULL,
962 const bool frame_selected,
963 const int smooth_viewtx)
971 for (
Base *base =
FIRSTBASE(view_layer); base; base = base->next) {
995 if (frame_selected) {
996 Object *camera_old_rv3d, *camera_new_rv3d;
1013 .camera_old = camera_old_rv3d,
1014 .camera = camera_new_rv3d,
1074 ot->
description =
"Toggle display of selected object(s) separately and centered in view";
1075 ot->
idname =
"VIEW3D_OT_localview";
1087 "Move the view to frame the selected objects");
1096 bool changed =
false;
1098 for (
Base *base =
FIRSTBASE(view_layer); base; base = base->next) {
1103 if (base ==
BASACT(view_layer)) {
1135 ot->
name =
"Remove from Local View";
1136 ot->
description =
"Move selected objects out of local view";
1137 ot->
idname =
"VIEW3D_OT_localview_remove_from";
1156 ushort local_view_bits = 0;
1162 for (; sl; sl = sl->
next) {
1174 if (local_collections_uuid && ((local_collections_uuid & local_view_bits) == 0)) {
1175 return local_collections_uuid;
1179 for (
int i = 0; i < 16; i++) {
1180 if ((local_view_bits & (1 << i)) == 0) {
1190 const ushort local_view_bit)
1225 if (local_view_bit == 0) {
1242 uint local_view_bit = ~(0);
1243 bool do_reset =
false;
1267 else if (reset_all && (do_reset || (local_view_bit != ~(0)))) {
1281 #ifdef WITH_XR_OPENXR
1298 void ED_view3d_xr_mirror_update(
const ScrArea *
area,
const View3D *v3d,
const bool enable)
1306 view3d_xr_mirror_begin(region_rv3d->
regiondata);
1309 view3d_xr_mirror_end(region_rv3d->
regiondata);
1336 if (xr_shading->
prop) {
1342 const int old_xr_shading_flag = xr_shading->
flag;
1344 xr_shading->
flag = (xr_shading->
flag & ~flag_copy) | (old_xr_shading_flag & flag_copy);
typedef float(TangentPoint)[2]
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
struct Object * CTX_data_edit_object(const bContext *C)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
struct GpencilModifierData * BKE_gpencil_modifiers_get_virtual_modifierlist(const struct Object *ob, struct GpencilVirtualModifierData *data)
void IDP_FreeProperty(struct IDProperty *prop)
struct IDProperty * IDP_CopyProperty(const struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
#define FOREACH_BASE_IN_EDIT_MODE_BEGIN(_view_layer, _v3d, _instance)
void BKE_layer_collection_local_sync(struct ViewLayer *view_layer, const struct View3D *v3d)
#define FOREACH_BASE_IN_EDIT_MODE_END
bool BKE_id_is_editable(const struct Main *bmain, const struct ID *id)
struct ModifierData * BKE_modifiers_get_virtual_modifierlist(const struct Object *ob, struct VirtualModifierData *data)
General operations, lookup, etc. for blender objects.
void BKE_object_tfm_protected_restore(struct Object *ob, const ObjectTfmProtectedChannels *obtfm, short protectflag)
struct Object * BKE_object_pose_armature_get(struct Object *ob)
bool BKE_object_is_mode_compat(const struct Object *ob, eObjectMode object_mode)
void BKE_object_tfm_protected_backup(const struct Object *ob, ObjectTfmProtectedChannels *obtfm)
void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], bool use_hidden)
void BKE_report(ReportList *reports, eReportType type, const char *message)
bool BKE_scene_uses_blender_eevee(const struct Scene *scene)
bool BKE_scene_uses_blender_workbench(const struct Scene *scene)
int BLI_linklist_index(const LinkNode *list, void *ptr) ATTR_WARN_UNUSED_RESULT
#define BLI_linklist_prepend_alloca(listp, ptr)
#define LISTBASE_FOREACH(type, var, list)
MINLINE float max_fff(float a, float b, float c)
MINLINE float max_ff(float a, float b)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void mul_mat3_m4_v3(const float M[4][4], float r[3])
void translate_m4(float mat[4][4], float tx, float ty, float tz)
bool invert_m4_m4(float R[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void normalize_m4_m4(float R[4][4], const float M[4][4]) ATTR_NONNULL()
void mat4_normalized_to_quat(float q[4], const float mat[4][4])
void quat_to_mat4(float mat[4][4], const float q[4])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f)
void BLI_rcti_init_pt_radius(struct rcti *rect, const int xy[2], int size)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
#define INIT_MINMAX(min, max)
struct Depsgraph Depsgraph
void DEG_tag_on_visible_update(struct Main *bmain, bool do_time)
void DEG_id_type_tag(struct Main *bmain, short id_type)
void DEG_id_tag_update(struct ID *id, int flag)
struct Object * DEG_get_original_object(struct Object *object)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
@ ID_RECALC_COPY_ON_WRITE
@ eGpencilModifierType_Armature
#define OB_MODE_ALL_WEIGHT_PAINT
#define OBEDIT_FROM_VIEW_LAYER(view_layer)
#define FIRSTBASE(_view_layer)
#define V3D_CAMERA_SCENE(scene, v3d)
#define BASACT(_view_layer)
@ USER_GPU_FLAG_NO_DEPT_PICK
#define RV3D_LOCK_FLAGS(rv3d)
@ V3D_RUNTIME_XR_SESSION_ROOT
@ RV3D_LOCK_ANY_TRANSFORM
@ V3D_SHADING_WORLD_ORIENTATION
#define V3D_XR_SESSION_MIRROR
#define V3D_LOCAL_COLLECTIONS
void DRW_opengl_context_enable(void)
bool(* DRW_ObjectFilterFn)(struct Object *ob, void *user_data)
void DRW_draw_select_loop(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, bool use_obedit_skip, bool draw_surface, bool use_nearest, bool do_material_sub_selection, const struct rcti *rect, DRW_SelectPassFn select_pass_fn, void *select_pass_user_data, DRW_ObjectFilterFn object_filter_fn, void *object_filter_user_data)
void DRW_opengl_context_disable(void)
void ED_object_base_select(struct Base *base, eObjectSelect_Mode mode)
void ED_area_tag_redraw(ScrArea *area)
bool ED_operator_view3d_active(struct bContext *C)
bool ED_operator_scene_editable(struct bContext *C)
bool ED_view3d_area_user_region(const struct ScrArea *area, const struct View3D *v3d, struct ARegion **r_region)
#define XRAY_ENABLED(v3d)
bool ED_view3d_viewplane_get(struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *r_viewplane, float *r_clipsta, float *r_clipend, float *r_pixsize)
bool ED_view3d_camera_to_view_selected(struct Main *bmain, struct Depsgraph *depsgraph, const struct Scene *scene, struct Object *camera_ob)
void ED_view3d_draw_setup_view(const struct wmWindowManager *wm, struct wmWindow *win, struct Depsgraph *depsgraph, struct Scene *scene, struct ARegion *region, struct View3D *v3d, const float viewmat[4][4], const float winmat[4][4], const struct rcti *rect)
void ED_view3d_to_object(const struct Depsgraph *depsgraph, struct Object *ob, const float ofs[3], const float quat[4], float dist)
float ED_view3d_radius_to_dist(const struct View3D *v3d, const struct ARegion *region, const struct Depsgraph *depsgraph, char persp, bool use_aspect, float radius)
@ VIEW3D_SELECT_PICK_NEAREST
void ED_view3d_lastview_store(struct RegionView3D *rv3d)
bool ED_view3d_lock(struct RegionView3D *rv3d)
bool ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_region)
@ VIEW3D_SELECT_FILTER_NOP
@ VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK
@ VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK
void GPU_matrix_ortho_set(float left, float right, float bottom, float top, float near, float far)
void GPU_matrix_frustum_set(float left, float right, float bottom, float top, float near, float far)
#define GPU_matrix_projection_get(x)
uint GPU_select_buffer_remove_by_id(GPUSelectResult *buffer, int hits, uint select_id)
void GPU_select_begin(GPUSelectResult *buffer, unsigned int buffer_len, const struct rcti *input, eGPUSelectMode mode, int oldhits)
@ GPU_SELECT_NEAREST_SECOND_PASS
@ GPU_SELECT_NEAREST_FIRST_PASS
@ GPU_SELECT_PICK_NEAREST
void GPU_select_cache_begin(void)
bool GPU_select_is_cached(void)
void GPU_select_cache_load_id(void)
void GPU_select_cache_end(void)
unsigned int GPU_select_end(void)
void GPU_depth_test(eGPUDepthTest test)
Read Guarded memory(de)allocation.
void UI_Theme_Restore(struct bThemeState *theme_state)
void UI_SetTheme(int spacetype, int regionid)
void UI_Theme_Store(struct bThemeState *theme_state)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
const Depsgraph * depsgraph
ccl_global float * buffer
ccl_global KernelShaderEvalInput * input
ccl_gpu_kernel_postfix ccl_global float int int int int float bool reset
clear internal cached data and reset random seed
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
unsigned short local_view_bits
eGPUSelectMode gpu_select_mode
struct GpencilModifierData * next
ListBase layer_collections
unsigned short local_collections_bits
struct ModifierData * next
struct RegionView3D * localvd
struct ToolSettings * toolsettings
struct SceneStats * local_stats
unsigned short local_view_uuid
unsigned short local_collections_uuid
struct Object * ob_center
struct Depsgraph * depsgraph
struct ViewLayer * view_layer
struct RegionView3D * rv3d
struct View3DShading shading
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
XrSessionSettings session_settings
void ED_view3d_smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *region, int smooth_viewtx, const V3D_SmoothParams *sview)
void ED_view3d_smooth_view_ex(const struct Depsgraph *depsgraph, struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *area, struct View3D *v3d, struct ARegion *region, int smooth_viewtx, const V3D_SmoothParams *sview)
static void local_collections_reset_uuid(LayerCollection *layer_collection, const ushort local_view_bit)
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)
void view3d_opengl_select_cache_end(void)
static int localview_remove_from_exec(bContext *C, wmOperator *op)
void ED_view3d_local_collections_reset(struct bContext *C, const bool reset_all)
void VIEW3D_OT_localview(wmOperatorType *ot)
static void view3d_local_collections_reset(Main *bmain, const uint local_view_bit)
static uint free_localview_bit(Main *bmain)
static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob)
static int localview_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_localview_remove_from(wmOperatorType *ot)
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)
void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot)
static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *op)
static bool drw_select_loop_pass(eDRWSelectStage stage, void *user_data)
static bool drw_select_filter_object_mode_lock(Object *ob, void *user_data)
static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
void view3d_winmatrix_set(Depsgraph *depsgraph, ARegion *region, const View3D *v3d, const rcti *rect)
static bool drw_select_filter_object_mode_lock_for_weight_paint(Object *ob, void *user_data)
static void sync_viewport_camera_smoothview(bContext *C, View3D *v3d, Object *ob, const int smooth_viewtx)
static uint free_localcollection_bit(Main *bmain, ushort local_collections_uuid, bool *r_reset)
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)
void view3d_viewmatrix_set(Depsgraph *depsgraph, const Scene *scene, const View3D *v3d, RegionView3D *rv3d, const float rect_scale[2])
eV3DSelectObjectFilter ED_view3d_select_filter_from_mode(const Scene *scene, const Object *obact)
static bool localview_remove_from_poll(bContext *C)
bool ED_view3d_local_collections_set(Main *bmain, struct View3D *v3d)
void view3d_opengl_select_cache_begin(void)
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)
void VIEW3D_OT_camera_to_view(wmOperatorType *ot)
static bool view3d_camera_to_view_poll(bContext *C)
bool ED_operator_rv3d_user_region_poll(bContext *C)
static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_smooth_viewtx_get(const wmOperator *op)
bool WM_xr_session_is_ready(const wmXrData *xr)
bool WM_xr_session_exists(const wmXrData *xr)