[Closed] Removing IKControl from bone?
I have some bone objects that are controlled by IK. Therefore, each of the bones have an IKControl as matrix3 PRS controller.
Now I would like to remove that IKControl controller from each bone object and replace it with a default PRS controller. But simply assigning a new controller to bone01.transform.controller produces a runtime error saying: Controller not replaceable: IKControl
Any suggestions how to do this anyway?
Cheers!
– MartinB
I don’t think you can… as long as a bone is part of an IK chain then that bone has an IK controller, if you don’t want it to have an IK controller then you have no IK on the bone…
Maybe you can make a new bone and parent that to the IK bone and go from there?
-Johan
I am happy to delete the entire IK chain, if I would know (given a bone) which one it is?
– MartinB
Is this what you are looking for.
joints=#()
stPos=#([0,0,0],[100,0,0],[180,40,0],[188.944,44.4721,0])
dir=[0,0,1]
for i = 1 to 3 do
(
b=boneSys.createBone stPos[i] stPos[i+1] dir
if i>1 then b.parent=joints[i-1]
append joints b
)
solver=ikSys.ikChain joints[1] joints[3] "IKHISolver"
--Now run this.
delete solver
Not really, but thanks anyway. In your example, you create the IKSolver and store a reference to it that you use to delete it. I need to find the “contents” of your ‘solver’ variable while only looking at $bone02, for example.
If you could split your code into two parts, one for just creating the bones for testing, and one for deleting the IK without passing any data between the two parts (except the name of one bone, of course), that would help.
I could try some nasty refs.dependson and try to iterate my way to the IK Solver, but I would really like to avoid that if possible.
FWIW: When I open Schematic View and look at the bone/IK chain created by your example, there is no connection line between Bone02 and IK Chain01…
Thanks again!
– MartinB
So you want to have a bone selected and determine what solver is controlling it?
If so bone02 will not directly get that for you I don’t think. refs.dependents on it only returns
#(ReferenceTarget:NodeSelection, ReferenceTarget:ReferenceTarget)
How ever if you check the bone01 or bone03 you get this.
#(ReferenceTarget:NodeSelection, ReferenceTarget:ReferenceTarget, Controller:IKChainControl, $Object:IK Chain01 @ [180.000000,40.000004,0.000000])
So you might have to recurse up the parents from the bone that you have selected and check if it is dependent on a solver or not.
What is it that you are actualy trying to do, what sort of tool are you writting?
Yes, exactly.
Hm. Well, that’s not really what I wanted to hear.
This is for a script that bakes any type of animation down into keyframes.
For that, I need to remove the current transform controller from the node in order to be able to store new keyframes; and unfortunately, the IK Solver is designed in a way that does not allow this without first removing the IK Solver itself. Therefore my question how to get from a bone to the IK Solver it is controlled by.
Is there a way to get all the affected bones for a given IK Solver? Maybe I could go that way, first get all solvers, then store the transforms for all their bones, then kill the solvers and reapply the transforms?
– MartinB
Hi Martin,
I’ve written a function that bakes objects’ transforms and can handle IK Chains. This is an ugly can of worms We used this function at snowball|VFX, and it works for the most part, however, in some more complex rigs (invoving scripting and such) it sometimes broke. The way I did it, was to ignore any bones that are a part of an IK chain, but when an end effector is baked, the function goes through the entire bone chain and bake them all. For us this wasn’t an issue since we usually baked all of the character’s objects in one go.
If you want, I can send you this function.
cheers,
o
How did you determine whether a bone is part of an IK chain?
That would be really nice, thank you! Please send it to martin at breidt dot net, thanks!
– MartinB
I check if it’s transform controller is IKControl.
That would be really nice, thank you! Please send it to martin at breidt dot net, thanks!
– MartinB
Sent.
cheers,
o