THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/10/2008 at 21:15, xxxxxxxx wrote:
Cinema 4D Version: 10.5
Platform: Mac OSX ;
Language(s) : C.O.F.F.E.E ; XPRESSO ;
I've recently been working on rigging through COFFEE. I've got constraints down at this point but I'd also like to be able to set XPresso stuff without going through the SDK.
I've been wondering: is it possible to set up XPresso nodes by going adding data to BaseContainers only? I know that the C++ SDK has specific stuff on creating ports and making new nodes, but all I want to do is to create and attach standard C4D nodes through COFFEE.
I figure it's a longshot but if anyone has any info, please let me know. Thanks!
On 09/10/2008 at 02:06, xxxxxxxx wrote:
To my knowledge this is not possible.
On 13/10/2008 at 07:49, xxxxxxxx wrote:
As mentioned this is not possible with COFFEE.
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.