Home Website Youtube GitHub

Missing variable use in line 1969 of anim_utils.py

mGear version 4.0.2 (but checking the latest version still has this problem)
Maya 2022
Windows 10

Hi, I’ve developed a requested tool by my company’s animation department to multi-bake the RangeSwitching which lets them run a single tool to bake all the limbs from FK → IK, all vice versa, or some FK → IK and others IK → FK. As logic wise this is doing the same thing as the SpaceSwitching tool just multiple times, I used the logic of that tool to build this one. I ended up creating a UI that would plug variables into the methods of toIK or toFK within anim_utils.py, but I ran into the issue of it always baking to FK, even if I was running the toIK method.

What I found was that both toIK and toFK run another method called execute, and in line 1969 of anim_utils.py within the execute method there’s this code:
ui.transfer(startFrame, endFrame, onlyKeyframes, ikRot, switchTo="fk")

The problem is always setting it to “fk” without there being a variable will always bake as fk when running this logic part of the code separate to the SpaceSwitching tool. When I changed this line to instead use the variable ‘switchTo’ that it’s been using to hold either “fk” or “ik” respectively it’s been working as intended and baking to either ik or fk:
ui.transfer(startFrame, endFrame, onlyKeyframes, ikRot, switchTo=switchTo)

With this in mind, it looks to me like it would be best if in the next mGear update this line is changed to have the variable be used compared to always baking to fk.

Thanks,
Branden

2 Likes

Thanks for the feedback @Branboy98 I will check it ASAP
logged here:

1 Like