Skip to content
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

[Enhancement] Save asset view options settings #147

Open
Kryptos-FR opened this issue Aug 26, 2018 · 16 comments
Open

[Enhancement] Save asset view options settings #147

Kryptos-FR opened this issue Aug 26, 2018 · 16 comments
Labels
area-GameStudio enhancement New feature or request good first issue Good for newcomers

Comments

@Kryptos-FR
Copy link
Member

Kryptos-FR commented Aug 26, 2018

Good first issue
Issues reserved for newcomers. Consider taking it only if it's your first time working on a feature or a bug in Xenko.

The view options (such as level of zoom, filters, grid or tile view, etc.) are not saved in the settings and thus use their default value when restarting the Game Studio.

Starting point:

  • AssetViewUserControl.xaml in Xenko.Core.Assets.Editor
  • EditorSettings in Xenko.Core.Assets.Editor
  • AssetCollectionViewModel in Xenko.Core.Assets.Editor
@Kryptos-FR Kryptos-FR added enhancement New feature or request good first issue Good for newcomers area-GameStudio labels Aug 26, 2018
@dadofboi
Copy link

dadofboi commented May 8, 2021

Hi there, I'm new to Stride (actually, I've never actually participated in an open-source project before this), and I'm interested in helping out. My coding experience is limited to programing business software, so I think that this issue would be a good fit for me as a starting point, since it doesn't seem to require technical knowledge specific to game engine development.

Would it be OK if I tried to solve this issue?

@herocrab
Copy link
Contributor

herocrab commented May 8, 2021

@dadofboi Yes, definitely! PRs are welcome!

@dadofboi
Copy link

dadofboi commented May 10, 2021

Hi, I've been trying to look through the XAML files and whenever I try to view the Designer tab, I get this error. Everything works perfectly fine when building Stride though, or when I create another WPF project.

invalid-markup-error

Is this a bug, or is it actually expected behavior? I'm not familiar at all with WPF so sorry if this is a trivial issue.

Edit: For reference, here are the error messages:
error-message

Editing the attributes causing the errors gave me this error instead:
null-reference-exception

Commenting out the Window.Resources node allow me the load the designer, but with other errors:
window-resources
designer-window

@manio143
Copy link
Member

In complex WPF applications you can't really use the designer because there's a lot of dynamic parts to the views - depending on the data you're working on in the project. So you wouldn't be working with a designer but straight with XAML. While debugging you can use VS tools to select a part of the window (a control or panel) and show it in the visual tree view which can allow you to map it back to a line in the XAML file.

@dadofboi
Copy link

Thanks for the help! My company still uses WinForms (yeah, I know), so I had no idea this is how WPF works. In that case I'll spend some time learning about WPF and then try to tackle this issue again.

@soorMSWE
Copy link
Contributor

Hello, is it okay if I take a stab at implementing this enhancement?

@Eideren
Copy link
Collaborator

Eideren commented May 31, 2024

Definitely, please do !

@soorMSWE
Copy link
Contributor

Been looking at this and I think I have a good understanding on this system and what needs to be done, but just in case I was hoping to get some feedback real quick:

  • So the fields we want to save (These view options) will essentially need to be added to the EditorSettings as new SettingsKey objects.
  • In the EditorSettings the load and save behaviors are performed so the idea here would be mainly to get these fields and link them to the SettingsKey objects to be properly saved and loaded as needed.
  • In order to access for example the thumbnail size, this TileThumbnailSizeProperty will need to be somehow linked to the SettingsKey object from EditorSettings.

Still have a few questions:

  • In the AssetViewUserControl.xaml file, we can see the tile and grid size properties are set from the UI from user input, would we need to access those size vars from its corresponding cs file? (IE from the AssetViewUserControl.xaml.cs)
  • At first I think getting one property to save and load would be easiest to implement and test but what other fields should be saved eventually? I know the issue mentions Filter (from AssetCollectionViewModel.cs),Tile and Grid Views and Current Zoom level.
  • In terms of debugging this in vs, I was having some trouble finding the specific UI that these actions (like thumbnail and grid size changes) are performed in.

@Eideren
Copy link
Collaborator

Eideren commented Jun 1, 2024

  1. Yes
  2. You can keep it as just the options listed over here:
    image
    So, as the first post mentions, the filter, display, sort and view type, although for that last one I'm not sure if there is any other views but the tiles, maybe @Kryptos-FR could clarify this issue further, but what I've listed should be good enough.
  3. From what I understood, the screenshot above should clarify this, let me know if that's not enough and I could send a short clip over. Or maybe I just didn't understand the question properly, in which case let me know as well :)

@soorMSWE
Copy link
Contributor

soorMSWE commented Jun 1, 2024

Thank you so much for the quick response! These help very much, and I look forward to implementing this!

@Kryptos-FR
Copy link
Member Author

I'll come back to you with some details. Remind me in a few days if I forget.

@soorMSWE
Copy link
Contributor

soorMSWE commented Jun 7, 2024

I am looking into saving the selected settings in the editor as a settings key in internalSettings.cs. The issue I am running into is how to access the ObservableListSelectedContent in AssetCollectionViewModel.cs to save it as a settings key in InternalSettings.cs. Do you have any suggestions on how I should approach this?

@Eideren
Copy link
Collaborator

Eideren commented Jun 8, 2024

@soorMSWE What are you trying to do specifically here, saving and restoring the assets that were selected in the last session ? If that's the case, best to avoid it for now since this is actually quite complex in comparison to what this issue is about. Not sure the settings serialization is prepared for that.

@soorMSWE
Copy link
Contributor

soorMSWE commented Jun 8, 2024

Hello,

I confused myself with what I was trying to do. I am actually trying to save the asset filters and not the selected assets. I am currently looking into it. Please let me know if you have any suggestions!

@soorMSWE
Copy link
Contributor

soorMSWE commented Jun 9, 2024

Hello,

I am currently looking at how to possibly put the current filters stored in ObservableSet into a SettingsKey but its proving to be a bit tricky. I was thinking maybe pulling out the stored strings in the AssetFilterViewModel objects and storing them in a settingsKey since I dont think the AssetFilterViewModel objects can be simply saved out a settingsKey directly. Are we able to save out the lists through the SettingsKeys?

@Eideren
Copy link
Collaborator

Eideren commented Jun 10, 2024

@soorMSWE

Are we able to save out the lists through the SettingsKeys?

Afaict, yes, we have tests covering those here https://github.com/stride3d/stride/blob/master/sources/core/Stride.Core.Design.Tests/TestSettings.cs
And one actual usage over there https://github.com/stride3d/stride/blob/master/sources/editor/Stride.GameStudio/Settings/GameStudioInternalSettings.cs#L16

I was thinking maybe pulling out the stored strings in the AssetFilterViewModel objects and storing them in a settingsKey

Sounds good, just a note, there's also the FilterCategory Category which should be saved alongside the string that way you can properly differentiate between name, tag and type filters.

If you create a new data type to store those two variables into, make sure to decorate it with [DataContract] for it to be properly serialized. If you need more info on how the serialization works in this engine there's a fairly thin document over there https://doc.stride3d.net/latest/en/manual/scripts/serialization.html

dloe added a commit to dloe/stride_fork that referenced this issue Jul 15, 2024
Eideren pushed a commit that referenced this issue Jul 21, 2024
* Zoom save settings for Tile and Grid

* added ViewFilters Settings Key

* Adjusted settingskey and added load area

* Fixed formatting on SettingsKey default

* Implemented Filters to be saved and reloaded on new instances

* Added SaveAssetFilters call to filter IsActive toggle

* Adjusted comments and fixed filter load order to be consistent

* Updated load and save methods to now be private

- No reason for them to be public

* Removed unnecessary comment

- was for tracking potential load points with asset  filters

* added private access modifier for asset filter view model data var

---------

Co-authored-by: soorMSWE <soor@uci.edu>
Co-authored-by: Will S <wrshield@uci.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-GameStudio enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

7 participants