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

Add the ability to change the color/icon of folders in the FileSystem view #768

Closed
the-sink opened this issue Apr 30, 2020 · 21 comments
Closed
Milestone

Comments

@the-sink
Copy link

Describe the project you are working on:
Underground 3D facility with an interactive environment

Describe the problem or limitation you are having in your project:
Due to the nature of my project, I have lots of project files and this will inherently start to pile up with folders. Better folder organization is a good way to clean up your filestructure but is only a part of the solution.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
There should be an option to change the icon or base color of any folder in the FileSystem view that would reflect in both the normal and split modes. You would right click and be presented with "Change folder icon"/"Change folder color" options (or something similar) that would allow you to customize the folder icon/color, and this would save.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
mockup
^ Only demonstrates colors

If this enhancement will not be used often, can it be worked around with a few lines of script?:
Not that I am aware of, short of completely replacing the FileSystem view with a custom one using a plugin.

Is there a reason why this should be core and not an add-on in the asset library?:
It is a relatively simple feature that would require an unnecessarily complex means to add yourself (see above question).

This is already a feature in Unreal Engine (at least the color part) and is a very nice tool to help organize and define which folders are more/less important when navigating the filesystem, and I think it would be a great QOL feature for developers.

@Calinou
Copy link
Member

Calinou commented Apr 30, 2020

Should this information be stored in project metadata (= not in version control) or in project.godot so it can be checked into version control? I'm leaning towards the latter, but I'm not 100% sure.

Also, while customizing the colors to a few presets sounds good to me, I'm not sure if we should allow for customizing the icon entirely. This would make it difficult to support both dark and light themes. Built-in icons will change their colors automatically to adapt to the current editor theme, but this isn't the case for custom icons. You may not be using the editor with a light theme yourself, but many people are 🙂

I think the following color presets would be a good start, similar to GIMP's color tags:

  • None (default – use a color derived from the editor theme's accent color)
  • Blue (deep shade, to be easy to distinguish from None in the default editor theme)
  • Green
  • Yellow
  • Orange
  • Brown
  • Red
  • Violet
  • Gray (darker than others, for "secondary" folders)

Edit: It may also be a good idea to add subtle differences to the icon's shape depending on the color. This way, folder icons can be distinguished by colorblind people.

@the-sink
Copy link
Author

Fair point on the custom icons. A predefined color palette/presets would be more than enough to solve the bulk of the issue.

I'd definitely vouch for it being checked into version control so that when, let's say, another team member pulls a project or someone online downloads a demo project, the project itself can also reflect these folder colors. Would be better for continuity I think.

@dalexeev
Copy link
Member

dalexeev commented May 1, 2020

Should this information be stored in project metadata (= not in version control) or in project.godot so it can be checked into version control?

KDE has .directory file that is used for similar purposes. Also .gdignore is already used to ignore directories.

Perhaps we should use .gddir or something similar. In this case, everyone can configure whether or not to include this file in version control.

@mhilbrunner
Copy link
Member

This is already a feature in Unreal Engine

It's also a fairly popular extension in Unity-land. (Mostly adding this for completion, as it may help gauge interest.)

@stilobique
Copy link

We have quickly lot folders, it's more easily to find a folder with a specific colour. When your work on a specific pole (Programmer, Graphites... you can give a colour system to your team.

@Norrox
Copy link

Norrox commented Jul 14, 2022

Skärmbild 2022-07-14 100352
Skärmbild 2022-07-14 100448
Some more refrence pictures.
Is this hard to do ? Are someone interesting in helping me navigating the source and make this change? is it a good beginning practice for a beginner ? :D

@the-sink
Copy link
Author

the-sink commented Jul 22, 2022

I was also interested in working on this, although I'm personally still learning the ropes on Godot's source code. If you're interested, I'll (hopefully) try to work on this at the-sink/custom-folder-colors after I've had some time to look around.

Question in regards to how folder colors are stored. I personally think adding them to the project.godot or (as @dalexeev suggested) adding a .gddir file are good ways to go about this, but what about when directories are externally manipulated? If someone deletes a folder outside of Godot, renames it, moves it, etc. All of that could present issues.

I like the .gddir idea as we could create this file inside of each directory that is customized. Granted, that method may cause some clutter in users' project directories if they decide to change the color of all the folders in their project, but assuming the use case for this will almost always be coloring the root folders, it shouldn't be that bad in the vast majority of situations where it's utilized. It'd also mean the ability to choose yourself whether or not to include them in version control (as previously mentioned), and no need to constantly re-check all of the folders to make sure they weren't externally modified.

@Calinou
Copy link
Member

Calinou commented Jul 22, 2022

Question in regards to how folder colors are stored. I personally think adding them to the project.godot or (as @dalexeev suggested) adding a .gddir file are good ways to go about this, but what about when directories are externally manipulated? If someone deletes a folder outside of Godot, renames it, moves it, etc. All of that could present issues.

I don't think we can effectively track renames – it's like favorites in the FileSystem dock.

As for folder deletions, we can ignore them but keep the entries in project.godot in case the folder is externally added again.

I wouldn't add a dedicated .gddir file, especially since I think folder colors should always be tracked in version control. You want those to be consistent across users when working in a team after all.

@stilobique
Copy link

[...]
I wouldn't add a dedicated .gddir file, especially since I think folder colors should always be tracked in version control. You want those to be consistent across users when working in a team after all.

Good point about your feedback ; that important -I think- to have a main solution (for a studio project), and for a specific user.

@dalexeev
Copy link
Member

There is also an option to add these settings to the .godot/editor/dir_params file (or similar). If you want, you can add it to the .gitignore exceptions, while with project.godot you have no choice.

In defense of the .gddir (or .gd_directory) file, this approach works well with moving, renaming, and restoring a directory, even with external programs (because .gddir only affects the folder it's directly in). Deleting the directory and creating a new one with the same name does not save the params, but on the other hand it sounds logical.

-I think- to have a main solution (for a studio project), and for a specific user.

The ability to locally override directory params seems interesting, but I'm not sure we need such a detailed configuration. I think it will be enough just to choose whether or not to track the params in the VCS.

@the-sink
Copy link
Author

the-sink commented Jul 23, 2022

I agree with @dalexeev in that it removes the need to track renaming/moving directories in-editor and removes any sort of problems created as a result of modifying folders outside of the editor. Buuuut...

I wonder, if it were to be put in project.godot, what would be the best way to store this information? It's going to show up in the Project Settings window (unless there's a way to hide options from the editor gui). A dictionary would be nice, keys being the folder paths and values being the color the user set it to, but I wasn't sure what the value type should be. If we want a specified color palette, using the Color type wouldn't be a good idea as users could just change them to any color at random...

I also think there is merit to keeping folder colors out of version control in some instances. Say for example an artist wants to highlight the Sprites and Levels folders because that's where they in specific will be working most of their time, and the gameplay programmer wants to highlight the Scripts folder instead. Allowing them to do this if they as a team decide it to be useful is nice. Folder colors can be synced across team members by default, and if they decide they don't want it tracked in version control anymore so they can have individual layouts, they can throw it into the gitignore.

@Calinou
Copy link
Member

Calinou commented Jul 24, 2022

It's going to show up in the Project Settings window (unless there's a way to hide options from the editor gui).

We already have special checks to handle this with class_name declarations and input map actions, both of which are stored in project.godot.

A dictionary would be nice, keys being the folder paths and values being the color the user set it to, but I wasn't sure what the value type should be.

The value can be a string with a predefined color name: red, green, blue, etc. I wouldn't allow using custom color codes as users may pick colors that are unreadable on a light theme. Not everyone will be using the same theme when working on a project, so it's important that color choices are always readable on both dark and light themes.

@Norrox
Copy link

Norrox commented Dec 11, 2022

@the-sink any updates on this, i see your repository is gone? :)

@the-sink
Copy link
Author

Sorry for the lack of a follow-up, I ended up not having enough time to try and implement it myself at the time. I can take another shot at it once I have more time in a few days, but if anyone else wants to try and implement this themselves please feel free to do so!

@the-sink
Copy link
Author

the-sink commented Dec 19, 2022

Okay I think I actually have some time to work on this now... It's definitely a learning experience for me since I'm not all too familiar with the codebase, but I'll try my best and of course if any of the more experienced contributors have critiques, feel free to mention them!

Currently at the-sink/godot (folder-colors branch). I think it's a reasonable implementation to just have a sub-menu for all of the pre-defined folder color options. For instance:

image

This requires another, partially unrelated change that I'll submit a PR for in a bit (edit: created godotengine/godot#70286) that copies the get_item_icon_modulate/set_item_icon_modulate functions from the ItemList class over to PopupMenu, so that I can use the same editor folder icon for the dropdown menu. Might be useful in other areas of the editor/for users' projects as well?

@DennisGHUA
Copy link

gm2-comparison
I'd like to highlight a compelling feature from Gamemaker's asset browser that sets it apart from Godot's current implementation. Gamemaker not only uses distinct colors for folder icons but takes it a step further by matching the background color with that of the folder itself, slightly darkening it. To enhance visibility, opened folders in Gamemaker's asset browser receive an even darker shade, creating a clear visual distinction.

I think integrating this approach into Godot's asset browser would significantly improve user experience and navigation. The incorporation of folder background colors aligned with their icon color would make it easier to identify different folders and their states, allowing users to intuitively locate assets more efficiently.

As a side note, it's worth mentioning that Godot's asset view currently lacks a clear differentiation between opened and closed folders, which is a separate matter but may also benefit from attention and improvement in the future.

@Norrox
Copy link

Norrox commented Jul 30, 2023

i see #70286 got merged, does it mean you @the-sink can make this work?
@DennisGHUA Yeah, that would be great to have that!

@the-sink
Copy link
Author

the-sink commented Aug 6, 2023

@Norrox Good reminder haha, started working on this again and got it to (I think?) a functional state:

godot.windows.editor.x86_64_2023-08-05_20-11-36.mp4

image

Stores folder colors in project.godot as was discussed. I'd be interested in trying what @DennisGHUA is suggesting, although I'm not too sure if Trees support that kind of background color adjustment? Might need to be a separate feature request.

Edit: Nevermind! I assumed TreeItem::set_custom_bg_color wouldn't span the whole width of the column, but it appears that it does, so background tinting should be super straightforward. Messing around with that idea now:

image

@DennisGHUA
Copy link

@the-sink Impressive progress! I'd like to highlight a particular aspect in my example: when considering subfolders lacking an assigned color, they currently inherit the folder color from the one immediately above them. To enhance this, I propose that setting the default color of a subfolder to match that of its parent folder would be a more intuitive approach, moving away from the fixed blue color for all subfolders.

@the-sink
Copy link
Author

the-sink commented Aug 9, 2023

@DennisGHUA Thanks! It definitely does look better when folder colors are inherited as the background color is:

image

Just created a draft PR!

@akien-mga akien-mga added this to the 4.2 milestone Aug 29, 2023
@akien-mga
Copy link
Member

Implemented by godotengine/godot#80440.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants