Add additional names to GLTF entities for easier querying #13473
Labels
A-Assets
Load files from disk to use for things like images, models, and sounds
C-Usability
A simple quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
I have a very simple blender file with a single mesh and multiple materials:
![image](https://private-user-images.githubusercontent.com/1215187/332871166-b485f425-8571-49d3-9f65-d9c77bacb4e6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg3NDI5NzAsIm5iZiI6MTcxODc0MjY3MCwicGF0aCI6Ii8xMjE1MTg3LzMzMjg3MTE2Ni1iNDg1ZjQyNS04NTcxLTQ5ZDMtOWY2NS1kOWM3N2JhY2I0ZTYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYxOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MThUMjAzMTEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NGZjMjI0OWZmZDkyMzQ3ZDNjMTk4ZTZiOGQ1MDAwM2YwZGYwZmUwOWUwNTQxOTQ4MzQyNjRmOGMxNTJmMjBhZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.rpom46uT3mElZLhUzWjl8SugGWIhL-wD_x_lu_VJDts)
When exporting to GLTF it creates a mesh with multiple primitives:
![image](https://private-user-images.githubusercontent.com/1215187/332871434-3b724f09-e5df-4852-8ab6-21d598a6bd78.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg3NDI5NzAsIm5iZiI6MTcxODc0MjY3MCwicGF0aCI6Ii8xMjE1MTg3LzMzMjg3MTQzNC0zYjcyNGYwOS1lNWRmLTQ4NTItOGFiNi0yMWQ1OThhNmJkNzgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYxOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MThUMjAzMTEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzUwMDQ3NWRmZTAwODk3ODhkYWQ3ZmJjN2FkM2VmNjM1ZjU2M2Y4ZDAwN2M5YWQ1NWE2YjQ2NmQ4NDk0Y2ZkZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.H5o47XTCSHkvh2JCXdG4MRjBAfYBNslEaacf4WL33LI)
Bevy creates an entity for the node object and separate entity per each primitive of the mesh (no mesh-specific entity):
![image](https://private-user-images.githubusercontent.com/1215187/332870505-b280e132-8204-4056-ae7a-bf3d8263676a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg3NDI5NzAsIm5iZiI6MTcxODc0MjY3MCwicGF0aCI6Ii8xMjE1MTg3LzMzMjg3MDUwNS1iMjgwZTEzMi04MjA0LTQwNTYtYWU3YS1iZjNkODI2MzY3NmEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYxOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MThUMjAzMTEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OGVmN2JjMzFmNzYyZTQ0MGJhNWI2ZjkwNTczMWZhOWI2NTQ3ZjQ5ZTNjNjBjZDIyZTYwYjQ0OTQyM2YwZGY3NyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.rQrtJJKFWQkCHRwnpgHsLkGHS_xlrPnE7FJ8xnYQQ5g)
There are few problems:
What solution would you like?
I'd like to add more
Name
-like components to make querying much easier:Names are not enough in this case because:
In such case it will be trivial to find/replace components for any Gltf scene.
What alternative(s) have you considered?
I don't see currently any ECS friendly alternative.
We could also have
GltfInstance
component attached to the root node that will map entities by type/name but IMHO it is not really ECS way of doing things:Additional context
This is just a suggestion.
There are 100% better ways to solve this problem but we should improve Gltf usability for sure. Currently it just way to cumbersome and requires huge amount of boilerplate code.
The text was updated successfully, but these errors were encountered: