vini-guerrero / godot_game_tools

This is a blender add-on that contains tools to ease the creation/import process of assets into Godot Game Engine
GNU General Public License v2.0
364 stars 34 forks source link

Error while initializing character #56

Open selgesel opened 2 years ago

selgesel commented 2 years ago

Whenever I try to initialize a character or import an animation I get the following error and can't proceed further.

Python: Traceback (most recent call last):
  File "/home/selgesel/.var/app/org.blender.Blender/config/blender/3.1/scripts/addons/src/operators/character_controller.py", line 65, in execute
    bpy.ops.wm_ggt.prepare_mixamo_rig('EXEC_DEFAULT')
  File "/app/blender/3.1/scripts/modules/bpy/ops.py", line 130, in __call__
    ret = _op_call(self.idname_py(), C_dict, kw, C_exec, C_undo)
RuntimeError: Error: Python: Traceback (most recent call last):
  File "/home/selgesel/.var/app/org.blender.Blender/config/blender/3.1/scripts/addons/src/operators/character_controller.py", line 235, in execute
    bpy.ops.wm_ggt.rename_mixamo_rig('EXEC_DEFAULT')
  File "/app/blender/3.1/scripts/modules/bpy/ops.py", line 130, in __call__
    ret = _op_call(self.idname_py(), C_dict, kw, C_exec, C_undo)
RuntimeError: Error: Python: Traceback (most recent call last):
  File "/home/selgesel/.var/app/org.blender.Blender/config/blender/3.1/scripts/addons/src/operators/character_controller.py", line 215, in execute
    bpy.context.scene.frame_end = bpy.context.object.animation_data.action.frame_range[-1]
TypeError: bpy_struct: item.attr = val: Scene.frame_end expected an int type, not float

location: /app/blender/3.1/scripts/modules/bpy/ops.py:130
location: /app/blender/3.1/scripts/modules/bpy/ops.py:130
location: <unknown location>:-1

Based on the error message I checked out the frame_range value and realized that it's a Vector2 with float values.

image

So I tried casting the resulting item to int (e.g. bpy.context.scene.frame_end = int(bpy.context.object.animation_data.action.frame_range[-1])) wherever I could, which did make the errors disappear, but unsurprisingly, every single animation had a duration of 2 frames afterwards.

I tried different Blender versions (3.1.1 and 3.1.2), different addon versions (2.0.4 and 2.0.5), and different models/animations (Y-Bot and Erika Archer), but nothing helped.

I don't know any Blender scripting so I have no idea what value frame_range should normally have and why it doesn't now, but if you can point me in the right direction I can try to find the solution myself.

P.S.: I'm aware of a similar issue at #55 but that's closed without any followup, so I decided to open a new one with more details, hope it's OK