THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/10/2008 at 08:43, xxxxxxxx wrote:
Thanks for both the unofficial and official takes on this.
Matthias, this is a gaping hole in the abilities of COFFEE... I actually looked at the SDK code for the graphview stuff and some posts by Kuroyume and I think a few convenience functions would be a serious boon to folks attempting higher-level rigging or automated rigging of multiple characters.
I'm trying to sort through how I'd want this to work -- I've been translating rigging knowledge from Maya and Blender to C4D a lot more, recently. In Maya, for example, when you want something to rotate half the speed of its driver, you do something like this:
\> // create a node that multiples things
\> string $mdn = `shadingNode -asUtility "multiplyDivide"`;
\> // connect the driver -- rotate X to the first input's X
\> connectAttr -f driver.rotateX ($mdn + ".input1X");
\> // set the multiplier to half
\> setAttr ($mdn + ".input2X") 0.5;
\> // connect node to driven
\> connectAttr -f ($mdn + ".outputX") driven.rotateX;
Naturally since C4D's dependency graph doesn't work in the same way as Maya's the code would need to be different. I've been thinking it might look something like this:
\> var obj1 = doc->FindObject("driver");
\> var obj2 = doc->FindObject("driven");
\> // this one has the xpresso tag on it
\> var tagHolder = doc->FindObject("TagHolder");
\> var xt = ....
\> // assume that xt is filled with the XpressoTag on tagHolder
\> // second parameter is the node's name
\> var math = xt->CreateNode("Math", "RotateMultiplier");
\> // when you add an object to the graphview, it returns something like
\> // an object node so you can modify it
\> var obj1Node = xt->AddObject(obj1);
\> var obj2Node = xt->AddObject(obj2);
\> // set the math node's stuff
\> // instead of #2000:1000 or whatever comes up in the script editor,
\> // use the names
\> math->SetPlugValue("Input2", "0.5");
\> // connect stuff up
\> // should be checking the return value to see if it failed
\> xt->ConnectPlugs(obj1Node, "RotationH", math, "Input1");
\> xt->ConnectPlugs(math, "Output", obj2Node, "RotationH");
Note that I don't make the plugs visible or anything; I think that would be done automatically in these cases.
So now the followup question: has anyone dug deep enough in Xpresso who has a few pointers to help me along my way, or at least a list of pitfalls that aren't mention in the SDK? I've noticed from Kuroyume's code (he came up a few times with regards to mimicking set driven keys, although I'm not sure he ever found a solution) that there are a few necessary yet undocumented library calls I'd need to know about if I were to roll my own.