Blender V5.0
view3d_navigate_view_all.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BKE_armature.hh"
10#include "BKE_context.hh"
11#include "BKE_layer.hh"
12#include "BKE_library.hh"
13#include "BKE_object.hh"
14#include "BKE_paint.hh"
15#include "BKE_paint_types.hh"
16#include "BKE_scene.hh"
17#include "BKE_screen.hh"
18
19#include "BLI_bounds.hh"
20#include "BLI_listbase.h"
21#include "BLI_math_matrix.hh"
22#include "BLI_math_vector.h"
23
25
26#include "ED_mesh.hh"
27#include "ED_particle.hh"
28#include "ED_screen.hh"
29
30#include "WM_api.hh"
31#include "WM_message.hh"
32
33#include "RNA_access.hh"
34#include "RNA_define.hh"
35
36#include "view3d_intern.hh"
37#include "view3d_navigate.hh" /* own include */
38
39using blender::float3;
40
41/* -------------------------------------------------------------------- */
46
47static bool view3d_object_skip_minmax(const View3D *v3d,
48 const RegionView3D *rv3d,
49 const Object *ob,
50 const bool skip_camera,
51 bool *r_only_center)
52{
53 BLI_assert(ob->id.orig_id == nullptr);
54 *r_only_center = false;
55
56 if (skip_camera && (ob == v3d->camera)) {
57 return true;
58 }
59
60 if ((ob->type == OB_EMPTY) && (ob->empty_drawtype == OB_EMPTY_IMAGE) &&
62 {
63 *r_only_center = true;
64 return false;
65 }
66
67 return false;
68}
69
70static void view3d_object_calc_minmax(Depsgraph *depsgraph,
71 Scene *scene,
72 Object *ob_eval,
73 const bool only_center,
74 float3 &min,
75 float3 &max)
76{
77 /* Account for duplis. */
78 if (BKE_object_minmax_dupli(depsgraph, scene, ob_eval, min, max, false) == 0) {
79 /* Use if duplis aren't found. */
80 if (only_center) {
81 minmax_v3v3_v3(min, max, ob_eval->object_to_world().location());
82 }
83 else {
84 BKE_object_minmax(ob_eval, min, max);
85 }
86 }
87}
88
90 View3D *v3d,
91 ARegion *region,
92 const float min[3],
93 const float max[3],
94 bool do_zoom,
95 const int smooth_viewtx)
96{
97 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
98 float afm[3];
99 float size;
100
102
103 /* SMOOTHVIEW */
104 float ofs_new[3];
105 float dist_new;
106
107 sub_v3_v3v3(afm, max, min);
108 size = max_fff(afm[0], afm[1], afm[2]);
109
110 if (do_zoom) {
111 char persp;
112
113 if (rv3d->is_persp) {
114 if (rv3d->persp == RV3D_CAMOB && ED_view3d_camera_lock_check(v3d, rv3d)) {
115 persp = RV3D_CAMOB;
116 }
117 else {
118 persp = RV3D_PERSP;
119 }
120 }
121 else { /* ortho */
122 if (size < 0.0001f) {
123 /* bounding box was a single point so do not zoom */
124 do_zoom = false;
125 }
126 else {
127 /* adjust zoom so it looks nicer */
128 persp = RV3D_ORTHO;
129 }
130 }
131
132 if (do_zoom) {
134 dist_new = ED_view3d_radius_to_dist(
135 v3d, region, depsgraph, persp, true, (size / 2) * VIEW3D_MARGIN);
136 if (rv3d->is_persp) {
137 /* Don't zoom closer than the near clipping plane. */
138 const float dist_min = ED_view3d_dist_soft_min_get(v3d, true);
139 CLAMP_MIN(dist_new, dist_min);
140 }
141 }
142 }
143
144 mid_v3_v3v3(ofs_new, min, max);
145 negate_v3(ofs_new);
146
147 V3D_SmoothParams sview = {nullptr};
148 sview.ofs = ofs_new;
149 sview.dist = do_zoom ? &dist_new : nullptr;
150 /* The caller needs to use undo begin/end calls. */
151 sview.undo_str = nullptr;
152
153 if (rv3d->persp == RV3D_CAMOB && !ED_view3d_camera_lock_check(v3d, rv3d)) {
154 rv3d->persp = RV3D_PERSP;
155 sview.camera_old = v3d->camera;
156 }
157
158 ED_view3d_smooth_view(C, v3d, region, smooth_viewtx, &sview);
159
160 /* Smooth-view does view-lock #RV3D_BOXVIEW copy. */
161}
162
167 View3D *v3d,
168 const float min[3],
169 const float max[3],
170 const bool do_zoom,
171 const int smooth_viewtx)
172{
173 ScrArea *area = CTX_wm_area(C);
174 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
175 if (region->regiontype == RGN_TYPE_WINDOW) {
176 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
177 /* when using all regions, don't jump out of camera view,
178 * but _do_ allow locked cameras to be moved */
179 if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) {
180 view3d_from_minmax(C, v3d, region, min, max, do_zoom, smooth_viewtx);
181 }
182 }
183 }
184}
185
187
188/* -------------------------------------------------------------------- */
193
194std::optional<blender::Bounds<float3>> view3d_calc_minmax_visible(Depsgraph *depsgraph,
195 ScrArea *area,
196 ARegion *region,
197 const bool use_all_regions,
198 const bool clip_bounds)
199{
200 /* NOTE: we could support calculating this without requiring a #View3D or #RegionView3D
201 * Currently this isn't needed. */
202
203 const View3D *v3d = static_cast<View3D *>(area->spacedata.first);
204 const RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
208
209 float3 min, max;
211
212 bool changed = false;
213
214 const bool skip_camera = (ED_view3d_camera_lock_check(v3d, rv3d) ||
215 /* any one of the regions may be locked */
216 (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
217
218 BKE_view_layer_synced_ensure(scene_eval, view_layer_eval);
219 LISTBASE_FOREACH (Base *, base_eval, BKE_view_layer_object_bases_get(view_layer_eval)) {
220 if (BASE_VISIBLE(v3d, base_eval)) {
221 bool only_center = false;
222 Object *ob = DEG_get_original(base_eval->object);
223 if (view3d_object_skip_minmax(v3d, rv3d, ob, skip_camera, &only_center)) {
224 continue;
225 }
226 view3d_object_calc_minmax(depsgraph, scene, base_eval->object, only_center, min, max);
227 changed = true;
228 }
229 }
230
231 if (changed) {
232 if (clip_bounds && RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
233 /* This is an approximation, see function documentation for details. */
235 }
236 }
237
238 if (!changed) {
239 return std::nullopt;
240 }
242}
243
244std::optional<blender::Bounds<float3>> view3d_calc_minmax_selected(Depsgraph *depsgraph,
245 ScrArea *area,
246 ARegion *region,
247 const bool use_all_regions,
248 const bool clip_bounds,
249 bool *r_do_zoom)
250{
251 /* NOTE: we could support calculating this without requiring a #View3D or #RegionView3D
252 * Currently this isn't needed. */
253
254 const View3D *v3d = static_cast<View3D *>(area->spacedata.first);
255 const RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
256
259
260 const Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
262
263 BKE_view_layer_synced_ensure(scene_eval, view_layer_eval);
264 Object *ob_eval = BKE_view_layer_active_object_get(view_layer_eval);
265 Object *obedit = OBEDIT_FROM_OBACT(ob_eval);
266 const bool is_face_map = (region->runtime->gizmo_map &&
267 WM_gizmomap_is_any_selected(region->runtime->gizmo_map));
268 const bool skip_camera = (ED_view3d_camera_lock_check(v3d, rv3d) ||
269 /* any one of the regions may be locked */
270 (use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
271
272 float3 min, max;
274 bool changed = false;
275
276 *r_do_zoom = true;
277
278 if (is_face_map) {
279 ob_eval = nullptr;
280 }
281
282 if (ob_eval && (ob_eval->mode & OB_MODE_WEIGHT_PAINT)) {
283 /* hard-coded exception, we look for the one selected armature */
284 /* this is weak code this way, we should make a generic
285 * active/selection callback interface once... */
286 Base *base_eval;
287 for (base_eval = (Base *)BKE_view_layer_object_bases_get(view_layer_eval)->first; base_eval;
288 base_eval = base_eval->next)
289 {
290 if (BASE_SELECTED_EDITABLE(v3d, base_eval)) {
291 if (base_eval->object->type == OB_ARMATURE) {
292 if (base_eval->object->mode & OB_MODE_POSE) {
293 break;
294 }
295 }
296 }
297 }
298 if (base_eval) {
299 ob_eval = base_eval->object;
300 }
301 }
302
303 if (is_face_map) {
304 changed = WM_gizmomap_minmax(region->runtime->gizmo_map, true, true, min, max);
305 }
306 else if (obedit) {
307 /* only selected */
309 scene_eval, view_layer_eval, v3d, obedit->type, obedit->mode, ob_eval_iter)
310 {
311 changed |= ED_view3d_minmax_verts(scene_eval, ob_eval_iter, min, max);
312 }
314 }
315 else if (ob_eval && (ob_eval->mode & OB_MODE_POSE)) {
317 scene_eval, view_layer_eval, v3d, ob_eval->type, ob_eval->mode, ob_eval_iter)
318 {
319 const std::optional<blender::Bounds<float3>> bounds = BKE_pose_minmax(ob_eval_iter, true);
320 if (bounds) {
322 ob_eval->object_to_world(), *bounds);
323 minmax_v3v3_v3(min, max, world_bounds.min);
324 minmax_v3v3_v3(min, max, world_bounds.max);
325 changed = true;
326 }
327 }
329 }
330 else if (BKE_paint_select_face_test(ob_eval)) {
331 changed = paintface_minmax(ob_eval, min, max);
332 }
333 else if (ob_eval && (ob_eval->mode & OB_MODE_PARTICLE_EDIT)) {
334 changed = PE_minmax(depsgraph, scene, view_layer, min, max);
335 }
336 else if (ob_eval && (ob_eval->mode & OB_MODE_SCULPT_CURVES)) {
338 scene_eval, view_layer_eval, v3d, ob_eval->type, ob_eval->mode, ob_eval_iter)
339 {
340 changed |= ED_view3d_minmax_verts(scene_eval, ob_eval_iter, min, max);
341 }
343 }
344 else if (ob_eval && (ob_eval->mode & (OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT |
346 {
348 if (ob_eval->mode & OB_MODE_SCULPT) {
349 mode = PaintMode::Sculpt;
350 }
351 else if (ob_eval->mode & OB_MODE_VERTEX_PAINT) {
352 mode = PaintMode::Vertex;
353 }
354 else if (ob_eval->mode & OB_MODE_WEIGHT_PAINT) {
355 mode = PaintMode::Weight;
356 }
357 else if (ob_eval->mode & OB_MODE_TEXTURE_PAINT) {
359 }
360 Paint *paint = BKE_paint_get_active_from_paintmode(scene, mode);
361 BKE_paint_stroke_get_average(paint, ob_eval, min);
363 changed = true;
364 *r_do_zoom = false;
365 }
366 else {
367 LISTBASE_FOREACH (Base *, base_eval, BKE_view_layer_object_bases_get(view_layer_eval)) {
368 if (BASE_SELECTED(v3d, base_eval)) {
369 bool only_center = false;
370 Object *ob = DEG_get_original(base_eval->object);
371 if (view3d_object_skip_minmax(v3d, rv3d, ob, skip_camera, &only_center)) {
372 continue;
373 }
374 view3d_object_calc_minmax(depsgraph, scene, base_eval->object, only_center, min, max);
375 changed = true;
376 }
377 }
378 }
379
380 if (changed) {
381 if (clip_bounds && RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
382 /* This is an approximation, see function documentation for details. */
384 }
385 }
386
387 if (!changed) {
388 return std::nullopt;
389 }
391}
392
394 ViewLayer *view_layer,
395 const View3D *v3d,
396 const blender::float3 &point,
397 const float scale_margin)
398{
400
401 LISTBASE_FOREACH (const Base *, base, BKE_view_layer_object_bases_get(view_layer)) {
402 if (!BASE_SELECTED(v3d, base)) {
403 continue;
404 }
405 Object *ob = base->object;
407
408 float3 min, max;
409 view3d_object_calc_minmax(depsgraph, scene, ob, false, min, max);
410
412
413 bounds.scale_from_center(float3(scale_margin));
414
415 float3 local_min = blender::math::transform_point(ob->object_to_world(), bounds.min);
416 float3 local_max = blender::math::transform_point(ob->object_to_world(), bounds.max);
417
418 if (point[0] >= local_min[0] && point[1] >= local_min[1] && point[2] >= local_min[2] &&
419 point[0] <= local_max[0] && point[1] <= local_max[1] && point[2] <= local_max[2])
420 {
421 return true;
422 }
423 }
424 return false;
425}
426
428
429/* -------------------------------------------------------------------- */
434
436{
437 ScrArea *area = CTX_wm_area(C);
438 ARegion *region = CTX_wm_region(C);
439 View3D *v3d = CTX_wm_view3d(C);
440 Scene *scene = CTX_data_scene(C);
441
442 const bool use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
443 const bool center = RNA_boolean_get(op->ptr, "center");
444 const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
445
447 std::optional<blender::Bounds<float3>> bounds = view3d_calc_minmax_visible(
448 depsgraph, area, region, use_all_regions, true);
449 if (center) {
450 /* in 2.4x this also move the cursor to (0, 0, 0) (with shift+c). */
451 View3DCursor *cursor = &scene->cursor;
452
453 cursor->set_matrix(blender::float4x4::identity(), false);
454
456 WM_msg_publish_rna_prop(mbus, &scene->id, &scene->cursor, View3DCursor, location);
457
459 }
460
461 if (!bounds.has_value()) {
462 ED_region_tag_redraw(region);
463 /* TODO: should this be cancel?
464 * I think no, because we always move the cursor, with or without
465 * object, but in this case there is no change in the scene,
466 * only the cursor so I choice a ED_region_tag like
467 * view3d_smooth_view do for the center_cursor.
468 * See bug #22640.
469 */
470 return OPERATOR_FINISHED;
471 }
472
473 float3 &min = bounds.value().min;
474 float3 &max = bounds.value().max;
475
476 if (center) {
477 minmax_v3v3_v3(min, max, float3(0.0f));
478 }
479
481 if (use_all_regions) {
482 view3d_from_minmax_multi(C, v3d, min, max, true, smooth_viewtx);
483 }
484 else {
485 view3d_from_minmax(C, v3d, region, min, max, true, smooth_viewtx);
486 }
487
488 ED_view3d_smooth_view_undo_end(C, area, op->type->name, false);
489
490 return OPERATOR_FINISHED;
491}
492
494{
495 /* identifiers */
496 ot->name = "Frame All";
497 ot->description = "View all objects in scene";
498 ot->idname = "VIEW3D_OT_view_all";
499
500 /* API callbacks. */
501 ot->exec = view3d_all_exec;
503
504 /* flags */
505 ot->flag = 0;
506
507 /* properties */
509 RNA_def_boolean(ot->srna, "center", false, "Center", "");
510}
511
513
514/* -------------------------------------------------------------------- */
519
521{
522 ScrArea *area = CTX_wm_area(C);
523 ARegion *region = CTX_wm_region(C);
524 View3D *v3d = CTX_wm_view3d(C);
525 bool do_zoom = true;
526 const bool use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
527 const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
528
530 const std::optional<blender::Bounds<float3>> bounds = view3d_calc_minmax_selected(
531 depsgraph, area, region, use_all_regions, true, &do_zoom);
532
533 if (!bounds.has_value()) {
534 return OPERATOR_FINISHED;
535 }
536
537 const float3 &min = bounds.value().min;
538 const float3 &max = bounds.value().max;
539
541 if (use_all_regions) {
542 view3d_from_minmax_multi(C, v3d, min, max, do_zoom, smooth_viewtx);
543 }
544 else {
545 view3d_from_minmax(C, v3d, region, min, max, do_zoom, smooth_viewtx);
546 }
547
548 ED_view3d_smooth_view_undo_end(C, area, op->type->name, false);
549
550 return OPERATOR_FINISHED;
551}
552
554{
555 /* identifiers */
556 ot->name = "Frame Selected";
557 ot->description = "Move the view to the selection center";
558 ot->idname = "VIEW3D_OT_view_selected";
559
560 /* API callbacks. */
561 ot->exec = viewselected_exec;
563
564 /* flags */
565 ot->flag = 0;
566
567 /* properties */
569}
570
std::optional< blender::Bounds< blender::float3 > > BKE_pose_minmax(const Object *ob, bool use_select)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
#define FOREACH_OBJECT_IN_MODE_END
Definition BKE_layer.hh:382
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
#define FOREACH_OBJECT_IN_MODE_BEGIN(_scene, _view_layer, _v3d, _object_type, _object_mode, _instance)
Definition BKE_layer.hh:377
ListBase * BKE_view_layer_object_bases_get(ViewLayer *view_layer)
General operations, lookup, etc. for blender objects.
void BKE_object_minmax(Object *ob, blender::float3 &r_min, blender::float3 &r_max)
bool BKE_object_empty_image_frame_is_visible_in_view3d(const Object *ob, const RegionView3D *rv3d)
bool BKE_object_minmax_dupli(Depsgraph *depsgraph, Scene *scene, Object *ob, blender::float3 &r_min, blender::float3 &r_max, bool use_hidden)
void BKE_paint_stroke_get_average(const Paint *paint, const Object *ob, float stroke[3])
Definition paint.cc:1952
Paint * BKE_paint_get_active_from_paintmode(Scene *sce, PaintMode mode)
Definition paint.cc:374
bool BKE_paint_select_face_test(const Object *ob)
Definition paint.cc:1640
PaintMode
#define BLI_assert(a)
Definition BLI_assert.h:46
#define LISTBASE_FOREACH(type, var, list)
MINLINE float max_fff(float a, float b, float c)
void minmax_v3v3_v3(float min[3], float max[3], const float vec[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(float r[3])
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
#define INIT_MINMAX(min, max)
#define CLAMP_MIN(a, b)
void DEG_id_tag_update(ID *id, unsigned int flags)
bool DEG_is_original(const T *id)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
ViewLayer * DEG_get_evaluated_view_layer(const Depsgraph *graph)
ViewLayer * DEG_get_input_view_layer(const Depsgraph *graph)
T * DEG_get_original(T *id)
Scene * DEG_get_input_scene(const Depsgraph *graph)
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
@ OB_MODE_PARTICLE_EDIT
@ OB_MODE_WEIGHT_PAINT
@ OB_MODE_SCULPT
@ OB_MODE_SCULPT_CURVES
@ OB_MODE_POSE
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_VERTEX_PAINT
@ OB_EMPTY_IMAGE
@ OB_EMPTY
@ OB_ARMATURE
#define BASE_SELECTED(v3d, base)
#define BASE_SELECTED_EDITABLE(v3d, base)
#define OBEDIT_FROM_OBACT(ob)
#define BASE_VISIBLE(v3d, base)
@ RGN_TYPE_WINDOW
@ V3D_LOCK_CAMERA
#define RV3D_CLIPPING_ENABLED(v3d, rv3d)
@ RV3D_CAMOB
@ RV3D_PERSP
@ RV3D_ORTHO
@ OPERATOR_FINISHED
bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
Definition editface.cc:682
int PE_minmax(Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, blender::float3 &min, blender::float3 &max)
bool ED_operator_region_view3d_active(bContext *C)
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:618
#define VIEW3D_MARGIN
float ED_view3d_radius_to_dist(const View3D *v3d, const ARegion *region, const Depsgraph *depsgraph, char persp, bool use_aspect, float radius)
bool ED_view3d_clipping_clamp_minmax(const RegionView3D *rv3d, float min[3], float max[3])
bool ED_view3d_camera_lock_check(const View3D *v3d, const RegionView3D *rv3d)
float ED_view3d_dist_soft_min_get(const View3D *v3d, bool use_persp_range)
#define C
Definition RandGen.cpp:29
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
Bounds< VecBase< T, 3 > > transform_bounds(const MatBase< T, D, D > &matrix, const Bounds< VecBase< T, 3 > > &bounds)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
VecBase< float, 3 > float3
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
#define min(a, b)
Definition sort.cc:36
void * regiondata
ARegionRuntimeHandle * runtime
struct Base * next
struct Object * object
struct ID * orig_id
Definition DNA_ID.h:501
void * first
char empty_drawtype
View3DCursor cursor
ListBase spacedata
ListBase regionbase
const char * undo_str
struct Object * camera
const char * name
Definition WM_types.hh:1033
struct wmOperatorType * type
struct PointerRNA * ptr
max
Definition text_draw.cc:251
bool ED_view3d_minmax_verts(const Scene *scene, Object *obedit, float min[3], float max[3])
void view3d_operator_properties_common(wmOperatorType *ot, const enum eV3D_OpPropFlag flag)
bool view3d_zoom_or_dolly_poll(bContext *C)
void ED_view3d_smooth_view_undo_begin(bContext *C, const ScrArea *area)
void ED_view3d_smooth_view(bContext *C, View3D *v3d, ARegion *region, int smooth_viewtx, const V3D_SmoothParams *sview)
@ V3D_OP_PROP_USE_ALL_REGIONS
void ED_view3d_smooth_view_force_finish(bContext *C, View3D *v3d, ARegion *region)
void ED_view3d_smooth_view_undo_end(bContext *C, const ScrArea *area, const char *undo_str, bool undo_grouped)
static void view3d_from_minmax_multi(bContext *C, View3D *v3d, const float min[3], const float max[3], const bool do_zoom, const int smooth_viewtx)
std::optional< blender::Bounds< float3 > > view3d_calc_minmax_visible(Depsgraph *depsgraph, ScrArea *area, ARegion *region, const bool use_all_regions, const bool clip_bounds)
bool view3d_calc_point_in_selected_bounds(Depsgraph *depsgraph, ViewLayer *view_layer, const View3D *v3d, const blender::float3 &point, const float scale_margin)
std::optional< blender::Bounds< float3 > > view3d_calc_minmax_selected(Depsgraph *depsgraph, ScrArea *area, ARegion *region, const bool use_all_regions, const bool clip_bounds, bool *r_do_zoom)
static bool view3d_object_skip_minmax(const View3D *v3d, const RegionView3D *rv3d, const Object *ob, const bool skip_camera, bool *r_only_center)
static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *region, const float min[3], const float max[3], bool do_zoom, const int smooth_viewtx)
void VIEW3D_OT_view_all(wmOperatorType *ot)
void VIEW3D_OT_view_selected(wmOperatorType *ot)
static wmOperatorStatus viewselected_exec(bContext *C, wmOperator *op)
static void view3d_object_calc_minmax(Depsgraph *depsgraph, Scene *scene, Object *ob_eval, const bool only_center, float3 &min, float3 &max)
static wmOperatorStatus view3d_all_exec(bContext *C, wmOperator *op)
wmOperatorType * ot
Definition wm_files.cc:4237
bool WM_gizmomap_is_any_selected(const wmGizmoMap *gzmap)
bool WM_gizmomap_minmax(const wmGizmoMap *gzmap, bool, bool use_select, float r_min[3], float r_max[3])
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_)
int WM_operator_smooth_viewtx_get(const wmOperator *op)