Loading...
Searching...
No Matches
FormatOverride.hpp
1#pragma once
2
3#include <ossia/dataflow/geometry_port.hpp>
4
5#include <memory>
6#include <string_view>
7
8namespace Threedim::PrimitiveCloud
9{
10
11// Shallow-clones `state` and rewrites every primitive_cloud_component
12// reachable through the scene tree to carry `override` as its
13// `format_id`. Heavy fields (raw_data buffer_resource, extra_buffers,
14// bounds, …) are shared via shared_ptr — no GPU upload duplicates.
15//
16// Used by AssetLoader's "Format override" line edit and the TagAs
17// pass-through node so unrecognised PLY columns / procedural producers
18// without an autodetected format_id can still be routed by a
19// FlattenedSceneFilterNode in mode 12 (format_id == match_str).
20//
21// `override.empty()` returns the input verbatim (`const_pointer_cast`
22// to drop the const, but no actual mutation is performed). A null
23// `state` returns null. Otherwise the returned shared_ptr is freshly
24// allocated; its `version` and `dirty_index` are bumped by 1 so
25// downstream change-detection sees a fresh frame.
26//
27// Walks scene_node children recursively. Nested scene_node_ptr inside
28// children is itself deep-cloned so the rewrite is leak-free for the
29// const tree shape.
30std::shared_ptr<ossia::scene_state> applyFormatOverride(
31 std::shared_ptr<const ossia::scene_state> state,
32 std::string_view override);
33
34} // namespace Threedim::PrimitiveCloud