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

Add project-wide group management #907

Closed
Zylann opened this issue May 26, 2020 · 2 comments · Fixed by godotengine/godot#60965
Closed

Add project-wide group management #907

Zylann opened this issue May 26, 2020 · 2 comments · Fixed by godotengine/godot#60965
Milestone

Comments

@Zylann
Copy link

Zylann commented May 26, 2020

Continuation from godotengine/godot#5744

Describe the project you are working on:
A game where scenes must be in groups to be treated differently by some gameplay features.

Describe the problem or limitation you are having in your project:
When adding a group to a node, it must be typed in manually. However those groups are well defined in my game, and there is a risk I do a typo, or even don't remember exactly which group I should use.

A group management dialog has been merged to the engine already godotengine/godot#16502, unfortunately it does not meet those requirements, and is quite confusing, because:

  • It only proposes groups that already exist in the scene. So if you want to add a new one which already exist in other scenes of your project, you have to remember and type groups again.
  • Despite being opened from the Groups tab, it does not relate to the selected node. Instead, it shows all nodes of the scene in a flat list (including those under instanced scenes), which is messy.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Like collision layers, I would like to be able to declare a list of global groups that can be used in my game, in Project Settings. This would allow insert groups using a dropdown list / scroll list rather than having to type it each time.
Besides, it also allows the editor to auto-complete in the script editor, because it will know which groups are globally available, not only those present in the current scene. It helps self-documenting the project as well because important groups used by the project can be found in one place.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
Pretty much what has been proposed in this PR: godotengine/godot#24262
In ProjectSettings, a place where we can input a list of globally defined groups.
Then in the Node dock, in addition to be able to type a group manually, we may be able to choose from a list of known groups.

It will still be allowed to make groups on the fly in the current scene or in code, and those can still be included in the proposed dropdown. The point is, there can also be a common set of groups that you don't need to re-define anymore in every new scene.

If this enhancement will not be used often, can it be worked around with a few lines of script?:
There has been an attempt to make a plugin related to this need: https://www.youtube.com/watch?v=inBR5-071ko
But it doesn't adress the same concerns and doesn't seem to integrate to the editor that much. Besides, I can't find such plugin on the assetlib (nothing with "group").

Is there a reason why this should be core and not an add-on in the asset library?:
Groups are a core basic feature, and are added/removed using very specific UIs of the editor. A plugin cannot modify that, and cannot alter script auto-completion either. All it can do is to add extra UIs that don't integrate with the existing ones.

@Calinou Calinou changed the title Project-wide group management Add project-wide group management Sep 24, 2021
@me2beats
Copy link

I was thinking about a slightly different approach, when the engine parses all PackedScenes and creates a list of groups automatically. Does it have disadvantages, maybe performance? Does it make sense to combine these 2 ways.

@me2beats
Copy link

me2beats commented Jun 11, 2022

Declaring the groups manually would only affect code completion and drop-downs, wouldn't it?
This should not affect get_tree().get_nodes_in_group(x) if the group x is not declared manually but exists in the tree.
get_tree().get_nodes_in_group(x) should be avaliable in any case,

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

Successfully merging a pull request may close this issue.

4 participants