score-plugin-spline3d/Spline3D/Model.hpp
1 #pragma once
2 #include <State/Address.hpp>
3 #include <State/Unit.hpp>
4 
5 #include <Process/Process.hpp>
6 
8 
9 #include <ossia/dataflow/nodes/spline/spline3d.hpp>
10 
11 #include <Spline3D/Metadata.hpp>
12 
13 #include <verdigris>
14 
15 namespace Spline3D
16 {
17 
18 class ProcessModel final : public Process::ProcessModel
19 {
20  SCORE_SERIALIZE_FRIENDS
21  PROCESS_METADATA_IMPL(Spline3D::ProcessModel)
22 
23  W_OBJECT(ProcessModel)
24 
25 public:
26  static constexpr bool hasExternalUI() noexcept { return true; }
28  const TimeVal& duration, const Id<Process::ProcessModel>& id, QObject* parent);
29  ~ProcessModel() override;
30 
31  template <typename Impl>
32  ProcessModel(Impl& vis, QObject* parent)
33  : Process::ProcessModel{vis, parent}
34  {
35  vis.writeTo(*this);
36  init();
37  }
38 
39  void init();
40  State::AddressAccessor address() const;
41  void setAddress(const State::AddressAccessor& arg);
42  State::Unit unit() const;
43  void setUnit(const State::Unit&);
44 
45  bool tween() const { return m_tween; }
46  void setTween(bool tween)
47  {
48  if(m_tween == tween)
49  return;
50 
51  m_tween = tween;
52  tweenChanged(tween);
53  }
54 
55  QString prettyName() const noexcept override;
56 
57  const ossia::spline3d_data& spline() const noexcept { return m_spline; }
58  void setSpline(const ossia::spline3d_data& c)
59  {
60  if(m_spline != c)
61  {
62  m_spline = c;
63  splineChanged();
64  }
65  }
66 
67  std::unique_ptr<Process::Outlet> outlet;
68 
69  void addressChanged(const ::State::AddressAccessor& arg_1)
70  W_SIGNAL(addressChanged, arg_1);
71  void tweenChanged(bool tween) W_SIGNAL(tweenChanged, tween);
72  void unitChanged(const State::Unit& arg_1) W_SIGNAL(unitChanged, arg_1);
73  void splineChanged() W_SIGNAL(splineChanged);
74 
75 private:
76  TimeVal contentDuration() const noexcept override;
77  void loadPreset(const Process::Preset& preset) override;
78  Process::Preset savePreset() const noexcept override;
79 
80  ossia::spline3d_data m_spline;
81 
82  bool m_tween = false;
83 
84  W_PROPERTY(State::Unit, unit READ unit WRITE setUnit NOTIFY unitChanged)
85 
86  W_PROPERTY(bool, tween READ tween WRITE setTween NOTIFY tweenChanged)
87 
88  W_PROPERTY(
90  address READ address WRITE setAddress NOTIFY addressChanged)
91 };
92 }
The Process class.
Definition: score-lib-process/Process/Process.hpp:61
Definition: score-plugin-spline3d/Spline3D/Model.hpp:19
The id_base_t class.
Definition: Identifier.hpp:57
Definition: Preset.hpp:32
Definition: Address.hpp:108
Definition: Unit.hpp:18
Definition: TimeValue.hpp:21