diff --git a/FerramAerospaceResearch/FARPartGeometry/GeometryPartModule.cs b/FerramAerospaceResearch/FARPartGeometry/GeometryPartModule.cs index 2246e6fee..f4bb9e84c 100644 --- a/FerramAerospaceResearch/FARPartGeometry/GeometryPartModule.cs +++ b/FerramAerospaceResearch/FARPartGeometry/GeometryPartModule.cs @@ -136,6 +136,8 @@ public bool Valid unignoredTransforms; [SerializeField] bool ignoreIfNoRenderer; + [SerializeField] + bool rebuildOnAnimation; #if DEBUG class DebugInfoBuilder @@ -629,7 +631,13 @@ private void CheckAnimations() ++_sendUpdateTick; if(updateShape) - UpdateShapeWithAnims(); //event to update voxel, with rate limiter for computer's sanity and error reduction + { + if (rebuildOnAnimation) + RebuildAllMeshData(); + else + UpdateShapeWithAnims(); //event to update voxel, with rate limiter for computer's sanity and error reduction + UpdateVoxelShape(); + } } private void UpdateShapeWithAnims() @@ -641,8 +649,6 @@ private void UpdateShapeWithAnims() transformMatrix = EditorLogic.RootPart.partTransform.worldToLocalMatrix; UpdateTransformMatrixList(transformMatrix); - - UpdateVoxelShape(); } private void UpdateVoxelShape() @@ -848,15 +854,25 @@ private List CreateMeshListFromTransforms(ref List meshTran if (part.Modules.Contains()) { + bool variants = part.Modules.Contains(); List jettisons = part.Modules.GetModules(); - HashSet jettisonTransforms = new HashSet(); + HashSet jettisonTransforms = new HashSet(); for(int i = 0; i < jettisons.Count; i++) { ModuleJettison j = jettisons[i]; if (j.jettisonTransform == null) continue; - jettisonTransforms.Add(j.jettisonTransform); + if (variants) + { + // with part variants, jettison name is a comma separated list of transform names + foreach (string name in j.jettisonName.Split(',')) + { + jettisonTransforms.Add(name); + } + } + else + jettisonTransforms.Add(j.jettisonTransform.name); if (j.isJettisoned) continue; @@ -878,7 +894,7 @@ private List CreateMeshListFromTransforms(ref List meshTran { foreach (Transform t in meshTransforms) { - if (jettisonTransforms.Contains(t)) + if (jettisonTransforms.Contains(t.name)) continue; MeshData md = GetVisibleMeshData(t, ignoreIfNoRenderer, false); if (md == null) @@ -1003,6 +1019,7 @@ public override void OnLoad(ConfigNode node) LoadBool(node, "forceUseMeshes", out forceUseMeshes); LoadBool(node, "ignoreForMainAxis", out ignoreForMainAxis); LoadBool(node, "ignoreIfNoRenderer", out ignoreIfNoRenderer); + LoadBool(node, "rebuildOnAnimation", out rebuildOnAnimation); ignoredTransforms = LoadList(node, "ignoreTransform"); unignoredTransforms = LoadList(node, "unignoreTransform"); } diff --git a/GameData/FerramAerospaceResearch/FARVoxelGeometryOverrides.cfg b/GameData/FerramAerospaceResearch/FARVoxelGeometryOverrides.cfg index 1b0bb4ed1..3b105869a 100644 --- a/GameData/FerramAerospaceResearch/FARVoxelGeometryOverrides.cfg +++ b/GameData/FerramAerospaceResearch/FARVoxelGeometryOverrides.cfg @@ -10,7 +10,9 @@ { @MODULE[GeometryPartModule] { - %forceUseColliders = True + %forceUseMeshes = True + %ignoreIfNoRenderer = true + %rebuildOnAnimation = true } } @PART[KW3mPetalAdapter]:AFTER[FerramAerospaceResearch] @@ -41,6 +43,169 @@ %forceUseMeshes = True } } +@PART[liquidEngineMini_v2]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[JetEngine]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[turboFanSize2]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[LiquidEngineKE-1]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[Size3AdvancedEngine]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[Size2LFB]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[liquidEngine3_v2]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[nuclearEngine]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[liquidEngine]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[LiquidEngineLV-T91]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %ignoreIfNoRenderer = true + } +} +@PART[LiquidEngineLV-TX87]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %ignoreIfNoRenderer = true + } +} +@PART[LiquidEngineRE-I2]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[engineLargeSkipper]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[liquidEngine2-2_v2]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %ignoreIfNoRenderer = true + } +} +@PART[liquidEngine1-2]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[LiquidEngineRK-7]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[solidBooster_v2]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[solidBooster_sm_v2]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[LiquidEngineRV-1]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %forceUseMeshes = true + %ignoreIfNoRenderer = true + } +} +@PART[SSME]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %ignoreIfNoRenderer = true + } +} +@PART[toroidalAerospike]:AFTER[FerramAerospaceResearch] +{ + @MODULE[GeometryPartModule] + { + %ignoreIfNoRenderer = true + } +} //axis ignoring @PART[structuralPanel1]:AFTER[FerramAerospaceResearch] diff --git a/GameData/FerramAerospaceResearch/Plugins/FerramAerospaceResearch.dll b/GameData/FerramAerospaceResearch/Plugins/FerramAerospaceResearch.dll index a93f7f899..07f9269b9 100644 Binary files a/GameData/FerramAerospaceResearch/Plugins/FerramAerospaceResearch.dll and b/GameData/FerramAerospaceResearch/Plugins/FerramAerospaceResearch.dll differ diff --git a/README.md b/README.md index 7217d987c..c770017ad 100644 --- a/README.md +++ b/README.md @@ -66,11 +66,15 @@ CHANGELOG ======================================================= -------------------master branch------------------- +Fix voxelization of most stock engines ([#39](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/39)) +Voxelization correctly handles jettison transforms with part variants ([#39](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/39)) +Fix voxelization of `InflatableHeatShield` ([#39](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/39)) Fixed voxelization of simple heat shields ([#37](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/37)) -Added additional nodes to `GeometryPartModule` ([#37](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/37), see PR for more details): +Added additional nodes to `GeometryPartModule` ([#37](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/37), [#39](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/39), see PRs for more details). The new nodes should allow parts to be voxelized much closer to what is visible and handle animations better: * `ignoreTransform` (string) * `ignoreIfNoRenderer` (bool) * `unignoreTransform` (string) +* `rebuildOnAnimation` (bool) NRE fixes ([#36](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/36)): * Trying to display debug voxels with no parts in the editor diff --git a/bin/Debug/FerramAerospaceResearch.dll b/bin/Debug/FerramAerospaceResearch.dll index b317eda66..5567291ca 100644 Binary files a/bin/Debug/FerramAerospaceResearch.dll and b/bin/Debug/FerramAerospaceResearch.dll differ diff --git a/bin/Debug/ferramGraph.dll b/bin/Debug/ferramGraph.dll index 9f6611948..e9b0e243b 100644 Binary files a/bin/Debug/ferramGraph.dll and b/bin/Debug/ferramGraph.dll differ