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