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:
authorJulien Duroure <julien.duroure@gmail.com>2019-04-15 17:40:56 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-04-15 17:40:56 +0300
commitfefd011035aadc77f1317d732e111fbf6d3d96c3 (patch)
tree6bf4d1b80342e942bf34915bfa588bf9d3c78c85
parentb1cc242cfd7d63efc77392762346d4768ce667ba (diff)
glTF importer: Keep user render engine (cycles or Eevee) when importing
Note that node tree can't be created when render engine is Workbench, so switching to Eevee.
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_gltf.py3
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_scene.py6
2 files changed, 6 insertions, 3 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py b/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
index fac02fb3..7acbb81e 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
@@ -25,7 +25,8 @@ class BlenderGlTF():
@staticmethod
def create(gltf):
"""Create glTF main method."""
- bpy.context.scene.render.engine = 'BLENDER_EEVEE'
+ if bpy.context.scene.render.engine not in ['CYCLES', 'BLENDER_EEVEE']:
+ bpy.context.scene.render.engine = 'BLENDER_EEVEE'
BlenderGlTF.pre_compute(gltf)
if gltf.data.scenes is not None:
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
index f935eb02..2bd58162 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
@@ -41,7 +41,8 @@ class BlenderScene():
scene = bpy.context.scene
if bpy.context.collection.name in bpy.data.collections: # avoid master collection
gltf.blender_active_collection = bpy.context.collection.name
- scene.render.engine = "BLENDER_EEVEE"
+ if scene.render.engine not in ['CYCLES', 'BLENDER_EEVEE']:
+ scene.render.engine = "BLENDER_EEVEE"
gltf.blender_scene = scene.name
else:
@@ -55,7 +56,8 @@ class BlenderScene():
else:
# No scene in glTF file, create all objects in current scene
scene = bpy.context.scene
- scene.render.engine = "BLENDER_EEVEE"
+ if scene.render.engine not in ['CYCLES', 'BLENDER_EEVEE']:
+ scene.render.engine = "BLENDER_EEVEE"
if bpy.context.collection.name in bpy.data.collections: # avoid master collection
gltf.blender_active_collection = bpy.context.collection.name
gltf.blender_scene = scene.name