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

◆ node_network()

InspectResult MayaFlux::Portal::Forma::Inspector::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.

Builds a collapsible ValueGroup whose header is the network's topology and output mode, with body rows for node count and enabled state. Intended to be nested inside node_graph_manager() but callable independently when the caller already holds a network reference.

Definition at line 205 of file NodeQuery.cpp.

210{
211 const float ind = x_min + static_cast<float>(depth) * k_inspect_indent;
212
213 const std::string header_label
214 = std::string(Reflect::enum_to_string(net->get_topology()))
215 + " / "
216 + std::string(Reflect::enum_to_string(net->get_output_mode()));
217
218 auto net_ref = net;
219 std::vector<ValueSpec> values {
220 ValueSpec {
221 .label = "nodes",
222 .reader = [net_ref] { return std::to_string(net_ref->get_node_count()); },
223 },
224 ValueSpec {
225 .label = "enabled",
226 .reader = [net_ref] { return net_ref->is_enabled() ? "true" : "false"; },
227 },
228 ValueSpec {
229 .label = "channels",
230 .reader = [net_ref] {
231 const auto ch = net_ref->get_registered_channels();
232 std::string s;
233 for (size_t i = 0; i < ch.size(); ++i) {
234 if (i)
235 s += ',';
236 s += std::to_string(ch[i]);
237 }
238 return s.empty() ? "-" : s;
239 },
240 },
241 };
242
243 const auto dims = row_pixel_dims(surface.window(), ind, x_max, row_h);
244 auto hbuf = make_row_buffer(surface.window(), header_label, dims);
245 std::vector<RowBuffer> rbufs;
246 rbufs.reserve(values.size());
247 for (const auto& spec : values)
248 rbufs.push_back(make_row_buffer(surface.window(), spec.label, dims));
249
250 auto group = make_value_group(values, std::move(hbuf), rbufs,
251 surface, cursor, ind, x_max, row_h, false);
252
253 InspectResult result;
254 result.group = std::move(group);
255 return result;
256}
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.
constexpr std::string_view enum_to_string(EnumType value) noexcept
Universal enum to string converter using magic_enum (original case)

References MayaFlux::Reflect::enum_to_string(), MayaFlux::Portal::Forma::InspectResult::group, MayaFlux::Portal::Forma::k_inspect_indent, MayaFlux::Portal::Forma::ValueSpec::label, make_row_buffer(), MayaFlux::Portal::Forma::make_value_group(), MayaFlux::Portal::Forma::row_pixel_dims(), and MayaFlux::Portal::Forma::Surface::window().

Referenced by node_graph_manager().

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