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

Shaders won't get stored in file when exporting/importing #63

Open mvort opened 1 year ago

mvort commented 1 year ago

Describe the bug I am trying to edit the course file of a mario kart wii track, I'll export as dae and reimport without having made any chances. shaders and materials are lost in the process if i want to reimport the materials all shader information is gone and needs to be manually set to the original value

To Reproduce Steps to reproduce the behavior:

  1. Open course_model.brres file of any mario kart wii track (e.g. https://wiki.tockdom.com/wiki/Area_64)
  2. Export material course_model.brres > 3DModels(NW4R) > course > Materials > dash_panel as dash_panel.mdl0mat
  3. Export course.mdl0 as course.dae
  4. replace course.mdl0 with exported course.dae
  5. import asset > material > dash_panel.mdl0mat
  6. shader information is gone

Expected behavior original shader information should be restored

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Would be great to have an option to export all materials shaders beforhand and import/restore them all at once. otherwise we will have to manually compare and edit those values

I have tried using this plugin but it doesn't seem to work properly anymore: https://github.com/zach-zajack/matshader-replace

  1. BrawlCrate will crash if there are errors in the brres file (e.g. https://wiki.tockdom.com/wiki/Grassy_Plains)
  2. materials and shaders will not be added/replaced at allhttps://wiki.tockdom.com/wiki/Grassy_Plains

is the api still correct and could be used as a temporary workaround? image

Gabriela-Orzechowska commented 1 year ago

Considering the structure of MDL0 and how shaders are linked to materials using an array this is not a bug. It's not really possible to store that information in material file efficiently.

mvort commented 1 year ago

If that is true, then one could possibly write an external plugin (or even implement a new feature) comparing the original mdl0 to the new mdl0 and restore all values in material/shader files. That's what I had to do manually.. if something could be done by an algorithm more efficiently, it should be :)