22 Scenario::Command::CommandFactoryName(),
LoadPreset,
"Load a preset")
27 , m_old{obj.savePreset()}
28 , m_new{std::move(newval)}
35 m_path.find(ctx).loadPreset(m_old);
40 m_path.find(ctx).loadPreset(m_new);
45 stream << m_path << m_old << m_new;
49 stream >> m_path >> m_old >> m_new;
69 , m_old{model.savePreset()}
70 , m_new{std::move(newval)}
75 for(
auto& port : model.inlets())
76 m_oldInlets.emplace_back(
78 for(
auto& port : model.outlets())
79 m_oldOutlets.emplace_back(
86 auto& cmt = m_path.find(ctx);
89 Dataflow::removeCables(m_oldCables, ctx);
92 cmt.loadPreset(m_old);
96 SCORE_ASSERT(m_oldInlets.size() == cmt.inlets().size());
97 SCORE_ASSERT(m_oldOutlets.size() == cmt.outlets().size());
100 for(std::size_t i = 0; i < m_oldInlets.size(); i++)
102 cmt.inlets()[i]->loadData(m_oldInlets[i].data);
104 for(std::size_t i = 0; i < m_oldOutlets.size(); i++)
106 cmt.outlets()[i]->loadData(m_oldOutlets[i].data);
110 Dataflow::restoreCables(m_oldCables, ctx);
112 cmt.outletsChanged();
117 Dataflow::removeCables(m_oldCables, ctx);
119 auto& cmt = m_path.find(ctx);
120 cmt.loadPreset(m_new);
122 Dataflow::reloadPortsInNewProcess(m_oldInlets, m_oldOutlets, m_oldCables, cmt, ctx);
125 cmt.outletsChanged();
134 stream << m_path << m_old << m_new << m_oldInlets << m_oldOutlets << m_oldCables;
138 stream >> m_path >> m_old >> m_new >> m_oldInlets >> m_oldOutlets >> m_oldCables;
145 std::vector<Dataflow::SavedPort> m_oldInlets, m_oldOutlets;
147 Dataflow::SerializedCables m_oldCables;
Definition DocumentContext.hpp:18