glTF importer: select all (and only) the imported objects
This commit is contained in:
parent
f969687078
commit
ee912f6fd2
|
@ -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, 12),
|
||||
"version": (1, 4, 13),
|
||||
'blender': (2, 90, 0),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -43,6 +43,7 @@ class BlenderScene():
|
|||
|
||||
if bpy.context.mode != 'OBJECT':
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
BlenderScene.select_imported_objects(gltf)
|
||||
BlenderScene.set_active_object(gltf)
|
||||
|
||||
@staticmethod
|
||||
|
@ -56,6 +57,16 @@ class BlenderScene():
|
|||
anim_name = gltf.data.animations[0].track_name
|
||||
BlenderAnimation.restore_animation(gltf, anim_name)
|
||||
|
||||
@staticmethod
|
||||
def select_imported_objects(gltf):
|
||||
"""Select all (and only) the imported objects."""
|
||||
if bpy.ops.object.select_all.poll():
|
||||
bpy.ops.object.select_all(action='DESELECT')
|
||||
|
||||
for vnode in gltf.vnodes.values():
|
||||
if vnode.type == VNode.Object:
|
||||
vnode.blender_object.select_set(state=True)
|
||||
|
||||
@staticmethod
|
||||
def set_active_object(gltf):
|
||||
"""Make the first root object from the default glTF scene active.
|
||||
|
|
Loading…
Reference in New Issue