
- #Maya python setattr shader color update#
- #Maya python setattr shader color full#
- #Maya python setattr shader color free#
Lastly, the L_hand01_JNT is point constrained to L_arm03_JNT and we only blend the rotate and scale attributes on it, as otherwise the wrist becomes dislocated during blending, because we are interpolating linearly translation values. Then we have a simple non-stretchy IK setup, but obviously a stretchy one would work in the same way. The blending is controlled by L_armIkFk_CTL.fkIk. These two chains are blended via a few blendColors nodes for translate, rotate and scale into the final chain. We assume that we have an arm joint chain – L_arm01_JNT > L_arm02_JNT > L_arm03_JNT and a hand joint chain – L_hand01_JNT > L_hand02_JNT with their correspondent IK and FK chains – L_armIk01_JNT > …, L_armFk01_JNT > …, etc. – IK Control and IK hand joint both oriented in worldĪgain, you do not have to use the same file as I do as it is just an example, but it is important to be clear on the existing setup. – All controls and joints are oriented the same All this is due to the nature of inverse kinematics.Īlso, for easier explaining I assume we are working on an arm and hand setup, but obviously the same approach would work for any IK/FK chain. What this means is that if we have rotations in multiple axis on our FK control for that middle joint (elbow, knee, etc.) the IK/FK matching will not work properly. Mainly, I am talking about the limited rotation of the second joint in the chain, as IK setups allow for rotations only in one axis. It is important to understand the limitations of a seamless IK FK switch before we dive in. The files contain just a simple IK/FK blending system, on which we can test our matching setup, but with different control orientations.
#Maya python setattr shader color full#
The full code (which is very short anyway) is in this gist and there are three scene files in here for each version of our setup.
#Maya python setattr shader color free#
So, in order to give you a bit of a better context I have uploaded the example scene that I am using, so you can have a look at the exact structure, but feel free to use your own scene with IK/FK blending setup. I have added the button to a custom marking menu for easier access. What fixes is though is switching back and forth once more.īasically, there is just one command for the seamless IK FK Switch, which detects the current kinematics and switches to the other one maintaining the pose. That’s why I decided to use constraints to achieve my rotations, which seems to be a simple enough and stable solution.ĮDIT: It seems like even with constraints it is possible to get that issue in the case where the IK control is oriented differently. Im sure that throughout the web there are many solutions to the problem, but most of the ones I found were in MEL and some of them were a bit unstable, because they were relying too much on the xform command or the rotate one with the ws flag, which I am assuming causes issues sometimes when mapping from world space to relative, where a joint will have the exact same world rotation, so it looks perfectly, but if you blend between IK and FK you can see it shifting and then coming back in place. The IK to FK switching was trivial and there were not many issues with that, but I had a very hard time figuring out the FK to IK one, as I had no idea what the pole vector really is and also, my IK control was not oriented the same way as my FK one. There was this mechanical EVA suit that I was rigging for a masterclass assignment at uni given by Frontier. I remember the first time I tried to set up a seamless IK FK switch with Python vividly.
#Maya python setattr shader color update#
Until I update the article, either try replacing them with xform calls or have a look at Alessandra’s comment. EDIT: I would advise against using this exact same script as the parentConstraints have been known to cause issues and are not a graceful solution at all.
