MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / PostRepatch

Method PostRepatch

Source/Snapshots.cpp:498–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496}
497
498void Snapshots::PostRepatch(PatchCableSource* cableSource, bool fromUserClick)
499{
500 if (TheSynth->IsLoadingState())
501 return;
502
503 auto numModules = mSnapshotModules.size();
504 auto numControls = mSnapshotControls.size();
505
506 mSnapshotModules.clear();
507 for (auto cable : mModuleCable->GetPatchCables())
508 mSnapshotModules.push_back(static_cast<IDrawableModule*>(cable->GetTarget()));
509 mSnapshotControls.clear();
510 for (auto cable : mUIControlCable->GetPatchCables())
511 mSnapshotControls.push_back(static_cast<IUIControl*>(cable->GetTarget()));
512
513 if (mSnapshotModules.size() < numModules || mSnapshotControls.size() < numControls) //we removed something, clean up any snapshots that refer to it
514 {
515 for (auto& square : mSnapshotCollection)
516 {
517 std::vector<Snapshot> toRemove;
518 for (const auto& snapshot : square.mSnapshots)
519 {
520 if (!IsConnectedToPath(snapshot.mControlPath))
521 toRemove.push_back(snapshot);
522 }
523
524 for (auto remove : toRemove)
525 square.mSnapshots.remove(remove);
526 }
527 }
528}
529
530bool Snapshots::IsConnectedToPath(std::string path) const
531{

Callers

nothing calls this directly

Calls 3

IsLoadingStateMethod · 0.80
sizeMethod · 0.80
GetTargetMethod · 0.45

Tested by

no test coverage detected