Skip to content

Commit

Permalink
Merge pull request #3448 from eggrobin/patchy
Browse files Browse the repository at this point in the history
Only show patched conics if the frame makes sense
  • Loading branch information
eggrobin authored Oct 23, 2022
2 parents 7251a89 + 896c473 commit b26c192
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ksp_plugin_adapter/ksp_plugin_adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.Linq;
using KSP.Localization;

using static principia.ksp_plugin_adapter.ReferenceFrameSelector.FrameType;

namespace principia {
namespace ksp_plugin_adapter {

Expand Down Expand Up @@ -2021,7 +2023,9 @@ private void RemoveStockTrajectoriesIfNeeded(CelestialBody celestial) {
return;
}
celestial.orbitDriver.Renderer.drawMode =
main_window_.display_patched_conics
main_window_.display_patched_conics &&
plotting_frame_selector_.frame_type == BODY_CENTRED_NON_ROTATING &&
plotting_frame_selector_.Centre() == celestial.orbit.referenceBody
? OrbitRenderer.DrawMode.REDRAW_AND_RECALCULATE
: OrbitRenderer.DrawMode.OFF;
}
Expand All @@ -2032,7 +2036,11 @@ private void RemoveStockTrajectoriesIfNeeded(Vessel vessel) {
PatchRendering.RelativityMode.RELATIVE;
}

if (main_window_.display_patched_conics || !is_manageable(vessel)) {
if ((main_window_.display_patched_conics &&
plotting_frame_selector_.frame_type == BODY_CENTRED_NON_ROTATING &&
plotting_frame_selector_.Centre() ==
vessel.orbitDriver.orbit.referenceBody) ||
!is_manageable(vessel)) {
vessel.orbitDriver.Renderer.drawMode =
vessel.PatchedConicsAttached
? OrbitRenderer.DrawMode.OFF
Expand Down

0 comments on commit b26c192

Please sign in to comment.