Blender V5.3
view3d_gizmo_geometry_nodes.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "WM_api.hh"
10#include "WM_types.hh"
11
12#include "DNA_modifier_types.h"
13#include "DNA_node_types.h"
14
16#include "BKE_context.hh"
18#include "BKE_geometry_set.hh"
20#include "BKE_instances.hh"
22#include "BKE_modifier.hh"
24#include "BKE_node_runtime.hh"
25#include "BKE_object.hh"
26
27#include "BLI_math_base_safe.hh"
28#include "BLI_math_matrix.hh"
29#include "BLI_math_matrix_c.hh"
30#include "BLI_math_rotation.hh"
32
33#include "RNA_access.hh"
34
35#include "MOD_nodes.hh"
36
37#include "NOD_eval_log.hh"
39
40#include "UI_resources.hh"
41
42#include "ED_gizmo_library.hh"
43#include "ED_node.hh"
44
45#include "DEG_depsgraph.hh"
47
48#include "view3d_intern.hh"
49
50namespace blender {
51
53namespace eval_log = nodes::eval_log;
55
56static bool gizmo_is_interacting(const wmGizmo &gizmo)
57{
58 return gizmo.interaction_data != nullptr;
59}
60
62{
63 switch (color_id) {
65 return TH_GIZMO_PRIMARY;
67 return TH_GIZMO_SECONDARY;
69 return TH_AXIS_X;
71 return TH_AXIS_Y;
73 return TH_AXIS_Z;
74 }
75 return TH_GIZMO_PRIMARY;
76}
77
79{
80 return std::array{TH_AXIS_X, TH_AXIS_Y, TH_AXIS_Z}[axis];
81}
82
83static void get_axis_gizmo_colors(const int axis, float *r_color, float *r_color_hi)
84{
85 const ThemeColorID theme_id = get_axis_theme_color_id(axis);
86 ui::theme::get_color_3fv(theme_id, r_color);
87 ui::theme::get_color_3fv(theme_id, r_color_hi);
88 r_color[3] = 0.6f;
89 r_color_hi[3] = 1.0f;
90}
91
93{
94 /* Without this, the gizmo may be skewed. */
97 m.z_axis() = math::normalize(m.z_axis());
99}
100
102 const float3 &direction,
103 const math::AxisSigned direction_axis)
104{
106 math::Quaternion rotation;
107 const float3 base_direction = math::to_vector<float3>(direction_axis);
108 rotation_between_vecs_to_quat(&rotation.w, base_direction, direction);
110 mat.location() = position;
111 return mat;
112}
113
116 bool invalid_transform = false;
117};
118
119using ApplyChangeFn = std::function<void(
120 UString socket_identifier, FunctionRef<void(bke::SocketValueVariant &value)> modify_value)>;
121
123 const bContext &C;
124 /* Transform of the object and geometry that the gizmo belongs to. */
130
131 template<typename T> [[nodiscard]] bool get_input_value(const UString identifier, T &r_value)
132 {
133 const bNodeSocket &socket = *this->gizmo_node.input_by_identifier(identifier);
134 const std::optional<T> value_opt = this->tree_log.find_primitive_socket_value<T>(socket);
135 if (!value_opt) {
136 return false;
137 }
138 r_value = *value_opt;
139 return true;
140 }
141};
142
144 public:
151
152 virtual ~NodeGizmos() = default;
153
158 virtual void create_gizmos(wmGizmoGroup &gzgroup) = 0;
159
161 virtual void update(GizmosUpdateParams & /*params*/) {}
162
165
166 void hide_all()
167 {
168 for (wmGizmo *gizmo : this->get_all_gizmos()) {
170 }
171 }
172
173 void show_all()
174 {
175 for (wmGizmo *gizmo : this->get_all_gizmos()) {
176 WM_gizmo_set_flag(gizmo, WM_GIZMO_HIDDEN, false);
177 }
178 }
179
182 {
183 bool any_interacting = false;
184 for (const wmGizmo *gizmo : this->get_all_gizmos()) {
185 any_interacting |= gizmo_is_interacting(*gizmo);
186 }
187 return any_interacting;
188 }
189};
190
191class LinearGizmo : public NodeGizmos {
192 private:
193 wmGizmo *gizmo_ = nullptr;
194
195 struct EditData {
197 float factor_from_transform = 1.0f;
198 float current_value = 0.0f;
199 } edit_data_;
200
201 public:
202 void create_gizmos(wmGizmoGroup &gzgroup) override
203 {
204 gizmo_ = WM_gizmo_new("GIZMO_GT_arrow_3d", &gzgroup, nullptr);
205 }
206
208 {
209 return {gizmo_};
210 }
211
212 void update(GizmosUpdateParams &params) override
213 {
214 const auto &storage = *static_cast<const NodeGeometryLinearGizmo *>(params.gizmo_node.storage);
215 const bool is_interacting = gizmo_is_interacting(*gizmo_);
216
217 this->update_style(storage);
218
219 if (is_interacting) {
220 return;
221 }
222 if (!this->update_transform(params)) {
223 return;
224 }
226 }
227
229 {
230 /* Make sure the enum values are in sync. */
234 RNA_enum_set(gizmo_->ptr, "draw_style", storage.draw_style);
235
236 WM_gizmo_set_line_width(gizmo_, 1.0f);
237
238 const float length = (storage.draw_style == GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_BOX) ? 0.8f :
239 1.0f;
240 RNA_float_set(gizmo_->ptr, "length", length);
241
242 const ThemeColorID color_theme_id = get_gizmo_theme_color_id(
244 ui::theme::get_color_3fv(color_theme_id, gizmo_->color);
245 ui::theme::get_color_3fv(TH_GIZMO_HI, gizmo_->color_hi);
246 }
247
249 {
251 float3 direction;
252 if (!params.get_input_value("Position"_ustr, position) ||
253 !params.get_input_value("Direction"_ustr, direction))
254 {
255 params.r_report.missing_socket_logs = true;
256 return false;
257 }
258 direction = math::normalize(direction);
259 if (math::is_zero(direction)) {
260 params.r_report.invalid_transform = true;
261 return false;
262 }
263
264 const float4x4 gizmo_base_transform = matrix_from_position_and_up_direction(
266
267 float4x4 gizmo_transform = params.parent_transform * gizmo_base_transform;
268 edit_data_.factor_from_transform = safe_divide(1.0f, math::length(gizmo_transform.z_axis()));
270 copy_m4_m4(gizmo_->matrix_basis, gizmo_transform.ptr());
271 return true;
272 }
273
275 {
276 /* Always reset to 0 when not interacting. */
277 edit_data_.current_value = 0.0f;
278
279 wmGizmoPropertyFnParams fn_params{};
280 fn_params.user_data = this;
281 fn_params.value_set_fn =
282 [](const wmGizmo * /*gz*/, wmGizmoProperty *gz_prop, const void *value_ptr) {
283 LinearGizmo &self = *static_cast<LinearGizmo *>(gz_prop->custom_func.user_data);
284 const float new_gizmo_value = *static_cast<const float *>(value_ptr);
285 self.edit_data_.current_value = new_gizmo_value;
286 const float offset = new_gizmo_value * self.edit_data_.factor_from_transform;
287 self.apply_change("Value"_ustr, [&](bke::SocketValueVariant &value_variant) {
288 value_variant.ensure_type<float>() += offset;
289 });
290 };
291 fn_params.value_get_fn =
292 [](const wmGizmo * /*gz*/, wmGizmoProperty *gz_prop, void *value_ptr) {
293 LinearGizmo &self = *static_cast<LinearGizmo *>(gz_prop->custom_func.user_data);
294 *static_cast<float *>(value_ptr) = self.edit_data_.current_value;
295 };
296 WM_gizmo_target_property_def_func(gizmo_, "offset", &fn_params);
297 }
298};
299
300class DialGizmo : public NodeGizmos {
301 private:
302 wmGizmo *gizmo_ = nullptr;
303
304 struct EditData {
305 bool is_negative_transform = false;
306 float current_value = 0.0f;
307 } edit_data_;
308
309 public:
310 void create_gizmos(wmGizmoGroup &gzgroup) override
311 {
312 gizmo_ = WM_gizmo_new("GIZMO_GT_dial_3d", &gzgroup, nullptr);
313 }
314
316 {
317 return {gizmo_};
318 }
319
320 void update(GizmosUpdateParams &params) override
321 {
322 const auto &storage = *static_cast<const NodeGeometryDialGizmo *>(params.gizmo_node.storage);
323 const bool is_interacting = gizmo_is_interacting(*gizmo_);
324
325 this->update_style(storage, is_interacting);
326
327 if (is_interacting) {
328 return;
329 }
330 if (!this->update_transform(params)) {
331 return;
332 }
334 }
335
336 void update_style(const NodeGeometryDialGizmo &storage, const bool is_interacting)
337 {
339 WM_gizmo_set_line_width(gizmo_, 2.0f);
340 RNA_boolean_set(gizmo_->ptr, "wrap_angle", false);
341
342 int draw_options = RNA_enum_get(gizmo_->ptr, "draw_options");
343 SET_FLAG_FROM_TEST(draw_options, is_interacting, ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE);
344 RNA_enum_set(gizmo_->ptr, "draw_options", draw_options);
345
346 const ThemeColorID color_theme_id = get_gizmo_theme_color_id(
348 ui::theme::get_color_3fv(color_theme_id, gizmo_->color);
349 ui::theme::get_color_3fv(TH_GIZMO_HI, gizmo_->color_hi);
350 }
351
353 {
355 float3 up;
356 bool screen_space;
357 float radius;
358 if (!params.get_input_value("Position"_ustr, position) ||
359 !params.get_input_value("Up"_ustr, up) ||
360 !params.get_input_value("Screen Space"_ustr, screen_space) ||
361 !params.get_input_value("Radius"_ustr, radius))
362 {
363 params.r_report.missing_socket_logs = true;
364 return false;
365 }
366 up = math::normalize(up);
367
368 if (math::is_zero(up) || math::is_zero(radius)) {
369 params.r_report.invalid_transform = true;
370 return false;
371 }
372
373 const float4x4 gizmo_base_transform = matrix_from_position_and_up_direction(
375 float4x4 gizmo_transform = params.parent_transform * gizmo_base_transform;
376 edit_data_.is_negative_transform = math::determinant(gizmo_transform) < 0.0f;
378 copy_m4_m4(gizmo_->matrix_basis, gizmo_transform.ptr());
379
380 WM_gizmo_set_flag(gizmo_, WM_GIZMO_DRAW_NO_SCALE, !screen_space);
381 float transform_scale = 1.0f;
382 if (!screen_space) {
383 /* We can't scale the dial gizmo non-uniformly, so just take the average of the scale in each
384 * axis for now. */
386 }
387 copy_m4_m4(gizmo_->matrix_offset,
389
390 return true;
391 }
392
394 {
395 edit_data_.current_value = 0.0f;
396
398 params.user_data = this;
399 params.value_set_fn =
400 [](const wmGizmo * /*gz*/, wmGizmoProperty *gz_prop, const void *value_ptr) {
401 DialGizmo &self = *static_cast<DialGizmo *>(gz_prop->custom_func.user_data);
402 const float new_gizmo_value = *static_cast<const float *>(value_ptr);
403 self.edit_data_.current_value = new_gizmo_value;
404 float offset = new_gizmo_value;
405 if (self.edit_data_.is_negative_transform) {
406 offset = -offset;
407 }
408 self.apply_change("Value"_ustr, [&](bke::SocketValueVariant &value_variant) {
409 value_variant.ensure_type<float>() += offset;
410 });
411 };
412 params.value_get_fn = [](const wmGizmo * /*gz*/, wmGizmoProperty *gz_prop, void *value_ptr) {
413 DialGizmo &self = *static_cast<DialGizmo *>(gz_prop->custom_func.user_data);
414 *static_cast<float *>(value_ptr) = self.edit_data_.current_value;
415 };
416 WM_gizmo_target_property_def_func(gizmo_, "offset", &params);
417 }
418};
419
421 private:
422 std::array<wmGizmo *, 3> translation_gizmos_ = {};
423 std::array<wmGizmo *, 3> rotation_gizmos_ = {};
424 std::array<wmGizmo *, 3> scale_gizmos_ = {};
425
426 bool any_translation_visible_ = false;
427 bool any_rotation_visible_ = false;
428 bool any_scale_visible_ = false;
429
430 int transform_orientation_ = V3D_ORIENT_GLOBAL;
431
436 float4x4 parent_transform_;
437
438 struct EditData {
439 float3 current_translation;
440 float3 current_rotation;
441 float3 current_scale;
442 } edit_data_;
443
444 public:
445 void create_gizmos(wmGizmoGroup &gzgroup) override
446 {
447 /* Translation */
448 for (const int axis : IndexRange(3)) {
449 translation_gizmos_[axis] = WM_gizmo_new("GIZMO_GT_arrow_3d", &gzgroup, nullptr);
450 }
451
452 /* Rotation */
453 for (const int axis : IndexRange(3)) {
454 rotation_gizmos_[axis] = WM_gizmo_new("GIZMO_GT_dial_3d", &gzgroup, nullptr);
455 }
456
457 /* Scale */
458 for (const int axis : IndexRange(3)) {
459 scale_gizmos_[axis] = WM_gizmo_new("GIZMO_GT_arrow_3d", &gzgroup, nullptr);
460 }
461 }
462
464 {
466 gizmos.extend(translation_gizmos_);
467 gizmos.extend(rotation_gizmos_);
468 gizmos.extend(scale_gizmos_);
469 return gizmos;
470 }
471
472 void update(GizmosUpdateParams &params) override
473 {
474 const auto &storage = *static_cast<const NodeGeometryTransformGizmo *>(
475 params.gizmo_node.storage);
476
477 this->update_visibility(params, storage);
479 this->update_rotate_style();
480 this->update_scale_style();
481
483 math::Quaternion rotation;
484 if (!params.get_input_value("Position"_ustr, position) ||
485 !params.get_input_value("Rotation"_ustr, rotation))
486 {
487 params.r_report.missing_socket_logs = true;
488 return;
489 }
490
491 float4x4 base_transform_from_socket = math::from_rotation<float4x4>(rotation);
492 base_transform_from_socket.location() = position;
493
494 Scene &scene = *CTX_data_scene(&params.C);
495 const TransformOrientationSlot &orientation_slot = scene.orientation_slots[0];
496 transform_orientation_ = orientation_slot.type;
497
498 parent_transform_ = params.parent_transform;
499
500 this->update_translate_transform_and_target_property(params, base_transform_from_socket);
501 this->update_rotate_transform_and_target_property(params, base_transform_from_socket);
502 this->update_scale_transform_and_target_property(params, base_transform_from_socket);
503 }
504
506 {
507 any_translation_visible_ = false;
508 any_rotation_visible_ = false;
509 any_scale_visible_ = false;
510
511 const auto &elem = std::get<nodes::inverse_eval::MatrixElem>(params.elem.elem);
512
513 for (const int axis : IndexRange(3)) {
514 const bool translation_used = (storage.flag &
516 elem.translation;
517 const bool rotation_used = (storage.flag &
519 elem.rotation;
520 const bool scale_used = (storage.flag & (GEO_NODE_TRANSFORM_GIZMO_USE_SCALE_X << axis)) &&
521 elem.scale;
522
523 WM_gizmo_set_flag(translation_gizmos_[axis], WM_GIZMO_HIDDEN, !translation_used);
524 WM_gizmo_set_flag(rotation_gizmos_[axis], WM_GIZMO_HIDDEN, !rotation_used);
525 WM_gizmo_set_flag(scale_gizmos_[axis], WM_GIZMO_HIDDEN, !scale_used);
526
527 any_translation_visible_ |= translation_used;
528 any_rotation_visible_ |= rotation_used;
529 any_scale_visible_ |= scale_used;
530 }
531 }
532
534 {
535 for (const int axis : IndexRange(3)) {
536 wmGizmo *gizmo = translation_gizmos_[axis];
537 get_axis_gizmo_colors(axis, gizmo->color, gizmo->color_hi);
538 WM_gizmo_set_line_width(gizmo, 2.0f);
539
540 float start = 0.0f;
541 float length = 1.0f;
542 if (any_rotation_visible_) {
543 start = 1.125;
544 length = 0.0f;
545 }
546 else if (any_scale_visible_) {
547 start = 1.0f;
548 length = 0.0f;
549 }
550
551 unit_m4(gizmo->matrix_offset);
552 gizmo->matrix_offset[3][2] = start;
553 RNA_float_set(gizmo->ptr, "length", length);
555 }
556 }
557
559 {
560 for (const int axis : IndexRange(3)) {
561 wmGizmo *gizmo = rotation_gizmos_[axis];
562 get_axis_gizmo_colors(axis, gizmo->color, gizmo->color_hi);
563
564 const bool is_interacting = gizmo_is_interacting(*gizmo);
565 int draw_options = RNA_enum_get(gizmo->ptr, "draw_options");
566 /* The clipping currently looks a bit weird without the white circle around the gizmo.
567 * However, without clipping it looks also very confusing sometimes. */
568 draw_options |= ED_GIZMO_DIAL_DRAW_FLAG_CLIP;
569 SET_FLAG_FROM_TEST(draw_options, is_interacting, ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE);
570 RNA_enum_set(gizmo->ptr, "draw_options", draw_options);
571
573 WM_gizmo_set_line_width(gizmo, 3.0f);
574 RNA_boolean_set(gizmo->ptr, "wrap_angle", false);
575 }
576 }
577
579 {
580 for (const int axis : IndexRange(3)) {
581 wmGizmo *gizmo = scale_gizmos_[axis];
582 get_axis_gizmo_colors(axis, gizmo->color, gizmo->color_hi);
583 RNA_enum_set(gizmo->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_BOX);
584
585 const float length = (any_translation_visible_ || any_rotation_visible_) ? 0.775f : 1.0f;
586 RNA_float_set(gizmo->ptr, "length", length);
587
588 WM_gizmo_set_line_width(gizmo, 2.0f);
589 }
590 }
591
593 const float4x4 &base_transform_from_socket)
594 {
595 for (const int axis_i : IndexRange(3)) {
596 const math::Axis axis = math::Axis::from_int(axis_i);
597 wmGizmo *gizmo = translation_gizmos_[axis_i];
598 if (gizmo_is_interacting(*gizmo)) {
599 continue;
600 }
601
602 const float4x4 gizmo_transform = get_axis_gizmo_matrix_basis(
603 axis, base_transform_from_socket, params);
604 copy_m4_m4(gizmo->matrix_basis, gizmo_transform.ptr());
605
606 edit_data_.current_translation[axis_i] = 0.0f;
607
609 params.user_data = this;
610 params.value_set_fn = [](const wmGizmo *gz,
611 wmGizmoProperty *gz_prop,
612 const void *value_ptr) {
613 TransformGizmos &self = *static_cast<TransformGizmos *>(gz_prop->custom_func.user_data);
614 const int axis_i = Span(self.translation_gizmos_).first_index(const_cast<wmGizmo *>(gz));
615 const float new_gizmo_value = *static_cast<const float *>(value_ptr);
616 self.edit_data_.current_translation[axis_i] = new_gizmo_value;
617 float3 translation{};
618 translation[axis_i] = new_gizmo_value;
619 self.apply_change("Value"_ustr, [&](bke::SocketValueVariant &value_variant) {
620 float4x4 &value = value_variant.ensure_type<float4x4>();
621 const float3x3 orientation = float3x3(value);
622 float3 offset{};
623 if (self.transform_orientation_ == V3D_ORIENT_GLOBAL) {
624 offset = math::transform_direction(math::invert(self.parent_transform_), translation);
625 }
626 else {
627 const float factor = safe_divide(
628 1.0f, math::length((self.parent_transform_.view<3, 3>() * orientation)[axis_i]));
629 offset = math::transform_direction(orientation, translation) * factor;
630 }
631 value.location() += offset;
632 });
633 };
634 params.value_get_fn = [](const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_ptr) {
635 TransformGizmos &self = *static_cast<TransformGizmos *>(gz_prop->custom_func.user_data);
636 const int axis_i = Span(self.translation_gizmos_).first_index(const_cast<wmGizmo *>(gz));
637 *static_cast<float *>(value_ptr) = self.edit_data_.current_translation[axis_i];
638 };
639 WM_gizmo_target_property_def_func(gizmo, "offset", &params);
640 }
641 }
642
644 const float4x4 &base_transform_from_socket)
645 {
646 for (const int axis_i : IndexRange(3)) {
647 const math::Axis axis = math::Axis::from_int(axis_i);
648 wmGizmo *gizmo = rotation_gizmos_[axis_i];
649 if (gizmo_is_interacting(*gizmo)) {
650 continue;
651 }
652
653 const float4x4 gizmo_transform = get_axis_gizmo_matrix_basis(
654 axis, base_transform_from_socket, params);
655 copy_m4_m4(gizmo->matrix_basis, gizmo_transform.ptr());
656
657 edit_data_.current_rotation[axis_i] = 0.0f;
658
660 params.user_data = this;
661 params.value_set_fn = [](const wmGizmo *gz,
662 wmGizmoProperty *gz_prop,
663 const void *value_ptr) {
664 TransformGizmos &self = *static_cast<TransformGizmos *>(gz_prop->custom_func.user_data);
665 const int axis_i = Span(self.rotation_gizmos_).first_index(const_cast<wmGizmo *>(gz));
666 const math::Axis axis = math::Axis::from_int(axis_i);
667 const float new_gizmo_value = *static_cast<const float *>(value_ptr);
668 self.edit_data_.current_rotation[axis_i] = new_gizmo_value;
669 self.apply_change("Value"_ustr, [&](bke::SocketValueVariant &value_variant) {
670 float4x4 &value = value_variant.ensure_type<float4x4>();
671 float3 local_rotation_axis;
672 if (self.transform_orientation_ == V3D_ORIENT_GLOBAL) {
673 local_rotation_axis = math::normalize(math::transform_direction(
674 math::invert(float3x3(self.parent_transform_)), math::to_vector<float3>(axis)));
675 }
676 else {
677 local_rotation_axis = math::normalize(float3(value[axis_i]));
678 }
679 float3x3 rotation_matrix;
680 rotation_matrix = math::from_rotation<float3x3>(
681 math::AxisAngle(local_rotation_axis, -new_gizmo_value));
682 value.view<3, 3>() = rotation_matrix * value.view<3, 3>();
683 });
684 };
685 params.value_get_fn = [](const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_ptr) {
686 TransformGizmos &self = *static_cast<TransformGizmos *>(gz_prop->custom_func.user_data);
687 const int axis_i = Span(self.rotation_gizmos_).first_index(const_cast<wmGizmo *>(gz));
688 *static_cast<float *>(value_ptr) = self.edit_data_.current_rotation[axis_i];
689 };
690 WM_gizmo_target_property_def_func(gizmo, "offset", &params);
691 }
692 }
693
695 const float4x4 &base_transform_from_socket)
696 {
697 for (const int axis_i : IndexRange(3)) {
698 const math::Axis axis = math::Axis::from_int(axis_i);
699 wmGizmo *gizmo = scale_gizmos_[axis_i];
700 if (gizmo_is_interacting(*gizmo)) {
701 continue;
702 }
703
704 const float4x4 gizmo_transform = get_axis_gizmo_matrix_basis(
705 axis, base_transform_from_socket, params);
706 copy_m4_m4(gizmo->matrix_basis, gizmo_transform.ptr());
707
708 edit_data_.current_scale[axis_i] = 0.0f;
709
711 params.user_data = this;
712 params.value_set_fn = [](const wmGizmo *gz,
713 wmGizmoProperty *gz_prop,
714 const void *value_ptr) {
715 TransformGizmos &self = *static_cast<TransformGizmos *>(gz_prop->custom_func.user_data);
716 const int axis_i = Span(self.scale_gizmos_).first_index(const_cast<wmGizmo *>(gz));
717 const math::Axis axis = math::Axis::from_int(axis_i);
718 const float new_gizmo_value = *static_cast<const float *>(value_ptr);
719 self.edit_data_.current_scale[axis_i] = new_gizmo_value;
720 float3 scale{1.0f, 1.0f, 1.0f};
721 scale[axis_i] += new_gizmo_value;
722 self.apply_change("Value"_ustr, [&](bke::SocketValueVariant &value_variant) {
723 float4x4 &value = value_variant.ensure_type<float4x4>();
724 float3 local_scale_axis;
725 if (self.transform_orientation_ == V3D_ORIENT_GLOBAL) {
727 math::invert(float3x3(self.parent_transform_)), math::to_vector<float3>(axis)));
728 }
729 else {
730 local_scale_axis = math::normalize(float3(value[axis_i]));
731 }
732 const float3x3 rotation_matrix = math::from_rotation<float3x3>(
733 math::AxisAngle(local_scale_axis, math::to_vector<float3>(axis)));
734 const float3x3 scaled = math::invert(rotation_matrix) *
735 math::from_scale<float3x3>(scale) * rotation_matrix *
736 value.view<3, 3>();
737
738 /* Apply only the new column lengths to the original directions to avoid
739 * rotation drift when repeatedly applying the scale transform, see #155866. */
740 for (int i = 0; i < 3; i++) {
741 const float3 col = float3(value[i]);
742 const float len_sq = math::length_squared(col);
743 if (len_sq > math::square(1e-6f)) {
744 const float len = math::sqrt(len_sq);
745 value[i] = float4(col * (math::length(float3(scaled[i])) / len), 0.0f);
746 }
747 }
748 });
749 };
750 params.value_get_fn = [](const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_ptr) {
751 TransformGizmos &self = *static_cast<TransformGizmos *>(gz_prop->custom_func.user_data);
752 const int axis_i = Span(self.scale_gizmos_).first_index(const_cast<wmGizmo *>(gz));
753 *static_cast<float *>(value_ptr) = self.edit_data_.current_scale[axis_i];
754 };
755 WM_gizmo_target_property_def_func(gizmo, "offset", &params);
756 }
757 }
758
760 const float4x4 &base_transform_from_socket,
761 const GizmosUpdateParams &params) const
762 {
763 float4x4 gizmo_transform;
764 const float3 global_location =
765 (params.parent_transform * base_transform_from_socket).location();
766 const float3 axis_direction = math::to_vector<float3>(axis);
767 float3 global_direction{};
768 if (transform_orientation_ == V3D_ORIENT_GLOBAL) {
769 global_direction = axis_direction;
770 }
771 else {
772 global_direction = math::transform_direction(params.parent_transform.view<3, 3>() *
773 base_transform_from_socket.view<3, 3>(),
774 axis_direction);
775 }
776 global_direction = math::normalize(global_direction);
777 gizmo_transform.location() = global_location;
779 global_location, global_direction, math::AxisSigned::Z_POS);
780 }
781};
782
787
788 friend bool operator==(const GeoNodesObjectGizmoID &a, const GeoNodesObjectGizmoID &b) = default;
789
791 {
792 return get_default_hash(this->object_orig, this->gizmo_id);
793 }
794};
795
800
801static std::unique_ptr<NodeGizmos> create_gizmo_node_gizmos(const bNode &gizmo_node)
802{
803 switch (gizmo_node.type_legacy) {
805 return std::make_unique<LinearGizmo>();
807 return std::make_unique<DialGizmo>();
809 return std::make_unique<TransformGizmos>();
810 }
811 return {};
812}
813
816 const bke::NodeGizmoID &gizmo_id)
817{
818 if (const auto *edit_data_component = geometry.get_component<bke::GeometryComponentEditData>()) {
819 if (edit_data_component->gizmo_edit_hints_) {
820 if (const float4x4 *m = edit_data_component->gizmo_edit_hints_->gizmo_transforms.lookup_ptr(
821 gizmo_id))
822 {
823 return m;
824 }
825 }
826 }
827 return nullptr;
828}
829
834 const bke::NodeGizmoID &gizmo_id)
835{
836 if (find_direct_gizmo_transform(geometry, gizmo_id)) {
837 return true;
838 }
839 if (!geometry.has_instances()) {
840 return false;
841 }
842 const bke::Instances *instances = geometry.get_instances();
843 for (const bke::InstanceReference &reference : instances->references()) {
844 if (reference.type() != bke::InstanceReference::Type::GeometrySet) {
845 continue;
846 }
847 const bke::GeometrySet &reference_geometry = reference.geometry_set();
848 if (has_nested_gizmo_transform(reference_geometry, gizmo_id)) {
849 return true;
850 }
851 }
852 return false;
853}
854
855static std::optional<float4x4> find_gizmo_geometry_transform_recursive(
856 const bke::GeometrySet &geometry, const bke::NodeGizmoID &gizmo_id, const float4x4 &transform)
857{
858 if (const float4x4 *m = find_direct_gizmo_transform(geometry, gizmo_id)) {
859 return transform * *m;
860 }
861 if (!geometry.has_instances()) {
862 return std::nullopt;
863 }
864 const bke::Instances *instances = geometry.get_instances();
865 const Span<bke::InstanceReference> references = instances->references();
866 const Span<int> handles = instances->reference_handles();
867 const Span<float4x4> transforms = instances->transforms();
868 for (const int reference_i : references.index_range()) {
869 const bke::InstanceReference &reference = references[reference_i];
871 continue;
872 }
873 const bke::GeometrySet &reference_geometry = reference.geometry_set();
874 if (has_nested_gizmo_transform(reference_geometry, gizmo_id)) {
875 const int index = handles.first_index_try(reference_i);
876 if (index >= 0) {
877 const float4x4 sub_transform = transform * transforms[index];
878 if (const std::optional<float4x4> m = find_gizmo_geometry_transform_recursive(
879 reference_geometry, gizmo_id, sub_transform))
880 {
881 return m;
882 }
883 }
884 }
885 }
886 return std::nullopt;
887}
888
894 const NodesModifierData &nmd_orig,
895 const View3D &v3d)
896{
897 if (v3d.flag2 & V3D_SHOW_VIEWER) {
899 if (const eval_log::ViewerNodeLog *viewer_log =
900 nmd_orig.runtime->eval_log->find_viewer_node_log_for_path(viewer_path))
901 {
902 if (const bke::GeometrySet *viewer_geometry = viewer_log->main_geometry()) {
903 return *viewer_geometry;
904 }
905 }
906 }
907 return bke::object_get_evaluated_geometry_set(object_eval);
908}
909
913static std::optional<float4x4> find_gizmo_geometry_transform(const bke::GeometrySet &geometry,
914 const bke::NodeGizmoID &gizmo_id)
915{
916 const float4x4 identity = float4x4::identity();
917 return find_gizmo_geometry_transform_recursive(geometry, gizmo_id, identity);
918}
919
921{
922 ScrArea *area = CTX_wm_area(C);
923 View3D *v3d = area->spacedata.first_as<View3D>();
925 return false;
926 }
927 return true;
928}
929
930static void WIDGETGROUP_geometry_nodes_setup(const bContext * /*C*/, wmGizmoGroup *gzgroup)
931{
932 GeometryNodesGizmoGroup *gzgroup_data = MEM_new<GeometryNodesGizmoGroup>(__func__);
933 gzgroup->customdata = gzgroup_data;
934 gzgroup->customdata_free = [](void *data) {
935 auto *gzgroup_data = static_cast<GeometryNodesGizmoGroup *>(data);
936 MEM_delete(gzgroup_data);
937 };
938}
939
941{
942 auto &gzgroup_data = *static_cast<GeometryNodesGizmoGroup *>(gzgroup->customdata);
943
944 View3D *v3d = CTX_wm_view3d(C);
945 if (!v3d) {
946 return;
947 }
948
950 if (wm == nullptr) {
951 return;
952 }
953 Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
954
955 /* A new map containing the active gizmos is build. This is less error prone than trying to
956 * update the old map in place. */
958
959 /* This needs to stay around for a bit longer because the compute contexts are required when
960 * applying the gizmo changes. */
961 auto compute_context_cache = std::make_shared<bke::ComputeContextCache>();
962
964 *C,
965 *compute_context_cache,
966 [&](const Object &object_orig,
967 const NodesModifierData &nmd_orig,
968 const ComputeContext &compute_context,
969 const bNode &gizmo_node,
970 const bNodeSocket &gizmo_socket) {
971 const GeoNodesObjectGizmoID gizmo_id = {&object_orig,
972 {compute_context.hash(), gizmo_node.identifier}};
973 if (new_gizmos_by_node.contains(gizmo_id)) {
974 /* Already handled. */
975 return;
976 }
977 if (!nmd_orig.runtime->eval_log) {
978 /* Can't create gizmos without any logged data. */
979 return;
980 }
981 Object *object_eval = DEG_get_evaluated(depsgraph, const_cast<Object *>(&object_orig));
982 if (!object_eval) {
983 return;
984 }
985
986 const bke::GeometrySet geometry = find_geometry_for_gizmo(*object_eval, nmd_orig, *v3d);
987
988 /* Figure out which parts of the gizmo are editable. */
990 compute_context, gizmo_node, gizmo_socket);
991
992 bNodeTree &ntree = *nmd_orig.node_group;
993 ntree.ensure_topology_cache();
994
995 NodeGizmos *node_gizmos = nullptr;
996 if (std::optional<std::unique_ptr<NodeGizmos>> old_gizmos =
997 gzgroup_data.gizmos_by_node.pop_try(gizmo_id))
998 {
999 /* Gizmos for this node existed already, reuse them. */
1000 node_gizmos = old_gizmos->get();
1001 new_gizmos_by_node.add(gizmo_id, std::move(*old_gizmos));
1002 }
1003 else {
1004 /* There are no gizmos for this node yet, create new ones. */
1005 std::unique_ptr<NodeGizmos> new_node_gizmos = create_gizmo_node_gizmos(gizmo_node);
1006 new_node_gizmos->create_gizmos(*gzgroup);
1007 /* Enable undo for all geometry nodes gizmos. */
1008 for (wmGizmo *gizmo : new_node_gizmos->get_all_gizmos()) {
1009 gizmo->flag |= WM_GIZMO_NEEDS_UNDO;
1010 }
1011 node_gizmos = new_node_gizmos.get();
1012 new_gizmos_by_node.add(gizmo_id, std::move(new_node_gizmos));
1013 }
1014
1015 /* Initially show all gizmos. They may be hidden as part of the update again. */
1016 node_gizmos->show_all();
1017
1018 NodeTreeLog &tree_log = nmd_orig.runtime->eval_log->get_tree_log(compute_context.hash());
1019 tree_log.ensure_socket_values();
1021
1022 const std::optional<float4x4> crazy_space_geometry_transform =
1024
1025 const bool missing_logged_data = !tree_log.evaluated_gizmo_nodes.contains(
1026 gizmo_node.identifier);
1027 if (missing_logged_data) {
1028 /* Rerun modifier to make sure that values are logged. */
1030 depsgraph, const_cast<ID *>(&object_orig.id), ID_RECALC_GEOMETRY);
1032 node_gizmos->hide_all();
1033 return;
1034 }
1035 const bool missing_used_transform = gizmo_node.output_socket(0).is_logically_linked() &&
1036 !crazy_space_geometry_transform.has_value();
1037 if (missing_used_transform) {
1038 node_gizmos->hide_all();
1039 return;
1040 }
1041
1042 const float4x4 object_to_world{object_eval->object_to_world()};
1043 const float4x4 geometry_transform = crazy_space_geometry_transform.value_or(
1045
1046 UpdateReport report;
1047 GizmosUpdateParams update_params{
1048 *C, object_to_world * geometry_transform, gizmo_node, tree_log, report, elem};
1049 node_gizmos->update(update_params);
1050
1051 bool any_interacting = node_gizmos->is_any_interacting();
1052
1053 if (!any_interacting) {
1054 if (report.missing_socket_logs || report.invalid_transform) {
1055 /* Avoid showing gizmos which are in the wrong place. */
1056 node_gizmos->hide_all();
1057 return;
1058 }
1059 /* Update the callback to apply gizmo changes based on the new context. */
1060 node_gizmos->apply_change =
1061 [C = C,
1062 compute_context_cache,
1063 compute_context = &compute_context,
1064 gizmo_node_tree = &gizmo_node.owner_tree(),
1065 gizmo_node = &gizmo_node,
1066 object_orig = &object_orig,
1067 nmd = &nmd_orig,
1068 eval_log = nmd_orig.runtime->eval_log](
1069 const UString socket_identifier,
1070 const FunctionRef<void(bke::SocketValueVariant &)> modify_value) {
1071 gizmo_node_tree->ensure_topology_cache();
1072 const bNodeSocket &socket = *gizmo_node->input_by_identifier(socket_identifier);
1073
1075 const_cast<Object &>(*object_orig),
1076 const_cast<NodesModifierData &>(*nmd),
1077 *eval_log,
1078 *compute_context,
1079 socket,
1080 modify_value);
1081
1085 };
1086 }
1087 });
1088
1089 /* Hide all except the interacting gizmo. */
1090 bool any_gizmo_interactive = false;
1091 for (const std::unique_ptr<NodeGizmos> &node_gizmos : new_gizmos_by_node.values()) {
1092 any_gizmo_interactive |= node_gizmos->is_any_interacting();
1093 }
1094 if (any_gizmo_interactive) {
1095 for (std::unique_ptr<NodeGizmos> &node_gizmos : new_gizmos_by_node.values()) {
1096 for (wmGizmo *gizmo : node_gizmos->get_all_gizmos()) {
1097 if (!gizmo_is_interacting(*gizmo)) {
1098 WM_gizmo_set_flag(gizmo, WM_GIZMO_HIDDEN, true);
1099 }
1100 }
1101 }
1102 }
1103
1104 /* Remove gizmos that are not used anymore. */
1105 for (std::unique_ptr<NodeGizmos> &node_gizmos : gzgroup_data.gizmos_by_node.values()) {
1106 const Vector<wmGizmo *> gizmos = node_gizmos->get_all_gizmos();
1107 for (wmGizmo *gizmo : gizmos) {
1108 WM_gizmo_unlink(&gzgroup->gizmos, gzgroup->parent_gzmap, gizmo, const_cast<bContext *>(C));
1109 }
1110 }
1111
1112 gzgroup_data.gizmos_by_node = std::move(new_gizmos_by_node);
1113}
1114
1116 wmGizmoGroup * /*gzgroup*/)
1117{
1118}
1119
1120} // namespace ed::view3d::geometry_nodes_gizmos
1121
1123{
1125
1126 gzgt->name = "Geometry Nodes Widgets";
1127 gzgt->idname = "VIEW3D_GGT_geometry_nodes";
1128
1130
1136}
1137
1138} // namespace blender
#define GEO_NODE_GIZMO_LINEAR
#define GEO_NODE_GIZMO_DIAL
#define GEO_NODE_GIZMO_TRANSFORM
General operations, lookup, etc. for blender objects.
#define C
Definition RandGen.cpp:29
#define NC_GEOM
Definition WM_types.hh:406
#define ND_DATA
Definition WM_types.hh:552
#define SET_FLAG_FROM_TEST(value, test, flag)
btMatrix3x3 scaled(const btVector3 &s) const
Create a scaled copy of the matrix.
const ComputeContextHash & hash() const
constexpr IndexRange()=default
ValueIterator values() const &
Definition BLI_map.hh:884
bool add(const Key &key, const Value &value)
Definition BLI_map.hh:295
bool contains(const Key &key) const
Definition BLI_map.hh:353
bool contains(const Key &key) const
Definition BLI_set.hh:310
constexpr int64_t first_index_try(const T &search_value) const
Definition BLI_span.hh:391
constexpr Span()=default
constexpr IndexRange index_range() const
Definition BLI_span.hh:405
Span< int > reference_handles() const
Definition instances.cc:222
Span< float4x4 > transforms() const
Definition instances.cc:235
Span< InstanceReference > references() const
Definition instances.cc:290
void update_style(const NodeGeometryDialGizmo &storage, const bool is_interacting)
virtual void create_gizmos(wmGizmoGroup &gzgroup)=0
float4x4 get_axis_gizmo_matrix_basis(const math::Axis axis, const float4x4 &base_transform_from_socket, const GizmosUpdateParams &params) const
void update_scale_transform_and_target_property(GizmosUpdateParams &params, const float4x4 &base_transform_from_socket)
void update_translate_transform_and_target_property(GizmosUpdateParams &params, const float4x4 &base_transform_from_socket)
void update_visibility(GizmosUpdateParams &params, const NodeGeometryTransformGizmo &storage)
void update_rotate_transform_and_target_property(GizmosUpdateParams &params, const float4x4 &base_transform_from_socket)
static constexpr Axis from_int(const int axis_int)
std::optional< T > find_primitive_socket_value(const bNodeSocket &query_socket)
#define main()
#define storage(slot, qualifiers)
#define position
float length(VecOp< float, D >) RET
float3x3 scale(float3x3 mat, float2 scale)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
Definition math_dual.h:263
#define T
GeometrySet object_get_evaluated_geometry_set(const Object &object, bool apply_subdiv=true)
static ThemeColorID get_axis_theme_color_id(const int axis)
static float4x4 matrix_from_position_and_up_direction(const float3 &position, const float3 &direction, const math::AxisSigned direction_axis)
static void WIDGETGROUP_geometry_nodes_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static const float4x4 * find_direct_gizmo_transform(const bke::GeometrySet &geometry, const bke::NodeGizmoID &gizmo_id)
static void WIDGETGROUP_geometry_nodes_setup(const bContext *, wmGizmoGroup *gzgroup)
static std::optional< float4x4 > find_gizmo_geometry_transform(const bke::GeometrySet &geometry, const bke::NodeGizmoID &gizmo_id)
static std::unique_ptr< NodeGizmos > create_gizmo_node_gizmos(const bNode &gizmo_node)
static void WIDGETGROUP_geometry_nodes_draw_prepare(const bContext *, wmGizmoGroup *)
static bool WIDGETGROUP_geometry_nodes_poll(const bContext *C, wmGizmoGroupType *)
std::function< void( UString socket_identifier, FunctionRef< void(bke::SocketValueVariant &value)> modify_value)> ApplyChangeFn
static ThemeColorID get_gizmo_theme_color_id(const GeometryNodeGizmoColor color_id)
static bool gizmo_is_interacting(const wmGizmo &gizmo)
static bool has_nested_gizmo_transform(const bke::GeometrySet &geometry, const bke::NodeGizmoID &gizmo_id)
static void get_axis_gizmo_colors(const int axis, float *r_color, float *r_color_hi)
static bke::GeometrySet find_geometry_for_gizmo(const Object &object_eval, const NodesModifierData &nmd_orig, const View3D &v3d)
static std::optional< float4x4 > find_gizmo_geometry_transform_recursive(const bke::GeometrySet &geometry, const bke::NodeGizmoID &gizmo_id, const float4x4 &transform)
QuaternionBase< float > Quaternion
T length_squared(const VecBase< T, Size > &a)
T sqrt(const T &a)
bool is_orthonormal(const MatT &mat)
T to_vector(const Axis axis)
T length(const VecBase< T, Size > &a)
AxisAngleBase< float, AngleRadianBase< float > > AxisAngle
bool is_unit_scale(const MatBase< T, NumCol, NumRow > &m)
T average(const VecBase< T, Size > &a)
bool is_zero(const T &a)
CartesianBasis invert(const CartesianBasis &basis)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< T, 3 > to_scale(const MatBase< T, NumCol, NumRow > &mat)
T square(const T &a)
VecBase< T, 3 > transform_direction(const MatBase< T, 3, 3 > &mat, const VecBase< T, 3 > &direction)
MatT from_rotation(const RotationT &rotation)
T determinant(const MatBase< T, Size, Size > &mat)
ie::ElemVariant get_editable_gizmo_elem(const ComputeContext &gizmo_context, const bNode &gizmo_node, const bNodeSocket &gizmo_socket)
void foreach_active_gizmo(const bContext &C, bke::ComputeContextCache &compute_context_cache, const ForeachGizmoFn fn)
void apply_gizmo_change(bContext &C, Object &object, NodesModifierData &nmd, eval_log::NodesEvalLog &eval_log, const ComputeContext &gizmo_context, const bNodeSocket &gizmo_socket, const FunctionRef< void(bke::SocketValueVariant &value)> apply_on_gizmo_value_fn)
void get_color_3fv(int colorid, float col[3])
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
Definition BKE_text.h:91
ScrArea * CTX_wm_area(const bContext *C)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void WM_gizmo_target_property_def_func(wmGizmo *gz, const char *idname, const wmGizmoPropertyFnParams *params)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
void VIEW3D_GGT_geometry_nodes(wmGizmoGroupType *gzgt)
void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3])
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
@ TH_GIZMO_SECONDARY
@ GEO_NODE_TRANSFORM_GIZMO_USE_SCALE_X
@ GEO_NODE_TRANSFORM_GIZMO_USE_TRANSLATION_X
@ GEO_NODE_TRANSFORM_GIZMO_USE_ROTATION_X
MatBase< float, 4, 4 > float4x4
void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
Definition wm_gizmo.cc:318
void WM_gizmo_unlink(ListBaseT< wmGizmo > *gizmolist, wmGizmoMap *gzmap, wmGizmo *gz, bContext *C)
Definition wm_gizmo.cc:161
VecBase< float, 4 > float4
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
Definition wm_gizmo.cc:303
BMesh const char void * data
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
wmWindowManager * CTX_wm_manager(const bContext *C)
void BKE_main_ensure_invariants(Main &bmain, std::optional< Span< ID * > > modified_ids=std::nullopt)
void unit_m4(float m[4][4])
wmGizmo * WM_gizmo_new(const StringRef idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
Definition wm_gizmo.cc:97
MatBase< float, 3, 3 > float3x3
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void DEG_id_tag_update_for_side_effect_request(Depsgraph *depsgraph, ID *id, unsigned int flags)
@ GEO_NODE_GIZMO_COLOR_PRIMARY
@ GEO_NODE_GIZMO_COLOR_Y
@ GEO_NODE_GIZMO_COLOR_SECONDARY
@ GEO_NODE_GIZMO_COLOR_Z
@ GEO_NODE_GIZMO_COLOR_X
@ ED_GIZMO_ARROW_STYLE_NORMAL
@ ED_GIZMO_ARROW_STYLE_CROSS
@ ED_GIZMO_ARROW_STYLE_BOX
@ WM_GIZMOGROUPTYPE_PERSISTENT
@ WM_GIZMO_DRAW_NO_SCALE
@ WM_GIZMO_DRAW_OFFSET_SCALE
@ WM_GIZMO_DRAW_VALUE
@ WM_GIZMO_NEEDS_UNDO
Main * CTX_data_main(const bContext *C)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_CROSS
@ GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_BOX
@ GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_ARROW
Scene * CTX_data_scene(const bContext *C)
wmKeyMap * WM_gizmogroup_setup_keymap_generic_maybe_drag(const wmGizmoGroupType *, wmKeyConfig *kc)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
VecBase< float, 3 > float3
MINLINE float safe_divide(float a, float b)
constexpr uint64_t get_default_hash(const T &v, const Args &...args)
Definition BLI_hash.hh:252
@ V3D_GIZMO_HIDE_MODIFIER
View3D * CTX_wm_view3d(const bContext *C)
@ ED_GIZMO_DIAL_DRAW_FLAG_CLIP
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE
const c_style_mat & ptr() const
const MatView< T, ViewNumCol, ViewNumRow, NumCol, NumRow, SrcStartCol, SrcStartRow, Alignment > view() const
NodesModifierRuntime * runtime
std::shared_ptr< nodes::eval_log::NodesEvalLog > eval_log
Definition MOD_nodes.hh:58
TransformOrientationSlot orientation_slots[4]
ListBaseT< SpaceLink > spacedata
eView3D_Flag2 flag2
eView3D_GizmoFlag gizmo_flag
friend bool operator==(const GeoNodesObjectGizmoID &a, const GeoNodesObjectGizmoID &b)=default
Map< GeoNodesObjectGizmoID, std::unique_ptr< NodeGizmos > > gizmos_by_node
std::variant< BoolElem, FloatElem, IntElem, VectorElem, RotationElem, MatrixElem > elem
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnSetupKeymap setup_keymap
wmGizmoGroupFnDrawPrepare draw_prepare
eWM_GizmoFlagGroupTypeFlag flag
ListBaseT< wmGizmo > gizmos
void(*) customdata_free(void *)
wmGizmoPropertyFnSet value_set_fn
wmGizmoPropertyFnGet value_get_fn
float matrix_basis[4][4]
float matrix_offset[4][4]
ccl_device_inline Transform transform_scale(const float3 s)
Definition transform.h:313