| 54 | } |
| 55 | |
| 56 | ValueTree MorphPluginParameters::copyState() { |
| 57 | ValueTree tree = PluginParameters::copyState(); |
| 58 | |
| 59 | if (tree.getChildWithName("pointTree").isValid()) { |
| 60 | tree.removeChild(tree.getChildWithName("pointTree"), nullptr); |
| 61 | } |
| 62 | |
| 63 | ValueTree pointTree("pointTree"); |
| 64 | |
| 65 | auto points = lastPointsV2.points; |
| 66 | if(points.isEmpty()) { |
| 67 | return tree; |
| 68 | } |
| 69 | |
| 70 | pointTree.setProperty("ylimit", lastPointsV2.yScale, nullptr); |
| 71 | |
| 72 | for(auto& point : points) { |
| 73 | ValueTree valuePoint ("point"); |
| 74 | valuePoint.setProperty("x", point.x, nullptr); |
| 75 | valuePoint.setProperty("y", point.y, nullptr); |
| 76 | pointTree.appendChild(valuePoint, nullptr); |
| 77 | } |
| 78 | |
| 79 | tree.addChild(pointTree, -1, nullptr); |
| 80 | |
| 81 | return tree; |
| 82 | } |
| 83 | |
| 84 | void MorphPluginParameters::setControlPointComponent(ControlPointComponent* component) { |
| 85 | component->setListener(this); |