/** Retrieve a preset. */ @Override public void doRetrievePreset(int presetSlot, int version) { IEditState temp = retrievePresetObject(presetSlot, version); // Extend with scalars: int buffSize = temp.getNumScalarParams(); temp.allowScalarParam(itsTransientPresetTemplate.getNumScalarParams() - 1); for (int i = buffSize; i < itsTransientPresetTemplate.getNumScalarParams(); i++) { temp.putScalar(i, itsTransientPresetTemplate.scalars[i]); } // Extend with vectors: note: we need to clone the template. // (Edit buffers are seriously mutable.) buffSize = temp.getNumVectorParams(); temp.allowVectorParam(itsTransientPresetTemplate.getNumVectorParams() - 1); for (int i = buffSize; i < itsTransientPresetTemplate.getNumVectorParams(); i++) { VectorParam source = itsTransientPresetTemplate.vectors[i]; float[] f = new float[source.x.length]; System.arraycopy(source.x, 0, f, 0, source.x.length); VectorParam vp = new VectorParam(); vp.x = f; temp.putVector(i, vp); } temp.setOriginalPresetHint(presetSlot, version); getEditBuffer().refreshFrom(temp); pushEditState(); }
@Override public VectorParam examineVectorParameter00(int paramId) { IEditState eb = getEditBuffer(); int np = eb.getNumVectorParams(); if (np > paramId) { return eb.getVector(paramId); } else { return null; } }