Facepunch / sbox-issues

173 stars 11 forks source link

ShaderGraph - Branch node quietly changes to an attribute when re-opening older shadergraphs #5822

Open Gmod4phun opened 1 month ago

Gmod4phun commented 1 month ago

Describe the bug

Having an older material with an older shader created in shadergraph, I noticed recently that it did not work correctly once I recompiled the shader after the reverse-z update. Found out that the Branch node is now by default an Attribute, and not an UI option. This is probably a thing since IsAttribute was added to the Branch node in https://github.com/Facepunch/sbox-issues/issues/5475

This breaks older materials that relied on it being a UI option in the material editor. I noticed it when my material was no longer grayscale because of the branch node quietly changing to attribute.

image

To Reproduce

  1. Have a shadergraph that was created before the Branch node had the ability to be an attribute
  2. Open the shadergraph, and re-save it
  3. See that the Branch is now an Attribute
  4. Materials that used the old shader can now not work properly

Expected behavior

Most likely have the older shadergraphs (the ones that did not have IsAttribute set on the Branch node in the .shdrgrph) set the IsAttribute to false by default.

Media/Files

No response

Additional context

No response

DevulTj commented 1 month ago

I have a feeling this is related to a JSON deserialization issue we're having where it won't deserialize to the default value of the property, it'll use the default value of the type.

Gmod4phun commented 1 month ago

Unless I'm missing something, the default for bool should be false, but it is true, so I suspect it does indeed use the default of the property, since when you add a fresh Branch node in the shadergraph, it will have IsAttribute checked.