glTF exporter: Set blender active scene as main scene in glTF file
This commit is contained in:
parent
fe627477c2
commit
ea5f0df783
|
@ -15,7 +15,7 @@
|
|||
bl_info = {
|
||||
'name': 'glTF 2.0 format',
|
||||
'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
|
||||
"version": (0, 9, 52),
|
||||
"version": (0, 9, 53),
|
||||
'blender': (2, 80, 0),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -66,14 +66,14 @@ def __get_copyright(export_settings):
|
|||
|
||||
|
||||
def __gather_gltf(exporter, export_settings):
|
||||
scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
|
||||
active_scene_idx, scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
|
||||
|
||||
if export_settings['gltf_draco_mesh_compression']:
|
||||
gltf2_io_draco_compression_extension.compress_scene_primitives(scenes, export_settings)
|
||||
exporter.add_draco_extension()
|
||||
|
||||
for scene in scenes:
|
||||
exporter.add_scene(scene)
|
||||
for idx, scene in enumerate(scenes):
|
||||
exporter.add_scene(scene, idx==active_scene_idx)
|
||||
for animation in animations:
|
||||
exporter.add_animation(animation)
|
||||
|
||||
|
|
|
@ -30,12 +30,14 @@ def gather_gltf2(export_settings):
|
|||
"""
|
||||
scenes = []
|
||||
animations = [] # unfortunately animations in gltf2 are just as 'root' as scenes.
|
||||
active_scene = None
|
||||
for blender_scene in bpy.data.scenes:
|
||||
scenes.append(__gather_scene(blender_scene, export_settings))
|
||||
if export_settings[gltf2_blender_export_keys.ANIMATIONS]:
|
||||
animations += __gather_animations(blender_scene, export_settings)
|
||||
|
||||
return scenes, animations
|
||||
if bpy.context.scene.name == blender_scene.name:
|
||||
active_scene = len(scenes) -1
|
||||
return active_scene, scenes, animations
|
||||
|
||||
|
||||
@cached
|
||||
|
|
|
@ -156,7 +156,7 @@ class GlTF2Exporter:
|
|||
with open(dst_path, 'wb') as f:
|
||||
f.write(image.data)
|
||||
|
||||
def add_scene(self, scene: gltf2_io.Scene, active: bool = True):
|
||||
def add_scene(self, scene: gltf2_io.Scene, active: bool = False):
|
||||
"""
|
||||
Add a scene to the glTF.
|
||||
|
||||
|
|
Loading…
Reference in New Issue