-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Nodes added via EditorPlugin shouldn't have properties under Script Variables #10799
Comments
Not sure if that is useful since a custom type will already have a script attached and you can't attach another one. #4378 would solve this though. |
? No, I just did it in my own project.
^ this totally compiles and runs just fine. It is possible to have a custom type's variables AND a script's variables both present on a node. But currently the custom type's variables are mixed in with the script's. |
A good example for this is this custom node in the Godot Next plugin: The ControlSwitcher extends the BaseSwitcher that also export variables. I found this discussion before to post my proposal, that is displaying the nome name instead of "Scrips variables" always when it's possible. The current behaviour seems to me non-core nodes are first citizen class nodes and the others second citizen class nodes. So, if I create a Scene+GDScript called Enemy, and create many instances in another scene, I think it's more informative to see "Enemy" instead "Script variables". In the same way, if I extend the Enemy as BigBoss, I would like to see the BigBoss category for exported variables followed by Enemy class with the respective exported variables, just like the internal Godot classes. And I think this should be the behaviour even for nodes not meant for plugins (ie, that extends the EditorPluging class and register it). |
@AllanDaemon I've discovered since originally posting this issue that even the custom types are themselves really just scripts on top of nodes. They aren't actually "custom types" at all. Not sure of all of the details, but it appears that
...and that's pretty much it. It's actually REALLY lax as far as interaction goes, and I can kinda get why, based on that reality, there has been some confusion/debate between users and the core devs regarding how to handle and interpret custom types, and really any type that derives from a scripted type. But as vnen said, the issue he mentioned would help to alleviate this problem if people could customize what category is associated with the variables. It just sucks that, for now, you can't create categories and sub-categories for properties (like if I had category each for BaseSwitcher/ControlSwitcher, and then sub-categories for sets of properties that were related). Glad to hear someone is actually looking at that repo though. It's still pretty barren at the moment. XD |
As the time to change this in the Godot 3 is running out, I've made an implementation to test it. It's in my fork: It basically uses the name of the node instance instead "Script Variables", if the object extends Node. This is my first time with Godot code and I still getting familiar with it, so there is room for improvements.
I actually saw this repo is your @willnationsdev after you said it in the last post. |
Judging from the code changes you made, it looks like all you have to do is a push into the list a If I have 3 levels of hierarchy of script:
If you then selected a node with the
There is supposed to be a map SOMEWHERE (the ClassDB maybe?) that tracks the inheritance hierarchies between scripts by their path(?) or name or something. You would need to use that map in order to look up the additional labels that would need to be added. I'm not sure if it would even be possible to isolate which properties are associated with each layer of the hierarchy though, cause you'd have to know at what point in the list to insert the new category block. I know P.S. Yes, I am the maker of that repository, hehe. It's pretty early on in its lifetime, so I don't expect it to be expanded all that much until after 3.0 and people start making all sorts of things like character controllers, basic camera tools, etc. Godot-NExt is meant to just consolidate stuff that doesn't really fit into a repository all by its lonesome. |
@AllanDaemon Looking at the source code, it seems like every Script object has a Gotta thank karroffel for giving me a lead on where to get the base script (don't wanna ping him though). |
In 2.x, I used func _get_property_list():
return [
{usage = PROPERTY_USAGE_CATEGORY, type = TYPE_NIL, name = "CircularContainer"},
#...
] I guess we might automatically create a category for each script, based on its filename. Seems like a simpler thing to do than implementing categories ( #4378 ), in any case... |
@bojidar-bg do you know if there is an easy way to check whether a script has an exported property, maybe in the ClassDB? |
You cannot look a script up in ClassDB, other than that, you might instance the script and call |
@bojidar-bg Are you working on this now then, based on what I read in that PR? Cause I was gonna start trying to do it. |
@willnationsdev I might, depends on what the community votes on. |
btw, I've been working on this since yesterday. I'm adding |
Well, I wasted a whole bunch of time on this. Apparently, manually inserting multiple PROPERTY_USAGE_CATEGORY
Ended up with...
|
Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine. The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker. If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance! |
If a node's script is added to the engine via
EditorPlugin::add_custom_type
, the exported properties of that node should not be listed in the Inspector under Script Variables. Instead, it should be labeled whatever the name of the new node type is. For example, with a new node called MyNode inheriting Control, I might have in the Inspector...Then, if I add a script to that node, I should see...
The text was updated successfully, but these errors were encountered: