135 const int smooth_viewtx,
205 bool changed =
false;
309 const int smooth_viewtx,
325 float step, step_inv;
364 step = (3.0f * step * step - 2.0f * step * step * step);
366 step_inv = 1.0f - step;
432 if (rv3d && rv3d->
sms) {
448 ot->
idname =
"VIEW3D_OT_smoothview";
515 ot->
name =
"Align Camera to View";
517 ot->
idname =
"VIEW3D_OT_camera_to_view";
543 if (camera_ob ==
NULL) {
558 ot->
name =
"Camera Fit Frame to Selected";
559 ot->
description =
"Move the camera so selected objects are framed";
560 ot->
idname =
"VIEW3D_OT_camera_to_view_selected";
579 const int smooth_viewtx)
585 space_link = space_link->next) {
588 if (other_v3d == v3d) {
591 if (other_v3d->
camera == ob) {
596 &space_link->regionbase;
598 other_region = other_region->next) {
600 if (other_region->regiondata) {
611 .camera_old = other_camera_old,
612 .camera = other_v3d->
camera,
613 .ofs = other_rv3d->
ofs,
615 .dist = &other_rv3d->
dist,
616 .lens = &other_v3d->
lens,
657 if (camera_old != ob) {
665 .camera_old = camera_old,
695 ot->
name =
"Set Active Object as Camera";
696 ot->
description =
"Set the active object as the active camera for this view or scene";
697 ot->
idname =
"VIEW3D_OT_object_as_camera";
723 float clipsta, clipend;
731 printf(
"%s: %d %d %f %f %f %f %f %f\n",
747 viewplane.
xmin = full_viewplane.
xmin +
749 viewplane.
ymin = full_viewplane.
ymin +
751 viewplane.
xmax = full_viewplane.
xmin +
753 viewplane.
ymax = full_viewplane.
ymin +
757 viewplane = full_viewplane;
762 viewplane.
xmin, viewplane.
xmax, viewplane.
ymin, viewplane.
ymax, clipsta, clipend);
766 viewplane.
xmin, viewplane.
xmax, viewplane.
ymin, viewplane.
ymax, clipsta, clipend);
802 const float rect_scale[2])
815 bool use_lock_ofs =
false;
853 float persmat[4][4], persinv[4][4];
870 vec[0] /= rect_scale[0];
871 vec[1] /= rect_scale[1];
913 bool continue_pass =
false;
919 continue_pass =
true;
923 if (
data->pass == 0) {
929 continue_pass = (
hits > 0);
936 return continue_pass;
993 const bool do_passes = ((is_pick_select ==
false) &&
996 bool draw_surface =
true;
998 char gpu_select_mode;
1009 if (is_pick_select) {
1035 switch (select_filter) {
1040 object_filter.user_data = obact;
1053 obact, &virtualModifierData);
1054 for (; md; md = md->
next) {
1066 &virtualModifierData);
1067 for (; md; md = md->
next) {
1077 object_filter.user_data = ob_pose_list;
1119 .buffer_len = bufsize,
1123 draw_surface =
false;
1132 &drw_select_loop_user_data,
1134 object_filter.user_data);
1135 hits = drw_select_loop_user_data.
hits;
1148 .buffer_len = bufsize,
1162 &drw_select_loop_user_data,
1164 object_filter.user_data);
1165 hits = drw_select_loop_user_data.
hits;
1181 printf(
"Too many objects in select buffer\n");
1218 ushort local_view_bits = 0;
1225 for (; sl; sl = sl->
next) {
1236 for (
int i = 0; i < 16; i++) {
1237 if ((local_view_bits & (1 << i)) == 0) {
1251 const bool frame_selected,
1252 const int smooth_viewtx,
1257 float min[3],
max[3], box[3];
1259 uint local_view_bit;
1270 if (local_view_bit == 0) {
1279 for (base =
FIRSTBASE(view_layer); base; base = base->
next) {
1284 base_iter->local_view_bits |= local_view_bit;
1290 for (base =
FIRSTBASE(view_layer); base; base = base->
next) {
1317 for (region =
area->regionbase.first; region; region = region->
next) {
1320 bool ok_dist =
true;
1324 float dist_new, ofs_new[3];
1329 if (frame_selected) {
1336 camera_old = v3d->
camera;
1340 if (
size < 0.0001f) {
1363 .camera_old = camera_old,
1366 .dist = ok_dist ? &dist_new :
NULL,
1381 const bool frame_selected,
1382 const int smooth_viewtx)
1390 for (
Base *base =
FIRSTBASE(view_layer); base; base = base->next) {
1413 if (frame_selected) {
1414 Object *camera_old_rv3d, *camera_new_rv3d;
1431 .camera_old = camera_old_rv3d,
1432 .camera = camera_new_rv3d,
1490 ot->
description =
"Toggle display of selected object(s) separately and centered in view";
1491 ot->
idname =
"VIEW3D_OT_localview";
1503 "Move the view to frame the selected objects");
1512 bool changed =
false;
1514 for (
Base *base =
FIRSTBASE(view_layer); base; base = base->next) {
1519 if (base ==
BASACT(view_layer)) {
1551 ot->
name =
"Remove from Local View";
1552 ot->
description =
"Move selected objects out of local view";
1553 ot->
idname =
"VIEW3D_OT_localview_remove_from";
1573 ushort local_view_bits = 0;
1579 for (; sl; sl = sl->
next) {
1591 if (local_collections_uuid && ((local_collections_uuid & local_view_bits) == 0)) {
1592 return local_collections_uuid;
1596 for (
int i = 0; i < 16; i++) {
1597 if ((local_view_bits & (1 << i)) == 0) {
1607 const ushort local_view_bit)
1647 if (local_view_bit == 0) {
1664 uint local_view_bit = ~(0);
1665 bool do_reset =
false;
1689 else if (reset_all && (do_reset || (local_view_bit != ~(0)))) {
1703 #ifdef WITH_XR_OPENXR
1720 void ED_view3d_xr_mirror_update(
const ScrArea *
area,
const View3D *v3d,
const bool enable)
1728 view3d_xr_mirror_begin(region_rv3d->
regiondata);
1731 view3d_xr_mirror_end(region_rv3d->
regiondata);
1753 if (xr_shading->
prop) {
1759 const int old_xr_shading_flag = xr_shading->
flag;
1761 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)
Camera data-block and utility functions.
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 ARegion * CTX_wm_region(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
struct ModifierData * BKE_modifiers_get_virtual_modifierlist(const struct Object *ob, struct VirtualModifierData *data)
General operations, lookup, etc. for blender objects.
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_minmax(struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden)
void BKE_object_tfm_protected_backup(const struct Object *ob, ObjectTfmProtectedChannels *obtfm)
void BKE_object_tfm_protected_restore(struct Object *ob, const ObjectTfmProtectedChannels *obtfm, const short protectflag)
void BKE_report(ReportList *reports, ReportType 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()
float angle_signed_normalized_qtqt(const float q1[4], const float q2[4])
void interp_qt_qtqt(float q[4], const float a[4], const float b[4], const float t)
void mat4_normalized_to_quat(float q[4], const float mat[4][4])
void copy_qt_qt(float q[4], const float a[4])
void quat_to_mat4(float mat[4][4], const float q[4])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
MINLINE bool equals_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT
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])
MINLINE bool equals_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
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)
typedef double(DMatrix)[4][4]
void DEG_on_visible_update(struct Main *bmain, const bool do_time)
struct Depsgraph Depsgraph
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
#define ID_IS_LINKED(_id)
@ eGpencilModifierType_Armature
#define OB_MODE_ALL_WEIGHT_PAINT
Object is a sort of wrapper for general info.
#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)
#define V3D_XR_SESSION_MIRROR
@ RV3D_LOCK_ANY_TRANSFORM
@ V3D_RUNTIME_XR_SESSION_ROOT
#define V3D_LOCAL_COLLECTIONS
@ V3D_SHADING_WORLD_ORIENTATION
void DRW_opengl_context_enable(void)
bool(* DRW_ObjectFilterFn)(struct Object *ob, void *user_data)
void DRW_opengl_context_disable(void)
void DRW_draw_select_loop(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, bool use_obedit_skip, bool draw_surface, bool use_nearest, 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 ED_object_base_select(struct Base *base, eObjectSelect_Mode mode)
void ED_area_tag_redraw(ScrArea *area)
bScreen * ED_screen_animation_playing(const struct wmWindowManager *wm)
void ED_region_tag_redraw(struct ARegion *region)
bool ED_operator_view3d_active(struct bContext *C)
bool ED_operator_scene_editable(struct bContext *C)
bool ED_view3d_camera_lock_sync(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d)
bool ED_view3d_area_user_region(const struct ScrArea *area, const struct View3D *v3d, struct ARegion **r_region)
#define XRAY_ENABLED(v3d)
float ED_view3d_radius_to_dist(const struct View3D *v3d, const struct ARegion *region, const struct Depsgraph *depsgraph, const char persp, const bool use_aspect, const float radius)
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)
#define VIEW3D_DIST_FALLBACK
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_from_object(const struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens)
float ED_view3d_offset_distance(const float mat[4][4], const float ofs[3], const float fallback_dist)
bool ED_view3d_camera_lock_autokey(struct View3D *v3d, struct RegionView3D *rv3d, struct bContext *C, const bool do_rotate, const bool do_translate)
void ED_view3d_update_viewmat(struct Depsgraph *depsgraph, const struct Scene *scene, struct View3D *v3d, struct ARegion *region, const float viewmat[4][4], const float winmat[4][4], const struct rcti *rect, bool offscreen)
void ED_view3d_to_object(const struct Depsgraph *depsgraph, struct Object *ob, const float ofs[3], const float quat[4], const float dist)
@ VIEW3D_SELECT_PICK_NEAREST
void ED_view3d_lastview_store(struct RegionView3D *rv3d)
bool ED_view3d_lock(struct RegionView3D *rv3d)
void ED_view3d_camera_lock_init(const struct Depsgraph *depsgraph, struct View3D *v3d, 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(uint *buffer, int hits, uint select_id)
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)
@ GPU_SELECT_NEAREST_SECOND_PASS
@ GPU_SELECT_NEAREST_FIRST_PASS
@ GPU_SELECT_PICK_NEAREST
unsigned int GPU_select_end(void)
void GPU_select_begin(unsigned int *buffer, unsigned int bufsize, const struct rcti *input, char mode, int oldhits)
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)
void reset()
clear internal cached data and reset random seed
const Depsgraph * depsgraph
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
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
struct GpencilModifierData * next
ListBase layer_collections
unsigned short local_collections_bits
struct ModifierData * next
struct RenderEngine * render_engine
struct SmoothView3DStore * sms
struct RegionView3D * localvd
struct wmTimer * smooth_timer
struct ToolSettings * toolsettings
struct SmoothView3DState dst
struct SmoothView3DState src
struct SmoothView3DState org
struct Object * camera_old
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
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
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 view3d_orbit_apply_dyn_ofs(float r_ofs[3], const float ofs_old[3], const float viewquat_old[4], const float viewquat_new[4], const float dyn_ofs[3])
void view3d_boxview_copy(struct ScrArea *area, struct ARegion *region)
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)
int view3d_opengl_select(ViewContext *vc, uint *buffer, uint bufsize, const rcti *input, eV3DSelectMode select_mode, eV3DSelectObjectFilter select_filter)
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 void view3d_smooth_view_state_backup(struct SmoothView3DState *sms_state, const View3D *v3d, const RegionView3D *rv3d)
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)
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)
void ED_view3d_smooth_view_ex(const Depsgraph *depsgraph, wmWindowManager *wm, wmWindow *win, ScrArea *area, View3D *v3d, ARegion *region, const int smooth_viewtx, const V3D_SmoothParams *sview)
bool ED_view3d_local_collections_set(Main *bmain, struct View3D *v3d)
void view3d_opengl_select_cache_begin(void)
static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
int view3d_opengl_select_with_id_filter(ViewContext *vc, uint *buffer, uint bufsize, const rcti *input, eV3DSelectMode select_mode, eV3DSelectObjectFilter select_filter, uint select_id)
void ED_view3d_smooth_view(bContext *C, View3D *v3d, ARegion *region, const int smooth_viewtx, const struct V3D_SmoothParams *sview)
void ED_view3d_smooth_view_force_finish(bContext *C, View3D *v3d, ARegion *region)
static void view3d_smooth_view_state_restore(const struct SmoothView3DState *sms_state, View3D *v3d, RegionView3D *rv3d)
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)
void VIEW3D_OT_smoothview(wmOperatorType *ot)
static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *region, bool sync_boxview)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_event_add_mousemove(wmWindow *win)
int WM_operator_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
int WM_operator_smooth_viewtx_get(const wmOperator *op)
void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
wmTimer * WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
bool WM_xr_session_is_ready(const wmXrData *xr)
bool WM_xr_session_exists(const wmXrData *xr)