CharlieD
Topic Author
Posts: 7
Joined: 24 Jun 2024, 13:55

Intended Project Structure (For Global Styling)

21 Nov 2024, 14:44

Hey!

I am looking into how we can setup global styling and am wondering the intended studio project structure. Is it intended for you to have one studio project with all your UI inside or should we be creating multiple studio projects that then all use the same global styles (theme)?

Is the handling of global styles across multiple projects something supported in studio yet?
I have looked at 3 different approaches and would like to know if I'm on the right track or am completely missing the mark!

Approach 1:
The first approach I tried was to use a relative path to a different project:
<ResourceDictionary Source="../MyProject/GlobalResources.xaml" />
This works in game and with the VSCode extension however doesn't work within studio (Elements aren't styles nor can I see any styles in the styles dropdowns)

Approach 2:
The second approach uses what I believe is the intended path for none studio projects which is to set the global styles up in the unreal project settings and in a blend project use the App.Xaml to point to that theme so you can see everything while creating the UI.

Is there a way to do this in studio? I have noticed that studio always includes the GlobalResources.Xaml file even if it isn't referenced in the Main Xaml. Is this Studios version of App.Xaml?

Approach 3:
The Third approach I tried was to use the new feature project references. This has allowed me to do what I wanted to do in Approach 1 however Studio isnt displaying any of the styles brought in from the referenced project.
The elements show as styled within studio but display as "None" in the style drop down and I am unable to see any of the styles from the referenced project in the style dropdown.
StudioStylesNone.PNG
StudioStylesNone.PNG (7.95 KiB) Viewed 5616 times
Another issue I have noticed with the referenced projects is that they disappear from studio after you reopen the project
ProjectReferenceMissing.PNG
ProjectReferenceMissing.PNG (4.17 KiB) Viewed 5616 times
This has no effect on the functionality but is confusing from a user POV

This approach only works in studio and not unreal
 
User avatar
dstewart
Site Admin
Posts: 133
Joined: 22 Jan 2024, 11:41

Re: Intended Project Structure (For Global Styling)

22 Nov 2024, 15:22

Hi Charlie!

To answer the Studio topics:
Is it intended for you to have one studio project with all your UI inside or should we be creating multiple studio projects that then all use the same global styles (theme)?
We offer solutions for both, so this will depend on your personal/tactical preference.
I would however generally say that the workflow and architecture is more geared towards having a single Noesis Project per product. As I'll get into more below, there are some constraints that exist when leveraging External/Referenced Projects that make it a bit less streamlined of an approach.
There is also a slight added friction point in using References, that External Projects are 'read-only' in the Local Project they are referenced. This means that to make edits to shared Resources, you'd have to jump between projects/application windows.

There are still merits to both systems though. For example, there is a strong case for multi-project Studios to create a single UI Core Library as an agnostic 'central project', which can then referenced in each individual product's project as needed.

----------
I have noticed that studio always includes the GlobalResources.Xaml file even if it isn't referenced in the Main Xaml. Is this Studios version of App.Xaml?
That's exactly right. The vision for GlobalResources was essentially to offer a simplified 'default' destination for created Resources, universally-accessible throughout the entire project, without having to necessarily perform a lot of Dictionary management and merging gymnastics.

----------

Now in terms of the Project References feature. There is a very important constraint to note in the current implementation, in that only created ResourceDictionaries of an External Project can be accessed in the Local Project.
If a Resource is contained within a Page, or an Element of the External Project, it will not be accessible in the Local Project when referenced.
If a Resource is contained within the GlobalResources of the External Project, it will not be accessible in the Local Project when referenced.
This means that anything currently within the External Project's GlobalResources or within its Pages/Elements, have to be moved to a ResourceDictionary, if you want them to be 'shareable' between projects.

So, how to access Resources that are contained in a manually-created Dictionary within the External Project:
Basically, you got the first step already, which is to Reference the External Project in the Local Project.
At this point however, those Resources will not yet be accessible in the Local Project.
To make this work, after creating the Reference, you will have to head to the Resources Tab, select the GlobalResources.xaml and merge into it the External Project's ResourceDictionary.
After you do this, it should be accessible across your Pages.

----------

The Reference content disappearing from the Assets Panel is a bug that I've also managed to reproduce on my end, and I've submitted a Ticket for us to fix this:
https://www.noesisengine.com/bugs/view.php?id=3817
(Thank you for reporting this!)

----------

Let us know if the method above makes this work for you, if not we can help troubleshoot further. We really appreciate the post, and the feedback by the way, so thank you for that as well!

- Dorian
 
CharlieD
Topic Author
Posts: 7
Joined: 24 Jun 2024, 13:55

Re: Intended Project Structure (For Global Styling)

25 Nov 2024, 11:32

Thanks for the response Dorian, I've been able to use project references as you described! This might be good information for you to update on https://www.noesisengine.com/docs/4.0/G ... ssets.html
 
User avatar
dstewart
Site Admin
Posts: 133
Joined: 22 Jan 2024, 11:41

Re: Intended Project Structure (For Global Styling)

25 Nov 2024, 11:47

Absolutely wonderful to hear, glad its all working!

(and excellent point on the Documentation too; I'll make sure to include a note to update this on the next pass of the Assets Panel documentation (the current version was made before we added the Add Reference feature :) )

Thanks!

- Dorian
 
Danilo
Posts: 17
Joined: 25 Nov 2021, 14:36

Re: Intended Project Structure (For Global Styling)

01 Dec 2024, 21:28

Hey,

Just an additional question to this. I hope it is okay that I just post it here instead of opening a new topic. I am working on a UI heavy Grand Strategy game. The project has a lot of User Interfaces components. Performance wise can I have everything created in components and then nested in one MainPage?
Historically I tend to work more dynamically and instantiate only the components that I need by adding them dynamically through the code behind class.
Since Studio projects are strict MVVM and have no code behind, how would you do this? Is it acceptable to have all the components already hard coded in one XAML file? How does Noesis handle those files? Is it optimizing the views by instantiating only visible enabled views? What should I take care of or keep in mind?
 
User avatar
jsantos
Site Admin
Posts: 4822
Joined: 20 Jan 2012, 17:18
Contact:

Re: Intended Project Structure (For Global Styling)

10 Dec 2024, 13:44

Apologies for the delay in responding! 😊 Next time, please consider opening a new thread instead of continuing one marked as solved.
Since Studio projects are strict MVVM and have no code behind, how would you do this?
To clarify, there will be options to include your own code-behind in Studio. The C++ SDK enables customization of Noesis Studio, allowing you to launch it from your own sample with your custom classes registered. The same applies to Unity and Unreal.
Performance wise can I have everything created in components and then nested in one MainPage?
It's better to move these components into data templates (either in separate dictionaries or within the global one). More details on this approach can be found in the following post:

viewtopic.php?t=3319

Who is online

Users browsing this forum: No registered users and 1 guest