bpy.ops.import_scene.gltf doesn't work with bpy.ops.wm.read_factory_settings?
See original GitHub issueI’m trying to load gltf after clearing the scene, like shown here: https://github.com/KhronosGroup/glTF-Blender-IO/blob/7a3532e32fcce61ab08aa0c081282e72e668ea4c/tests/roundtrip_gltf.py But I’m getting the error:
Error: Traceback (most recent call last):
File "\Text", line 34, in <module>
File "\Text", line 32, in process_one
File "\Text", line 12, in process_gltf
File "C:\Program Files\Blender Foundation\Blender 2.83.4\2.83\scripts\modules\bpy\ops.py", line 201, in __call__
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender 2.83.4\2.83\scripts\addons\io_scene_gltf2\__init__.py", line 900, in execute
return self.import_gltf2(context)
File "C:\Program Files\Blender Foundation\Blender 2.83.4\2.83\scripts\addons\io_scene_gltf2\__init__.py", line 919, in import_gltf2
return self.unit_import(self.filepath, import_settings)
File "C:\Program Files\Blender Foundation\Blender 2.83.4\2.83\scripts\addons\io_scene_gltf2\__init__.py", line 937, in unit_import
BlenderGlTF.create(self.gltf_importer)
File "C:\Program Files\Blender Foundation\Blender 2.83.4\2.83\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_gltf.py", line 42, in create
BlenderGlTF._create(gltf)
File "C:\Program Files\Blender Foundation\Blender 2.83.4\2.83\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_gltf.py", line 49, in _create
BlenderScene.create(gltf)
File "C:\Program Files\Blender Foundation\Blender 2.83.4\2.83\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_scene.py", line 40, in create
BlenderNode.create_vnode(gltf, 'root')
File "C:\Program Files\Blender Foundation\Blender 2.83.4\2.83\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_node.py", line 51, in create_vnode
BlenderNode.create_vnode(gltf, child)
File "C:\Program Files\Blender Foundation\Blender 2.83.4\2.83\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_node.py", line 40, in create_vnode
BlenderNode.create_bones(gltf, vnode_id)
File "C:\Program Files\Blender Foundation\Blender 2.83.4\2.83\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_node.py", line 134, in create_bones
bpy.context.window.scene = bpy.data.scenes[gltf.blender_scene]
AttributeError: 'NoneType' object has no attribute 'scene'
location: C:\Program Files\Blender Foundation\Blender 2.83.4\2.83\scripts\modules\bpy\ops.py:201
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Issue with importing USD files via bpy.ops.wm.usd_import ...
Hi, I'm working on an add on and I'd like to import USDZ, USD, USDA, and USDC via the python library. I seem...
Read more >read_factory_settings makes all other operators call fail in ...
I want to read a ply mesh at blender startup using a python script given in the command line: blender --python load_ply.py ....
Read more >Calling operator "bpy.ops.export_scene.gltf" error
I can't get the GTLF export to work with Python scripting. repo steps: Open Blender (I tried 2.8 and 3.3) Select “General” template...
Read more >bpy.ops.wm.append works without error but does not append
Hello I am currently trying to append collections from specific folder and when I use the bpy.ops.wm.append , it returns no error but ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, I can reproduce OP’s stack trace. To trigger it you need to run blender without the
-b
(headless) option. Deleting that line does not fix it, it will error again when we try to switch to edit mode.I’m assuming this is for the same reason as: https://stackoverflow.com/questions/28075599/opening-blend-files-using-blenders-python-api/28083541#28083541
#1184 does fix it.
Yes, thank you.