Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gdignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.github
.github/*
README.md
LICENSE
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto eol=lf
/** export-ignore
/addons !export-ignore
/addons/** !export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.import/
export.cfg
export_credentials.cfg
export_presets.cfg

# Imported translations (automatically generated from CSV files)
*.translation
Expand Down
52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,59 @@
# Fancy-Folder-Icons

Custom Folder Icons Addon For Godot 4

Allows you to choose a custom icons for folders. *(also works with files)*
Allows you to choose a custom icons for folders. _(also works with files)_

[![Godot Engine 4.3](https://img.shields.io/badge/Godot_Engine-4.x-blue)](https://godotengine.org/) ![ToolHack](https://img.shields.io/badge/Tool-Addon-green) ![Copyrights License](https://img.shields.io/badge/License-MIT-blue)

![Icon](images/folder.png)

# How Work
In the godot file system, press RMB (right click) on any folder/file you want to **iconize** and select **Custom Icon** from the menu.

instead of having to set a custom icon for each folder indevidually, the folders will be set using rules.

### Rules instructions

for match rules you can have the path be matched my string, or \* for wildcard which matches any folder, or \*\* for wildcard that matches any amount of folders in a row.

rules can be changed at project settings plugin/fancy_folder_icons/rules

## eg:

- match rule "res://scenes/blocks/\*\*/images/"
- matches "res://scenes/blocks/block1/images/"
- matches "res://scenes/blocks/block2/images/"
- matches "res://scenes/blocks/block3/nested_folder/images/"
- matches "res://scenes/blocks/block3/nested_folder/nested_folder2/images/"

---

- replace rule "res://scenes/blocks/image.png"
- loads image from "res://scenes/blocks/image.png"

---

- match rule "res://scenes/blocks/\*\*/images/"
- replace rule "res://scenes/blocks/$1/images/editorBar.png||res://scenes/blocks/$1/images/1.png||res://scenes/blocks/$1/images/unpressed.png||res://scenes/blocks/$1/images/ghost.png"
- when match rule matches "res://scenes/blocks/block1/images/"
- tries to load image from "res://scenes/blocks/block1/images/editorBar.png"
- if not successful tries to load image from "res://scenes/blocks/block1/images/1.png"
- if not successful tries to load image from "res://scenes/blocks/block1/images/unpressed.png"
- if not successful tries to load image from "res://scenes/blocks/block1/images/ghost.png"
- if not successful logs an error

---

if one replace rule fails, if the file is not found, to match the errors are saved and only shown if no later replace rules match.

## settings

- textureAppliesToNestedFolders

## todo

- add support for more than one \*\* per match rule
- add support for test\* to mean folder starting with test

### File System Preview

Expand All @@ -18,7 +63,8 @@ In the godot file system, press RMB (right click) on any folder/file you want to

![MenuPreview](https://github.com/user-attachments/assets/1bf25cd1-505f-4090-b0ab-3abc58fe30f4)

# Special Thanks 📜
# Special Thanks 📜

This section lists users who have contributed to improving the quality of this project.

[@Lerpwave](https://github.com/Lerpwave)
Expand Down
2 changes: 1 addition & 1 deletion addons/fancy_folder_icons/ZoomMore.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion addons/fancy_folder_icons/ZoomMore.svg.import
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

importer="texture"
type="CompressedTexture2D"
uid="uid://blssopgxxr688"
uid="uid://cauvpy3qi5d0r"
path="res://.godot/imported/ZoomMore.svg-9285dc7b7b612cd8cd72dec673436c34.ctex"
metadata={
"vram_texture": false
Expand Down
54 changes: 27 additions & 27 deletions addons/fancy_folder_icons/menu_fancy.gd
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
@tool
extends EditorContextMenuPlugin
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Fancy Folder Icons
# Fancy Folder Icons
#
# Folder Icons addon for addon godot 4
# https://github.com/CodeNameTwister/Fancy-Folder-Icons
# author: "Twister"
# Folder Icons addon for addon godot 4
# https://github.com/CodeNameTwister/Fancy-Folder-Icons
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#region godotengine_repository_icons
const ICON : Texture = preload("res://addons/fancy_folder_icons/ZoomMore.svg")
const ICON: Texture = preload("res://addons/fancy_folder_icons/ZoomMore.svg")
#endregion

signal iconize_paths(path : Variant)
signal iconize_paths(path: Variant)

func _popup_menu(paths: PackedStringArray) -> void:
var _process : bool = false
for p : String in paths:
if FileAccess.file_exists(p) or DirAccess.dir_exists_absolute(p):
# The translation in tool mode doesn't seem to work at the moment, I'll leave the code anyway.
var locale : String = OS.get_locale_language()
var translation: Translation = TranslationServer.get_translation_object(locale)
add_context_menu_item("{0} {1}".format([_get_tr(translation,&"Custom"), _get_tr(translation,&"Icon")]).capitalize(), _on_pick_cmd.bind(paths), ICON)
break
var _process: bool = false
for p: String in paths:
if FileAccess.file_exists(p) or DirAccess.dir_exists_absolute(p):
# The translation in tool mode doesn't seem to work at the moment, I'll leave the code anyway.
var locale: String = OS.get_locale_language()
var translation: Translation = TranslationServer.get_translation_object(locale)
add_context_menu_item("{0} {1}".format([_get_tr(translation, &"Custom"), _get_tr(translation, &"Icon")]).capitalize(), _on_pick_cmd.bind(paths), ICON)
break

# v4.5.beta1.official [46c495ca2] Error, not receive arg0 values.
func _on_pick_cmd(arg0 : Variant, arg1_fallvar : Variant = null) -> void:
if arg0 is PackedStringArray and arg0.size() > 0:
iconize_paths.emit(arg0)
elif arg1_fallvar is PackedStringArray and arg1_fallvar.size() > 0:
iconize_paths.emit(arg1_fallvar)
func _get_tr(translation : Translation, msg : StringName) -> StringName:
if translation == null:
return msg
var new_msg : StringName = translation.get_message(msg)
if new_msg.is_empty():
return msg
return new_msg
func _on_pick_cmd(arg0: Variant, arg1_fallvar: Variant = null) -> void:
if arg0 is PackedStringArray and arg0.size() > 0:
iconize_paths.emit(arg0)
elif arg1_fallvar is PackedStringArray and arg1_fallvar.size() > 0:
iconize_paths.emit(arg1_fallvar)
func _get_tr(translation: Translation, msg: StringName) -> StringName:
if translation == null:
return msg
var new_msg: StringName = translation.get_message(msg)
if new_msg.is_empty():
return msg
return new_msg
Loading