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 auto cables = Dataflow::restoreCablesWithoutTouchingPorts(m_oldCables, ctx);
112 cmt.outletsChanged();
113 Dataflow::notifyAddedCables(cables, ctx);
118 Dataflow::removeCables(m_oldCables, ctx);
120 auto& cmt = m_path.find(ctx);
121 cmt.loadPreset(m_new);
123 auto cables = Dataflow::reloadPortsInNewProcess(
124 m_oldInlets, m_oldOutlets, m_oldCables, cmt, ctx);
127 cmt.outletsChanged();
128 Dataflow::notifyAddedCables(cables, ctx);
133 stream << m_path << m_old << m_new << m_oldInlets << m_oldOutlets << m_oldCables;
137 stream >> m_path >> m_old >> m_new >> m_oldInlets >> m_oldOutlets >> m_oldCables;
144 std::vector<Dataflow::SavedPort> m_oldInlets, m_oldOutlets;
146 Dataflow::SerializedCables m_oldCables;
Definition DocumentContext.hpp:18