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

Custom resources don't use icon for file in filesystem #32706

Closed
ghost opened this issue Oct 10, 2019 · 23 comments · Fixed by #77932
Closed

Custom resources don't use icon for file in filesystem #32706

ghost opened this issue Oct 10, 2019 · 23 comments · Fixed by #77932

Comments

@ghost
Copy link

ghost commented Oct 10, 2019

Godot version:
3.2 alpha-1 (custom build)
OS/device including version:
ArcoLinux
Issue description:
Practically all of Godot's resource types use a special icon to help the user determine what sort of file they're dealing with, assuming the file extension isn't enough (and a lot of resources use .tres/.res anyway.) However, custom resources, though an icon can be supplied for them via class_name, do not use that icon in the filesystem, despite it working most everywhere else it would be used.

class_name Actor, "res://System/Icons/actor_icon.png" extends Resource

image
Works in the inspector

image
And in the Create New Resource dialogue

image
And when creating a new resource in a property

image
But, sadly, just a generic file icon used here, the same icon used for all other custom resources.

Ideally the user would be able to identify the resource, wherever it may be, by the icon, much like they do most other resources; this inconsistency breaks that reliance, and makes it considerably more difficult to determine at a glance what kind of file you're dealing with.

@KoBeWi
Copy link
Member

KoBeWi commented Oct 21, 2020

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

@cgbeutler
Copy link

cgbeutler commented Nov 12, 2020

I am seeing this in 3.2.3. I will try to make a minimal reproduction tomorrow.
It may also be worth noting that double-clicking the saved resource in the "FileSystem" tab does bring it up in the inspector with the proper script attached. Not sure if the FileSystem window is pulling from the resource before the script is attached, or if it is pulling from some other registry.

@bmolyneaux
Copy link
Contributor

Here is a reproduction project:
ResourceIcon.zip

my_resource has the icon.png in the Create New Resource dialog, but not in the FileSystem panel.

@luislodosm
Copy link

Same problem. Godot 3.3

Script:

extends Resource
class_name CondicionDatos, "res://motor/iconos/condicion.png"

Create new resource window:

Captura de pantalla 2021-05-01 a las 11 10 16

Filesystem:

Captura de pantalla 2021-05-01 a las 11 08 53

Filesystem (double window):

Captura de pantalla 2021-05-01 a las 11 12 18

@coppolaemilio
Copy link
Member

Would love to see this one implemented! I'm offering a $100 bounty for anyone that can fix/implement this since it is much needed for Dialogic 2.0

@coppolaemilio
Copy link
Member

There was a PR attempting to fix the issue #51089 but it was rejected for performance reasons.
And it seems like to fix this we also need to address this one: #27333

Not sure, just trying to add more information to the issue.

@MikeSchulze
Copy link

same issue happens on Godot 4.0 beta4

@coppolaemilio
Copy link
Member

@MikeSchulze As far as I know this was never fixed, so it is still a thing.

@MikeSchulze
Copy link

@MikeSchulze As far as I know this was never fixed, so it is still a thing.

Thats bad, it would be nice to have this consistent.
I was looking to get such extra info out of selected TreeItem to calculate my context menus.

@Atlinx
Copy link
Contributor

Atlinx commented Feb 17, 2023

I will try making a new PR with one of the strategies from my original PR, where I attached icon gathering to preview generation. This'll mean icons might not update immediately (requiring an editor restart and maybe even a cache clear), but it'll still be performant and not touch core code.

@Calinou Calinou added this to the 4.x milestone Feb 17, 2023
@vassembly
Copy link

can confirm on 4.0rc2

@TomerconDevelopers
Copy link

same issue in 4.0.2 rc1 too

image

@YuriSizov
Copy link
Contributor

Thanks for your reports, but there is no need to confirm it. It's a missing feature that hasn't been implemented yet.

@akien-mga akien-mga modified the milestones: 4.x, 4.1 Jun 7, 2023
@YuriSizov YuriSizov modified the milestones: 4.1, 4.2 Jun 23, 2023
@YuriSizov YuriSizov removed this from the 4.2 milestone Nov 14, 2023
@YuriSizov YuriSizov added this to the 4.x milestone Nov 14, 2023
@akien-mga akien-mga modified the milestones: 4.x, 4.3 Mar 14, 2024
@z4gon
Copy link

z4gon commented Jun 7, 2024

I'm seeing this issue in this build:

Godot Engine v4.3.beta1.official.a4f2ea91a - https://godotengine.org
OpenGL API 4.1 Metal - 88 - Compatibility - Using Device: Apple - Apple M1 Pro

Screenshot 2024-06-07 at 6 34 48 PM
Screenshot 2024-06-07 at 6 34 43 PM
Screenshot 2024-06-07 at 6 34 04 PM

@KoBeWi
Copy link
Member

KoBeWi commented Jun 8, 2024

@z4gon Your resource doesn't have @icon defined. What is your expected result in this case?

@z4gon
Copy link

z4gon commented Jun 8, 2024

@KoBeWi oooh, ok so two things:

  • I didn't know @icon was something that could be defined
  • I thought all resources (custom or not) had the cube icon

So, knowing this, I think I would expect custom resources to have the cube icon by default?
Same way scripts have the gear icon by default?

@z4gon
Copy link

z4gon commented Jun 8, 2024

@KoBeWi I set an @icon to the script and now it works! thank you!
Closing and opening the editor fixes remaining issues like seeing the resource icon in the inspector.

@icon("res://textures/icons/icon_sword.svg")
class_name MyResource
extends Resource

@export var my_value: int = 0

Screenshot 2024-06-08 at 1 07 04 PM
Screenshot 2024-06-08 at 1 07 09 PM

Noticed that this seems to only work if the @icon is set on the actual script, it doesn't recognize @icon coming from a super class.

If you have a ResourceB that extends ResourceA, @icon needs to be set in both classes.

@z4gon
Copy link

z4gon commented Jun 8, 2024

Oddly enough, if the resource exports a packed scene, it breaks the icon.

@icon("res://textures/icons/icon_sword.svg")
class_name MyResource
extends Resource

@export var my_value: int = 0
@export var my_scene: PackedScene

Screenshot 2024-06-08 at 1 08 30 PM
Screenshot 2024-06-08 at 1 08 34 PM

@KoBeWi
Copy link
Member

KoBeWi commented Jun 8, 2024

So, knowing this, I think I would expect custom resources to have the cube icon by default?

I checked that, if a Resource has custom icon, the icon will show in FileSystem, but not in the inspector. Iconless resources use generic file icon, because we don't have custom icon for Resource (the cube is used for Object).

Noticed that this seems to only work if the @ICON is set on the actual script, it doesn't recognize @ICON coming from a super class.

That's another bug. You can open a new issue.

Oddly enough, if the resource exports a packed scene, it breaks the icon.

Also another bug.

@z4gon
Copy link

z4gon commented Jun 8, 2024

I checked that, if a Resource has custom icon, the icon will show in FileSystem, but not in the inspector.

I re-checked this, and custom icons for resources show up in the Inspector, but you need to close and re-open the editor for them to show up. I reported the bug here: #92919

Iconless resources use generic file icon, because we don't have custom icon for Resource (the cube is used for Object).

Would it be cool to have a generic icon for iconless Resources?

Noticed that this seems to only work if the @ICON is set on the actual script, it doesn't recognize @ICON coming from a super class.

That's another bug. You can open a new issue.

Created bug report here: #92921

Oddly enough, if the resource exports a packed scene, it breaks the icon.

Also another bug.

I re-checked this in an empty project and couldn't reproduce anymore, I can export a PackedScene and it works fine.
It breaks if the PackedScene also references the same texture of the custom icon, which I think was one of the cases I was testing back then. But I couldn't find a reliable way to reproduce, it's a bit random.

@laspencer91
Copy link

laspencer91 commented Jun 9, 2024

v 4.2.2
Seeing the icon in the Inspector, but not in FileSystem. Even after reloading the editor.

image

image

Note: My icon is a 64x64 PNG

@KoBeWi
Copy link
Member

KoBeWi commented Jun 9, 2024

The icons were fixed only in 4.3.

@z4gon
Copy link

z4gon commented Jun 9, 2024

I re-checked this in an empty project and couldn't reproduce anymore, I can export a PackedScene and it works fine.
It breaks if the PackedScene also references the same texture of the custom icon, which I think was one of the cases I was testing back then. But I couldn't find a reliable way to reproduce, it's a bit random.

I was able to repro, I made a bug report for it here: #92942

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