Godot: is it possible to add custom property for a node through the inspector?

Created on 18 Sep 2017  Â·  13Comments  Â·  Source: godotengine/godot

Operating system or device, Godot version, GPU Model and driver (if graphics related):
ALL

Issue description:

It's easy to add property to a node by call Object.set ( String property, Variant value ).
For some cases, we may need to add some nodes of the same type and attach some data to each node without extends the Node.
of course, this may be done through scripts. But it will be intuitive this may be done just through the inspector.

Steps to reproduce:

Link to minimal example project:

archived

Most helpful comment

This is supported but it's not really exposed.. maybe it should be

On Sep 18, 2017 2:08 PM, "Marc" notifications@github.com wrote:

Like tag properties? A sort of arbitrary dictionary every node (or even
object) can have? I think such a feature would need core dev advice

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/11384#issuecomment-330289103,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF-Z27CjZ_MWgY-m_fhcIQde2LhPHYf9ks5sjqOXgaJpZM4PaW13
.

All 13 comments

No. Use export for now.

extends Node
export var custom_prop = 0

I knew it's impossible for current release.
I asked it here to make sure whether it's possible to have this in future release.

And use export will bring in much stuff.

@alexzheng
Can u make an example what u need it for?
Properties only make sense if they have an impacted in sth.
Since you want to add them without an additional script there is no additional functionality. And all the functionality which should be acessible is already bound to GDscript anyways.

For example, I have several menus extends from a base menu, and all buttons pressed signal is handled in a callback. If I can attach data to these buttons, It will not need to attach scripts to each button.

I think you can already bind additional parameters when you connect signals:
image

@Zylann
Thanks,I know this,but this is not my situation.

Just came up with another situation.
A root node which handles multiple instances. Than each instance can store a property how it is treated. Things like how much money you get when collecting an item. Or how much Damage is Felt when walking over it. How propable it is, that it explodes...

Like tag properties? A sort of arbitrary dictionary every node (or even resource) can have? I think such a feature would need core dev advice (and would benefit only non-coders)

This is supported but it's not really exposed.. maybe it should be

On Sep 18, 2017 2:08 PM, "Marc" notifications@github.com wrote:

Like tag properties? A sort of arbitrary dictionary every node (or even
object) can have? I think such a feature would need core dev advice

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/11384#issuecomment-330289103,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF-Z27CjZ_MWgY-m_fhcIQde2LhPHYf9ks5sjqOXgaJpZM4PaW13
.

Yes, just like the tag, but Godot can have more kinds of types supported.
The final scene file may just like the export did in script, but we can done this without a script.
Not only non-coders, but also programmer may handle these properties in scripts.

Depends on the resolution of #18591.

Duplicate of #5433.

I wrote a plugin to solve exactly this issue:

https://github.com/ballerburg9005/godot-metadata-inspector

Was this page helpful?
0 / 5 - 0 ratings