Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2022-09-25 17:59:17 +0300
committerJulien Duroure <julien.duroure@gmail.com>2022-09-25 17:59:17 +0300
commit90732dddff7ef0b211851c067feb680f1377f8f9 (patch)
tree2174b01dbe47d506c0e9d981ed0c68e3e0b2626a
parent97bb515d3ac4062a8fb58544750a002433daffcc (diff)
glTF exporter: option to export active collection without nested collections
-rwxr-xr-xio_scene_gltf2/__init__.py21
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_export_keys.py3
-rw-r--r--io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py7
3 files changed, 23 insertions, 8 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 6a7e0983..54968399 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -4,7 +4,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
- "version": (3, 4, 20),
+ "version": (3, 4, 21),
'blender': (3, 3, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
@@ -313,10 +313,16 @@ class ExportGLTF2_Base:
default=False
)
- use_active_collection: BoolProperty(
+ use_active_collection_with_nested: BoolProperty(
+ name='Active Collection and nested Collections',
+ description='Export objects in the active collection and nested collections only',
+ default=False
+ )
+
+ use_active_collection_without_nested: BoolProperty(
name='Active Collection',
description='Export objects in the active collection only',
- default=False
+ default=False
)
use_active_scene: BoolProperty(
@@ -506,7 +512,8 @@ class ExportGLTF2_Base:
'use_selection',
'use_visible',
'use_renderable',
- 'use_active_collection',
+ 'use_active_collection_with_nested',
+ 'use_active_collection_without_nested'
'use_mesh_edges',
'use_mesh_vertices',
'use_active_scene',
@@ -569,7 +576,8 @@ class ExportGLTF2_Base:
export_settings['gltf_visible'] = self.use_visible
export_settings['gltf_renderable'] = self.use_renderable
- export_settings['gltf_active_collection'] = self.use_active_collection
+ export_settings['gltf_active_collection_with_nested'] = self.use_active_collection_with_nested
+ export_settings['gltf_active_collection_without_nested'] = self.use_active_collection_without_nested
export_settings['gltf_active_scene'] = self.use_active_scene
export_settings['gltf_selected'] = self.use_selection
@@ -709,7 +717,8 @@ class GLTF_PT_export_include(bpy.types.Panel):
col.prop(operator, 'use_selection')
col.prop(operator, 'use_visible')
col.prop(operator, 'use_renderable')
- col.prop(operator, 'use_active_collection')
+ col.prop(operator, 'use_active_collection_without_nested')
+ col.prop(operator, 'use_active_collection_with_nested')
col.prop(operator, 'use_active_scene')
col = layout.column(heading = "Data", align = True)
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py b/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py
index 96f97af1..bcf2c1fc 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py
@@ -17,7 +17,8 @@ APPLY = 'gltf_apply'
SELECTED = 'gltf_selected'
VISIBLE = 'gltf_visible'
RENDERABLE = 'gltf_renderable'
-ACTIVE_COLLECTION = 'gltf_active_collection'
+ACTIVE_COLLECTION_WITH_NESTED = 'gltf_active_collection_with_nested'
+ACTIVE_COLLECTION_WITHOUT_NESTED = 'gltf_active_collection_without_nested'
SKINS = 'gltf_skins'
DEF_BONES_ONLY = 'gltf_def_bones'
FORCE_SAMPLING = 'gltf_force_sampling'
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py
index 203e1ec5..cfeb70e2 100644
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py
@@ -393,11 +393,16 @@ class VExportTree:
if all([c.hide_render for c in self.nodes[uuid].blender_object.users_collection]):
return False
- if self.export_settings[gltf2_blender_export_keys.ACTIVE_COLLECTION]:
+ if self.export_settings[gltf2_blender_export_keys.ACTIVE_COLLECTION_WITH_NESTED]:
found = any(x == self.nodes[uuid].blender_object for x in bpy.context.collection.all_objects)
if not found:
return False
+ if self.export_settings[gltf2_blender_export_keys.ACTIVE_COLLECTION_WITHOUT_NESTED]:
+ found = any(x == self.nodes[uuid].blender_object for x in bpy.context.collection.objects)
+ if not found:
+ return False
+
return True
def search_missing_armature(self):