Closed Shaun-Fong closed 1 year ago
Bing the data
Hi @Shaun-Fong, great to see someone using this lib and even contributing.
This feature is something I thought about adding at the beginning but scraped it for a less complex solution- in the form of QAttribute
.
Now that I got back to this topic, I did some thinking and R&D and I think that it still might be an interesting addition to the library, although it would require a more complex implementation than what I can see in your fork.
If you are interested I can write down the specifications for this feature and explain the reasoning behind it. We could work on it together, just let me know if you are interested in this form of collaboration.
If you are interested I can write down the specifications for this feature and explain the reasoning behind it. We could work on it together, just let me know if you are interested in this form of collaboration.
of course! that sounds great!
automate referencing named elements from UXML so that the user doesn't have to copy and paste names from VisualTreeAsset
and write query calls each time the element name is modified or added.
Given the following UXML:
<ui:VisualElement>
<ui:Label name="title" />
</ui:VisualElement>
<ui:VisualElement name="menu">
<ui:Button name="confirm-button" />
</ui:VisualElement>
We generate something like:
partial class CodeGenExample
{
private Label title;
private VisualElement menu;
private Button confirmButton;
private void AssignQueryResults(VisualElement root)
{
title = root.Q<Label>("title");
menu = root.Q<VisualElement>("menu");
confirmButton = root.Q<Button>("confirm-button");
}
}
AssetImporter.userdata
?Added to develop
@ErnSur hi , thanks for this useful ui toolkit extension.
try this out
I add script automatic generation feature and I think this way faster than alt+c copy and paste .
If you think this great I will optimize the code then pull request.
Right Click any UXML files , and click UIToolkit->GenerateBinding .
If generated before , it also scan all scripts in project , find the right file (By file name like : UXML File Name+"Binding.cs") and update.