This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

Been digging through the source, but haven't quite found anything clearly that indicates how the generated SVGs get assigned to editor nodes.

Anyone know of any examples on how to do this or where the root of this lies?

There are a lot of set_icon() and get_icon() and I've hit some dead ends with them.

in Engine by (5,286 points)

I think they are generated by using the class name directly, so if you define Sprite3D, it will lookup for an icon named icon_sprite_3d.svg

I'm not sure what you mean by defining. A macro definition, or something else?

Currently I've done something like this in a node's header.

#include "scene/2d/node_2d.h"

class MyNode : public Node2D {
    GDCLASS(MyNode, Node2D);

When I add this node in the Editor it has the white icon of a Node and not Node2D.

So you registered a class named MyNode: try to add an icon to the editor, which you name icon_my_node.svg. Just drop it in the icons folder, compile and see if that works for your class.

It's implicit by class name?

How would you go about reusing the existing icons? Do you have to copy and rename them?

I'm trying to create a module, so I don't want to modify anything in the repo outside the module's directory.

Gridmap is a module, yet its icon is not in its folder ¯\(ツ)
I once opened an issue about this for documentation, which apparently was solved somehow, but the same issue exists for icons and is still a thing

I see. I suppose I'll leave them as is for now.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.