[Bf-extensions-cvs] [b4a92f13] blender2.8: Fix object importer in blender 2.8

Dalai Felinto noreply at git.blender.org
Fri Jan 19 13:53:38 CET 2018


Commit: b4a92f139628b421c711d64e7f2f31b6687c3017
Author: Dalai Felinto
Date:   Fri Jan 19 10:53:31 2018 -0200
Branches: blender2.8
https://developer.blender.org/rBAb4a92f139628b421c711d64e7f2f31b6687c3017

Fix object importer in blender 2.8

===================================================================

M	io_scene_obj/__init__.py
M	io_scene_obj/import_obj.py

===================================================================

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



More information about the Bf-extensions-cvs mailing list