KSP-RO / ProceduralParts

A continuation of StretchySRBs, which is a continuation of StretchyTanks
72 stars 79 forks source link

Terrible performance in the editor when the root part is procedural #339

Closed JonnyOThan closed 1 year ago

JonnyOThan commented 1 year ago

I was helping someone diagnose some bad performance in the editor. If the root part of the craft is a procedural part, the dragcubetool logic will clone and destroy the entire vessel any time a part is modified. This occurs because the vesselcomponent gets added to the root part, and has a list of all the parts on the vessel.

image

This could be the root (heh) cause of #273 as well - because the entire vessel is being created and destroyed, any error messages associated with different parts will also be re-emitted to the log, producing lots of red herrings.

JonnyOThan commented 1 year ago

As @gotmachine points out, there is no vessel in the editor scene, so that's probably not the underlying issue - but it could be this: https://github.com/KSP-RO/ProceduralParts/blob/10b32eb12f5ecbe9e7f28950023c18c5e730b4ba/Source/ProceduralTools/DragCubeTool.cs#L34

DRVeyl commented 1 year ago

IIRC, this specific code line is to enforce not generating the drag cubes until the part is actually attached to something. You get really bad problems when you allow the drag cubes to generate while the part is in the ghosted state. Mainly, you get the parts flickering attached and ghosted -- most noticeable when attaching a procedural part in symmetry. Or, well, it would be if that line weren't present.

JonnyOThan commented 1 year ago

According to Gotmachine, parts in the editor are actually attached in the Unity parent/child sense, so cloning a part will instantiate the entire part subtree.

siimav commented 1 year ago

341 should fix this weirdness