Loading...
Searching...
No Matches
SetControllerControlValue.hpp
1#pragma once
2#include <Process/Commands/LoadPresetCommandFactory.hpp>
3#include <Process/Dataflow/Port.hpp>
4#include <Process/Process.hpp>
5#include <Process/Script/ScriptEditor.hpp>
6#include <Process/Script/ScriptProcess.hpp>
7
8#include <Scenario/Commands/ScenarioCommandFactory.hpp>
9
10#include <Dataflow/Commands/CableHelpers.hpp>
11
12#include <score/tools/Unused.hpp>
13
14#include <ossia/detail/algorithms.hpp>
15
16#include <score_plugin_scenario_export.h>
17namespace Scenario
18{
19// TODO find a way to keep this in sync with Scenario::EditScript
20class SCORE_PLUGIN_SCENARIO_EXPORT SetControllerControlValue
22{
23 SCORE_COMMAND_DECL(
24 Scenario::Command::CommandFactoryName(), SetControllerControlValue,
25 "Set a control")
26public:
28 const Process::ControlInlet& obj, ossia::value newval,
29 const score::DocumentContext& ctx);
30
32
33 void undo(const score::DocumentContext& ctx) const final override;
34 void redo(const score::DocumentContext& ctx) const final override;
35
36 void update(const Process::ControlInlet& obj, ossia::value newval, unused_t);
37 void setNewValue(ossia::value v) override { m_new = std::move(v); }
38
39protected:
40 void serializeImpl(DataStreamInput& stream) const final override;
41 void deserializeImpl(DataStreamOutput& stream) final override;
42
43private:
45 ossia::value m_old, m_new;
46 std::vector<Dataflow::SavedPort> m_oldInlets, m_oldOutlets;
47
48 Dataflow::SerializedCables m_oldCables;
49};
50
53{
54 SCORE_CONCRETE("8a3e1f65-3c4b-4d0e-a0a1-2a8c7c3e5b7d")
55public:
56 bool matches(
57 const Process::ControlInlet&, unused_t, const score::DocumentContext&) const noexcept override
58 {
59 return true;
60 }
62 const Process::ControlInlet& obj, ossia::value newval,
63 const score::DocumentContext& ctx) const override
64 {
65 return new SetControllerControlValue{obj, std::move(newval), ctx};
66 }
67};
68}
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition LoadPresetCommandFactory.hpp:51
Definition LoadPresetCommandFactory.hpp:43
Definition Port.hpp:242
Sets controls that change the ports of their process with SetControllerControlValue.
Definition SetControllerControlValue.hpp:53
Definition SetControllerControlValue.hpp:22
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition ObjectMatches.hpp:6
Definition DocumentContext.hpp:18
Definition Unused.hpp:3