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

Sidebar upgrade #1894 #2350

Merged
merged 18 commits into from
Sep 22, 2024
Merged

Conversation

firedfromlife
Copy link
Contributor

PR for: "Editor: Better Resource List + Sidebar" #1894

  • Added collapse functionality to sidebar.
  • Added select after search to sidebar search.
  • Updated sidebar sorting.
    • Now breaks resources into groups by "Character" and "Timeline"

Notes:

  • Due to odd behaviors and known issues of the godot "Tree" node, resources must be double clicked to open.
    • When using item_selected, a nullptr error occurs causing many problems including crashing of the editor.
  • Tree node does not support Middle mouse events, so middle click to remove no longer works.

firedfromlife and others added 8 commits June 19, 2024 02:31
- Character Events now suggest characters already in the timeline first.
- Text Events now suggest characters already in the timeline first.
- Text Events now place the most character from the most recent (relative to the text event) character event in the timeline first.
- character was shadowing from the outer scope, updated to event_character
	- More descriptive and less likely to shadow
- make character.get_character_name() return Unique Identifier if possible
- add check to avoid error when a character event doesn't have a character set
- Now acknowleges character and text events.
- Live updates!
- Ignores null values in characters and text events.
- Only searches up the timeline relevant to the current event.
@Jowan-Spooner
Copy link
Collaborator

I would love if we could get single-click to open working again. I will try to rebase this on the main branch first though.

Jowan-Spooner and others added 4 commits July 26, 2024 10:36
Whether the sidebar is collapsed is now saved to editor state.

Simplifies ResourceListItem class into a contained class (avoids the public class name). Also uses RefCounted to avoid having to free them manually.

Some code cleanup.
@firedfromlife
Copy link
Contributor Author

@Jowan-Spooner
Fixed. Single click now works.
One function wrap and a call_deferred was able to fix the issue. Found an issue in godot from 2018 that someone had that ended up being the answer.

@firedfromlife
Copy link
Contributor Author

Before merging this PR I would also like to add one more sort option, sorting by folders. Seems this would address a few issues including #2033 .

@Jowan-Spooner
Copy link
Collaborator

I think it might also make sense to have an option to automatically collapse the Character and Timeline sections when switching to the character or timeline editors (so that you kinda only see the timelines when in timeline editor, but could still manually expand the character section). No need to add this though, it can also be done later.

print_rich(
(
"[b]Updating resource list[/b]:\n\t [i]Resource List: [/i]%s\n\t[i]Resource List D: [/i]%s"
% [resources_list, DialogicUtil.get_editor_setting("last_resources", [])]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed when the merge happens. This was me troubleshooting an issue that was caused by having the editor scenes open.

- Add icons to the SortMode dropdown
- Simplify sorting code
- Don't show right-click menu on "folder" items
@Jowan-Spooner
Copy link
Collaborator

@firedfromlife do you consider this ready for merging or would you like to continue working on this? The only "bug" I noticed was that if you have two folders with the same name, they get merged (e.g. if I have res://Chapter1/Home/tml.dtl and res://Chapter2/Home/some_tml.dtl both get put into one Home section). It might be better to add the parent folder to the names (Chapter1/Home and Chapter2/Home), but that is kinda annoying to code, so I'd be okay with leaving it like it is for now.

@firedfromlife
Copy link
Contributor Author

I would like to fix that bug, sorry been busy with work recently. Plan to work on the issue this weekend.

@firedfromlife
Copy link
Contributor Author

@Jowan-Spooner Alright, so I added another sort option called "Path" This works closer to what you recommended. It currently just prints the whole relative path as the folder name, which may not be ideal.

I kept the "Folders" option working as before. I think this could be useful depending on how someone has their game organized.

@Jowan-Spooner
Copy link
Collaborator

Hey @firedfromlife,
finally published alpha 15 so now back to looking at this.
It all seems to work quite well. I'm fine with keeping the path option as is for now, although I agree it probably isn't ideal to just use the whole path. I think I would rename "Default" to "Type" though.

I think we could potentially even implement using the folder colors set in the file system, not sure though (and not as part of this PR)

@firedfromlife
Copy link
Contributor Author

"and not as part of this PR"

Oops... I was already working on that. Haha.

I also updated "Default to "Type" and "Path" now displays only the directory and the parent, if it has one.

Colors can't be added to the "Folder" mode without making that its own setting, which would be possible, and I am not apposed to. It merges contents of multiple directories, so it has no way to determine which color it would use.
The folder colors are simply stored in the project.godot file as follows:

[file_customization]

folder_colors={
"res://assets/folder_1/timelines/": "yellow",
"res://assets/folder_b/timelines/": "orange"
}

If we really wanted to add colors to the folder option, we could add it like so:

[dialogic]
folder_colors={
"timelines":"red",
"assets":"teal"
}

I think this would be worth adding, and it would be (hopefully) simple enough to add to the existing right click menu for the sidebar.

Not pushing changes yet, still cleaning up some messy debug code.

image

@Jowan-Spooner
Copy link
Collaborator

@firedfromlife Oh nice. I think for now showing the file system folder colors in the "Path" option would be enough.

Should we also change the background color of the files then, like the file system does it? Maybe slighly less opaque?

Thanks for all the work on this.

@firedfromlife
Copy link
Contributor Author

@Jowan-Spooner
Alright, I think that should be it for this PR.

Let me know if it looks good to you 👍

@Jowan-Spooner
Copy link
Collaborator

@firedfromlife Thank you so much for all this work. I will test it again over the next days.

@Jowan-Spooner
Copy link
Collaborator

It looks good to me. I'd like to simplify some of the code, but I think I'll do that in a follow-up PR. These are working pretty well and while there are some further improvements that I feel could be great this is already so much better then before. Thank you very much!

@Jowan-Spooner Jowan-Spooner merged commit 8c79991 into dialogic-godot:main Sep 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants