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

◆ root_node() [2/2]

InspectResult MayaFlux::Portal::Forma::Inspector::root_node ( Nodes::ProcessingToken  token,
uint32_t  channel,
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 RootNode for a specific token and channel.

Header is "root [ch N]" for AUDIO_RATE or "root" for all other tokens. Body row exposes live node count from RootNode::get_node_size(). Each registered node is expanded via node() as a child. Networks for the token/channel are appended after the node children.

Definition at line 132 of file NodeQuery.cpp.

137{
138 auto& root = m_ngm.get_root_node(token, channel);
139
140 const float ind = x_min + static_cast<float>(depth) * k_inspect_indent;
141 const std::string header_label = token == Nodes::ProcessingToken::AUDIO_RATE
142 ? "root [ch " + std::to_string(channel) + "]"
143 : "root";
144
145 std::vector<ValueSpec> values {
146 ValueSpec {
147 .label = "nodes",
148 .reader = [&root] { return std::to_string(root.get_node_size()); },
149 },
150 };
151
152 const auto dims = row_pixel_dims(surface.window(), ind, x_max, row_h);
153 auto hbuf = make_row_buffer(surface.window(), header_label, dims);
154 std::vector<RowBuffer> rbufs;
155 rbufs.reserve(values.size());
156 for (const auto& spec : values)
157 rbufs.push_back(make_row_buffer(surface.window(), spec.label, dims));
158
159 auto group = make_value_group(values, std::move(hbuf), rbufs,
160 surface, cursor, ind, x_max, row_h, false);
161
162 InspectResult result;
163 result.group = std::move(group);
164
165 for (const auto& n : root.nodes()) {
166 if (!n)
167 continue;
168 auto node_result = node(
169 n, surface, cursor,
170 x_min, x_max, row_h, depth + 1);
171 surface.layer().relate(result.group.header.header_id, node_result.group.header.header_id);
172 result.children.push_back(std::move(node_result));
173 }
174
175 return result;
176}
RootNode & get_root_node(ProcessingToken token, unsigned int channel)
Gets or creates the root node for a specific token and channel.
Nodes::NodeGraphManager & m_ngm
RowBuffer make_row_buffer(const std::shared_ptr< Core::Window > &window, std::string_view text, glm::uvec2 pixel_dims) const
Definition Inspector.cpp:13
InspectResult 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.
Definition NodeQuery.cpp:85
@ AUDIO_RATE
Nodes that process at the audio sample rate.
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.

References MayaFlux::Nodes::AUDIO_RATE, MayaFlux::Portal::Forma::InspectResult::children, MayaFlux::Nodes::NodeGraphManager::get_root_node(), MayaFlux::Portal::Forma::InspectResult::group, MayaFlux::Portal::Forma::ValueGroup::header, MayaFlux::Portal::Forma::Collapsible::header_id, MayaFlux::Portal::Forma::k_inspect_indent, MayaFlux::Portal::Forma::ValueSpec::label, MayaFlux::Portal::Forma::Surface::layer(), m_ngm, make_row_buffer(), MayaFlux::Portal::Forma::make_value_group(), node(), MayaFlux::Portal::Forma::Layer::relate(), MayaFlux::Portal::Forma::row_pixel_dims(), and MayaFlux::Portal::Forma::Surface::window().

Referenced by node_graph_manager(), and root_node().

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