39 float dvec[3], vb[2], xscale, yscale;
47 float depth_close = FLT_MAX;
78 const float region_aspect = (
float)region->
winx / (
float)region->
winy;
94 if (depth_close == FLT_MAX) {
117 vb[0] = region->
winx;
118 vb[1] = region->
winy;
120 new_dist = rv3d->
dist;
123 if (depth_close != FLT_MAX &&
140 xy_delta[0] = (rect.
xmin + rect.
xmax - vb[0]) / 2.0f;
141 xy_delta[1] = (rect.
ymin + rect.
ymax - vb[1]) / 2.0f;
150 new_dist *=
max_ff(xscale, yscale);
155 new_dist = rv3d->
dist * (rv3d->
dist / new_dist);
160 CLAMP(new_dist, dist_range[0], dist_range[1]);
165 if (is_camera_lock) {
193 ot->
name =
"Zoom to Border";
194 ot->
description =
"Zoom in the view to the nearest object contained in the border";
195 ot->
idname =
"VIEW3D_OT_zoom_border";
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
void BKE_report(ReportList *reports, eReportType type, const char *message)
MINLINE float max_ff(float a, float b)
MINLINE void sub_v3_v3(float r[3], const float a[3])
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 void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rcti_resize_y(struct rcti *rect, int y)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void BLI_rcti_resize_x(struct rcti *rect, int x)
struct Depsgraph Depsgraph
#define DEFAULT_SENSOR_WIDTH
#define RV3D_LOCK_FLAGS(rv3d)
bool ED_view3d_camera_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d)
void ED_view3d_win_to_delta(const struct ARegion *region, const float xy_delta[2], float zfac, float r_out[3])
void ED_view3d_dist_range_get(const struct View3D *v3d, float r_dist_range[2])
bool ED_view3d_unproject_v3(const struct ARegion *region, float regionx, float regiony, float regionz, float world[3])
void ED_view3d_persp_switch_from_camera(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d, char persp)
float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3])
void ED_view3d_camera_lock_init(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d)
void view3d_operator_needs_opengl(const struct bContext *C)
void ED_view3d_depth_override(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, struct Object *obact, eV3DDepthOverrideMode mode, struct ViewDepths **r_depths)
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
const Depsgraph * depsgraph
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* cancel)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
struct wmOperatorType * type
void view3d_depths_rect_create(ARegion *region, rcti *rect, ViewDepths *r_d)
float view3d_depth_near(ViewDepths *d)
void view3d_boxview_sync(struct ScrArea *area, struct ARegion *region)
bool view3d_zoom_or_dolly_poll(bContext *C)
void ED_view3d_smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *region, int smooth_viewtx, const V3D_SmoothParams *sview)
void VIEW3D_OT_zoom_border(wmOperatorType *ot)
static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
void WM_gesture_box_cancel(bContext *C, wmOperator *op)
int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
void WM_operator_properties_border_to_rcti(struct wmOperator *op, rcti *rect)
void WM_operator_properties_gesture_box_zoom(wmOperatorType *ot)
int WM_operator_smooth_viewtx_get(const wmOperator *op)