DescID Morph Pose strength [SOLVED]
-
On 09/06/2015 at 02:08, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R16
Platform: Mac OSX ;
Language(s) : C++ ;---------
Hi,I'm working on an objectData plugin with some morph tags and XPresso files.
In one XPresso file I need to access the strength of a pose of the morph tag.
For that, I need the DescID of the strength of that specific pose.
How should I go on this?Now I have an operator_object node where I drop my morphTag onto with OperatorSetData (DROP_IN_BODY)
After this I'm not sure on what to do.
I somehow need to get the right DescID to use in GvCall.
I've tried this, but it's not working:DescID myMorphDescID = DescID(DescLevel(myFirstMorph->GetID()), DescLevel(MORPHTAG_STRENGTH));
How should I correctly retrieve the right DescID?
Thanks in advance for your help and time!
Greetings,
Casimir Smets -
On 09/06/2015 at 10:48, xxxxxxxx wrote:
Hi,
the DescID calculates as follows:
morph->GetID() * ID_CA_POSE_ANIMATE_CNT + ID_CA_POSE_ANIMATE_OFFSET + ID_CA_POSE_ANIMATE_STRENGTH
By the way, this thread may be also interesting in this context.
-
On 09/06/2015 at 11:07, xxxxxxxx wrote:
Hi Andreas,
I will definately look into this!
Thanks for your help and time!With kind regards,
Casimir Smets -
On 10/06/2015 at 05:10, xxxxxxxx wrote:
Hi,
I can't get it to work. The result for my DescID(1101) should be correct, but if I put that in GvCall, it seems to do nothing.
Here is my code for the morph xpresso node:GvNode* morphNode = nodeMaster->CreateNode(nodeMaster->GetRoot(), ID_OPERATOR_OBJECT, nullptr, 350, 0); if (!morphNode) return false; morphNode->OperatorSetData(GV_ATOM, morphTag, GV_OP_DROP_IN_BODY); GvOperatorData* morphData = morphNode->GetOperatorData(); DescID morphDescID = firstMorph->GetID() * ID_CA_POSE_ANIMATE_CNT + ID_CA_POSE_ANIMATE_OFFSET + ID_CA_POSE_ANIMATE_STRENGTH; // Untill here everything works perfectly fine, and the DescID I get has the value 1101 Int32 morphInID = GvCall(morphData, GetMainID) (morphNode, GV_PORT_INPUT, morphDescID); GvPort* morphInPort = morphNode->AddPort(GV_PORT_INPUT, morphInID); if (!morphInPort) return false;
Thanks in advance for your help and time!
Greetings,
Casimir Smets -
On 22/06/2015 at 01:58, xxxxxxxx wrote:
Hi,
Could somebody please help me with this?
I've tried around 100 id's, but none of them work.Thanks in advance for your help and time!
With kind regards,
Casimir Smets -
On 24/06/2015 at 12:05, xxxxxxxx wrote:
Hi,
I'm still using a temporary internet connection. So I can't reply back to you about this.
But I do have some code for handling PoseMorphs and Xpresso that might possibly help you out.This is R13 code:
//This is an example of loading a PoseMorph tag into a node in the xpresso editor //Then adding the first morph's strength output port in the xpresso node //PoseMorph tag required headers #include "..\..\..\resource\modules\ca\res\description caposemorph.h" #include "..\..\..\..\resource\_api\c4d_libs\lib_ca.h" //GvCall required headers #include "c4d_graphview.h" #include "c4d_operatorplugin.h" //A custom macro for getting the node's data #define GvCall(op,fnc) (((GvOperatorData* )op)->*((OPERATORPLUGIN* )C4DOS.Bl->RetrieveTableX((NodeData* )op,1))->fnc) Bool SimplePlugin::Execute(BaseDocument *doc) { PolygonObject *obj = (PolygonObject * ) doc->GetActiveObject(); if(!obj) return FALSE; //Get the xpresso and PoseMorph tags on the object XPressoTag *xTag = (XPressoTag* )obj->GetTag(Texpresso, 0); if(!xTag) return FALSE; CAPoseMorphTag *morphTag=(CAPoseMorphTag* )obj->GetTag(Tposemorph); if(!morphTag) return FALSE; //Get the xpresso's master container GvNodeMaster *nm = xTag->GetNodeMaster(); //Create a new Object type node GvNode *morphNode = nm->CreateNode(nm->GetRoot(), ID_OPERATOR_OBJECT, NULL, 120, 200); //Assign the new node to the morph tag //This acts like dragging an dropping the morph tag onto the xpresso Object node morphNode->OperatorSetData(GV_ATOM, morphTag, GV_OP_DROP_IN_BODY); //Get the morphNode's data GvOperatorData *od = morphNode->GetOperatorData(); //Get the first morph's strength description and use it to create an output port for it CAMorph *firstMorph = morphTag->GetMorph(1); DescID id = DescID(ID_CA_POSE_ANIMATE_DATA, firstMorph->GetID()*ID_CA_POSE_ANIMATE_CNT+ID_CA_POSE_ANIMATE_OFFSET+ID_CA_POSE_ANIMATE_STRENGTH); LONG didValue = GvCall(od, GetMainID)(morphNode, GV_PORT_OUTPUT, id); GvPort *port = morphNode->AddPort(GV_PORT_OUTPUT, didValue, GV_PORT_FLAG_IS_VISIBLE, TRUE); nm->Message(MSG_UPDATE); EventAdd(); return true; }
-The Ghost
-
On 25/06/2015 at 02:41, xxxxxxxx wrote:
Hi Scott,
Thanks for your answer!
I have more or less the same code.
I did some testing with GePrint and found where the problem is.Int32 morphInID = GvCall(morphData, GetMainID) (morphNode, GV_PORT_INPUT, morphDescID);
This line does not store the inport ID :s
I have no problem with setting the morphData, morphNode or morphDescID, only the morphInID.Does somebody know what could be the problem here?
Maybe a moderator?Thanks in advance for your help and time!
With kind regards,
Casimir Smets -
On 01/07/2015 at 06:47, xxxxxxxx wrote:
Hi,
first things first:
Scott, I'm glad to see you again. Hope your life is getting better again.Now, for the question:
Casimir, did you see how Scott generates the DescID in his code? Did you change your code accordingly? -
On 01/07/2015 at 07:33, xxxxxxxx wrote:
Hi Andreas,
Well, I thought I did, but apparentally I was not paying quite the right attention.
Therefor, I'm really sorry!If I change it to Scott's way it works perfectly.
Thanks for your answers, both Scott and Andreas!!
With kind regards,
Casimir Smets