UI Nodes with a `CalculatedSize` shouldn't have child nodes or both `Image` and `Text` components
Objective
If a parent UI node with a MeasureFunc has a child node, the parent's size won't be determined by the MeasureFunc.
Ui Nodes with CalculatedSize. Image, and Text components won't be sized correctly.
It's hard to understand/explain, sometimes causes no problems, and sometimes causes unpredictable and confusing bugs.
#7894 is an example of where this has caused a problem.
Solution
Add some doc comments telling users not to do any of these things. Panic if any of them is done.
Changelog
- Added a system
detect_calculated_size_conflictsthat panics if a Ui Node with aCalculatedSizecomponent has a child UI node or bothImageandTextcomponents
I feel like UI nodes ought to have some kind of "node type" tag. And only read components that are relevant to the specified node type. For example images would ignore text, text would ignore images, flexbox nodes would ignore both text and images, etc.
Yes, ideally that would be implemented with entity relations I think, where Text and UiImage would be mutually exclusive components and it would be impossible to construct an entity containing both of them.
Closed as not that important and there will be better ways to implement it soon.