Home Youtube GitHub

How to apply FK/IK match?


#1

Hi again Miquel

Another simple question for you. How does the animator apply FK/IK match. I only see FK/IK blend under the arm and leg controls.

Thanks
Gavin


#2

is in the synoptic view :wink:


#3

Is it? I don’t see it. Excuse my ignorance but this is my first time animating an mGear character rig, and it’s the first time my colleague rigged in mGear (and in a rush), so everything is new, and things have possibly not been set up correctly?

If it’s the buttons “IK/FK Arm left” etc, then when I left click these
Can’t find object : arm_L0_fk0_mth
Can’t find object : arm_L0_fk1_mth
Can’t find object : arm_L0_fk2_mth
Can’t find object : arm_L0_ik_mth
Can’t find object : arm_L0_upv_mth
Can’t find object : arm_L0_ikRot_mth
// Error: root : Uncaught exception
Traceback (most recent call last):
File “C:\Users\gavinm\Documents\maya\2017\modules\scripts\mgear\maya\synoptic\widgets.py”, line 121, in mousePressEvent
utils.ikFkMatch(model, ikfk_attr, uiHost_name, fks, ik, upv, ikRot)
File “C:\Users\gavinm\Documents\maya\2017\modules\scripts\mgear\maya\synoptic\utils.py”, line 600, in ikFkMatch
transform.matchWorldTransform(ikTarget, ikCtrl)
File “C:\Users\gavinm\Documents\maya\2017\modules\scripts\mgear\maya\transform.py”, line 537, in matchWorldTransform
sWM = source.getMatrix(worldSpace=True)
AttributeError: ‘NoneType’ object has no attribute ‘getMatrix’ //


#4

Looks like the rig is missing the nodes to help match the IK FK. Or can’t find it for some reason

Hard to say without checking the rig.

Check if rig have objects with the _mth suffix

I hope this helps


#5

Hello, Miquel.

I have the same issue with ik/fk match. It does not work only when i build rig with check-box “IK separated Trans and Rot ctl” in arm`s module settings is disabled.

I get this in script editor:

Can’t find object : arm_L0_ikRot_ctl
Can’t find object : arm_L0_ikRot_mth
# Traceback (most recent call last):
# File “C:\mgear\scripts\mgear\maya\synoptic\widgets.py”, line 121, in mousePressEvent
# utils.ikFkMatch(model, ikfk_attr, uiHost_name, fks, ik, upv, ikRot)
# File “C:\mgear\scripts\mgear\maya\synoptic\utils.py”, line 665, in ikFkMatch
# transform.matchWorldTransform(ikRotTarget, ikRotNode)
# File “C:\mgear\scripts\mgear\maya\transform.py”, line 537, in matchWorldTransform
# sWM = source.getMatrix(worldSpace=True)
# AttributeError: ‘NoneType’ object has no attribute 'getMatrix’

Thanks


#6

@Vasilii Sorry for the late reply.

yes the default configuration is for separated Trans and rotation controls.

You need to edit the template with qtdesigner and recompile again the .ui file

Just change the ikRot Value to None.

here is also a capture in from the python modules synoptic/widgets.py

sorry for the lack of documentation in this area.
I hope it helps. Please let me know if you need more help

cheers,
Miquel


#7

a quick workaround for this is also to navigate to the fk hand controller and under it you can duplicate the _ref group twice and rename it to the missing _mth and _ctl for each side.
then it works again.

with a bit af python knowledge, the mgear code could br modified so it can be implemented on creation time…


#8

Thanks @Miquel !
Everything works fine.

@soulcage thank you for your quick workaround. Its very usefull.


#9

Hi @Miquel.

First of all, Happy 2019!

I’m having a similar issue. I’m getting the following error when using the Synoptic to transfer the animation from FK to IK (and vice versa):
# Traceback (most recent call last):
# File “V:\Maya_Animation_Tools\scripts\mGear\release\scripts\mgear\maya\synoptic\utils.py”, line 1084, in doItByUI
# self.transfer(startFrame, endFrame, onlyKeyframes, self.hasIkRot)
# File “V:\Maya_Animation_Tools\scripts\mGear\release\scripts\mgear\maya\synoptic\utils.py”, line 1067, in transfer
# pm.cutKey(roll_att, time=(startFrame, endFrame))
# File “C:\Program Files\Autodesk\Maya2016\Python\lib\site-packages\pymel\internal\factories.py”, line 945, in newFuncWithTimeRangeFlags
# return beforeTimeRangeFunc(*args, **kwargs)
# File “C:\Program Files\Autodesk\Maya2016\Python\lib\site-packages\pymel\internal\pmcmds.py”, line 139, in wrappedCmd
# raise pymel.core.general._objectError(obj)
# pymel.core.general.MayaAttributeError: Maya Attribute does not exist (or is not unique):: u’FootBallPlayer_Rig_v001:armUI_L0_ctl.arm_roll’

I have taken over the rig from the previous guy that was working at this studio and it seems like the way he set the rig up was to have all the arm UI attributes be on a different controller. For the left arm it can be located on a controller named FootBallPlayer_Rig_v001:shoulder_L0_ctl
They use mGear 2.2.1 and I don’t want to rock the boat halfway through a production by trying to upgrade to 2.6.1. Any ideas as to what I can do to fix this issue? The animators are referencing the rig into their scenes so it would be a matter of fixing the rig once and everyone SHOULD be happy. :joy:

I noticed in the Synoptic view that there’s a section below the IK/FK switching buttons for specifying the shoulder, IK Pos and UpV Pos. Those values stays blank, and I’m assuming that it is part of the problem.

Thanks in advance.


#10

Hi @FMaree

the error is complaining about u’FootBallPlayer_Rig_v001:armUI_L0_ctl.arm_roll’ like if it is not in the scene or duplicated name.
if the attributes are in other control you need to edit the synoptic and compile it again like in the other image

Also this video may help: https://youtu.be/EOiQ5lY1PPY

the menu will update when you pass the mouse over, that was a limitation on how the UI is loaded. is not any issue

Cheers,
Miquel


#11

Hi @Miquel

Apologies for only getting back to you now. I’ve been swamped with other higher priority stuff.

Thank you very much! This worked like a charm on mGear 2.2.1! :tada:

I noticed that mGear version 3 is now out. Will this sort of issue be solved in that version? If so I’ll be looking at making the transition as soon as we’re done with this project.


#12

Wow, didnt know you could fk/ik switch so seamlessly. NICE! Mgear really is awesome.


#13

Just wanted to mention that the technology that does the snapping is available as well outside the picker itself. The picker is just an UI calling the snapping code. Here is an example of how you can do the Ik/Fk snap on a specific control. You can of course do you own Picker or UI for this.

from mgear.synoptic.utils import ikFkMatch

character_root = "rig_grp"
switch_control = "armUI_L0_ctl"
switch_attribute = "arm_L0_blend"
fk_conbtrols = ("arm_L0_fk0_ctl", "arm_L0_fk1_ctl", "arm_L0_fk2_ctl")
ik_control = "arm_L0_ik_ctl"
ik_upvector_control = "arm_L0_upv_ctl"

ikFkMatch(character_root,
          switch_attribute,
          switch_control,
          fk_conbtrols,
          ik_control,
          ik_upvector_control)