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

    Object GetNext() method does not advance to next object

    Cinema 4D SDK
    3
    3
    534
    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.
    • N
      nicholas_yue
      last edited by

      We are using Arnold with C4D

      While iterating the scene, we have found that one of the node (create via the ArnoldtoC4D plugin), the GetNext() method does not return the next object but itself, this resulted in an infinite loop iterating the scene.

      Since we are now sitting between two different vendors, I am trying to narrow it down to who I need to follow up with regarding this issue.

      
      >>> doc = c4d.documents.GetActiveDocument()
      >>> obj = doc.GetFirstObject()
      >>> print(obj)
      <c4d.BaseObject object called 'Arnold distant_light/Arnold Light' with ID 1030424 at 0x0000027ACD423D10>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423AD0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423FB0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423DF0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423AD0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423FB0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423DF0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423AD0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423FB0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423DF0>
      >>> obj.GetNext()
      <c4d.BaseObject object called '<display driver>/Arnold Driver' with ID 1030141 at 0x0000027ACD423AD0>
      >>> 
      

      Cheers

      1 Reply Last reply Reply Quote 0
      • CairynC
        Cairyn
        last edited by

        The line obj.GetNext() only returns the next object, but you don't assign it again... so obj stays at the same object forever. Try obj = obj.GetNext().

        1 Reply Last reply Reply Quote 0
        • ferdinandF
          ferdinand
          last edited by ferdinand

          Hi @nicholas_yue,

          @Cairyn said everything (thanks for that). I would additionally recommend to read the Wikipedia article on graph traversal I have posted in your other thread, as it might clear up a few things for you.

          Cheers,
          Ferdinand

          MAXON SDK Specialist
          developers.maxon.net

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