Skip to content

Commit

Permalink
Merge pull request #2406 from KhronosGroup/fix_2399_option_not_select…
Browse files Browse the repository at this point in the history
…_created_objects

Fix #2399 - option to not selected created objects
  • Loading branch information
julienduroure authored Nov 28, 2024
2 parents 594aec4 + a65e58a commit 55e8b75
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 13 additions & 0 deletions addons/io_scene_gltf2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1860,6 +1860,12 @@ class ImportGLTF2(Operator, ConvertGLTF2_Base, ImportHelper):
default=False,
)

import_select_created_objects: BoolProperty(
name='Select imported objects',
description='Select created objects at the end of the import',
default=True,
)

import_scene_extras: BoolProperty(
name='Import Scene Extras',
description='Import scene extras as custom properties. '
Expand All @@ -1882,6 +1888,7 @@ def draw(self, context):
layout.prop(self, 'import_webp_texture')
layout.prop(self, 'import_scene_extras')
import_bone_panel(layout, operator)
import_ux_panel(layout, operator)

import_panel_user_extension(context, layout)

Expand Down Expand Up @@ -1978,6 +1985,12 @@ def import_bone_panel(layout, operator):
body.prop(operator, 'disable_bone_shape')
body.prop(operator, 'bone_shape_scale_factor')

def import_ux_panel(layout, operator):
header, body = layout.panel("GLTF_import_ux", default_closed=False)
header.label(text="Pipeline")
if body:
body.prop(operator, 'import_select_created_objects')


def import_panel_user_extension(context, layout):
for draw in importer_extension_layout_draw.values():
Expand Down
5 changes: 3 additions & 2 deletions addons/io_scene_gltf2/blender/imp/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ def create(gltf):

if bpy.context.mode != 'OBJECT':
bpy.ops.object.mode_set(mode='OBJECT')
BlenderScene.select_imported_objects(gltf)
BlenderScene.set_active_object(gltf)
if gltf.import_settings['import_select_created_objects']:
BlenderScene.select_imported_objects(gltf)
BlenderScene.set_active_object(gltf)

@staticmethod
def create_animations(gltf):
Expand Down

0 comments on commit 55e8b75

Please sign in to comment.