Blender V5.3
view3d_utils.cc File Reference
#include <algorithm>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstring>
#include "DNA_camera_types.h"
#include "DNA_curve_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
#include "RNA_path.hh"
#include "MEM_guardedalloc.h"
#include "BLI_array_utils_c.hh"
#include "BLI_bitmap_draw_2d.hh"
#include "BLI_listbase.hh"
#include "BLI_math_color_c.hh"
#include "BLI_math_geom_c.hh"
#include "BLI_math_matrix.hh"
#include "BLI_math_matrix_c.hh"
#include "BLI_math_rotation_c.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_rect.hh"
#include "BLI_utildefines.hh"
#include "BLI_vector.hh"
#include "BKE_camera.h"
#include "BKE_context.hh"
#include "BKE_library.hh"
#include "BKE_object.hh"
#include "BKE_scene.hh"
#include "BKE_screen.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_query.hh"
#include "GPU_matrix.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "ED_keyframing.hh"
#include "ED_screen.hh"
#include "ED_undo.hh"
#include "ED_view3d.hh"
#include "ANIM_keyframing.hh"
#include "ANIM_keyingsets.hh"
#include "UI_resources.hh"
#include "view3d_intern.hh"

Go to the source code of this file.

Classes

struct  blender::PointsInPlanesMinMax_UserData
struct  blender::View3D_AutoDistLast
struct  blender::ReadData

Namespaces

namespace  blender
 BMesh Iterators.

Functions

View Data Access Utilities
void blender::ED_view3d_background_color_get (const Scene *scene, const View3D *v3d, float r_color[3])
void blender::ED_view3d_text_colors_get (const Scene *scene, const View3D *v3d, float r_text_color[4], float r_shadow_color[4])
bool blender::ED_view3d_has_workbench_in_texture_color (const Scene *scene, const Object *ob, const View3D *v3d)
Camera * blender::ED_view3d_camera_data_get (View3D *v3d, RegionView3D *rv3d)
float blender::ED_view3d_dist_soft_min_get (const View3D *v3d, bool use_persp_range)
Bounds< float > blender::ED_view3d_dist_soft_range_get (const View3D *v3d, bool use_persp_range)
bool blender::ED_view3d_clip_range_get (const Depsgraph *depsgraph, const View3D *v3d, const RegionView3D *rv3d, bool use_ortho_factor, float *r_clip_start, float *r_clip_end)
bool blender::ED_view3d_viewplane_get (const Depsgraph *depsgraph, const View3D *v3d, const RegionView3D *rv3d, int winx, int winy, rctf *r_viewplane, float *r_clip_start, float *r_clip_end, float *r_pixsize)
View State/Context Utilities
void blender::view3d_operator_needs_gpu (const bContext *C)
void blender::view3d_region_operator_needs_gpu (ARegion *region)
void blender::ED_view3d_polygon_offset (const RegionView3D *rv3d, float dist)
bool blender::ED_view3d_context_activate (bContext *C)
View Clipping Utilities
void blender::ED_view3d_clipping_calc_from_boundbox (float clip[4][4], const BoundBox *bb, bool is_flip)
void blender::ED_view3d_clipping_calc (BoundBox *bb, float planes[4][4], const ARegion *region, const Object *ob, const rcti *rect)
View Clipping Clamp Min/Max
static void blender::points_in_planes_minmax_fn (const float co[3], int, int, int, void *user_data_p)
bool blender::ED_view3d_clipping_clamp_minmax (const RegionView3D *rv3d, float min[3], float max[3])
View Bound-Box Utilities
static bool blender::view3d_boundbox_clip_m4 (const BoundBox *bb, const float persmatob[4][4])
bool blender::ED_view3d_boundbox_clip_ex (const RegionView3D *rv3d, const BoundBox *bb, float obmat[4][4])
bool blender::ED_view3d_boundbox_clip (RegionView3D *rv3d, const BoundBox *bb)
View Perspective & Mode Switching

Misc view utility functions.

bool blender::ED_view3d_offset_lock_check (const View3D *v3d, const RegionView3D *rv3d)
void blender::ED_view3d_lastview_store (RegionView3D *rv3d)
void blender::ED_view3d_lock_clear (View3D *v3d)
void blender::ED_view3d_persp_switch_from_camera (const Depsgraph *depsgraph, View3D *v3d, RegionView3D *rv3d, eRegionView3D_Persp persp)
bool blender::ED_view3d_persp_ensure (const Depsgraph *depsgraph, View3D *v3d, ARegion *region)
Camera View Utilities

Utilities for manipulating the camera-view.

bool blender::ED_view3d_camera_view_zoom_scale (RegionView3D *rv3d, const float scale)
bool blender::ED_view3d_camera_view_pan (ARegion *region, const float event_ofs[2])
Camera Lock API

Lock the camera to the 3D Viewport, allowing view manipulation to transform the camera.

bool blender::ED_view3d_camera_lock_check (const View3D *v3d, const RegionView3D *rv3d)
void blender::ED_view3d_camera_lock_init_ex (const Depsgraph *depsgraph, View3D *v3d, RegionView3D *rv3d, bool calc_dist)
void blender::ED_view3d_camera_lock_init (const Depsgraph *depsgraph, View3D *v3d, RegionView3D *rv3d)
bool blender::ED_view3d_camera_lock_sync (const Depsgraph *depsgraph, View3D *v3d, RegionView3D *rv3d)
bool blender::ED_view3d_camera_autokey (const Scene *scene, ID *id_key, bContext *C, bool do_rotate, bool do_translate)
bool blender::ED_view3d_camera_lock_autokey (View3D *v3d, RegionView3D *rv3d, bContext *C, bool do_rotate, bool do_translate)
bool blender::ED_view3d_camera_lock_undo_test (const View3D *v3d, const RegionView3D *rv3d, bContext *C)
static bool blender::view3d_camera_lock_undo_ex (const char *str, const View3D *v3d, const RegionView3D *rv3d, bContext *C, const bool undo_group)
bool blender::ED_view3d_camera_lock_undo_push (const char *str, const View3D *v3d, const RegionView3D *rv3d, bContext *C)
bool blender::ED_view3d_camera_lock_undo_grouped_push (const char *str, const View3D *v3d, const RegionView3D *rv3d, bContext *C)
Box View Support

Use with quad-split so each view is clipped by the bounds of each view axis.

static void blender::view3d_boxview_clip (ScrArea *area)
static void blender::view3d_boxview_sync_axis (RegionView3D *rv3d_dst, RegionView3D *rv3d_src)
void blender::view3d_boxview_sync (ScrArea *area, ARegion *region)
void blender::view3d_boxview_copy (ScrArea *area, ARegion *region)
void blender::ED_view3d_quadview_update (ScrArea *area, ARegion *region, bool do_clip)
View Auto-Depth Utilities
static float blender::view_autodist_depth_margin (ARegion *region, const int mval[2], int margin)
bool blender::ED_view3d_autodist (ARegion *region, View3D *v3d, const int mval[2], float mouse_worldloc[3], const float fallback_depth_pt[3])
bool blender::ED_view3d_autodist_simple (ARegion *region, const int mval[2], float mouse_worldloc[3], int margin, const float *force_depth)
static bool blender::depth_segment_cb (int x, int y, void *user_data)
bool blender::ED_view3d_depth_read_cached_seg (const ViewDepths *vd, const int mval_sta[2], const int mval_end[2], int margin, float *r_depth)
View Radius/Distance Utilities

Use to calculate a distance to a point based on its radius.

float blender::ED_view3d_radius_to_dist_persp (float angle, float radius)
float blender::ED_view3d_radius_to_dist_ortho (float lens, float radius)
float blender::ED_view3d_radius_to_dist (const View3D *v3d, const ARegion *region, const Depsgraph *depsgraph, eRegionView3D_Persp persp, bool use_aspect, float radius)
View Distance Utilities
float blender::ED_view3d_offset_distance (const float mat[4][4], const float ofs[3], float fallback_dist)
void blender::ED_view3d_distance_set (RegionView3D *rv3d, float dist)
bool blender::ED_view3d_distance_set_from_location (RegionView3D *rv3d, const float dist_co[3], float dist_min)
View Transform Utilities
void blender::ED_view3d_from_m4 (const float mat[4][4], float ofs[3], float quat[4], const float *dist, float roll)
void blender::ED_view3d_to_m4 (float mat[4][4], const float ofs[3], const float quat[4], float dist, float roll)
void blender::ED_view3d_from_object (const Object *ob, float ofs[3], float quat[4], const float *dist, float roll, float *r_lens)
void blender::ED_view3d_to_object (const Depsgraph *depsgraph, Object *ob, const float ofs[3], const float quat[4], float dist, float roll)
static bool blender::view3d_camera_to_view_selected_impl (Main *bmain, Depsgraph *depsgraph, const Scene *scene, Object *camera_ob, float *r_clip_start, float *r_clip_end)
bool blender::ED_view3d_camera_to_view_selected (Main *bmain, Depsgraph *depsgraph, const Scene *scene, Object *camera_ob)
bool blender::ED_view3d_camera_to_view_selected_with_set_clipping (Main *bmain, Depsgraph *depsgraph, const Scene *scene, Object *camera_ob)
Depth Buffer Utilities
static bool blender::depth_read_test_fn (const void *value, void *userdata)
bool blender::ED_view3d_depth_read_cached (const ViewDepths *vd, const int mval[2], int margin, float *r_depth)
bool blender::ED_view3d_depth_read_cached_normal (const ARegion *region, const ViewDepths *depths, const int mval[2], float r_normal[3])
bool blender::ED_view3d_depth_unproject_v3 (const ARegion *region, const int mval[2], double depth, float r_location_world[3])

View Auto-Depth Last State Access

Calling consecutive trackpad gestures reuses the previous offset to prevent each trackpad event using a different offset, see: #103263.

static const char * blender::view3d_autodepth_last_id = "view3d_autodist_last"
bool blender::ED_view3d_autodist_last_check (wmWindow *win, const wmEvent *event)
void blender::ED_view3d_autodist_last_clear (wmWindow *win)
void blender::ED_view3d_autodist_last_set (wmWindow *win, const wmEvent *event, const float ofs[3], const bool has_depth)
bool blender::ED_view3d_autodist_last_get (wmWindow *win, float r_ofs[3])

View Axis Utilities

static float blender::view3d_quat_axis [6][4][4]
bool blender::ED_view3d_quat_from_axis_view (eRegionView3D_View view, eRegionView3D_ViewAxisRoll view_axis_roll, float r_quat[4])
bool blender::ED_view3d_quat_to_axis_view (const float quat[4], float epsilon, eRegionView3D_View *r_view, eRegionView3D_ViewAxisRoll *r_view_axis_roll)
bool blender::ED_view3d_quat_to_axis_view_and_reset_quat (float quat[4], float epsilon, eRegionView3D_View *r_view, eRegionView3D_ViewAxisRoll *r_view_axis_roll)
eRegionView3D_View blender::ED_view3d_lock_view_from_index (int index)
eRegionView3D_View blender::ED_view3d_axis_view_opposite (eRegionView3D_View view)
bool blender::ED_view3d_lock (RegionView3D *rv3d)
eRegionView3D_ViewFlipRoll blender::ED_view3d_effective_flip_axis (const RegionView3D *rv3d)

Detailed Description

3D View checks and manipulation (no operators).

Definition in file view3d_utils.cc.