diff --git a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java index ece537bcd..00eefcb68 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java @@ -1425,7 +1425,8 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona * Split the fin set into individual fins. * @return A list of the new fin sets. */ - public List splitFins() { + public List splitFins(boolean freezeRocket) { + final RocketComponent root = getRoot(); RocketComponent parent = getParent(); int index = parent.getChildPosition(this); int count = getFinCount(); @@ -1433,32 +1434,53 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona List splitFins = null; // List of all the split fins - if (count > 1) { - parent.removeChild(index); - splitFins = new ArrayList<>(); - for (int i = 0; i < count; i++) { - FinSet copy = (FinSet) this.copy(); - copy.setFinCount(1); - copy.setBaseRotation(base + i * 2 * Math.PI / count); - copy.setName(copy.getName() + " #" + (i + 1)); - copy.setOverrideMass(getOverrideMass() / getFinCount()); - parent.addChild(copy, index + i); - - splitFins.add(copy); + try { + // Freeze rocket + if (freezeRocket && root instanceof Rocket) { + ((Rocket) root).freeze(); } - } - // Split fins for children - for (RocketComponent listener : configListeners) { - if (listener instanceof FinSet) { - ((FinSet) listener).splitFins(); - this.removeConfigListener(listener); + // Split the fins + if (count > 1) { + parent.removeChild(index); + splitFins = new ArrayList<>(); + for (int i = 0; i < count; i++) { + FinSet copy = (FinSet) this.copy(); + copy.setFinCount(1); + copy.setBaseRotation(base + i * 2 * Math.PI / count); + copy.setName(copy.getName() + " #" + (i + 1)); + copy.setOverrideMass(getOverrideMass() / getFinCount()); + parent.addChild(copy, index + i); + + splitFins.add(copy); + } + } + + // Split fins for children + for (RocketComponent listener : configListeners) { + if (listener instanceof FinSet) { + ((FinSet) listener).splitFins(false); + this.removeConfigListener(listener); + } + } + } finally { + // Unfreeze rocket + if (freezeRocket && root instanceof Rocket) { + ((Rocket) root).thaw(); } } return splitFins; } + /** + * Split the fin set into individual fins. + * @return A list of the new fin sets. + */ + public List splitFins() { + return splitFins(true); + } + // for debugging. You can safely delete this method public static String getPointDescr( final Coordinate[] points, final String name, final String indent){