Skip to content

[ShaderGraph] [bugfix 1283782] Fix for previews when selecting "None" as your texture property texture #2182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2020

Conversation

cdxntchou
Copy link

Purpose of this PR

Fix for https://fogbugz.unity3d.com/f/cases/1283782/

The core of the issue is that we cannot remove a Texture (or any property really) from a MaterialPropertyBlock, and we also cannot set the Texture to null (error). So effectively we cannot go back to the unassigned Texture state that would allow us to automatically pick up the default texture values.

As a workaround, we now pass the defaults into the preview property for texture2Ds, so we can properly assign the texture in the MaterialPropertyBlock with the corresponding value.

Talking with Yao, it should be possible to actually make public RemoveProperty() functions on MaterialPropertyBlock, which would greatly simplify all of this, but that would be a feature in trunk, so not until 21.1 at the earliest.


Testing status

Tested that all four default types show up properly in previews, and in the main preview, and match the color in scene.
image

Tested that assigning default types works with undo/redo/assembly reload, and that the previews update correctly.
Tested that assigning and unassigning (set to none) textures still works properly, with undo/redo/assembly reload and preview update.

Tested that non-2D texture types (2DArray, 3D, cubemap) still work as expected.


Comments to reviewers

Notes for the reviewers you have assigned.

@cdxntchou cdxntchou marked this pull request as ready for review October 12, 2020 18:34
@cdxntchou cdxntchou requested a review from a team as a code owner October 12, 2020 18:34
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Developer manual testing is sufficient.

@cdxntchou
Copy link
Author

Yamato green except VFX_HDRP Win DX11, which is also failing on master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants