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
Individual materials for GUI nodes #7606
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big props for tackling the editor changes! The data dependencies in the Gui system are some of the most difficult to grasp in the entire editor code base. 😅
Before merging, we should add more validation for the selected material, and we could rename the new override-material-shader
output if we included the default material in the material-names
map under ""
like we do for the textures.
editor/src/clj/editor/gui.clj
Outdated
@@ -2388,6 +2513,7 @@ | |||
(input layouts-node g/NodeID) ; for tests | |||
(input fonts-node g/NodeID) ; for tests | |||
(input textures-node g/NodeID) ; for tests | |||
(input materials-node g/NodeID) ; for tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, did you write any tests? 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Editor changes look good! Great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm.
Some minor detail regarding setting the materials at creation time.
engine/gui/src/gui.cpp
Outdated
InternalNode* nodes = scene->m_Nodes.Begin(); | ||
for (uint32_t i = 0; i < scene->m_Nodes.Size(); ++i) | ||
{ | ||
if (nodes[i].m_Node.m_MaterialNameHash == name_hash) | ||
{ | ||
nodes[i].m_Node.m_Material = material; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think rather than looping for every node, for each material, we could have a loop outside of the function (at setup) where we lookup the materials from the map instead?
GUIs now has a list of materials that can be assigned to individual nodes, similar to textures, particles and fonts. If no material has been set on a node, the default GUI node material will be used.
Note: Assigning separate materials will break batching in the same manner as the regular GO world!
Fixes #7455
PR checklist