Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    GV Node AddPort fail

    Cinema 4D SDK
    python r19
    3
    5
    1.1k
    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.
    • chuanzhenC
      chuanzhen
      last edited by

      This is my code,but it is not work

      def main():
          xp = op.GetTag(c4d.Texpresso)
          m = xp.GetNodeMaster()
          root = m.GetRoot()
          one = m.CreateNode(root,c4d.ID_OPERATOR_OBJECT)
          one[c4d.GV_OBJECT_OBJECT_ID] = op
          one.AddPort(c4d.GV_PORT_OUTPUT,c4d.GV_OBJECT_OPERATOR_OBJECT_OUT,message=True)
          c4d.EventAdd()
      

      image
      test.png

      Thanks for any help!

      相信我,可以的!

      1 Reply Last reply Reply Quote 1
      • I
        iluxa7k
        last edited by

        Hello
        Same here for python. Even check by AddPortIsOK(), says True, not adding

        I also test c++ code, it adds to object operator(like topic master wants) but does not to nodemaster and no connect

        {
            BaseDocument *doc = GetActiveDocument();
        
            BaseObject *obj = (BaseObject *) doc->GetActiveObject();
            if(!obj) return FALSE;
        
            XPressoTag *xTag = (XPressoTag*)obj->GetTag(Texpresso, 0);
            if(!xTag) return FALSE;
        
            GvNodeMaster *nm = xTag->GetNodeMaster(); 
        
            GvNode *n1 = nm->GetRoot();
            GvPort *p1;
            if (n1->AddPortIsOK(GV_PORT_OUTPUT,40000002))
            {
        	    p1 = n1->AddPort(GV_PORT_OUTPUT, 40000002, GV_PORT_FLAG_IS_VISIBLE, TRUE);
        	    print("True"); 
            }
            else
            {
        	    print("False"); 
            }
              
            GvPort *p3 = n1->AddPort(GV_PORT_OUTPUT, 536870935, GV_PORT_FLAG_IS_VISIBLE, TRUE);
            
            GvNode *n2 = nm->CreateNode(nm->GetRoot(), ID_OPERATOR_OBJECT, NULL, 0, 0);
            GvPort *p2 = n2->AddPort(GV_PORT_OUTPUT, 40000002, GV_PORT_FLAG_IS_VISIBLE, TRUE);
        
            if (p1 && p2)
            {
                GvNode *n1u = NULL;
                GvNode *n2u = NULL;
                GvPort *p1u = NULL;
                GvPort *p2u = NULL;
                if (nm->IsConnectionValid(n1, p1, n2, p2, n1u, p1u, n2u, p2u))
                {
                  n2->AddConnection(n1, p1, n2, p2);
                }
             }
            n1->Message(MSG_UPDATE);
            n2->Message(MSG_UPDATE);
            nm->Message(MSG_UPDATE);
        
            EventAdd();
        }
        
        1 Reply Last reply Reply Quote 1
        • M
          m_adam
          last edited by

          Hi this is a Python bug already reported see https://developers.maxon.net/forum/topic/11386/how-to-control-the-on-off-of-a-node-in-expresso/7

          Cheers,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          chuanzhenC 1 Reply Last reply Reply Quote 2
          • chuanzhenC
            chuanzhen @m_adam
            last edited by

            @m_adam Thanks,hope to be resolved in future versions!

            相信我,可以的!

            1 Reply Last reply Reply Quote 0
            • M
              m_adam
              last edited by m_adam

              This issue is now fixed in R21.

              Cheers,
              Maxime.

              MAXON SDK Specialist

              Development Blog, MAXON Registered Developer

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