Johngoss725 / Mixamo-To-Godot

This is a Blender 2.9 script for importing mixamo Models to Godot-3
Creative Commons Zero v1.0 Universal
18 stars 3 forks source link

Model origin after scaleAll and action renaming in get_all_anims #1

Open CodeGuru12 opened 2 years ago

CodeGuru12 commented 2 years ago

First off I would like to say this script really saved my bacon and reduced the time significantly it takes for me to import animations into one model. I've been manually importing mixamo animations for a few weeks now and it's a really pain and time waster to have to do it over every time I make a change to my model. Now for the reason I came here. I'm not sure why, but I had a couple issues with the script. I am using fbx files for what it's worth, so maybe this is where the discrepancy comes from.

  1. It was placing crouched animations at a different level than standing animations.
  2. I found my animation names were being overwritten making some animations appear to be the wrong one

After some digging I solved 1. by changing the resize from 0.01 to 1. So the line is now

bpy.ops.transform.resize(value=(1, 1, 1), orient_type='GLOBAL'

Issue 2. I came across a stackoverflow question about renaming fcurves, and decided to give it a try.

Old line bpy.data.actions[0].name = os.path.basename(use_string) New line bpy.data.objects[0].animation_data.action.name = os.path.basename(use_string)

Cheers! And thanks again for sharing the code openly! I never could have written this by myself.

Johngoss725 commented 2 years ago

Thanks for the interest I also have a youtube channel where I do some work with Godot and Blender https://youtu.be/aft83fjpINI

On Sat, Jan 15, 2022 at 6:24 PM CodeGuru12 @.***> wrote:

First off I would like to say this script really saved my bacon and reduced the time significantly it takes for me to import animations into one model. I've been manually importing mixamo animations for a few weeks now and it's a really pain and time waster to have to do it over every time I make a change to my model. Now for the reason I came here. I'm not sure why, but I had a couple issues with the script. I am using fbx files for what it's worth, so maybe this is where the discrepancy comes from.

  1. It was placing crouched animations at a different level than standing animations.
  2. I found my animation names were being overwritten making some animations appear to be the wrong one

After some digging I solved 1. by changing the resize from 0.01 to 1. So the line is now

bpy.ops.transform.resize(value=(1, 1, 1), orient_type='GLOBAL'

Issue 1. I came across a stackoverflow question about renaming fcurves, and decided to give it a try.

Old line bpy.data.actions[0].name = os.path.basename(use_string) New line bpy.data.objects[0].animation_data.action.name = os.path.basename(use_string)

Cheers! And thanks again for sharing the code openly! I never could have written this by myself.

— Reply to this email directly, view it on GitHub https://github.com/Johngoss725/Mixamo-To-Godot/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUSYNDX7PQ2RAFCJOBJ4XKLUWH63BANCNFSM5MBRIWJA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

CodeGuru12 commented 2 years ago

Wanted to let you know the first issue 1.) is probably actually in the copyHips function. The issue popped up again today, and went away when I commented out that function. I have no idea what the fix is since I'm not at all familiar with blenders python API, but thought I'd leave this in case others run into a similar issue with crouch vs walking animations.