57 enum class TooltipBlockType {
65 std::optional<TooltipBlockType> last_block_type_;
73 : tip_data_(tip_data),
75 node_(socket.owner_node()),
84 const bool is_extend =
StringRef(socket_.idname) ==
"NodeSocketVirtual";
86 this->build_tooltip_extend_socket();
89 if (node_.is_dangling_reroute()) {
90 this->build_tooltip_dangling_reroute();
93 if (this->should_show_label()) {
94 this->build_tooltip_label();
96 this->build_tooltip_description();
97 this->build_tooltip_value();
98 this->build_tooltip_expected_bundle_type();
106 void build_tooltip_extend_socket()
108 this->add_text_field(
TIP_(
"Connect a link to create a new socket."));
111 void build_tooltip_dangling_reroute()
116 bool should_show_label()
118 if (this->get_socket_description().value_or(
"").empty()) {
122 if (socket_.is_output()) {
128 if (socket_.runtime->declaration && socket_.runtime->declaration->optional_label) {
134 void build_tooltip_label()
136 this->start_block(TooltipBlockType::Label);
137 if (node_.is_reroute()) {
138 this->add_text_field_header(
TIP_(
"Reroute"));
142 this->add_text_field_header(translated_socket_label);
145 void build_tooltip_description()
147 std::optional<std::string> description_opt = this->get_socket_description();
148 if (!description_opt) {
151 std::string description = std::move(*description_opt);
152 if (description.empty()) {
155 if (description[description.size() - 1] !=
'.') {
158 this->start_block(TooltipBlockType::Description);
159 this->add_text_field(std::move(description));
162 std::optional<std::string> get_socket_description()
164 if (socket_.runtime->declaration ==
nullptr) {
165 if (socket_.description[0]) {
166 return socket_.description;
170 const nodes::SocketDeclaration &socket_decl = *socket_.runtime->declaration;
171 if (!socket_decl.description.empty()) {
172 return TIP_(socket_decl.description);
174 if (socket_decl.align_with_previous_socket) {
175 const Span<nodes::ItemDeclarationPtr> all_items = node_.runtime->declaration->all_items;
177 if (&*all_items[i] != &socket_decl) {
183 const nodes::SocketDeclaration *previous_socket_decl =
184 dynamic_cast<const nodes::SocketDeclaration *
>(all_items[i - 1].get());
185 if (!previous_socket_decl) {
188 if (!previous_socket_decl->description.empty()) {
189 return TIP_(previous_socket_decl->description);
197 void build_tooltip_value()
200 eval_log::ContextualNodeTreeLogs tree_logs;
204 eval_log::NodeTreeLog *tree_log = tree_logs.get_main_tree_log(socket_);
205 if (tree_log && this->build_tooltip_value_from_tree_log(*tree_log)) {
209 if (node_.is_reroute()) {
210 if (always_show_value) {
211 this->start_block(TooltipBlockType::Value);
212 this->build_tooltip_value_unknown();
216 if (socket_.is_input()) {
217 if (this->is_socket_default_value_used()) {
218 this->build_tooltip_value_socket_default();
222 if (always_show_value) {
223 this->start_block(TooltipBlockType::Value);
224 this->build_tooltip_value_unknown();
228 void build_tooltip_value_unknown()
230 this->add_text_field_mono(
TIP_(
"Value: Unknown (not evaluated)"));
233 void build_tooltip_value_socket_default()
235 if (socket_.is_multi_input()) {
236 this->start_block(TooltipBlockType::Value);
237 this->add_text_field_mono(
TIP_(
"Values: None"));
240 const nodes::SocketDeclaration *socket_decl = socket_.runtime->declaration;
244 this->start_block(TooltipBlockType::Value);
245 build_tooltip_value_implicit_default(socket_decl->default_input_type);
248 if (socket_decl && socket_decl->structure_type == nodes::StructureType::Grid) {
249 this->start_block(TooltipBlockType::Value);
250 this->build_tooltip_value_and_type_oneline(
TIP_(
"Empty Grid"),
TIP_(
"Volume Grid"));
253 if (socket_.typeinfo->base_cpp_type ==
nullptr) {
256 const CPPType &cpp_type = *socket_.typeinfo->base_cpp_type;
258 socket_.typeinfo->get_base_cpp_value(socket_.default_value, socket_value);
260 this->start_block(TooltipBlockType::Value);
261 this->build_tooltip_value_generic({cpp_type, socket_value});
264 [[nodiscard]]
bool build_tooltip_value_from_tree_log(eval_log::NodeTreeLog &tree_log)
266 if (socket_.typeinfo->base_cpp_type ==
nullptr) {
269 tree_log.ensure_socket_values();
270 if (socket_.is_multi_input()) {
271 return this->build_tooltip_last_value_multi_input(tree_log);
273 eval_log::ValueLog *value_log = tree_log.find_socket_value_log(socket_);
277 this->start_block(TooltipBlockType::Value);
278 this->build_tooltip_value_eval_log(*value_log);
282 bool build_tooltip_last_value_multi_input(eval_log::NodeTreeLog &tree_log)
284 const Span<const bNodeLink *> connected_links = socket_.directly_linked_links();
286 Vector<std::pair<int, eval_log::ValueLog *>> value_logs;
287 bool all_value_logs_missing =
true;
288 for (
const int i : connected_links.
index_range()) {
289 const bNodeLink &link = *connected_links[i];
290 if (!link.is_used()) {
296 const bNodeSocket &from_socket = *link.fromsock;
297 eval_log::ValueLog *value_log = tree_log.find_socket_value_log(from_socket);
298 value_logs.append({i, value_log});
300 all_value_logs_missing =
false;
303 if (all_value_logs_missing) {
307 this->start_block(TooltipBlockType::Value);
308 for (
const auto &[i, value_log] : value_logs) {
309 const int connection_number = i + 1;
313 this->add_text_field_mono(fmt::format(
"{}:", connection_number));
318 this->build_tooltip_value_eval_log(*value_log);
321 this->build_tooltip_value_unknown();
328 void build_tooltip_value_eval_log(eval_log::ValueLog &value_log)
330 if (
const auto *generic_value_log =
dynamic_cast<const eval_log::GenericValueLog *
>(
333 this->build_tooltip_value_generic(generic_value_log->value);
335 else if (
const auto *string_value_log =
dynamic_cast<const eval_log::StringLog *
>(&value_log))
337 this->build_tooltip_value_string_log(*string_value_log);
339 else if (
const auto *field_value_log =
dynamic_cast<const eval_log::FieldInfoLog *
>(
342 this->build_tooltip_value_field_log(*field_value_log);
344 else if (
const auto *geometry_log =
dynamic_cast<const eval_log::GeometryInfoLog *
>(
347 this->build_tooltip_value_geometry_log(*geometry_log);
349 else if (
const auto *grid_log =
dynamic_cast<const eval_log::GridInfoLog *
>(&value_log)) {
350 build_tooltip_value_grid_log(*grid_log);
352 else if (
const auto *bundle_log =
dynamic_cast<const eval_log::BundleValueLog *
>(&value_log)) {
353 this->build_tooltip_value_bundle_log(*bundle_log);
355 else if (
const auto *closure_log =
dynamic_cast<const eval_log::ClosureValueLog *
>(&value_log))
357 this->build_tooltip_value_closure_log(*closure_log);
359 else if (
const auto *list_log =
dynamic_cast<const eval_log::ListInfoLog *
>(&value_log)) {
360 this->build_tooltip_value_list_log(*list_log);
362 else if (
const auto *image_log =
dynamic_cast<const eval_log::ImageInfoLog *
>(&value_log)) {
363 this->build_tooltip_value_image_log(*image_log);
367 void build_tooltip_value_and_type_oneline(
const StringRef value,
const StringRef type)
369 this->add_text_field_mono(fmt::format(
"{}: {}",
TIP_(
"Value"), value));
371 this->add_text_field_mono(fmt::format(
"{}: {}",
TIP_(
"Type"), type));
374 void build_tooltip_value_object(
const Object *
object)
376 std::string value_str;
378 value_str =
BKE_id_name(id_cast<const ID &>(*
object));
380 value_str +=
TIP_(
" (Self Object)");
384 value_str =
TIP_(
"None");
386 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(
"Object"));
389 template<
typename T> [[nodiscard]]
bool build_tooltip_value_data_block(
const GPointer &value)
391 const CPPType &type = *value.type();
392 if (!type.is<
T *>()) {
395 const T *
data = *value.get<
T *>();
396 std::string value_str;
401 value_str =
TIP_(
"None");
403 const ID_Type id_type = T::id_type;
406 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(id_type_name));
410 void build_tooltip_value_enum(
const nodes::MenuValue menu_item)
412 const auto *
storage = socket_.default_value_typed<bNodeSocketValueMenu>();
414 this->build_tooltip_value_and_type_oneline(
TIP_(
"Unknown"),
TIP_(
"Menu"));
417 const bke::RuntimeNodeEnumItem *enum_item =
storage->enum_items->find_item_by_identifier(
422 if (!enum_item->description.empty()) {
426 this->build_tooltip_value_and_type_oneline(
TIP_(enum_item->name),
TIP_(
"Menu"));
429 void build_tooltip_value_int(
const int value)
431 std::string value_str = fmt::format(
"{}", value);
433 value_str +=
TIP_(
" (Scene Frame)");
435 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(
"Integer"));
438 void build_tooltip_value_float(
const float value)
440 std::string value_str;
442 if (std::abs(value) > (1 << 24)) {
445 value_str = fmt::format(
"{:.10}", value);
448 value_str = fmt::format(
"{}", value);
451 value_str +=
TIP_(
" (Scene Frame)");
453 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(
"Float"));
458 return socket_.is_input() && !socket_.is_logically_linked() && socket_.runtime->declaration &&
459 socket_.runtime->declaration->default_input_type == type;
462 void build_tooltip_value_float2(
const float2 &value)
464 const std::string value_str = fmt::format(
"{} {}", value.
x, value.
y);
465 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(
"2D Float Vector"));
468 void build_tooltip_value_float3(
const float3 &value)
470 const std::string value_str = fmt::format(
"{} {} {}", value.
x, value.
y, value.
z);
471 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(
"3D Float Vector"));
474 void build_tooltip_value_float4(
const float4 &value)
476 const std::string value_str = fmt::format(
"{} {} {} {}", value.
x, value.
y, value.
z, value.
w);
477 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(
"4D Float Vector"));
482 const std::string value_str = fmt::format(
483 "{} {} {} {} ({})", value.r, value.g, value.b, value.a,
TIP_(
"Linear"));
484 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(
"Float Color"));
487 bool is_gamma =
false;
506 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(
"Rotation"));
509 void build_tooltip_value_bool(
const bool value)
511 std::string value_str = value ?
TIP_(
"True") :
TIP_(
"False");
512 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(
"Boolean"));
515 void build_tooltip_value_float4x4(
const float4x4 &value)
520 std::stringstream ss;
522 const float4 row = value_transposed[row_i];
523 ss << fmt::format(
"{:7.3} {:7.3} {:7.3} {:7.3}\n", row[0], row[1], row[2], row[3]);
526 this->add_text_field_mono(fmt::format(
"{}:",
TIP_(
"Value")));
528 this->add_text_field_mono(ss.str());
530 this->add_text_field_mono(fmt::format(
"{}: {}",
TIP_(
"Type"),
TIP_(
"4x4 Float Matrix")));
533 void build_tooltip_value_generic(
const GPointer &value)
536 const CPPType &value_type = *value.type();
537 if (value_type.is<Object *>()) {
538 this->build_tooltip_value_object(*value.get<Object *>());
541 if (this->build_tooltip_value_data_block<Material>(value)) {
544 if (this->build_tooltip_value_data_block<Tex>(value)) {
547 if (this->build_tooltip_value_data_block<Image>(value)) {
550 if (this->build_tooltip_value_data_block<Collection>(value)) {
555 if (!value_type.is<nodes::MenuValue>()) {
556 this->build_tooltip_value_unknown();
559 const nodes::MenuValue menu_item = *value.get<nodes::MenuValue>();
560 this->build_tooltip_value_enum(menu_item);
564 const CPPType &socket_base_cpp_type = *socket_.typeinfo->base_cpp_type;
566 if (value_type != socket_base_cpp_type) {
567 if (!conversions.is_convertible(value_type, socket_base_cpp_type)) {
568 this->build_tooltip_value_unknown();
573 conversions.convert_to_uninitialized(
574 value_type, socket_base_cpp_type, value.get(), socket_value);
577 if (socket_base_cpp_type.is<
int>()) {
578 this->build_tooltip_value_int(*
static_cast<int *
>(socket_value));
581 if (socket_base_cpp_type.is<
float>()) {
582 this->build_tooltip_value_float(*
static_cast<float *
>(socket_value));
585 if (socket_base_cpp_type.is<
float2>()) {
586 this->build_tooltip_value_float2(*
static_cast<float2 *
>(socket_value));
589 if (socket_base_cpp_type.is<
float3>()) {
590 this->build_tooltip_value_float3(*
static_cast<float3 *
>(socket_value));
593 if (socket_base_cpp_type.is<
float4>()) {
594 this->build_tooltip_value_float4(*
static_cast<float4 *
>(socket_value));
598 this->build_tooltip_value_color(*
static_cast<ColorGeometry4f *
>(socket_value));
602 this->build_tooltip_value_quaternion(*
static_cast<math::Quaternion *
>(socket_value));
605 if (socket_base_cpp_type.is<
bool>()) {
606 this->build_tooltip_value_bool(*
static_cast<bool *
>(socket_value));
609 if (socket_base_cpp_type.is<
float4x4>()) {
610 this->build_tooltip_value_float4x4(*
static_cast<float4x4 *
>(socket_value));
613 this->build_tooltip_value_unknown();
616 void build_tooltip_value_string_log(
const eval_log::StringLog &value_log)
618 std::string value_str = value_log.value;
619 if (value_log.truncated) {
622 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(
"String"));
625 const char *get_field_type_name(
const CPPType &base_type)
627 if (base_type.is<
int>()) {
628 return TIP_(
"Integer Field");
630 if (base_type.is<
float>()) {
631 return TIP_(
"Float Field");
633 if (base_type.is<
float2>()) {
634 return TIP_(
"2D Float Vector Field");
636 if (base_type.is<
float3>()) {
637 return TIP_(
"3D Float Vector Field");
639 if (base_type.is<
float4>()) {
640 return TIP_(
"4D Float Vector Field");
642 if (base_type.is<
bool>()) {
643 return TIP_(
"Boolean Field");
645 if (base_type.is<std::string>()) {
646 return TIP_(
"String Field");
649 return TIP_(
"Color Field");
652 return TIP_(
"Rotation Field");
655 return TIP_(
"Matrix Field");
657 if (base_type.is<nodes::MenuValue>()) {
658 return TIP_(
"Menu Field");
660 return TIP_(
"Field");
663 void build_tooltip_value_field_log(
const eval_log::FieldInfoLog &value_log)
665 const Span<std::string> input_tooltips = value_log.input_tooltips;
673 this->add_text_field_mono(
TIP_(
"Field depending on:"));
675 for (
const std::string &input_tooltip : input_tooltips) {
677 this->add_text_field_mono(fmt::format(
" \u2022 {}",
TIP_(input_tooltip)));
681 std::string type_str = this->get_field_type_name(value_log.type);
682 this->add_text_field_mono(fmt::format(
"{}: {}",
TIP_(
"Type"), type_str));
685 std::string count_to_string(
const int count)
689 return std::string(
str);
692 void build_tooltip_value_geometry_log(
const eval_log::GeometryInfoLog &geometry_log)
694 Span<bke::GeometryComponent::Type> component_types = geometry_log.component_types;
696 this->build_tooltip_value_and_type_oneline(
TIP_(
"None"),
TIP_(
"Geometry Set"));
699 this->add_text_field_mono(
TIP_(
"Geometry components:"));
701 std::string component_str;
704 const eval_log::GeometryInfoLog::MeshInfo &info = *geometry_log.mesh_info;
705 component_str = fmt::format(fmt::runtime(
TIP_(
"Mesh: {} vertices, {} edges, {} faces")),
706 this->count_to_string(info.verts_num),
707 this->count_to_string(info.edges_num),
708 this->count_to_string(info.faces_num));
712 const eval_log::GeometryInfoLog::PointCloudInfo &info = *geometry_log.pointcloud_info;
713 component_str = fmt::format(fmt::runtime(
TIP_(
"Point Cloud: {} points")),
714 this->count_to_string(info.points_num));
718 const eval_log::GeometryInfoLog::InstancesInfo &info = *geometry_log.instances_info;
719 component_str = fmt::format(fmt::runtime(
TIP_(
"Instances: {}")),
720 this->count_to_string(info.instances_num));
724 const eval_log::GeometryInfoLog::VolumeInfo &info = *geometry_log.volume_info;
725 component_str = fmt::format(fmt::runtime(
TIP_(
"Volume: {} grids")),
726 this->count_to_string(info.grids.size()));
730 const eval_log::GeometryInfoLog::CurveInfo &info = *geometry_log.curve_info;
731 component_str = fmt::format(fmt::runtime(
TIP_(
"Curve: {} points, {} splines")),
732 this->count_to_string(info.points_num),
733 this->count_to_string(info.splines_num));
737 const eval_log::GeometryInfoLog::GreasePencilInfo &info =
738 *geometry_log.grease_pencil_info;
739 component_str = fmt::format(fmt::runtime(
TIP_(
"Grease Pencil: {} layers")),
740 this->count_to_string(info.layers_num));
744 if (geometry_log.edit_data_info.has_value()) {
745 const eval_log::GeometryInfoLog::EditDataInfo &info = *geometry_log.edit_data_info;
746 component_str = fmt::format(
747 fmt::runtime(
TIP_(
"Edit: {}, {}, {}")),
748 info.has_deformed_positions ?
TIP_(
"positions") :
TIP_(
"no positions"),
749 info.has_deform_matrices ?
TIP_(
"matrices") :
TIP_(
"no matrices"),
750 info.gizmo_transforms_num > 0 ?
TIP_(
"gizmos") :
TIP_(
"no gizmos"));
755 if (!component_str.empty()) {
757 this->add_text_field_mono(fmt::format(
" \u2022 {}", component_str));
761 this->add_text_field_mono(
TIP_(
"Type: Geometry Set"));
764 void build_tooltip_value_grid_log(
const eval_log::GridInfoLog &grid_log)
766 std::string value_str;
767 if (grid_log.is_empty) {
768 value_str =
TIP_(
"None");
771 value_str =
TIP_(
"Volume Grid");
773 this->build_tooltip_value_and_type_oneline(value_str,
TIP_(
"Volume Grid"));
776 void build_tooltip_value_bundle_log(
const eval_log::BundleValueLog &bundle_log)
778 if (bundle_log.items.is_empty()) {
779 this->add_text_field_mono(
TIP_(
"Values: None"));
782 this->add_text_field_mono(
TIP_(
"Values:"));
783 Vector<eval_log::BundleValueLog::Item> sorted_items = bundle_log.items;
784 std::ranges::sort(sorted_items, [](
const auto &a,
const auto &
b) {
787 for (
const eval_log::BundleValueLog::Item &item : sorted_items) {
789 std::string type_name;
790 if (
const bke::bNodeSocketType *
const *socket_type =
791 std::get_if<const bke::bNodeSocketType *>(&item.type))
793 type_name =
TIP_((*socket_type)->label);
795 else if (
const StringRefNull *internal_type_name = std::get_if<StringRefNull>(&item.type))
797 type_name = *internal_type_name;
799 this->add_text_field_mono(fmt::format(
"\u2022 \"{}\" ({})\n", item.key, type_name));
803 this->add_text_field_mono(
TIP_(
"Type: Bundle"));
806 void build_tooltip_value_closure_log(
const eval_log::ClosureValueLog &closure_log)
808 if (closure_log.inputs.is_empty() && closure_log.outputs.is_empty()) {
809 this->add_text_field_mono(
TIP_(
"Value: None"));
812 if (!closure_log.inputs.is_empty()) {
813 this->add_text_field_mono(
TIP_(
"Inputs:"));
814 for (
const eval_log::ClosureValueLog::Item &item : closure_log.inputs) {
816 const std::string type_name =
TIP_(item.type->label);
817 this->add_text_field_mono(fmt::format(
"\u2022 \"{}\" ({})\n", item.key, type_name));
820 if (!closure_log.outputs.is_empty()) {
822 this->add_text_field_mono(
TIP_(
"Outputs:"));
823 for (
const eval_log::ClosureValueLog::Item &item : closure_log.outputs) {
825 const std::string type_name =
TIP_(item.type->label);
826 this->add_text_field_mono(fmt::format(
"\u2022 \"{}\" ({})\n", item.key, type_name));
831 this->add_text_field_mono(
TIP_(
"Type: Closure"));
834 void build_tooltip_value_list_log(
const eval_log::ListInfoLog &list_log)
836 this->add_text_field_mono(fmt::format(
"{}: {}",
TIP_(
"Length"), list_log.size));
838 this->add_text_field_mono(
TIP_(
"Type: List"));
841 void build_tooltip_value_image_log(
const eval_log::ImageInfoLog &image_log)
843 const bool has_display_window = image_log.data_size != image_log.display_size ||
844 image_log.data_offset !=
int2(0);
845 if (has_display_window) {
846 this->add_text_field_mono(
TIP_(
"Display/Data Window:"));
847 this->add_text_field_mono(fmt::format(
848 "\u2022 {}: {}x{}",
TIP_(
"Data Size"), image_log.data_size.x, image_log.data_size.y));
849 this->add_text_field_mono(fmt::format(
"\u2022 {}: {}x{}",
850 TIP_(
"Display Size"),
851 image_log.display_size.x,
852 image_log.display_size.y));
853 this->add_text_field_mono(fmt::format(
"\u2022 {}: ({}, {})",
855 image_log.data_offset.x,
856 image_log.data_offset.y));
859 this->add_text_field_mono(fmt::format(
860 "{}: {}x{}",
TIP_(
"Resolution"), image_log.data_size.x, image_log.data_size.y));
873 if (is_translated || is_rotated || is_scaled) {
874 this->add_text_field_mono(
TIP_(
"Transformation:"));
876 this->add_text_field_mono(
877 fmt::format(
"\u2022 {}: ({}, {})",
TIP_(
"Translation"), location.
x, location.
y));
880 this->add_text_field_mono(fmt::format(
884 this->add_text_field_mono(
889 this->add_text_field_mono(
TIP_(
"Transformation: Identity"));
894 this->add_text_field_mono(
TIP_(
"Sampling:"));
895 this->add_text_field_mono(
896 fmt::format(
"\u2022 {}: {}",
TIP_(
"Interpolation"),
TIP_(image_log.interpolation)));
897 if (image_log.extension_x == image_log.extension_y) {
898 this->add_text_field_mono(
899 fmt::format(
"\u2022 {}: {}",
TIP_(
"Extension"),
TIP_(image_log.extension_x)));
902 this->add_text_field_mono(
903 fmt::format(
"\u2022 {}: {}",
TIP_(
"Extension X"),
TIP_(image_log.extension_x)));
904 this->add_text_field_mono(
905 fmt::format(
"\u2022 {}: {}",
TIP_(
"Extension Y"),
TIP_(image_log.extension_y)));
910 this->add_text_field_mono(fmt::format(
"{}: {}",
TIP_(
"Precision"),
TIP_(image_log.precision)));
915 this->add_text_field_mono(
TIP_(
"Implicit Value: Uniform Image Coordinates"));
919 this->add_text_field_mono(
TIP_(
"Type: Image"));
931 this->build_tooltip_value_and_type_oneline(
TIP_(
"Index Field"),
936 this->build_tooltip_value_and_type_oneline(
TIP_(
"ID or Index Field"),
941 this->build_tooltip_value_and_type_oneline(
946 this->build_tooltip_value_and_type_oneline(
951 this->build_tooltip_value_and_type_oneline(
956 this->build_tooltip_value_and_type_oneline(
961 this->build_tooltip_value_and_type_oneline(
965 this->build_tooltip_value_and_type_oneline(
969 this->build_tooltip_value_and_type_oneline(
TIP_(
"Uniform Image Coordinates"),
970 TIP_(
"2D Float Vector"));
973 this->build_tooltip_value_and_type_oneline(
TIP_(
"Self Object"),
TIP_(
"Object"));
978 bool is_socket_default_value_used()
981 for (
const bNodeLink *link : socket_.directly_linked_links()) {
982 if (!link->is_used()) {
985 const bNodeSocket &from_socket = *link->fromsock;
986 const bNode &from_node = from_socket.owner_node();
987 if (from_node.is_dangling_reroute()) {
995 void build_tooltip_expected_bundle_type()
1000 if (socket_.is_output()) {
1003 const auto *socket_decl =
dynamic_cast<const nodes::decl::Bundle *
>(
1004 socket_.runtime->declaration);
1008 if (!socket_decl->bundle_type) {
1011 const nodes::BundleType &bundle_type = *socket_decl->bundle_type;
1013 if (
const auto *nested_bundle_type = std::get_if<nodes::NestedBundleTypePtr>(
1016 this->start_block(TooltipBlockType::BundleType);
1017 this->add_text_field_mono(
TIP_(
"Bundle Types:"));
1019 this->add_text_field_mono(fmt::format(
" \u2022 {}", flat_type->name()));
1022 else if (
const auto *flat_bundle_type = std::get_if<nodes::FlatBundleTypePtr>(
1025 this->start_block(TooltipBlockType::BundleType);
1026 this->add_text_field_mono(
TIP_(
"Bundle Type:"));
1027 for (
const nodes::FlatBundleType::Item &item : (*flat_bundle_type)->items()) {
1028 this->add_text_field_mono(fmt::format(
" \u2022 {}", item.name()));
1033 StringRef get_structure_type_tooltip(
const nodes::StructureType &structure_type)
1035 switch (structure_type) {
1036 case nodes::StructureType::Single: {
1037 return TIP_(
"Single Value");
1039 case nodes::StructureType::Dynamic: {
1040 return TIP_(
"Dynamic");
1042 case nodes::StructureType::Field: {
1043 return TIP_(
"Field");
1045 case nodes::StructureType::Grid: {
1046 return TIP_(
"Volume Grid");
1048 case nodes::StructureType::List: {
1049 return TIP_(
"List");
1067 void start_block(
const TooltipBlockType new_block_type)
1069 if (last_block_type_.has_value()) {
1072 last_block_type_ = new_block_type;
1075 void add_text_field_header(std::string text)
1091 void add_space(
const int amount = 1)
1093 for ([[maybe_unused]]
const int i :
IndexRange(amount)) {
1098 std::string indent(std::string text)
1100 if (indentation_ == 0) {
1103 return fmt::format(
"{: <{}}{}",
"", indentation_, text);