35#include "RNA_prototypes.hh"
51 const std::string label = fmt::format(
"{:.5f}", value);
52 layout.label(label, ICON_NONE);
56 const std::string label = fmt::format(
"{}", value);
57 layout.
label(label, ICON_NONE);
66 col.
label(fmt::format(
"{}: {:.5f}",
IFACE_(
"X"), value.x), ICON_NONE);
67 col.
label(fmt::format(
"{}: {:.5f}",
IFACE_(
"Y"), value.y), ICON_NONE);
68 col.
label(fmt::format(
"{}: {:.5f}",
IFACE_(
"Z"), value.z), ICON_NONE);
81 const int max_display_length = 200;
82 layout.
label(value.
substr(0, max_display_length), ICON_NONE);
118 if (value.
is_type<std::string>()) {
135 if (orig_collection) {
139 icon = int(ICON_COLLECTION_COLOR_01) + int(orig_collection->color_tag);
176 const int socket_index = params.
socket.index();
197 if (value_type != socket_base_cpp_type) {
198 if (!conversions.
is_convertible(value_type, socket_base_cpp_type)) {
204 value_type, socket_base_cpp_type, value.
get(), socket_value);
206 return draw_gpointer(params, {socket_base_cpp_type, socket_value});
234 snode->
edittree->ensure_topology_cache();
236 if (!socket.is_directly_linked()) {
258 b.use_custom_socket_order();
259 b.allow_any_socket_order();
264 if (!
node || !tree) {
270 bool has_geometry_input =
false;
271 bool has_potential_attribute_input =
false;
276 has_geometry_input =
true;
279 has_potential_attribute_input =
true;
283 if (has_geometry_input && has_potential_attribute_input) {
294 auto &input_decl =
b.add_input(socket_type, name,
UString(identifier))
298 input_decl.evaluated_geometry_field();
300 input_decl.structure_type(StructureType::Dynamic);
304 b.add_input<
decl::Extend>(
""_ustr,
"__extend__"_ustr).structure_type(StructureType::Dynamic);
321 socket_items::ui::draw_items_list_with_operators<GeoViewerItemsAccessor>(
322 C, panel, ntree,
node);
323 socket_items::ui::draw_active_item_props<GeoViewerItemsAccessor>(
325 panel->use_property_split_set(
true);
326 panel->use_property_decorate_set(
false);
327 panel->prop(item_ptr,
"socket_type",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
328 panel->prop(item_ptr,
"auto_remove",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
357 const StringRef viewer_attribute_name =
".viewer";
358 std::optional<int> last_geometry_identifier;
369 if (!last_geometry_identifier) {
377 r_log.
items.lookup_key_as(*last_geometry_identifier).value)
390 component, viewer_attribute_name, AttrDomain::Instance, field);
410 used_domain = *domain;
413 used_domain = AttrDomain::Point;
424 last_geometry_identifier.reset();
434 void *src_value = input_values[i];
451 if (std::optional<ed::space_node::ObjectAndModifier> object_and_modifier =
458 row.
icon = ICON_STATUS_ERROR;
459 row.
text =
TIP_(
"Modifier disabled");
460 row.
tooltip =
TIP_(
"The viewer does not work because the modifier is disabled");
461 params.
rows.append(std::move(row));
463 else if (!nmd.
node_group->group_output_node()) {
465 row.
icon = ICON_STATUS_ERROR;
468 "The viewer does not work because the node group used by the modifier has no output");
469 params.
rows.append(std::move(row));
476 row.
icon = ICON_STATUS_INFO;
477 row.
text =
TIP_(
"No color overlay");
479 "Rotation values can only be displayed with the text overlay in the 3D view");
480 params.
rows.append(std::move(row));
530 ntype.
ui_description =
"Display the input data in the Spreadsheet Editor";
#define NODE_CLASS_OUTPUT
#define NODE_STORAGE_FUNCS(StorageT)
#define BUFFER_FOR_CPP_TYPE_VALUE(type, variable_name)
#define BLI_SCOPED_DEFER(function_to_defer)
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_COLOR
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void destruct(void *ptr) const
const CPPType * type() const
constexpr IndexRange()=default
void convert_to_uninitialized(const CPPType &from_type, const CPPType &to_type, const void *from_value, void *to_value) const
bool is_convertible(const CPPType &from_type, const CPPType &to_type) const
void ensure_owns_direct_data()
constexpr StringRef substr(int64_t start, int64_t size) const
void add_item(std::string socket_name, SocketLinkOperation::LinkSocketFn fn, int weight=0)
const bNodeSocket & other_socket() const
void update_and_connect_available_socket(bNode &new_node, UString socket_name)
bNode & add_node(UString idname)
NodeTreeLog * get_main_tree_log(const bke::bNodeTreeZone *zone) const
Map< int32_t, ViewerNodeLog *, 0 > viewer_node_logs
void ensure_viewer_node_logs()
void ensure_socket_values()
ValueLog * find_socket_value_log(const bNodeSocket &query_socket)
static ContextualNodeTreeLogs get_contextual_tree_logs(const SpaceNode &snode)
CustomIDVectorSet< Item, ItemIdentifierGetter > items
#define storage(slot, qualifiers)
std::optional< AttrDomain > try_detect_field_domain(const GeometryComponent &component, const fn::GField &field)
bool try_capture_field_on_geometry(MutableAttributeAccessor attributes, const fn::FieldContext &field_context, const StringRef name, AttrDomain domain, const fn::Field< bool > &selection, const fn::GField &field)
const DataTypeConversions & get_implicit_type_conversions()
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
internal::ShallowDataConstRef< T > shallow_copy(const T &other)
std::optional< ObjectAndModifier > get_geometry_nodes_modifier_for_node_editor(const SpaceNode &snode)
void activate_geometry_node(Main &bmain, SpaceNode &snode, bNode &node, std::optional< int > item_identifier=std::nullopt)
void foreach_real_geometry(bke::GeometrySet &geometry, FunctionRef< void(bke::GeometrySet &geometry_set)> fn)
static void node_copy_storage(bNodeTree *, bNode *dst_node, const bNode *src_node)
static void draw_color(ui::Layout &layout, const ColorGeometry4f &value)
static bool node_insert_link(bke::NodeInsertLinkParams ¶ms)
static void draw_input_socket(CustomSocketDrawParams ¶ms)
static void node_blend_write(const bNodeTree &, const bNode &node, BlendWriter &writer)
static bool draw_from_socket_log_value(CustomSocketDrawParams ¶ms, eval_log::NodeTreeLog &tree_log)
static void geo_viewer_node_log_impl(const bNode &node, const Span< bke::SocketValueVariant * > input_values, eval_log::ViewerNodeLog &r_log)
static bool draw_gpointer(CustomSocketDrawParams ¶ms, const GPointer value)
static void draw_float(ui::Layout &layout, const float value)
static void log_viewer_attribute(const bNode &node, eval_log::ViewerNodeLog &r_log)
static void node_blend_read(bNodeTree &, bNode &node, BlendDataReader &reader)
static bool draw_generic_value_log(CustomSocketDrawParams ¶ms, const GPointer &value)
static void node_free_storage(bNode *node)
static void draw_empty_data_block(ui::Layout &layout)
static void node_init(bNodeTree *, bNode *node)
static void node_register()
static void node_operators()
static void draw_string(ui::Layout &layout, const StringRef value)
static bool draw_from_viewer_log_value(CustomSocketDrawParams ¶ms, eval_log::NodeTreeLog &tree_log)
static void draw_bool(ui::Layout &layout, const bool value)
static void draw_int(ui::Layout &layout, const int value)
static void node_declare(NodeDeclarationBuilder &b)
static void node_layout_ex(ui::Layout &layout, bContext *C, PointerRNA *ptr)
static void draw_data_block(ui::Layout &layout, const ID *id)
static void draw_vector(ui::Layout &layout, const float3 &value)
static void node_extra_info(NodeExtraInfoParams ¶ms)
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
void make_common_operators()
void blend_write(BlendWriter *writer, const bNode &node)
void destruct_array(bNode &node)
void blend_read_data(BlendDataReader *reader, bNode &node)
void copy_array(const bNode &src_node, bNode &dst_node)
Accessor::ItemT * add_item_with_socket_type_and_name(bNodeTree &ntree, bNode &node, const eNodeSocketDatatype socket_type, const char *name, std::optional< int > dimensions=std::nullopt)
bool try_add_item_via_any_extend_socket(bNodeTree &ntree, bNode &extend_node, bNode &storage_node, bNodeLink &link, const std::optional< StringRef > socket_identifier=std::nullopt, typename Accessor::ItemT **r_new_item=nullptr)
bool socket_type_supports_attributes(const eNodeSocketDatatype socket_type)
void geo_viewer_node_log(const bNode &node, const Span< bke::SocketValueVariant * > input_values, eval_log::ViewerNodeLog &r_log)
@ NODE_GEO_VIEWER_ITEM_FLAG_AUTO_REMOVE
const char * BKE_id_name(const ID &id)
BMesh const char void * data
int ED_outliner_icon_from_id(const ID &id)
SpaceNode * CTX_wm_space_node(const bContext *C)
T * DEG_get_original(T *id)
Main * CTX_data_main(const bContext *C)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
void write_string(const char *data)
eNodeSocketDatatype socket_type
struct bNodeTree * node_group
struct bNodeTree * edittree
bke::bNodeSocketType * typeinfo
const CPPType * base_cpp_type
NodeBlendWriteFunction blend_write_storage_content
void(*) register_operators()
std::string ui_description
NodeBlendDataReadFunction blend_data_read_storage_content
NodeExtraInfoFunction get_extra_info
void(*) draw_buttons_ex(ui::Layout &, bContext *C, PointerRNA *ptr)
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
bool(*) insert_link(NodeInsertLinkParams ¶ms)
void draw_standard(ui::Layout &layout, std::optional< StringRefNull > label_override=std::nullopt)
static void blend_read_data_item(BlendDataReader *reader, ItemT &item)
static std::string socket_identifier_for_item(const NodeGeometryViewerItem &item)
static StructRNA ** item_srna
static void blend_write_item(BlendWriter *writer, const ItemT &item)
bke::SocketValueVariant value
void label(StringRef name, int icon)
PanelLayout panel(const bContext *C, StringRef idname, bool default_closed)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
Layout & column(bool align)