MayaFlux 1.0.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 keeps it on this Inspector. Subsequent calls return the same result regardless of the supplied surface and cursor; the original window remains the render target. destroy() releases it, and the next call builds afresh.

Definition at line 265 of file NodeQuery.cpp.

269{
271 return *m_node_graph_result;
272 }
273
274 const auto tokens = m_ngm.get_active_tokens();
275
276 const std::string root_label = "NodeGraphManager ["
277 + std::to_string(tokens.size()) + " token"
278 + (tokens.size() == 1 ? "" : "s") + "]";
279
280 auto& ngm = m_ngm;
281 std::vector<EntrySpec> root_entrys {
282 EntrySpec {
283 .label = "tokens",
284 .reader = [&ngm] { return std::to_string(ngm.get_active_tokens().size()); },
285 },
286 };
287
288 auto hbuf = make_header_buffer(surface.window());
289 auto rbufs = make_row_buffers(surface.window(), root_entrys.size());
290
291 auto root_group = make_entry_group(root_entrys, root_label, std::move(hbuf), rbufs,
292 surface, cursor, x_min, x_max, row_h, false);
293
294 InspectResult& result = m_node_graph_result.emplace();
295 result.group = std::move(root_group);
296
297 for (const auto tok : tokens) {
298 const std::string tok_label = std::string(Reflect::enum_to_string(tok));
299 const bool multichannel = tok == Nodes::ProcessingToken::AUDIO_RATE;
300 auto channels = m_ngm.get_all_channels(tok);
301 if (multichannel)
302 std::ranges::sort(channels);
303
304 std::vector<EntrySpec> tok_entrys {
305 EntrySpec {
306 .label = "nodes",
307 .reader = [&ngm, tok] { return std::to_string(ngm.get_node_count(tok)); },
308 },
309 EntrySpec {
310 .label = "networks",
311 .reader = [&ngm, tok] { return std::to_string(ngm.get_network_count(tok)); },
312 },
313 };
314
315 auto tok_hbuf = make_header_buffer(surface.window());
316 auto tok_rbufs = make_row_buffers(surface.window(), tok_entrys.size());
317
318 auto tok_group = make_entry_group(tok_entrys, tok_label, std::move(tok_hbuf), tok_rbufs,
319 surface, cursor, x_min + k_inspect_indent, x_max, row_h, false);
320
321 InspectResult tok_result;
322 tok_result.group = std::move(tok_group);
323 surface.layer().relate(result.group.header.header_id, tok_result.group.header.header_id);
324
325 // ----- Networks section -----
326 {
327 auto net_hbuf = make_header_buffer(surface.window());
328 auto net_group = make_entry_group({}, "Networks", std::move(net_hbuf), {},
329 surface, cursor, x_min + 2.F * k_inspect_indent, x_max, row_h, false);
330
331 InspectResult net_section;
332 net_section.group = std::move(net_group);
333 surface.layer().relate(tok_result.group.header.header_id, net_section.group.header.header_id);
334
335 if (multichannel) {
336 for (const auto ch : channels) {
337 auto ch_hbuf = make_header_buffer(surface.window());
338 auto ch_group = make_entry_group({}, "ch " + std::to_string(ch), std::move(ch_hbuf), {},
339 surface, cursor, x_min + 3.F * k_inspect_indent, x_max, row_h, false);
340
341 InspectResult ch_result;
342 ch_result.group = std::move(ch_group);
343 surface.layer().relate(net_section.group.header.header_id, ch_result.group.header.header_id);
344
345 for (const auto& net : m_ngm.get_networks(tok, ch)) {
346 if (!net)
347 continue;
348 auto nr = node_network(net, surface, cursor, x_min, x_max, row_h, 4);
349 surface.layer().relate(ch_result.group.header.header_id, nr.group.header.header_id);
350 ch_result.children.push_back(std::move(nr));
351 }
352
353 net_section.children.push_back(std::move(ch_result));
354 }
355 } else {
356 for (const auto& net : m_ngm.get_networks(tok, 0)) {
357 if (!net)
358 continue;
359 auto nr = node_network(net, surface, cursor, x_min, x_max, row_h, 3);
360 surface.layer().relate(net_section.group.header.header_id, nr.group.header.header_id);
361 net_section.children.push_back(std::move(nr));
362 }
363 }
364
365 tok_result.children.push_back(std::move(net_section));
366 }
367
368 // ----- Nodes section -----
369 {
370 auto nodes_hbuf = make_header_buffer(surface.window());
371 auto nodes_group = make_entry_group({}, "Nodes", std::move(nodes_hbuf), {},
372 surface, cursor, x_min + 2.F * k_inspect_indent, x_max, row_h, false);
373
374 InspectResult nodes_section;
375 nodes_section.group = std::move(nodes_group);
376 surface.layer().relate(tok_result.group.header.header_id, nodes_section.group.header.header_id);
377
378 if (multichannel) {
379 for (const auto ch : channels) {
380 auto rn = root_node(tok, ch, surface, cursor, x_min, x_max, row_h, 3);
381 surface.layer().relate(nodes_section.group.header.header_id, rn.group.header.header_id);
382 nodes_section.children.push_back(std::move(rn));
383 }
384 } else {
385 auto rn = root_node(tok, 0, surface, cursor, x_min, x_max, row_h, 3);
386 surface.layer().relate(nodes_section.group.header.header_id, rn.group.header.header_id);
387 nodes_section.children.push_back(std::move(rn));
388 }
389
390 tok_result.children.push_back(std::move(nodes_section));
391 }
392
393 result.children.push_back(std::move(tok_result));
394 }
395
396 return result;
397}
uint32_t channels
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.
std::shared_ptr< Buffers::FormaBuffer > make_header_buffer(const std::shared_ptr< Core::Window > &window) const
A "text"-slotted buffer, registered with the BufferManager.
Definition Inspector.cpp:11
Nodes::NodeGraphManager & m_ngm
std::vector< EntryBuffer > make_row_buffers(const std::shared_ptr< Core::Window > &window, size_t count) const
count row targets, slices of one "text"-slotted buffer, for make_entry_group's rows.
Definition Inspector.cpp:24
std::optional< InspectResult > m_node_graph_result
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.
EntryGroup make_entry_group(std::span< const EntrySpec > entrys, std::string_view header_label, FormaTarget header_buf, std::span< const EntryBuffer > 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 entry rows under it.
Definition Entry.cpp:104
constexpr float k_inspect_indent
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, channels, 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::EntryGroup::header, MayaFlux::Portal::Forma::Collapsible::header_id, MayaFlux::Portal::Forma::k_inspect_indent, MayaFlux::Portal::Forma::EntrySpec::label, MayaFlux::Portal::Forma::Surface::layer(), m_ngm, m_node_graph_result, MayaFlux::Portal::Forma::make_entry_group(), make_header_buffer(), make_row_buffers(), node_network(), MayaFlux::Portal::Forma::Layer::relate(), root_node(), and MayaFlux::Portal::Forma::Surface::window().

Referenced by MayaFlux::Portal::Forma::inspect_node_graph().

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