saturday06 / VRM-Addon-for-Blender

VRM Importer, Exporter and Utilities for Blender 2.93 to 4.1
https://vrm-addon-for-blender.info
MIT License
1.24k stars 141 forks source link

Bug report : バグ報告 #70

Open MafioLive opened 2 years ago

MafioLive commented 2 years ago

Describe the bug :バグについて Unable to export VRM File

To Reproduce:バグの再現方法 Steps to reproduce the behavior: Was Working on my model and i went to export it. then i got a python error

Expected behavior:期待する動作 Expected to export successfully

Blenders Reported Error: Python: Traceback (most recent call last): File "C:\Users\Name\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\VRM_Addon_for_Blender-1_13_0\io_scene_vrm\exporter__init__.py", line 60, in execute vrm_bin = glb_obj.convert_bpy2glb("0.0") File "C:\Users\Name\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\VRM_Addon_for_Blender-1_13_0\io_scene_vrm\exporter\glb_obj.py", line 96, in convert_bpy2glb self.mesh_to_bin_and_dic() File "C:\Users\Name\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\VRM_Addon_for_Blender-1_13_0\io_scene_vrm\exporter\glb_obj.py", line 1342, in mesh_to_bin_and_dic bpy.ops.object.mode_set(mode="OBJECT") File "S:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\modules\bpy\ops.py", line 132, in call ret = _op_call(self.idname_py(), None, kw) RuntimeError: Operator bpy.ops.object.mode_set.poll() failed, context is incorrect

location: :-1

Silvea12 commented 2 years ago

The exact reproduction is to cause there to be no active object. One way to do this is by executing bpy.context.view_layer.objects.active = None Another is to create and delete an object (a cube or something, really anything) right before you hit export.

As long as bpy.context.view_layer.objects.active is None when you export the VRM, this crash will occur. Fixed in #74

saturday06 commented 2 years ago

The fix https://github.com/saturday06/VRM_Addon_for_Blender/pull/74 is released in latest release https://github.com/saturday06/VRM_Addon_for_Blender/releases Thanks!