Skip to content

[Feature] Prefab system #116

@brenocq

Description

@brenocq

Feature description
Currently, an Atta project defined in a .atta file stores all its entities and components within that single file. This makes it difficult to reuse common configurations of entities and components (like a complete robot model, a specific environment setup, or a piece of furniture) across multiple projects without copy-pasting, which is error-prone and hard to maintain.

Game engines often solve this with a "prefab" system. This feature proposes implementing a similar system in Atta, allowing users to define reusable sets of entities and components in separate files (e.g., .apfb) and then include or instantiate them within a main .atta project file.

When Atta's file module loads a .atta file containing a reference to such an external file, it should load the contents of the included file as if they were defined directly within the main file, effectively instantiating the prefab/scene part.

This would enable:

  • Reusability: Easily reuse complex objects or setups across different projects.
  • Organization: Break down large scenes into smaller, manageable, modular files.
  • Collaboration: Allow team members to work on different parts of a scene independently.
  • Future Potential:
    • Create libraries of standard prefabs (robots, sensors, environments).
    • Build converters from standard formats like URDF or USD into this reusable Atta format (.apfb).

Tasks

  • Design the syntax/mechanism within the .atta file format to specify the inclusion of an external prefab/scene file (e.g., specifying a file path).
  • Decide on the standard file extension(s) for these reusable files (e.g., .apfb).
  • Modify the .atta file loading logic (likely involving the file module and serialization systems) to detect and process these inclusion directives.
  • Implement the instantiation logic: when an inclusion is processed, create the necessary entities and components as defined in the external file within the context of the main scene.
  • Define how relative paths for included files should be resolved.
  • Address potential issues with naming conflicts or unique ID generation when instantiating multiple copies of the same prefab.
  • (Optional) Add UI functionality to select a set of entities in the Scene Tree and save them as a new prefab file (.apfb).
  • (Optional) Integrate prefab browsing and insertion with the File System Browser ([Feature] File System Browser Window).
  • Document the file format syntax for inclusions and the usage workflow.
  • Test thoroughly with various scenarios, including nested inclusions and multiple instantiations of the same prefab.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions