Blender V5.3
view3d_gizmo_camera.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 "BLI_listbase.hh"
10#include "BLI_math_matrix.hh"
11#include "BLI_math_matrix_c.hh"
12#include "BLI_math_vector_c.hh"
13#include "BLI_rect.hh"
14#include "BLI_utildefines.hh"
15
16#include "BKE_camera.h"
17#include "BKE_context.hh"
18#include "BKE_layer.hh"
19#include "BKE_lib_id.hh"
20
21#include "DNA_camera_types.h"
22#include "DNA_object_types.h"
23
24#include "ED_gizmo_library.hh"
25#include "ED_screen.hh"
26
27#include "UI_resources.hh"
28
29#include "MEM_guardedalloc.h"
30
31#include "RNA_access.hh"
32
33#include "WM_message.hh"
34#include "WM_types.hh"
35
36#include "DEG_depsgraph.hh"
37
38#include "view3d_intern.hh" /* own include */
39
40namespace blender {
41
42/* -------------------------------------------------------------------- */
45
51
52static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType * /*gzgt*/)
53{
54 View3D *v3d = CTX_wm_view3d(C);
56 return false;
57 }
60 {
61 return false;
62 }
63
64 const Main *bmain = CTX_data_main(C);
65 const Scene *scene = CTX_data_scene(C);
66 ViewLayer *view_layer = CTX_data_view_layer(C);
67 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
68 Base *base = BKE_view_layer_active_base_get(view_layer);
69 if (base && BASE_SELECTABLE(v3d, base)) {
70 Object *ob = base->object;
71 if (ob->type == OB_CAMERA) {
72 const Camera *camera = id_cast<Camera *>(ob->data);
73 /* TODO: support overrides. */
75 return true;
76 }
77 }
78 }
79 return false;
80}
81
82static void WIDGETGROUP_camera_setup(const bContext *C, wmGizmoGroup *gzgroup)
83{
84 const Main *bmain = CTX_data_main(C);
85 const Scene *scene = CTX_data_scene(C);
86 ViewLayer *view_layer = CTX_data_view_layer(C);
87 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
89 const float4x4 &ob_mat = ob->object_to_world();
90 float dir[3];
91
92 const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true);
93 const wmGizmoType *gzt_cage2d = WM_gizmotype_find("GIZMO_GT_cage_2d", true);
94
96 gzgroup->customdata = cagzgroup;
97
98 negate_v3_v3(dir, ob_mat.ptr()[2]);
99
100 /* dof distance */
101 {
102 wmGizmo *gz;
103 gz = cagzgroup->dop_dist = WM_gizmo_new_ptr(gzt_arrow, gzgroup, nullptr);
104 RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_CROSS);
106
109 }
110
111 /* focal length
112 * - logic/calculations are similar to BKE_camera_view_frame_ex, better keep in sync */
113 {
114 wmGizmo *gz;
115 gz = cagzgroup->focal_len = WM_gizmo_new_ptr(gzt_arrow, gzgroup, nullptr);
117 RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_CONE);
119
122
123 gz = cagzgroup->ortho_scale = WM_gizmo_new_ptr(gzt_cage2d, gzgroup, nullptr);
125 RNA_enum_set(gz->ptr,
126 "transform",
128
131 }
132
133 /* All gizmos must perform undo. */
134 for (wmGizmo &gz : gzgroup->gizmos) {
136 }
137}
138
139static void gizmo_orthoscale_prop_matrix_get(const wmGizmo * /*gz*/,
140 wmGizmoProperty *gz_prop,
141 void *value_p)
142{
143 BLI_assert(gz_prop->type->array_length == 16);
144 float (*matrix)[4] = static_cast<float (*)[4]>(value_p);
145
146 const bContext *C = static_cast<const bContext *>(gz_prop->custom_func.user_data);
147 const Main *bmain = CTX_data_main(C);
148 Scene *scene = CTX_data_scene(C);
149 ViewLayer *view_layer = CTX_data_view_layer(C);
150 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
151
152 const Object *ob = static_cast<const Object *>(BKE_view_layer_active_object_get(view_layer));
153 Camera *camera = id_cast<Camera *>(ob->data);
154
155 float gizmo_scale = camera->ortho_scale;
156 unit_m4(matrix);
157 matrix[0][0] = gizmo_scale;
158 matrix[1][1] = gizmo_scale;
159
160 /* This needs to be included, because we overwrite the whole matrix.
161 * We could investigate if the offset matrix could be added *afterwards*,
162 * then this wouldn't be needed. */
163 const float4x4 &ob_mat = ob->object_to_world();
164 const float matrix_sign = is_negative_m4(ob_mat.ptr()) ? -1.0f : 1.0f;
165
166 matrix[3][0] = camera->shiftx * gizmo_scale * -matrix_sign;
167 matrix[3][1] = camera->shifty * gizmo_scale;
168}
169
170static void gizmo_orthoscale_prop_matrix_set(const wmGizmo * /*gz*/,
171 wmGizmoProperty *gz_prop,
172 const void *value_p)
173{
174 const float (*matrix)[4] = static_cast<const float (*)[4]>(value_p);
175 BLI_assert(gz_prop->type->array_length == 16);
176
177 const bContext *C = static_cast<const bContext *>(gz_prop->custom_func.user_data);
178 const Main *bmain = CTX_data_main(C);
179 Scene *scene = CTX_data_scene(C);
180 ViewLayer *view_layer = CTX_data_view_layer(C);
181 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
182
183 const Object *ob = static_cast<const Object *>(BKE_view_layer_active_object_get(view_layer));
184 Camera *camera = id_cast<Camera *>(ob->data);
185
186 PointerRNA camera_ptr = RNA_pointer_create_discrete(&camera->id, RNA_Camera, camera);
187 PropertyRNA *ortho_scale_prop = RNA_struct_find_property(&camera_ptr, "ortho_scale");
188
189 float ortho_scale = len_v3(matrix[0]);
190 RNA_property_float_set(&camera_ptr, ortho_scale_prop, ortho_scale);
191
193 RNA_property_update_main(CTX_data_main(C), scene, &camera_ptr, ortho_scale_prop);
194}
195
197{
198 if (!gzgroup->customdata) {
199 return;
200 }
201
202 CameraWidgetGroup *cagzgroup = static_cast<CameraWidgetGroup *>(gzgroup->customdata);
203 View3D *v3d = CTX_wm_view3d(C);
204 const Main *bmain = CTX_data_main(C);
205 const Scene *scene = CTX_data_scene(C);
206 ViewLayer *view_layer = CTX_data_view_layer(C);
207 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
209 Camera *ca = id_cast<Camera *>(ob->data);
210 const float4x4 &ob_mat = ob->object_to_world();
211 float dir[3];
212
213 PointerRNA camera_ptr = RNA_pointer_create_discrete(&ca->id, RNA_Camera, ca);
214
215 const bool is_modal = WM_gizmo_group_is_modal(gzgroup);
216
217 negate_v3_v3(dir, ob_mat.ptr()[2]);
218
220 WM_gizmo_set_matrix_location(cagzgroup->dop_dist, ob_mat.location());
221 WM_gizmo_set_matrix_rotation_from_yz_axis(cagzgroup->dop_dist, ob_mat.ptr()[1], dir);
222
223 /* TODO: investigate why this doesn't work. */
224 if (false) {
225 WM_gizmo_set_scale(cagzgroup->dop_dist, ca->drawsize);
226 }
227 else {
228 mul_v3_fl(cagzgroup->dop_dist->matrix_basis[0], ca->drawsize);
229 mul_v3_fl(cagzgroup->dop_dist->matrix_basis[1], ca->drawsize);
230 }
231 WM_gizmo_set_flag(cagzgroup->dop_dist, WM_GIZMO_HIDDEN, false);
232
233 /* Need to set property here for undo. TODO: would prefer to do this in _init. */
235 &ca->id, RNA_CameraDOFSettings, &ca->dof);
237 cagzgroup->dop_dist, "offset", &camera_dof_ptr, "focus_distance", -1);
238 }
239 else {
240 WM_gizmo_set_flag(cagzgroup->dop_dist, WM_GIZMO_HIDDEN, true);
241 }
242
243 /* TODO: make focal length/ortho ob_scale_inv widget optional. */
244 const float aspx = float(scene->r.xsch) * scene->r.xasp;
245 const float aspy = float(scene->r.ysch) * scene->r.yasp;
246 const bool is_ortho = (ca->type == CAM_ORTHO);
247 const int sensor_fit = BKE_camera_sensor_fit(ca->sensor_fit, aspx, aspy);
248 /* Important to use camera value, not calculated fit since 'AUTO' uses width always. */
249 const float sensor_size = BKE_camera_sensor_size(ca->sensor_fit, ca->sensor_x, ca->sensor_y);
250 wmGizmo *widget = is_ortho ? cagzgroup->ortho_scale : cagzgroup->focal_len;
251 /* Only for perspective cameras (orthographic cameras are not scaled). */
252 float scale_matrix = 1.0f;
253 {
254 float offset[3];
255 float aspect[2];
256
257 WM_gizmo_set_flag(widget, WM_GIZMO_HIDDEN, false);
259 is_ortho ? cagzgroup->focal_len : cagzgroup->ortho_scale, WM_GIZMO_HIDDEN, true);
260
261 /* account for lens shifting */
262 offset[0] = ((ob->scale[0] > 0.0f) ? -2.0f : 2.0f) * ca->shiftx;
263 offset[1] = 2.0f * ca->shifty;
264 offset[2] = 0.0f;
265
266 /* get aspect */
267 aspect[0] = (sensor_fit == CAMERA_SENSOR_FIT_HOR) ? 1.0f : aspx / aspy;
268 aspect[1] = (sensor_fit == CAMERA_SENSOR_FIT_HOR) ? aspy / aspx : 1.0f;
269
270 unit_m4(widget->matrix_basis);
271
272 blender::float3 gizmo_location;
273 if (is_ortho) {
274 float zscale_or_one = ob->scale[2] == 0.0f ? 1.0f : fabsf(ob->scale[2]);
275 blender::float3 local_gizmo_location = blender::float3{
276 0.0f, 0.0f, -1.0f * ca->drawsize / zscale_or_one};
277 gizmo_location = blender::math::transform_point(ob_mat, local_gizmo_location);
278 }
279 else {
280 gizmo_location = ob_mat.location();
281 }
282 WM_gizmo_set_matrix_location(widget, gizmo_location);
283
284 const float *gizmo_y_axis = ob_mat.ptr()[1];
285 WM_gizmo_set_matrix_rotation_from_yz_axis(widget, gizmo_y_axis, dir);
286
287 if (is_ortho) {
288 RNA_float_set_array(widget->ptr, "dimensions", aspect);
289
290 /* Set the pivot for scaling. Handles the case where the lens shifting is not zero and the
291 * gizmo should scale around the lens center instead of the gizmo center. */
292 const float pivot[2] = {ca->shiftx, -ca->shifty};
293 RNA_float_set_array(widget->ptr, "pivot", pivot);
294
295 mul_v2_fl(offset, ca->ortho_scale * 0.5f);
297 }
298 else {
299 RNA_float_set_array(widget->ptr, "aspect", aspect);
301
302 const float ob_scale_inv[3] = {
303 1.0f / len_v3(ob_mat.ptr()[0]),
304 1.0f / len_v3(ob_mat.ptr()[1]),
305 1.0f / len_v3(ob_mat.ptr()[2]),
306 };
307 const float ob_scale_uniform_inv = (ob_scale_inv[0] + ob_scale_inv[1] + ob_scale_inv[2]) /
308 3.0f;
309 scale_matrix = (ca->drawsize * 0.5f) / ob_scale_uniform_inv;
310 mul_v3_fl(widget->matrix_basis[0], scale_matrix);
311 mul_v3_fl(widget->matrix_basis[1], scale_matrix);
312 }
313 }
314
315 /* Define & update properties.
316 *
317 * Check modal to prevent feedback loop for orthographic cameras,
318 * where the range is based on the scale, see: #141667. */
319 if (!is_modal) {
320 if (is_ortho) {
321 PropertyRNA *ortho_scale_prop = RNA_struct_find_property(&camera_ptr, "ortho_scale");
322 const wmGizmoPropertyType *gz_prop_type = WM_gizmotype_target_property_find(widget->type,
323 "matrix");
324
328 params.range_get_fn = nullptr;
329 params.user_data = (void *)C;
330 // params.user_data = ob;
331
332 WM_gizmo_target_property_def_func(widget, "matrix", &params);
334 widget, gz_prop_type, &camera_ptr, ortho_scale_prop, -1);
335 }
336 else {
337 PropertyRNA *prop = RNA_struct_find_property(&camera_ptr, "lens");
338 const wmGizmoPropertyType *gz_prop_type = WM_gizmotype_target_property_find(widget->type,
339 "offset");
340
341 WM_gizmo_target_property_clear_rna_ptr(widget, gz_prop_type);
342
343 float min, max, range;
344 float step, precision;
345
346 /* get property range */
347 RNA_property_float_ui_range(&camera_ptr, prop, &min, &max, &step, &precision);
348 range = max - min;
349
351 widget,
352 scale_matrix * range /
353 /* Half sensor, intentionally use sensor from camera and not calculated above. */
354 (0.5f * sensor_size));
355
356 WM_gizmo_target_property_def_rna_ptr(widget, gz_prop_type, &camera_ptr, prop, -1);
357 }
358 }
359
360 /* This could be handled more elegantly (split into two gizmo groups). */
364 }
365}
366
368 wmGizmoGroup *gzgroup,
369 wmMsgBus *mbus)
370{
371 ARegion *region = CTX_wm_region(C);
372 const Main *bmain = CTX_data_main(C);
373 const Scene *scene = CTX_data_scene(C);
374 ViewLayer *view_layer = CTX_data_view_layer(C);
375 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
377 Camera *ca = id_cast<Camera *>(ob->data);
378
379 wmMsgSubscribeValue msg_sub_value_gz_tag_refresh{};
380 msg_sub_value_gz_tag_refresh.owner = region;
381 msg_sub_value_gz_tag_refresh.user_data = gzgroup->parent_gzmap;
382 msg_sub_value_gz_tag_refresh.notify = WM_gizmo_do_msg_notify_tag_refresh;
383
384 {
385 const PropertyRNA *props[] = {
386 &rna_CameraDOFSettings_focus_distance,
387 &rna_Camera_display_size,
388 &rna_Camera_ortho_scale,
389 &rna_Camera_sensor_fit,
390 &rna_Camera_sensor_width,
391 &rna_Camera_sensor_height,
392 &rna_Camera_shift_x,
393 &rna_Camera_shift_y,
394 &rna_Camera_type,
395 &rna_Camera_lens,
396 };
397
398 PointerRNA idptr = RNA_id_pointer_create(&ca->id);
399
400 for (int i = 0; i < ARRAY_SIZE(props); i++) {
401 WM_msg_subscribe_rna(mbus, &idptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
402 }
403 }
404
405 /* Subscribe to render settings */
406 {
408 mbus, RenderSettings, resolution_x, &msg_sub_value_gz_tag_refresh);
410 mbus, RenderSettings, resolution_y, &msg_sub_value_gz_tag_refresh);
412 mbus, RenderSettings, pixel_aspect_x, &msg_sub_value_gz_tag_refresh);
414 mbus, RenderSettings, pixel_aspect_y, &msg_sub_value_gz_tag_refresh);
415 }
416}
417
431
433
434/* -------------------------------------------------------------------- */
437
441
443
444 struct {
447 float roll;
448 bool flipped_x;
450};
451
452/* scale callbacks */
454 wmGizmoProperty *gz_prop,
455 void *value_p)
456{
457 float (*matrix)[4] = static_cast<float (*)[4]>(value_p);
458 BLI_assert(gz_prop->type->array_length == 16);
459 CameraViewWidgetGroup *viewgroup = static_cast<CameraViewWidgetGroup *>(
460 gz_prop->custom_func.user_data);
461 const rctf *border = viewgroup->state.edit_border;
462
463 unit_m4(matrix);
464 matrix[0][0] = BLI_rctf_size_x(border);
465 matrix[1][1] = BLI_rctf_size_y(border);
466 matrix[3][0] = BLI_rctf_cent_x(border);
467 matrix[3][1] = BLI_rctf_cent_y(border);
468}
469
471 wmGizmoProperty *gz_prop,
472 const void *value_p)
473{
474 const float (*matrix)[4] = static_cast<const float (*)[4]>(value_p);
475 CameraViewWidgetGroup *viewgroup = static_cast<CameraViewWidgetGroup *>(
476 gz_prop->custom_func.user_data);
477 rctf *border = viewgroup->state.edit_border;
478 BLI_assert(gz_prop->type->array_length == 16);
479
480 rctf rect{};
481 rect.xmin = 0;
482 rect.ymin = 0;
483 rect.xmax = 1;
484 rect.ymax = 1;
485 BLI_rctf_resize(border, len_v3(matrix[0]), len_v3(matrix[1]));
486 BLI_rctf_recenter(border, matrix[3][0], matrix[3][1]);
487 BLI_rctf_isect(&rect, border, border);
488
489 if (viewgroup->is_camera) {
491 }
492}
493
495{
496 const Main *bmain = CTX_data_main(C);
497 Scene *scene = CTX_data_scene(C);
498
499 /* This is just so the border isn't always in the way,
500 * stealing mouse clicks from regular usage.
501 * We could change the rules for when to show. */
502 {
503 ViewLayer *view_layer = CTX_data_view_layer(C);
504 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
505 if (scene->camera != BKE_view_layer_active_object_get(view_layer)) {
506 return false;
507 }
508 }
509
510 View3D *v3d = CTX_wm_view3d(C);
512 return false;
513 }
514
515 ARegion *region = CTX_wm_region(C);
516 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
517 if (rv3d->persp == RV3D_CAMOB) {
518 if (scene->r.mode & R_BORDER) {
519 /* TODO: support overrides. */
520 if (BKE_id_is_editable(CTX_data_main(C), &scene->id)) {
521 return true;
522 }
523 }
524 }
525 else if (v3d->flag2 & V3D_RENDER_BORDER) {
526 return true;
527 }
528 return false;
529}
530
531static void WIDGETGROUP_camera_view_setup(const bContext * /*C*/, wmGizmoGroup *gzgroup)
532{
533 CameraViewWidgetGroup *viewgroup = MEM_new<CameraViewWidgetGroup>(__func__);
534
535 viewgroup->border = WM_gizmo_new("GIZMO_GT_cage_2d", gzgroup, nullptr);
536
537 RNA_enum_set(viewgroup->border->ptr,
538 "transform",
540 /* Box style is more subtle in this case. */
541 RNA_enum_set(viewgroup->border->ptr, "draw_style", ED_GIZMO_CAGE2D_STYLE_BOX);
542
543 WM_gizmo_set_scale(viewgroup->border, 10.0f / 0.15f);
544
545 gzgroup->customdata = viewgroup;
546
547 /* NOTE: #WM_GIZMO_NEEDS_UNDO is set on refresh and depends on modifying a camera object. */
548}
549
551{
552 CameraViewWidgetGroup *viewgroup = static_cast<CameraViewWidgetGroup *>(gzgroup->customdata);
553
554 ARegion *region = CTX_wm_region(C);
555 /* Drawing code should happen with fully evaluated graph. */
556 Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
557 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
558 if (rv3d->persp == RV3D_CAMOB) {
559 Scene *scene = CTX_data_scene(C);
560 View3D *v3d = CTX_wm_view3d(C);
561 viewgroup->state.view_border = BKE_camera_view_border(
562 scene, depsgraph, v3d, rv3d, region->winx, region->winy, false, false, true);
563 viewgroup->state.roll = rv3d->camroll;
564 viewgroup->state.flipped_x = (rv3d->rflag & RV3D_FLIP_X) != 0;
565 }
566 else {
567 rctf rect{};
568 rect.xmin = 0;
569 rect.ymin = 0;
570 rect.xmax = region->winx;
571 rect.ymax = region->winy;
572 viewgroup->state.view_border = rect;
573 viewgroup->state.roll = 0.0f;
574 viewgroup->state.flipped_x = false;
575 }
576
577 wmGizmo *gz = viewgroup->border;
579 mul_v3_fl(gz->matrix_space[0], BLI_rctf_size_x(&viewgroup->state.view_border));
580 mul_v3_fl(gz->matrix_space[1], BLI_rctf_size_y(&viewgroup->state.view_border));
581 gz->matrix_space[3][0] = viewgroup->state.view_border.xmin;
582 gz->matrix_space[3][1] = viewgroup->state.view_border.ymin;
583
584 /* Apply roll and flip. */
585 if (viewgroup->state.roll != 0.0f || viewgroup->state.flipped_x) {
586 const int center_x = region->winx / 2;
587 const int center_y = region->winy / 2;
588 gz->matrix_space[3][0] -= center_x;
589 gz->matrix_space[3][1] -= center_y;
590
592 rotate_m4(gz->matrix_space, 'Z', -viewgroup->state.roll);
593
594 /* Apply flip. */
595 if (viewgroup->state.flipped_x) {
596 negate_v4(gz->matrix_space[0]);
597 }
598
600
601 gz->matrix_space[3][0] += center_x;
602 gz->matrix_space[3][1] += center_y;
603 }
604}
605
607{
608 CameraViewWidgetGroup *viewgroup = static_cast<CameraViewWidgetGroup *>(gzgroup->customdata);
609
610 View3D *v3d = CTX_wm_view3d(C);
611 ARegion *region = CTX_wm_region(C);
612 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
613 Scene *scene = CTX_data_scene(C);
614
615 viewgroup->scene = scene;
616
617 {
618 wmGizmo *gz = viewgroup->border;
620
621 RNA_enum_set(viewgroup->border->ptr,
622 "transform",
624
625 if (rv3d->persp == RV3D_CAMOB) {
626 viewgroup->state.edit_border = &scene->r.border;
627 viewgroup->is_camera = true;
628 viewgroup->state.roll = rv3d->camroll;
629 viewgroup->state.flipped_x = (rv3d->rflag & RV3D_FLIP_X) != 0;
630 }
631 else {
632 viewgroup->state.edit_border = &v3d->render_border;
633 viewgroup->is_camera = false;
634 viewgroup->state.roll = 0.0f;
635 viewgroup->state.flipped_x = false;
636 }
637
641 params.range_get_fn = nullptr;
642 params.user_data = viewgroup;
643 WM_gizmo_target_property_def_func(gz, "matrix", &params);
644
646 }
647}
648
650{
651 gzgt->name = "Camera View Widgets";
652 gzgt->idname = "VIEW3D_GGT_camera_view";
653
655
660}
661
663
664} // namespace blender
Camera data-block and utility functions.
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
btScalar max
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
const int state
VecBase< float, 3 > float3
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
void get_color_3fv(int colorid, float col[3])
BMesh Iterators.
static void WIDGETGROUP_camera_setup(const bContext *C, wmGizmoGroup *gzgroup)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE void negate_v3_v3(float r[3], const float a[3])
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
void ED_gizmo_arrow3d_set_range_fac(wmGizmo *gz, const float range_fac)
static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void WM_gizmo_do_msg_notify_tag_refresh(bContext *, wmMsgSubscribeKey *, wmMsgSubscribeValue *msg_val)
void BLI_rctf_recenter(struct rctf *rect, float x, float y)
Definition rct.cc:616
void WM_gizmo_set_matrix_rotation_from_yz_axis(wmGizmo *gz, const float y_axis[3], const float z_axis[3])
Definition wm_gizmo.cc:277
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
void WM_gizmo_target_property_def_func(wmGizmo *gz, const char *idname, const wmGizmoPropertyFnParams *params)
PointerRNA RNA_id_pointer_create(ID *id)
MINLINE void mul_v2_fl(float r[2], float f)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
static void gizmo_orthoscale_prop_matrix_get(const wmGizmo *, wmGizmoProperty *gz_prop, void *value_p)
const wmGizmoPropertyType * WM_gizmotype_target_property_find(const wmGizmoType *gzt, const char *idname)
const wmGizmoType * WM_gizmotype_find(const StringRef idname, bool quiet)
void BLI_rctf_resize(struct rctf *rect, float x, float y)
Definition rct.cc:671
bool is_negative_m4(const float mat[4][4])
static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType *)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
@ CAMERA_SENSOR_FIT_HOR
void WM_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
Definition wm_gizmo.cc:298
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE
@ ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE_UNIFORM
MatBase< float, 4, 4 > float4x4
void VIEW3D_GGT_camera(wmGizmoGroupType *gzgt)
ViewLayer * CTX_data_view_layer(const bContext *C)
MINLINE void mul_v3_fl(float r[3], float f)
@ ED_GIZMO_CAGE2D_STYLE_BOX
void WM_gizmo_target_property_def_rna(wmGizmo *gz, const char *idname, PointerRNA *ptr, const char *propname, int index)
void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
Definition wm_gizmo.cc:313
void VIEW3D_GGT_camera_view(wmGizmoGroupType *gzgt)
static void WIDGETGROUP_camera_view_setup(const bContext *, wmGizmoGroup *gzgroup)
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
Definition wm_gizmo.cc:303
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void WM_gizmo_target_property_clear_rna_ptr(wmGizmo *gz, const wmGizmoPropertyType *gz_prop_type)
@ ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED
void DEG_id_tag_update(ID *id, unsigned int flags)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition BLI_rect.hh:215
rctf BKE_camera_view_border(const struct Scene *scene, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winx, int winy, bool no_shift, bool no_zoom, bool no_roll)
@ V3D_GIZMO_SHOW_CAMERA_DOF_DIST
@ V3D_GIZMO_SHOW_CAMERA_LENS
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
void unit_m4(float m[4][4])
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmGizmoGroupType *)
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
wmGizmo * WM_gizmo_new(const StringRef idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:97
bool WM_gizmo_group_is_modal(const wmGizmoGroup *gzgroup)
Definition wm_gizmo.cc:716
int BKE_camera_sensor_fit(int sensor_fit, float sizex, float sizey)
@ ED_GIZMO_ARROW_STYLE_CONE
@ ED_GIZMO_ARROW_STYLE_CROSS
static void WIDGETGROUP_camera_message_subscribe(const bContext *C, wmGizmoGroup *gzgroup, wmMsgBus *mbus)
void WM_msg_subscribe_rna(wmMsgBus *mbus, PointerRNA *ptr, const PropertyRNA *prop, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
@ WM_GIZMOGROUPTYPE_DEPTH_3D
@ WM_GIZMOGROUPTYPE_PERSISTENT
@ WM_GIZMOGROUPTYPE_SCALE
@ WM_GIZMO_DRAW_NO_SCALE
@ WM_GIZMO_DRAW_HOVER
@ WM_GIZMO_NEEDS_UNDO
float BKE_camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
void rotate_m4(float mat[4][4], char axis, float angle)
Depsgraph * CTX_data_expect_evaluated_depsgraph(const bContext *C)
void transpose_m4(float R[4][4])
Main * CTX_data_main(const bContext *C)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition BLI_rect.hh:211
bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest)
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
Definition BLI_rect.hh:198
@ ID_RECALC_PARAMETERS
Definition DNA_ID.h:1138
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
static void gizmo_render_border_prop_matrix_set(const wmGizmo *, wmGizmoProperty *gz_prop, const void *value_p)
MINLINE void negate_v4(float r[4])
static void gizmo_render_border_prop_matrix_get(const wmGizmo *, wmGizmoProperty *gz_prop, void *value_p)
Scene * CTX_data_scene(const bContext *C)
wmKeyMap * WM_gizmogroup_setup_keymap_generic_maybe_drag(const wmGizmoGroupType *, wmKeyConfig *kc)
static void WIDGETGROUP_camera_view_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax, float *step, float *precision)
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
Definition wm_gizmo.cc:283
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:84
bool BKE_id_is_editable(const Main *bmain, const ID *id)
Definition lib_id.cc:2782
void WM_gizmo_target_property_def_rna_ptr(wmGizmo *gz, const wmGizmoPropertyType *gz_prop_type, PointerRNA *ptr, PropertyRNA *prop, int index)
static void gizmo_orthoscale_prop_matrix_set(const wmGizmo *, wmGizmoProperty *gz_prop, const void *value_p)
ARegion * CTX_wm_region(const bContext *C)
BLI_INLINE float BLI_rctf_cent_x(const struct rctf *rct)
Definition BLI_rect.hh:194
View3D * CTX_wm_view3d(const bContext *C)
#define fabsf
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
#define min(a, b)
Definition sort.cc:38
struct Object * object
struct blender::CameraViewWidgetGroup::@105364114353266356352250050251241015025343130061 state
const c_style_mat & ptr() const
eRegionView3D_Flag rflag
eRegionView3D_Persp persp
struct Object * camera
struct RenderData r
eView3D_Flag2 flag2
eView3D_GizmoShowCamera gizmo_show_camera
eView3D_GizmoFlag gizmo_flag
wmGizmoGroupFnMsgBusSubscribe message_subscribe
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnSetupKeymap setup_keymap
wmGizmoGroupFnDrawPrepare draw_prepare
eWM_GizmoFlagGroupTypeFlag flag
ListBaseT< wmGizmo > gizmos
wmGizmoPropertyFnSet value_set_fn
wmGizmoPropertyFnRangeGet range_get_fn
wmGizmoPropertyFnGet value_get_fn
const wmGizmoPropertyType * type
struct blender::wmGizmoProperty::@216011055122204070127377170176223170047224321165 custom_func
float matrix_basis[4][4]
float matrix_space[4][4]
const wmGizmoType * type
eWM_GizmoFlag flag
#define WM_msg_subscribe_rna_anon_prop(mbus, type_, prop_, value)