Skip to content
Snippets Groups Projects
Commit dd0dffef authored by Julien Duroure's avatar Julien Duroure
Browse files

glTF importer: avoid rotation issue when active collection is disabled

parent c715490c
No related branches found
No related tags found
No related merge requests found
...@@ -121,6 +121,13 @@ class BlenderScene(): ...@@ -121,6 +121,13 @@ class BlenderScene():
# Avoid rotation bug if collection is hidden or disabled
if gltf.blender_active_collection is not None:
gltf.collection_hide_viewport = bpy.data.collections[gltf.blender_active_collection].hide_viewport
bpy.data.collections[gltf.blender_active_collection].hide_viewport = False
# TODO for visibility ... but seems not exposed on bpy for now
for node_idx in list_nodes: for node_idx in list_nodes:
if node_idx in exclude_nodes: if node_idx in exclude_nodes:
...@@ -143,6 +150,11 @@ class BlenderScene(): ...@@ -143,6 +150,11 @@ class BlenderScene():
#bpy.context.scene.collection.objects.unlink(obj_rotation) #bpy.context.scene.collection.objects.unlink(obj_rotation)
bpy.data.objects.remove(obj_rotation) bpy.data.objects.remove(obj_rotation)
# Restore collection hiden / disabled values
if gltf.blender_active_collection is not None:
bpy.data.collections[gltf.blender_active_collection].hide_viewport = gltf.collection_hide_viewport
# TODO restore visibility when expose in bpy
@staticmethod @staticmethod
def get_root_nodes(gltf): def get_root_nodes(gltf):
if gltf.data.nodes is None: if gltf.data.nodes is None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment