diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2020-09-05 16:26:50 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2020-09-05 16:26:50 +0300 |
commit | ee912f6fd22baaa94f925ac9dff5f9ccdbb2ecbd (patch) | |
tree | 2559903c8ebb282a2029217324a1e417a6ca11f3 /io_scene_gltf2/blender | |
parent | f9696870783db9e33b69f29ee61e7e7616d33b8c (diff) |
glTF importer: select all (and only) the imported objects
Diffstat (limited to 'io_scene_gltf2/blender')
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_scene.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py index 6119eb95..e6eadcd6 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py @@ -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 @@ -57,6 +58,16 @@ class BlenderScene(): 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. If no default scene, use the first scene, or just any root object. |