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

    Connect 2 output ports of xpresso [CLOSED]

    Scheduled Pinned Locked Moved PYTHON Development
    19 Posts 0 Posters 1.7k 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

      On 03/07/2015 at 22:08, xxxxxxxx wrote:

      Hello
      I have xpresso setup:

      • root - node, which is xgroup and has 2 output ports
      • new node -  node, which has 1 output port
        I tried to connect them (one output of root and one output of new node) but there is not success.

      I understand that need INPUT + OUTPUT ports, but how can be with 2 outputs by code?
      Manually we can make such connection.

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

        On 04/07/2015 at 10:45, xxxxxxxx wrote:

        Again me
        Sample code, execute at any c4d object, problem that ports do not connect (24 pos./line) :

        import c4d  
          
        def main() :  
          global vecoutp  
          obj = doc.GetActiveObject()  
          tag = doc.GetActiveTag()  
          if not tag:  
              tag = c4d.BaseTag(c4d.Texpresso)  
              obj.InsertTag(tag)  
                
          nm = tag.GetNodeMaster()  
          xg = nm.GetRoot()  
          print "pass 1"  
          for i in xrange(xg.GetOutPortCount()) :  
              port = xg.GetOutPort(i)  
              print port, port.GetName(xg), port.GetMainID()  
                
          bbox = nm.CreateNode(nm.GetRoot(),c4d.ID_OPERATOR_BOX,None, 0, 0)  
          nm.InsertFirst(xg, bbox)  
            
          if not xg.GetOutPort(0) :  
              vecoutp = xg.AddPort(c4d.GV_PORT_OUTPUT, 536870935)         
                
          c = vecoutp.Connect(bbox.GetOutPort(0)) # <<<<< not connect  
          print vecoutp, vecoutp.GetName(xg), vecoutp.GetMainID()  
          print bbox.GetOutPort(0), bbox.GetOutPort(0).GetName(bbox), bbox.GetOutPort(0).GetMainID()  
          print c  
            
          print "pass 2"  
            
          for i in xrange(xg.GetOutPortCount()) :  
                
              port = xg.GetOutPort(i)  
              print port, port.GetName(xg), port.GetMainID()  
                
          xg.Redraw()  
          nm.Message(c4d.MSG_UPDATE)      
          c4d.EventAdd()  
            
          
        if __name__=='__main__':  
          main()
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 05/07/2015 at 23:31, xxxxxxxx wrote:

          Has python for c4d such limit now? Or possible to do another way?!

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

            On 06/07/2015 at 05:09, xxxxxxxx wrote:

            Nodes are laying in same nodemaster

            `

            GvPort.Connect`( _port_ )
             **Note Remember, the nodes of the ports have to be in the same` GvNodeMaster`, otherwise the connection fails.**
            

            Also i trying to make clone of tag/Nodemaster and do versa - fails

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

              On 06/07/2015 at 07:20, xxxxxxxx wrote:

              Hi Ilya,

              I'm afraid, this currently a limitation in Python. As you need to connect two out-ports inside the Xgroup, this does currently not work (same for the input side as well).
              I'm currently checking with development, if there are workarounds.

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

                On 06/07/2015 at 07:29, xxxxxxxx wrote:

                Hello Andreas
                Thank you! I will wait.
                I also will test such code with c++ port. Maybe need to port code to CAPI if will be success

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

                  On 06/07/2015 at 11:26, xxxxxxxx wrote:

                  I test this CAPI snippet(write and execute at Remo c4d++ platform)

                  There is interesting, it marks ports(arrows) but not show connections

                    
                  {  
                    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 = n1->AddPort(GV_PORT_OUTPUT, 536870935, GV_PORT_FLAG_IS_VISIBLE, TRUE);  
                    
                    GvNode *n2 = nm->CreateNode(nm->GetRoot(), ID_OPERATOR_BOX, NULL, 0, 0);  
                    GvPort *p2 = n2->GetOutPort(0);  
                    
                        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);  
                        }  
                        }  
                    
                    nm->Message(MSG_UPDATE);  
                    
                    EventAdd();  
                  }  
                  


                  http://oi61.tinypic.com/xmvhbk.jpg

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

                    On 07/07/2015 at 02:03, xxxxxxxx wrote:

                    Ok, found one method, i will make connected samples and store at HD or c4d content.

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

                      On 08/07/2015 at 01:01, xxxxxxxx wrote:

                      Hi
                      A few things are not as expected, so i remove flag solved at topic.

                      Andreas, any info about to break limit?

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

                        On 08/07/2015 at 01:34, xxxxxxxx wrote:

                        Hi Ilya,

                        actually I didn't mark this thread as solved, as I had no answer from the devs. Today it was acknowledged as a limitation. It is currently not possible to connect an output of a node to an output of the parent Xgroup in Python (same for input nodes). Unfortunately there seems to be no workaround. Sorry.

                        Regarding your C++ code and the missing connection. I think, you need to call AddConnection() for the other node involved. See this thread.

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

                          On 08/07/2015 at 02:01, xxxxxxxx wrote:

                          Originally posted by xxxxxxxx

                          Hi Ilya,

                          actually I didn't mark this thread as solved, as I had no answer from the devs. Today it was acknowledged as a limitation. It is currently not possible to connect an output of a node to an output of the parent Xgroup in Python (same for input nodes). Unfortunately there seems to be no workaround. Sorry.

                          Regarding your C++ code and the missing connection. I think, you need to call AddConnection() for the other node involved. See this thread.

                          I add tag to name of topic, thinking it was resolved.

                          I don't understand one thing in py-sdk, why need such checking - GvNode.IsGroupNode

                          About c++ snippet, i tried different ways and same result.

                          Also if it will be (x)group why need this https://developers.maxon.net/docs/Cinema4DCPPSDK/html/group___g_v___g_r_o_u_p.html

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

                            On 08/07/2015 at 13:05, xxxxxxxx wrote:

                            Andreas, you are right!!!
                            I did it by c++, i don't know what was wrong. After restarting of machine - it worked! (caches or anything else prevent it)

                            i change

                            n2->AddConnection(n1, p1, n2, p2);
                            

                            to

                            n1->AddConnection(n1, p1, n2, p2);
                            

                            i move to c++(maybe S.Rath will bring light to py-code). Solved. Thank you

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

                              On 09/07/2015 at 05:17, xxxxxxxx wrote:

                              Hi Ilya,

                              glad it worked in C++.
                              The developer feedback I talked about yesterday came from S. Rath. I'm afraid you will have to wait for a fix in C4D for this to work in Python.

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

                                On 09/07/2015 at 05:35, xxxxxxxx wrote:

                                Thanks a'lot.

                                The developer feedback I talked about yesterday came from S. Rath. I'm afraid you will have to wait for a fix in C4D for this to work in Python.

                                R17? or will be sp4 for r16?

                                Anyway, please, close topic. I will port stuff to c++

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

                                  On 28/07/2015 at 07:25, xxxxxxxx wrote:

                                  Sorry that remind
                                  Have you fixed this issue in 16.051 patch?

                                  upd.
                                  🤢 seems not
                                  it cover several mysterious issue of nvdia 😠

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

                                    On 28/07/2015 at 07:48, xxxxxxxx wrote:

                                    Hi Ilya,

                                    you seem to have found out yourself. I would have left a note here, if the SP fixed this bug. Internally this bug has been addressed, but it was to late to get into the 16.051 update.

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

                                      On 28/07/2015 at 07:58, xxxxxxxx wrote:

                                      Anyway thanks.
                                      I see that developers back to work from vacation* 😉. If we got fix.

                                      * - You or someone from team pointed at this fact

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

                                        On 03/11/2015 at 07:48, xxxxxxxx wrote:

                                        This problem should be fixed in R17.

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

                                          On 03/11/2015 at 08:14, xxxxxxxx wrote:

                                          Originally posted by xxxxxxxx

                                          This problem should be fixed in R17.

                                          Hello
                                          I forgot about this - i'm checking out of it > that's great - it works! Thanks a'lot 👏👍
                                          (please, do not brake it)😉

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