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

Method SetUpFromSaveData

Source/NoteHocket.cpp:204–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202}
203
204void NoteHocket::SetUpFromSaveData()
205{
206 mNumDestinations = mModuleSaveData.GetInt("num_outputs");
207 int oldNumItems = (int)mDestinationCables.size();
208 if (mNumDestinations > oldNumItems)
209 {
210 for (int i = oldNumItems; i < mNumDestinations; ++i)
211 {
212 mDestinationCables.push_back(new AdditionalNoteCable());
213 mDestinationCables[i]->SetPatchCableSource(new PatchCableSource(this, kConnectionType_Note));
214 mDestinationCables[i]->GetPatchCableSource()->SetOverrideCableDir(ofVec2f(1, 0), PatchCableSource::Side::kRight);
215 AddPatchCableSource(mDestinationCables[i]->GetPatchCableSource());
216 ofRectangle rect = mWeightSlider[i]->GetRect(true);
217 mDestinationCables[i]->GetPatchCableSource()->SetManualPosition(rect.getMaxX() + 10, rect.y + rect.height / 2);
218 }
219 }
220 else if (mNumDestinations < oldNumItems)
221 {
222 for (int i = oldNumItems - 1; i >= mNumDestinations; --i)
223 {
224 RemovePatchCableSource(mDestinationCables[i]->GetPatchCableSource());
225 }
226 mDestinationCables.resize(mNumDestinations);
227 }
228
229 mDeterministic = mModuleSaveData.GetBool("deterministic");
230
231 AdjustHeight();
232}
233
234void NoteHocket::SaveLayout(ofxJSONElement& moduleInfo)
235{

Callers

nothing calls this directly

Calls 11

ofVec2fClass · 0.85
GetIntMethod · 0.80
sizeMethod · 0.80
SetPatchCableSourceMethod · 0.80
SetOverrideCableDirMethod · 0.80
SetManualPositionMethod · 0.80
getMaxXMethod · 0.80
resizeMethod · 0.80
GetBoolMethod · 0.80
GetPatchCableSourceMethod · 0.45
GetRectMethod · 0.45

Tested by

no test coverage detected