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

is it possible to add custom property for a node through the inspector? #11384

Closed
alexzheng opened this issue Sep 18, 2017 · 13 comments
Closed
Labels

Comments

@alexzheng
Copy link

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:

@ghost
Copy link

ghost commented Sep 18, 2017

No. Use export for now.

extends Node
export var custom_prop = 0

@alexzheng
Copy link
Author

alexzheng commented Sep 18, 2017

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.

@toger5
Copy link
Contributor

toger5 commented Sep 18, 2017

@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.

@alexzheng
Copy link
Author

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.

@Zylann
Copy link
Contributor

Zylann commented Sep 18, 2017

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

@alexzheng
Copy link
Author

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

@toger5
Copy link
Contributor

toger5 commented Sep 18, 2017

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...

@Zylann
Copy link
Contributor

Zylann commented Sep 18, 2017

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)

@reduz
Copy link
Member

reduz commented Sep 18, 2017 via email

@alexzheng
Copy link
Author

alexzheng commented Sep 18, 2017

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.

@bojidar-bg
Copy link
Contributor

Depends on the resolution of #18591.

@Calinou
Copy link
Member

Calinou commented Oct 2, 2019

Duplicate of #5433.

@ballerburg9005
Copy link

I wrote a plugin to solve exactly this issue:

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

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

No branches or pull requests

7 participants