igorseabra4 / IndustrialPark

Viewer and editor for .HIP and .HOP archive files from Heavy Iron Studios games such as SpongeBob SquarePants: Battle for Bikini Bottom and Scooby Doo: Night of 100 Frights (GameCube, PS2, Xbox, PC).
https://heavyironmodding.org/wiki/Industrial_Park_(level_editor)
GNU General Public License v3.0
40 stars 13 forks source link

Asset selection can take a long time #44

Open ItsPepperpot opened 7 months ago

ItsPepperpot commented 7 months ago

Sometimes selecting an asset in levels with many assets can take a long time (several seconds) before it appears selected with the gizmo + selection tint, especially in scenes with many objects.

To Reproduce

  1. Open a level with many objects (e.g. BB02.HIP/HOP)
  2. Click on an object to select it
  3. Observe it takes a long time to be selected
ItsPepperpot commented 1 week ago

ArchiveEditor.SetSelectedIndices is causing asset selection to take a long time. When you click in the 3D view, it will also change the selected layer on the layer combo box in the Archive Editor window.

This triggers the ArchiveEditor.comboBoxLayers_SelectedIndexChanged event - presumably causing every item in the Archive Editor asset list to be updated?

This takes about 800ms with BB02.hip and BB02.hop when selecting a Simple Object.

ItsPepperpot commented 1 week ago

It seems a large proportion of the time is spent here: https://github.com/igorseabra4/IndustrialPark/blob/ec5bb8be72f6e0d78ca10ce2173c8afba2b51339/IndustrialPark/ArchiveEditor/ArchiveEditor.cs#L570 adding the items to listViewAssets takes a long time.