MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ node()

InspectResult MayaFlux::Portal::Forma::Inspector::node ( const std::shared_ptr< Nodes::Node > &  n,
Surface surface,
LayoutCursor cursor,
float  x_min = -0.95F,
float  x_max = 0.95F,
float  row_h = 0.05F,
int  depth = 0 
)

Inspect a single Node and its full modulator tree.

Builds a ValueGroup whose header is the node's short type name and whose body rows expose the node's runtime values (output, role for modulators, etc.). Modulator children are recursively expanded as nested InspectResults related to this node's header.

Definition at line 85 of file NodeQuery.cpp.

90{
91 const float ind = x_min + static_cast<float>(depth) * k_inspect_indent;
92 const std::string header_label = Reflect::short_dynamic_type_name(*n);
93
94 auto node_ref = n;
95 std::vector<ValueSpec> values {
96 ValueSpec {
97 .label = "out",
98 .reader = [node_ref] { return std::to_string(node_ref->get_last_output()); },
99 },
100 };
101
102 const auto dims = row_pixel_dims(surface.window(), ind, x_max, row_h);
103 auto hbuf = make_row_buffer(surface.window(), header_label, dims);
104 std::vector<RowBuffer> rbufs;
105 rbufs.reserve(values.size());
106 for (const auto& spec : values)
107 rbufs.push_back(make_row_buffer(surface.window(), spec.label, dims));
108
109 auto group = make_value_group(values, std::move(hbuf), rbufs,
110 surface, cursor, ind, x_max, row_h, false);
111
112 InspectResult result;
113 result.group = std::move(group);
114
115 for (const auto& tree : n->get_modulator_tree()) {
116 auto child = inspect_modulator_tree(
117 tree, surface, cursor,
118 x_min, x_max, row_h, depth + 1);
119 surface.layer().relate(
120 result.group.header.header_id,
121 child.group.header.header_id);
122 result.children.push_back(std::move(child));
123 }
124
125 return result;
126}
InspectResult inspect_modulator_tree(const Nodes::ModulatorTree &tree, Surface &surface, LayoutCursor &cursor, float x_min, float x_max, float row_h, int depth)
Definition NodeQuery.cpp:36
RowBuffer make_row_buffer(const std::shared_ptr< Core::Window > &window, std::string_view text, glm::uvec2 pixel_dims) const
Definition Inspector.cpp:13
ValueGroup make_value_group(std::span< const ValueSpec > values, RowBuffer header_buf, std::span< const RowBuffer > row_bufs, Surface &surface, LayoutCursor &cursor, float x_min, float x_max, float row_h, bool initially_open)
Construct a collapsible header followed by N value rows under it.
constexpr float k_inspect_indent
glm::uvec2 row_pixel_dims(const std::shared_ptr< Core::Window > &window, float x_min, float x_max, float row_h)
Convert an NDC row rect into integer pixel dimensions.
std::string short_dynamic_type_name(const T &obj) noexcept
Returns the unqualified dynamic type name of obj.
Definition TypeInfo.hpp:95

References MayaFlux::Portal::Forma::InspectResult::children, MayaFlux::Portal::Forma::InspectResult::group, MayaFlux::Portal::Forma::ValueGroup::header, MayaFlux::Portal::Forma::Collapsible::header_id, inspect_modulator_tree(), MayaFlux::Portal::Forma::k_inspect_indent, MayaFlux::Portal::Forma::ValueSpec::label, MayaFlux::Portal::Forma::Surface::layer(), make_row_buffer(), MayaFlux::Portal::Forma::make_value_group(), MayaFlux::Portal::Forma::Layer::relate(), MayaFlux::Portal::Forma::row_pixel_dims(), MayaFlux::Reflect::short_dynamic_type_name(), and MayaFlux::Portal::Forma::Surface::window().

Referenced by root_node().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: