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

respect part variant changes in the editor #35

Merged
merged 2 commits into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
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
11 changes: 9 additions & 2 deletions FerramAerospaceResearch/FARGUI/FAREditorGUI/EditorGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ void Start()
guiRect.width = 650;


GameEvents.onEditorVariantApplied.Add(UpdateGeometryEvent);
GameEvents.onEditorPartEvent.Add(UpdateGeometryEvent);
GameEvents.onEditorUndo.Add(ResetEditorEvent);
GameEvents.onEditorRedo.Add(ResetEditorEvent);
Expand Down Expand Up @@ -196,6 +197,7 @@ void RemoveDesignConcerns()

void OnDestroy()
{
GameEvents.onEditorVariantApplied.Remove(UpdateGeometryEvent);
GameEvents.onEditorPartEvent.Remove(UpdateGeometryEvent);
GameEvents.onEditorUndo.Remove(ResetEditorEvent);
GameEvents.onEditorRedo.Remove(ResetEditorEvent);
Expand Down Expand Up @@ -254,6 +256,11 @@ public static void ResetEditor()
RequestUpdateVoxel();
}

private void UpdateGeometryEvent(Part part, PartVariant partVariant)
{
UpdateGeometryEvent(ConstructionEventType.Unknown, part);
}

private void UpdateGeometryEvent(ConstructionEventType type, Part pEvent)
{
if (type == ConstructionEventType.PartRotated ||
Expand All @@ -274,7 +281,7 @@ private void UpdateGeometryEvent(ConstructionEventType type, Part pEvent)

private void UpdateGeometryModule(ConstructionEventType type, Part p)
{
GeometryPartModule g = p.GetComponent<GeometryPartModule>();
GeometryPartModule g = p?.GetComponent<GeometryPartModule>();
if (g != null && g.Ready)
{
if (type == ConstructionEventType.Unknown)
Expand All @@ -286,7 +293,7 @@ private void UpdateGeometryModule(ConstructionEventType type, Part p)

private void UpdateGeometryModule(Part p)
{
GeometryPartModule g = p.GetComponent<GeometryPartModule>();
GeometryPartModule g = p?.GetComponent<GeometryPartModule>();
if (g != null && g.Ready)
{
g.EditorUpdate();
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ CHANGELOG
=======================================================
-------------------master branch-------------------

Voxelization respects part variant changes in the editor ([#35](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/35))
Expose IAS and EAS used by FAR in FARAPI ([#34](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/34))
Enable/disable FAR speed display on the navball from FARAPI ([#33](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/33))

Expand Down