Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-01-19 15:53:31 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-01-19 15:53:31 +0300
commitb4a92f139628b421c711d64e7f2f31b6687c3017 (patch)
treea049fd4913a117ff9715dd2879a927ed20e7e0c0 /io_scene_obj
parent8471942e21296fbbb819c6bddebb4d99e049fa24 (diff)
Fix object importer in blender 2.8
Diffstat (limited to 'io_scene_obj')
-rw-r--r--io_scene_obj/__init__.py2
-rw-r--r--io_scene_obj/import_obj.py11
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