2 #include <Process/Dataflow/Port.hpp>
3 #include <Process/Process.hpp>
5 #include <ossia/detail/algorithms.hpp>
10 template <
typename T = Process::ControlInlet>
13 r.stream.StartArray();
14 for(
const auto& inlet : proc.inlets())
16 if(
auto ctrl = qobject_cast<Process::ControlInlet*>(inlet))
18 r.stream.StartArray();
19 r.stream.Int(ctrl->id().val());
27 template <
typename T = Process::ControlInlet>
28 void loadFixedControls(
31 for(
const auto& arr : ctrls)
33 const auto&
id = arr[0].GetInt();
34 ossia::value val =
JsonValue{arr[1]}.to<ossia::value>();
36 auto it = ossia::find_if(
37 proc.inlets(), [&](
const auto& inl) { return inl->id().val() == id; });
38 if(it != proc.inlets().end())
41 if(
auto ctrl = qobject_cast<T*>(&inlet))
50 Process::Preset saveScriptProcessPreset(
const T& process,
const QString& data)
53 p.name = process.metadata().getName();
58 Process::saveFixedControls(r, process);
60 p.data = r.toByteArray();
64 template <
typename ScriptProperty,
typename T>
67 const rapidjson::Document doc = readJson(preset.data);
70 Process::loadFixedControls(doc.GetArray(), process);
Definition: JSONVisitor.hpp:52
void readFrom(const score::Entity< T > &obj)
Definition: EntitySerialization.hpp:7
The Process class.
Definition: score-lib-process/Process/Process.hpp:61
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Definition: JSONVisitor.hpp:372
Definition: Preset.hpp:32