glTF importer: avoid rotation issue when active collection is disabled

This commit is contained in:
Julien Duroure 2019-02-28 22:03:54 +01:00
parent c715490c5e
commit dd0dffef42
1 changed files with 12 additions and 0 deletions

View File

@ -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:
if node_idx in exclude_nodes:
@ -143,6 +150,11 @@ class BlenderScene():
#bpy.context.scene.collection.objects.unlink(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
def get_root_nodes(gltf):
if gltf.data.nodes is None: