soopercool101 / BrawlCrate

BrawlBox/BrawlTools Fork, Wii File Editor
https://discord.gg/s7c8763
GNU Lesser General Public License v3.0
154 stars 40 forks source link

CLR0s With UserData No Longer Crash on PostProcess #87

Closed QuickLava closed 1 year ago

QuickLava commented 1 year ago

Previously, attempting to save a CLR0 that had UserData entries defined would crash the program. This happened because the block that does the PostProcess calls for the CLR0MaterialNodes was changing the value of the dataAddress parameter before we reached the UserEntries PostProcess call; so the _userEntries.PostProcess() call was being done with a bad address parameter. Fixed by giving the CLR0MaterialNode block a local variable for holding the addresses it uses so it doesn't overwrite the original parameter.

QuickLava commented 1 year ago

Oh, and forgot to mention actually; changing values in a UserData block doesn't seem to correctly flag its parent Node as Dirty. From what I looked at, it seems like the setter for the UserEntries property in BRESEntryNode is intended to signal the change; but in my testing that function never actually got called.

soopercool101 commented 1 year ago

The latter is an unfortunate quirk of PropertyGrid, editing an array doesn't activate the setter code. A workaround needs to be devised, I'd imagine an event listener will be necessary