Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6422bbe02037
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5a4626303afe
Choose a head ref
  • 3 commits
  • 3 files changed
  • 2 contributors

Commits on Oct 8, 2021

  1. Allow typing in all fields.

    pleroy committed Oct 8, 2021
    Copy the full SHA
    0e21718 View commit details
  2. Comment.

    pleroy committed Oct 8, 2021
    Copy the full SHA
    b0a5798 View commit details
  3. Merge pull request #3143 from pleroy/Fix

    Allow typing in all fields
    eggrobin authored Oct 8, 2021
    Copy the full SHA
    5a46263 View commit details
Showing with 21 additions and 4 deletions.
  1. +2 −1 ksp_plugin_adapter/burn_editor.cs
  2. +13 −0 ksp_plugin_adapter/differential_slider.cs
  3. +6 −3 ksp_plugin_adapter/flight_planner.cs
3 changes: 2 additions & 1 deletion ksp_plugin_adapter/burn_editor.cs
Original file line number Diff line number Diff line change
@@ -151,7 +151,8 @@ public Event Render(string header, bool anomalous, double burn_final_time) {
changed |= Δv_binormal_.Render(enabled : !anomalous);
{
var render_time_base = time_base;
previous_coast_duration_.value = initial_time_ - render_time_base;
previous_coast_duration_.value_if_different =
initial_time_ - render_time_base;

// The duration of the previous coast is always enabled as it can make
// a manœuvre non-anomalous.
13 changes: 13 additions & 0 deletions ksp_plugin_adapter/differential_slider.cs
Original file line number Diff line number Diff line change
@@ -58,6 +58,7 @@ public double max_value {
set => max_value_ = value;
}

// Set from the UI.
public double value {
get => value_ ?? 0.0;
set {
@@ -68,6 +69,18 @@ public double value {
}
}

// Set from programmatic data, e.g., data obtained from C++. Does nothing if
// the value has not changed to avoid messing with UI input.
public double value_if_different {
set {
if (!value_.HasValue || value_ != value) {
value_ = value;
formatted_value_ = formatter_(value_.Value);
}
}
}

// TODO(phl): Remove and use value instead.
public void ResetValue(double new_value) {
value_ = null;
value = new_value;
9 changes: 6 additions & 3 deletions ksp_plugin_adapter/flight_planner.cs
Original file line number Diff line number Diff line change
@@ -77,7 +77,8 @@ protected override void RenderWindow(int window_id) {
plugin.FlightPlanCreate(vessel_guid,
plugin.CurrentTime() + 3600,
predicted_vessel.GetTotalMass());
final_time_.value = plugin.FlightPlanGetDesiredFinalTime(vessel_guid);
final_time_.value_if_different =
plugin.FlightPlanGetDesiredFinalTime(vessel_guid);
Shrink();
}
UnityEngine.GUI.DragWindow();
@@ -107,7 +108,8 @@ private void UpdateVesselAndBurnEditors() {
if (vessel_guid != null &&
plugin.FlightPlanExists(vessel_guid)) {
burn_editors_ = new List<BurnEditor>();
final_time_.value = plugin.FlightPlanGetDesiredFinalTime(vessel_guid);
final_time_.value_if_different =
plugin.FlightPlanGetDesiredFinalTime(vessel_guid);
for (int i = 0;
i < plugin.FlightPlanNumberOfManoeuvres(vessel_guid);
++i) {
@@ -154,7 +156,8 @@ private void RenderFlightPlan(string vessel_guid) {
}
// Always refresh the final time from C++ as it may have changed because
// the last burn changed.
final_time_.value = plugin.FlightPlanGetDesiredFinalTime(vessel_guid);
final_time_.value_if_different =
plugin.FlightPlanGetDesiredFinalTime(vessel_guid);

FlightPlanAdaptiveStepParameters parameters =
plugin.FlightPlanGetAdaptiveStepParameters(vessel_guid);