-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restructure the rendering of the flight plan #2104
Conversation
// Repaint. This means that any state change must occur before Layout or | ||
// after Repaint. This if statement implements the former. It updates the | ||
// vessel and the editors to reflect the current state of the plugin and | ||
// then proceeds with the UI code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we factor out this if statement in its own function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
ksp_plugin_adapter/flight_planner.cs
Outdated
RenderFlightPlan(vessel_guid); | ||
} else if (UnityEngine.GUILayout.Button("Create flight plan")) { | ||
plugin_.FlightPlanCreate(vessel_guid, | ||
plugin_.CurrentTime() + 1000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad indent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
ksp_plugin_adapter/flight_planner.cs
Outdated
|
||
FlightPlanAdaptiveStepParameters parameters = | ||
plugin_.FlightPlanGetAdaptiveStepParameters(vessel_guid); | ||
if (plugin_.FlightPlanExists(vessel_guid)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this not change the set of controls between calls to OnGUI?
the else if
branch below may change the value of this condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment for the uninitiated.
This ensures that we don't change state between Layout and Repaint, and it eliminates a funky null pointer exception when first creating a flight plan.