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

More flexible MeshLibrary generation from scene #3821

Open
rafallus opened this issue Jan 18, 2022 · 0 comments
Open

More flexible MeshLibrary generation from scene #3821

rafallus opened this issue Jan 18, 2022 · 0 comments

Comments

@rafallus
Copy link

rafallus commented Jan 18, 2022

Describe the project you are working on

Improvements to GridMap node and MeshLibrary

Describe the problem or limitation you are having in your project

When exporting a scene to a MeshLibrary resource, there are some limitations in the way the scene should be structured that can cause issues (see godotengine/godot#42297). The following scene tree shows some examples:

Root
|
|_ MeshInstance1    - Good, item will be named ‘MeshInstance1’
   |_ StaticBody
      |_ CollisionShape
|
|_ Node3D1    - Good, but item will be named ‘MeshInstance2’ (not ‘Node3D1’)
    |_ MeshInstance2
        |_ NavigationRegion
        |_ StaticBody
            |_ CollisionShape
|
|_ Node3D2    - Bad, even if this node is called ‘Node3D2’, the item would be named ‘MeshInstance1’ which is already taken
    |_ MeshInstance1
|
|_ Node3D3    - Bad, an item called 'MeshInstance3' is created but the StaticBody is ignored
   |_ MeshInstance3
   |_ StaticBody
      |_ CollisionShape
|
|_ Node3D4    - Bad, MeshInstance node should always be the first child of this node
   |_ StaticBody
      |_ CollisionShape
   |_ MeshInstance4

There should be more flexibility and a smarter way to generate the library. This is not just a matter of specifying in the documentation how the scene should be structured. There could be asset packs (commercial or free) that don't follow this style and making them work would be time consuming.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

To generate the MeshLibrary, the following should be taken into consideration:

  • The scene tree should be traversed up to a certain depth (configurable in the editor settings).
  • The items should be named after the main nodes (meaning the direct children of the Root node) and not after the MeshInstance node.
  • Only the first MeshInstance, StaticBody and NavigationRegion found are taken into account.
  • The option 'Apply MeshInstance Transforms' should be changed to 'Apply main node transforms' or something similar.
  • Whenever a node is a child of the main node, transforms will be applied.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

An example of a scene tree:

Root
|
|_ MeshInstance1    - Item will be named ‘MeshInstance1’
   |_ StaticBody
      |_ CollisionShape
|
|_ Node3D1    - Item will be named ‘Node3D1’ and will have navigation and static body if scanning depth >= 2
    |_ MeshInstance2
        |_ NavigationRegion
        |_ StaticBody
            |_ CollisionShape
|
|_ Node3D2    - Item will be named 'Node3D2'
    |_ MeshInstance1
|
|_ StaticBody1    - Item will be named 'StaticBody1'
   |_ CollisionShape
   |_ MeshInstance3
   |_ NavigationRegion
|
|_ NavigationRegion1    - Item will be named 'NavigationRegion1'
   |_ StaticBody
      |_ CollisionShape
   |_ MeshInstance4

There is the possibility to have mesh-less items. If this is allowed or not needs to be discussed.

If this enhancement will not be used often, can it be worked around with a few lines of script?

It will be used each time a scene is exported to a MeshLibrary

Is there a reason why this should be core and not an add-on in the asset library?

This is core

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

No branches or pull requests

2 participants