diff options
-rw-r--r-- | io_scene_obj/__init__.py | 2 | ||||
-rw-r--r-- | io_scene_obj/import_obj.py | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py index d15a6cc7..e5165c3b 100644 --- a/io_scene_obj/__init__.py +++ b/io_scene_obj/__init__.py @@ -139,7 +139,7 @@ class ImportOBJ(bpy.types.Operator, ImportHelper, IOOBJOrientationHelper): from_up=self.axis_up, ).to_4x4() keywords["global_matrix"] = global_matrix - keywords["use_cycles"] = (context.scene.render.engine == 'CYCLES') + keywords["use_cycles"] = (context.scene.view_render.engine == 'CYCLES') if bpy.data.is_saved and context.user_preferences.filepaths.use_relative_paths: import os diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py index c120e540..7ca22160 100644 --- a/io_scene_obj/import_obj.py +++ b/io_scene_obj/import_obj.py @@ -1294,10 +1294,17 @@ def load(context, for context_nurbs in nurbs: create_nurbs(context_nurbs, verts_loc, new_objects) + view_layer = context.view_layer + if view_layer.collections.active: + collection = view_layer.collections.active.collection + else: + collection = scene.master_collection.new() + view_layer.collections.link(collection) + # Create new obj for obj in new_objects: - base = scene.objects.link(obj) - base.select = True + collection.objects.link(obj) + obj.select_set('SELECT') # we could apply this anywhere before scaling. obj.matrix_world = global_matrix |