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

◆ node_graph_manager()

InspectResult & MayaFlux::Portal::Forma::Inspector::node_graph_manager ( Surface surface,
LayoutCursor cursor,
float  x_min = -0.95F,
float  x_max = 0.95F,
float  row_h = 0.05F 
)

Inspect the full NodeGraphManager state across all active tokens.

Emits one collapsible per active Nodes::ProcessingToken. Each token expands per-channel children, each of which recursively calls node() for every node registered to that channel. Networks for the token are appended after the channel children, showing topology, output mode, node count, enabled state, and registered channels.

Persistent: the first call builds the result against surface and cursor and stores it statically. Subsequent calls return the same result regardless of the supplied surface and cursor; the original window remains the render target. To display on a different surface, the process must be restarted.

Definition at line 262 of file NodeQuery.cpp.

266{
268 return *s_node_graph_result;
269 }
270
271 const auto tokens = m_ngm.get_active_tokens();
272
273 const std::string root_label = "NodeGraphManager ["
274 + std::to_string(tokens.size()) + " token"
275 + (tokens.size() == 1 ? "" : "s") + "]";
276
277 auto& ngm = m_ngm;
278 std::vector<ValueSpec> root_values {
279 ValueSpec {
280 .label = "tokens",
281 .reader = [&ngm] { return std::to_string(ngm.get_active_tokens().size()); },
282 },
283 };
284
285 const auto dims = row_pixel_dims(surface.window(), x_min, x_max, row_h);
286 auto hbuf = make_row_buffer(surface.window(), root_label, dims);
287 std::vector<RowBuffer> rbufs;
288 rbufs.reserve(root_values.size());
289 for (const auto& spec : root_values)
290 rbufs.push_back(make_row_buffer(surface.window(), spec.label, dims));
291
292 auto root_group = make_value_group(root_values, std::move(hbuf), rbufs,
293 surface, cursor, x_min, x_max, row_h, false);
294
295 InspectResult& result = s_node_graph_result.emplace();
296 result.group = std::move(root_group);
297
298 for (const auto tok : tokens) {
299 const std::string tok_label = std::string(Reflect::enum_to_string(tok));
300 const bool multichannel = tok == Nodes::ProcessingToken::AUDIO_RATE;
301 auto channels = m_ngm.get_all_channels(tok);
302 if (multichannel)
303 std::ranges::sort(channels);
304
305 std::vector<ValueSpec> tok_values {
306 ValueSpec {
307 .label = "nodes",
308 .reader = [&ngm, tok] { return std::to_string(ngm.get_node_count(tok)); },
309 },
310 ValueSpec {
311 .label = "networks",
312 .reader = [&ngm, tok] { return std::to_string(ngm.get_network_count(tok)); },
313 },
314 };
315
316 const auto tok_dims = row_pixel_dims(surface.window(), x_min + k_inspect_indent, x_max, row_h);
317 auto tok_hbuf = make_row_buffer(surface.window(), tok_label, tok_dims);
318 std::vector<RowBuffer> tok_rbufs;
319 tok_rbufs.reserve(tok_values.size());
320 for (const auto& spec : tok_values)
321 tok_rbufs.push_back(make_row_buffer(surface.window(), spec.label, tok_dims));
322
323 auto tok_group = make_value_group(tok_values, std::move(tok_hbuf), tok_rbufs,
324 surface, cursor, x_min + k_inspect_indent, x_max, row_h, false);
325
326 InspectResult tok_result;
327 tok_result.group = std::move(tok_group);
328 surface.layer().relate(result.group.header.header_id, tok_result.group.header.header_id);
329
330 // ----- Networks section -----
331 {
332 const auto net_dims = row_pixel_dims(surface.window(), x_min + 2.F * k_inspect_indent, x_max, row_h);
333 auto net_hbuf = make_row_buffer(surface.window(), "Networks", net_dims);
334 auto net_group = make_value_group({}, std::move(net_hbuf), {},
335 surface, cursor, x_min + 2.F * k_inspect_indent, x_max, row_h, false);
336
337 InspectResult net_section;
338 net_section.group = std::move(net_group);
339 surface.layer().relate(tok_result.group.header.header_id, net_section.group.header.header_id);
340
341 if (multichannel) {
342 for (const auto ch : channels) {
343 const auto ch_dims = row_pixel_dims(surface.window(), x_min + 3.F * k_inspect_indent, x_max, row_h);
344 auto ch_hbuf = make_row_buffer(surface.window(), "ch " + std::to_string(ch), ch_dims);
345 auto ch_group = make_value_group({}, std::move(ch_hbuf), {},
346 surface, cursor, x_min + 3.F * k_inspect_indent, x_max, row_h, false);
347
348 InspectResult ch_result;
349 ch_result.group = std::move(ch_group);
350 surface.layer().relate(net_section.group.header.header_id, ch_result.group.header.header_id);
351
352 for (const auto& net : m_ngm.get_networks(tok, ch)) {
353 if (!net)
354 continue;
355 auto nr = node_network(net, surface, cursor, x_min, x_max, row_h, 4);
356 surface.layer().relate(ch_result.group.header.header_id, nr.group.header.header_id);
357 ch_result.children.push_back(std::move(nr));
358 }
359
360 net_section.children.push_back(std::move(ch_result));
361 }
362 } else {
363 for (const auto& net : m_ngm.get_networks(tok, 0)) {
364 if (!net)
365 continue;
366 auto nr = node_network(net, surface, cursor, x_min, x_max, row_h, 3);
367 surface.layer().relate(net_section.group.header.header_id, nr.group.header.header_id);
368 net_section.children.push_back(std::move(nr));
369 }
370 }
371
372 tok_result.children.push_back(std::move(net_section));
373 }
374
375 // ----- Nodes section -----
376 {
377 const auto nodes_dims = row_pixel_dims(surface.window(), x_min + 2.F * k_inspect_indent, x_max, row_h);
378 auto nodes_hbuf = make_row_buffer(surface.window(), "Nodes", nodes_dims);
379 auto nodes_group = make_value_group({}, std::move(nodes_hbuf), {},
380 surface, cursor, x_min + 2.F * k_inspect_indent, x_max, row_h, false);
381
382 InspectResult nodes_section;
383 nodes_section.group = std::move(nodes_group);
384 surface.layer().relate(tok_result.group.header.header_id, nodes_section.group.header.header_id);
385
386 if (multichannel) {
387 for (const auto ch : channels) {
388 auto rn = root_node(tok, ch, surface, cursor, x_min, x_max, row_h, 3);
389 surface.layer().relate(nodes_section.group.header.header_id, rn.group.header.header_id);
390 nodes_section.children.push_back(std::move(rn));
391 }
392 } else {
393 auto rn = root_node(tok, 0, surface, cursor, x_min, x_max, row_h, 3);
394 surface.layer().relate(nodes_section.group.header.header_id, rn.group.header.header_id);
395 nodes_section.children.push_back(std::move(rn));
396 }
397
398 tok_result.children.push_back(std::move(nodes_section));
399 }
400
401 result.children.push_back(std::move(tok_result));
402 }
403
404 return result;
405}
std::vector< ProcessingToken > get_active_tokens() const
Gets all currently active processing tokens (domains)
std::vector< unsigned int > get_all_channels(ProcessingToken token) const
Gets all channel indices for a given processing token.
Nodes::NodeGraphManager & m_ngm
static std::optional< InspectResult > s_node_graph_result
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_network(const std::shared_ptr< Nodes::Network::NodeNetwork > &net, Surface &surface, LayoutCursor &cursor, float x_min=-0.95F, float x_max=0.95F, float row_h=0.05F, int depth=0)
Inspect a NodeNetwork and its per-network metadata.
InspectResult 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.
@ 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.
constexpr std::string_view enum_to_string(EnumType value) noexcept
Universal enum to string converter using magic_enum (original case)

References MayaFlux::Nodes::AUDIO_RATE, MayaFlux::Portal::Forma::InspectResult::children, MayaFlux::Reflect::enum_to_string(), MayaFlux::Nodes::NodeGraphManager::get_active_tokens(), MayaFlux::Nodes::NodeGraphManager::get_all_channels(), MayaFlux::Nodes::NodeGraphManager::get_networks(), 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_network(), MayaFlux::Portal::Forma::Layer::relate(), root_node(), MayaFlux::Portal::Forma::row_pixel_dims(), s_node_graph_result, and MayaFlux::Portal::Forma::Surface::window().

+ Here is the call graph for this function: