H-uru / Plasma

Cyan Worlds's Plasma game engine
http://h-uru.github.io/Plasma/
GNU General Public License v3.0
205 stars 81 forks source link

Assign sequential object IDs at Max export time #1425

Closed dpogue closed 1 year ago

Hoikas commented 1 year ago

So, it occurs to me that this has the same problem that libhsplasma had previously. What's happening here is that a PRP's ObjIDs are being sorted, then the PRP is written. Then, the next PRP's ObjIDs are sorted and the PRP is written. So, any cross-page references between PRPs may be shattered due to wrong ObjIDs being written if a reference is written out to another PRP before the other PRP is sorted. Therefore, the PrepForWrite function needs to be called on all RegistryPageNodes before any PRP is written.

dpogue commented 1 year ago

@Hoikas I had the same thought... except that this appears to be consistent with the behaviour from before https://github.com/H-uru/Plasma/pull/264 was merged 🤷🏼‍♂️

Hoikas commented 1 year ago

Let's go ahead and preemptively fix that problem so we don't have any land mines waiting on us. Cyan tended to be pretty good about limiting themselves one or two PRPs per max file, but we need to be more resilient due to not being on the other side of the hallway from our users 😉

dpogue commented 1 year ago

I exported the Nexus max files with this, and it appears that all the Object IDs are sequential.