Create Global Matrix port

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 23/09/2009 at 00:03, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   11.5 
Platform:      
Language(s) :

---------
Hi,

I want to create a global matrix port on an object node. Currently thats my code:

> \>             DescID cubeid = DescID(DescLevel(GV_OBJECT_OPERATOR_GLOBAL_OUT)); \>             portID =     GvCall(ot->GetOperatorData(), GetMainID)(ot, GV_PORT_OUTPUT, cubeid); \>             if(portID==NOTOK) return FALSE; \>              \>             Bool ok = ot->AddPortIsOK(GV_PORT_INPUT, portID); \>             if(ok==FALSE) return FALSE; \>

I use the constans of the file: gvoperator.h
But nothing happens. Is this the correct way?

Thanks for your help.

Cheers, Shawni

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 29/09/2009 at 02:53, xxxxxxxx wrote:

You just pass the port ID to AddPortIsOK and AddPort.

Example:

> \> if (node->AddPortIsOK(GV_PORT_INPUT, GV_OBJECT_OPERATOR_GLOBAL_IN)) \> { \>      GvPort \*port = NULL; \>      port = node->AddPort(GV_PORT_INPUT, GV_OBJECT_OPERATOR_GLOBAL_IN, GV_PORT_FLAG_IS_VISIBLE, TRUE); \> \>      if (port) \>      { \>           //do something \>      } \> } \>

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 29/09/2009 at 03:46, xxxxxxxx wrote:

Hi Matthias,

yes, this works fine (I tested yesterday). The problem is, that AddPort just takes a LONG value so a real DescID element is not possible ( to create a Position.X port). So I tried to merge these cases. GvCall just returns 0 on a global matrix, but works fine when I just pass a DescID element which points to a Subchannel Port (like Vector.x)

> <code>
> #define GvCall(op,fnc) (((GvOperatorData* )op)->*((OPERATORPLUGIN* )C4DOS.Bl->RetrieveTableX((NodeData* )op,1))->fnc)
> //I found this definition on plugincafe
> /* .code.*/
>
> DescID passedID = PyObject2DescID(id, ok); //convert my list [id, id, id] to a DescID element
>
> switch(io)
> {
>     case GV_PORT_INPUT:
>     {
>         LONG portID = GvCall(ot->GetOperatorData(), GetMainID)(ot, GV_PORT_INPUT, passedID);
>         if(portID==0) { // is not 0 if I pass a Vector.x Port DescID   [POSITION, POSITION_X]
>             portID = passedID[0].id; //otherwise just pass the ID, it might work 🙂
>         }
>        
>         Bool ok = ot->AddPortIsOK(GV_PORT_INPUT, portID);
>         if(ok==FALSE) return None;
>        
>         GvPort *port = ot->AddPort(GV_PORT_INPUT, portID, (GvPortFlags)flag, message);
>         /*..*/
>         break;
>     }
> </code>

Just subports like ports of the Math Node doesnt work yet, but this is another problem I have to check. This is just a "stupid" workaround, but it seems to work. Do you think thats still ok?

Cheers, Sebastian