Skip to content

Conversation

@SiboVG
Copy link
Member

@SiboVG SiboVG commented Jan 27, 2024

Okay, what started out as a small PR to fix #2438 quickly turned into much more... I'll take you through my rollercoaster.

The issue with #2438 was that exporting booster designs to RockSim would throw an error because booster exporting simply wasn't implemented. So, I started implementing it.

Then I noticed that OR only exported one instance of the pods/boosters. Also, the rotation of children components of the pod set was incorrect. That needed fixing. To do that, I needed to split a pod set/booster into separate pod set/booster instances and then export each instance to RockSim. Hey, would you look at that! I just fixed #2377. You can now split pods and boosters:
image
image
image
image

Okay, cool, worked great for pods, but crashed for boosters... After a bunch of investigating, I found something interesting. DoubleModels (or any other model) in component config dialogs weren't properly invalidated when the config dialog closed. This caused those models to remain listeners of the corresponding rocket component, thus activating whenever the component changed state. Not only did that cause my bug (and possible future bugs), it is also inefficient - the models also weren't garbage collected. So, I rewrote DoubleModel and other models to support proper invalidation, and then registered every model in each config dialog so that they would invalidate when the config dialog closed. Okay, great, so that bug's now fixed + we have a slight optimization of OpenRocket (not that I could notice it in OR's RAM usage, but hey, it's something).

Then, while playing around with the booster split functionality, I found a way to reliably trigger bug #2435. I was able to trigger it by changing the rocket's stageMap configuration (by splitting the boosters) and then undoing and redoing that operation 2 times. This PR now also fixes that bug. The issue was that loadFrom in the Rocket did not copy the stageMap of the source rocket, but instead referenced it. In some scenarios the source rocket's stage map would change, which also caused the stage map in the target rocket to change. This PR now ensures that the stage map is correctly copied.

With the pod/booster split functionality now working, I was able to code the RockSim booster exporting:
image

image

Then I thought "Hey, I should also support booster importing from a RockSim design" (a booster in RockSim is a pod that can be ejected). So I did that.

Almost done, I swear.

Finally, when playing around with the booster split functionality, I noticed that undoing/redoing changes to stage activeness did not work. If I disabled a booster stage, and then undo that operation, then the booster stage was enabled again - as expected. However, when redoing the operation, the stage activeness did not change. The issue was that stage activeness was not copied when copying/loading a rocket. This PR fixes that.


In summary:

  • RockSim booster (ejectable pod in RockSim) importing/exporting now supported
  • RockSim multi-instance pods is now supported + fixed the rotation of child components of the pod set
  • You can split pods and boosters into separate components (fixes Provide ability to "Split Pods" and "Split Boosters" #2377)
  • Fixes [Bug] IllegalStateException #2435
  • Optimized the rocket config dialogs by properly invalidating parameter models
  • Support undoing/redoing stage active state

SiboVG added 15 commits January 19, 2024 16:51
This change is to ensure that the stageMap property of the Rocket class is isolated from its source object. Previously, it directly referenced the stageMap of the source, but now we create an entirely new ConcurrentHashMap to hold those stages. This will prevent possible conflicts and unwanted modifications to the source stageMap.
This should not only improve efficiency, but also help with unwanted side effects of the component still having listeners even when the config dialog is disposed.
…lidate

This caused issue because the invalidating of invalidatables was sometimes triggered by AWT processes
This fixes an issue where undoing/redoing stage activeness actions wouldn't work.
@SiboVG SiboVG changed the title Issue 2438 [#2438, #2377, #2435] Support RockSim booster importing/exporting, pods/booster splitting & fix a bunch of bugs Jan 27, 2024
@neilweinstock
Copy link
Contributor

Wow, quite an epic PR. Nice work.

Can't wait to try to summarize that in the release notes. :)

@JoePfeiffer
Copy link
Contributor

Wow, this is an amazing piece of work!

@JoePfeiffer JoePfeiffer merged commit f2f3e71 into openrocket:unstable Jan 28, 2024
@SiboVG SiboVG deleted the issue-2438 branch January 28, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] exception in RockSim export [Bug] IllegalStateException Provide ability to "Split Pods" and "Split Boosters"

3 participants