Loading...
Searching...
No Matches
CreateCollection.hpp
1#pragma once
2#include <halp/controls.hpp>
3#include <halp/meta.hpp>
4
5#include <Threedim/StringListControl.hpp>
6
7#include <ossia/dataflow/geometry_port.hpp>
8
9#include <cstdint>
10#include <memory>
11#include <string>
12#include <vector>
13
14namespace Threedim
15{
16
17// Authors a named collection (a reusable set of scene paths) and
18// stamps it onto the passthrough scene_spec's collections vector.
19//
20// Collections are addressable by name anywhere downstream — a consumer
21// node that takes a collection name resolves the paths at consume-time,
22// which decouples "what is the set of things I care about?" from "what
23// am I doing to them?".
24//
25// Multiple CreateCollection nodes can chain: each contributes its own
26// named collection to the scene, and downstream consumers can pick any
27// of them by name. merge_scenes concatenates collections additively
28// across multi-producer merges.
30{
31public:
32 halp_meta(name, "Create Collection")
33 halp_meta(category, "Visuals/3D/Scene")
34 halp_meta(c_name, "create_collection")
35 halp_meta(description, "Attach a named collection of scene paths and tags to a scene.")
36 halp_meta(authors, "ossia team")
37 halp_meta(
38 manual_url,
39 "https://ossia.io/score-docs/processes/create-collection.html")
40 halp_meta(uuid, "6c2e9b7a-4d3f-4a1c-8f5e-2b7d9e4c3a1f")
41
42 struct ins
43 {
44 struct
45 {
46 halp_meta(name, "Scene In");
47 ossia::scene_spec scene;
48 uint8_t dirty{0};
49 } scene_in;
50
51 // Port-driven rebuild: controls trigger rebuild(); upstream
52 // scene_in changes detected in operator()().
53 struct : halp::lineedit<"Name", "">
54 { void update(CreateCollection& n) { n.rebuild(); } } name;
55 struct : string_list_control<"Paths">
56 {
57 halp_meta(description, "Scene paths in the collection, one per row.")
58 void update(CreateCollection& n) { n.rebuild(); }
59 } paths;
60 struct : string_list_control<"Tags">
61 {
62 halp_meta(description, "Tags attached to the collection, one per row.")
63 void update(CreateCollection& n) { n.rebuild(); }
64 } tags;
65 } inputs;
66
67 struct outs
68 {
69 struct
70 {
71 halp_meta(name, "Scene Out");
72 ossia::scene_spec scene;
73 uint8_t dirty{0};
74 } scene_out;
75 } outputs;
76
77 void rebuild();
78 void operator()();
79
80 std::shared_ptr<const ossia::scene_state> m_cached_out;
81 uint8_t m_pending_dirty{0xFF};
82 const ossia::scene_state* m_cached_in_state{};
83 int64_t m_cached_in_version{-1};
84 int64_t m_version_counter{0};
85};
86
87}
Definition CreateCollection.hpp:30
Definition CreateCollection.hpp:43
Definition CreateCollection.hpp:68
Definition StringListControl.hpp:83