GV Node AddPort fail



  • 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!



  • 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();
    }
    


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

    Cheers,
    Maxime.



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



  • This issue is now fixed in R21.

    Cheers,
    Maxime.


Log in to reply