Blender_bevy_components_wor.../tools/gltf_auto_export
Mark Moissette 529a68c844
refactor(tools/gltf_auto_export): complete restructuring of the tool (#67)
* split up code in logical modules instead of one giant file
 * added module structure, imports etc
 * updated README
 * add storing & reloading of lists of scenes
 * minor cleanups & tweaks
 * closes #64 
 * moved gltf_auto_export specific docs/images inside the addon's folder
 * updated main title image
2023-12-04 14:48:52 +01:00
..
docs refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00
ui refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00
README.md refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00
__init__.py refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00
auto_export.py refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00
config.py refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00
helpers.py refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00
helpers_collections.py refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00
helpers_export.py refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00
helpers_scenes.py refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00
internals.py refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00
preferences.py refactor(tools/gltf_auto_export): complete restructuring of the tool (#67) 2023-12-04 14:48:52 +01:00

README.md

gltf_auto_export

This Blender addon

  • automatically exports your level/world from Blender to gltf whenever you save your Blend file.
  • in Blueprints mode (highly recommended !) :
    • supports automatic exports of used collections as Gltf blueprints
    • supports any number of main/level scenes
      • Blender scenes where you define your levels, and all collection instances are replaced with "pointers" to other gltf files (all automatic)
    • supports any number of library scenes
      • Blender scenes where you define the assets that you use in your levels, in the form of collections
    • automatic export of changed objects & collections only ! a sort of "incremental export", where only the changed collections (if in use) get exported when you save your blend file

Installation:

  • in Blender go to edit => preferences => install

blender addon install

  • choose the path where gltf_auto_export.zip is stored

blender addon install

Usage:

Basics

  • before it can automatically save to gltf, you need to configure it
  • go to file => export => gltf auto export

blender addon use

  • set the autoexport parameters in the auto export panel:

    blender addon use3

    • export folder

    • pick your main (level) scenes and library scenes (see the chapter about Blueprints below)

      • click in the scene picker & select your scene

      select scene

      • click on the "+" icon

      select scene2

      • your scene is added to the list

      select scene3

  • and your standard gltf export parameters in the gltf panel

blender addon use2

  • click on "apply settings"
  • now next time you save your blend file you will get an automatically exported gltf file (or more than one, depending on your settings, see below)

Blueprints

You can enable this option to automatically replace all the collection instances inside your main scene with blueprints

  • whenever you change your main scene (or your library scene , if that option is enabled), all your collection instances

    • will be replaced with empties (this will not be visible to you)
    • those empties will have additional custom properties / components : BlueprintName & SpawnHere
    • your main scene/ level will be exported to a much more trimmed down gltf file (see next point)
    • all the original collections (that you used to create the instances) will be exported as seperate gltf files into the "library" folder
  • this means you will have

    • one small main gltf file (your level/world)
    • as many gltf files as you have used collections in the main scene , in the library path you specified : for the included basic example's assets, it looks something like this:

    library

    the .blend file that they are generated from can be found here

  • the above only applies to collections that have instances in your main scene! if you want a specific collection in your library to always get exported regardless of its use, you need to add a COLLECTION (boolean) custom property called AutoExport set to true

    not at the object level ! the collection level !

    force-export

    It will get automatically exported like any of the "in-use" collections.

  • you can also get an overview of all the exported collections in the export menu

    exported collections

Process

This is the internal logic of the export process with blueprints

process

ie this is an example scene...

and what actually gets exported for the main scene/world/level

all collections instances replaced with empties, and all those collections exported to gltf files as seen above

Development

  • since the code has now been split up into multiple modules, to make your life easier, I highly recomend (if you are using vscode like me) to use this excellent extension , works easilly and fast , even for the latest versions of Blender (v4.0 as of this writing)
  • this article might also help out (easy enough to get it working on linux too)

License

This tool, all its code, contents & assets is Dual-licensed under either of