glTF exporter: filtering of exported nodes
This partially solves bugs on "use_selected" option. Not perfect yet (for example on collection or linked collection), but better than nothing for now
This commit is contained in:
parent
f713ed8063
commit
33eae7da67
Notes:
blender-bot
2023-02-14 18:49:00 +01:00
Referenced by issue #80460, gltf / glb-export: 2nd level hierarchy selections can't be exported
|
@ -15,7 +15,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": (1, 4, 37),
|
||||
"version": (1, 4, 38),
|
||||
'blender': (2, 91, 0),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -49,25 +49,45 @@ def gather_node(blender_object, library, blender_scene, dupli_object_parent, exp
|
|||
|
||||
@cached
|
||||
def __gather_node(blender_object, library, blender_scene, dupli_object_parent, export_settings):
|
||||
children = __gather_children(blender_object, blender_scene, export_settings)
|
||||
|
||||
camera = None
|
||||
mesh = None
|
||||
skin = None
|
||||
weights = None
|
||||
|
||||
# If blender_scene is None, we are coming from animation export
|
||||
# Check to know if object is exported is already done, so we don't check
|
||||
# again if object is instanced in scene : this check was already done when exporting object itself
|
||||
if not __filter_node(blender_object, blender_scene, export_settings):
|
||||
return None
|
||||
if children:
|
||||
# This node should be filtered out, but has un-filtered children present.
|
||||
# So, export this node, excluding its camera, mesh, skin, and weights.
|
||||
# The transformations and animations on this node will have visible effects on children.
|
||||
pass
|
||||
else:
|
||||
# This node is filtered out, and has no un-filtered children or descendants.
|
||||
return None
|
||||
else:
|
||||
# This node is being fully exported.
|
||||
camera = __gather_camera(blender_object, export_settings)
|
||||
mesh = __gather_mesh(blender_object, library, export_settings)
|
||||
skin = __gather_skin(blender_object, export_settings)
|
||||
weights = __gather_weights(blender_object, export_settings)
|
||||
|
||||
node = gltf2_io.Node(
|
||||
camera=__gather_camera(blender_object, export_settings),
|
||||
children=__gather_children(blender_object, blender_scene, export_settings),
|
||||
camera=camera,
|
||||
children=children,
|
||||
extensions=__gather_extensions(blender_object, export_settings),
|
||||
extras=__gather_extras(blender_object, export_settings),
|
||||
matrix=__gather_matrix(blender_object, export_settings),
|
||||
mesh=__gather_mesh(blender_object, library, export_settings),
|
||||
mesh=mesh,
|
||||
name=__gather_name(blender_object, export_settings),
|
||||
rotation=None,
|
||||
scale=None,
|
||||
skin=__gather_skin(blender_object, export_settings),
|
||||
skin=skin,
|
||||
translation=None,
|
||||
weights=__gather_weights(blender_object, export_settings)
|
||||
weights=weights
|
||||
)
|
||||
|
||||
# If node mesh is skined, transforms should be ignored at import, so no need to set them here
|
||||
|
|
Loading…
Reference in New Issue