Skip to content
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

Only show patched conics if the frame makes sense #3448

Merged
merged 1 commit into from
Oct 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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