Skip to content

Add project-wide group management #907

@Zylann

Description

@Zylann

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions