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

    How do I return the connected port from the input port?

    Cinema 4D SDK
    sdk python r19 r20 r21
    5
    9
    1.6k
    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.
    • gheyretG
      gheyret
      last edited by

      Hi ~
      I want to get which port the node's input port connects to. and I try to use gvport.getdestination () in the Python SDK, but I find that the port has to be the output port to return properly, and if the port is the input port, it returns an empty list.
      Does anyone know how to return the connected port from the input port?

      Cheers~

      www.boghma.com

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        Hello,

        In C++ you would use GetIncomingSource but it's not implemented in python.

        So the only way is to check for each node in the same Xgroup if any of it's outgoing port is linked to your node.

        really not the best thing but that's the only workaround.

        Cheers,
        Manuel.

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • gheyretG
          gheyret
          last edited by

          All right. Thanks for your reply.
          Cheers~

          www.boghma.com

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by

            Hello,

            without feedback, i'll consider this thread as solved.

            Cheers,
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            • B
              bentraje
              last edited by

              Is this still a limitation or is there now a better workfaround for this?

              DunhouD 1 Reply Last reply Reply Quote 0
              • B bentraje referenced this topic on
              • M
                m_adam
                last edited by

                Hi I just implemented GetIncomingSource and GetIncomingDestination, they will be available in the next update of Cinema 4D.

                Cheers,
                Maxime.

                MAXON SDK Specialist

                Development Blog, MAXON Registered Developer

                1 Reply Last reply Reply Quote 0
                • DunhouD
                  Dunhou @bentraje
                  last edited by Dunhou

                  Hi @bentraje,
                  For a temp solution. it maybe stupid but can worked right now, it works with renderEngine libs, but you can easily custom with maxon and c4d api.

                  It also has some similar cousin:

                  • GetConnectedPortsAfter
                  • GetConnectedPortsBefore
                  • GetPreNodePorts
                  • GetNextNodePorts
                  • GetAllConnectedPorts

                  Hope it can helps.

                  Cheers~
                  DunHou.

                  Codes:

                  import c4d
                  from renderEngine import node_helper as nodeHelper
                  
                  def main() -> None:
                      material = doc.GetActiveMaterial()
                      helper = nodeHelper.NodeGraghHelper(material)
                      act_node: maxon.GraphNode = helper.GetActiveNodes()
                      if act_node:
                          for port in helper.GetConnectedPortsAfter(act_node):
                              print(port)
                  if __name__ == '__main__':
                      main()
                  

                  The Material and select the Standard BRDF

                  ded90361-946b-488b-b955-38ba8f40f6c9-image.png

                  Return

                  standardmaterial@TUGeQqzyIx5ijJlA7el82W>com.redshift3d.redshift4c4d.nodes.core.standardmaterial.outcolor
                  output@P0Ey0yEAFJror7c4Oew95V<com.redshift3d.redshift4c4d.node.output.surface
                  

                  https://boghma.com
                  https://github.com/DunHouGo

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

                    Hi @Dunhou in thsi case we are speaking about xpresso and not the new node, which already have this features with maxon.GraphModelHelper.GetDirectPredecessors.

                    But thanks a lot, this indeed looks useful !
                    Cheers,
                    Maxime.

                    MAXON SDK Specialist

                    Development Blog, MAXON Registered Developer

                    1 Reply Last reply Reply Quote 0
                    • B
                      bentraje
                      last edited by

                      @Dunhou
                      Thanks for the reference but yea I'm unfortunately using the xpresso here instead of the new node editor.
                      Which in all regards, an unfortunate scenario is xpresso is not integrated to the new node editor.

                      @m_adam
                      Gotcha. Thanks. Looking forward to the update.

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