Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Create Global Matrix port

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 266 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post