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

    Enabling Team Render in Render Queue

    Cinema 4D SDK
    s24 python
    3
    4
    797
    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.
    • .
      .del
      last edited by

      Hi- I have a python script that adds projects to the render queue successfully but now I'd like to be able to enable the Team Render option for them. After reviewing the documentation I felt like BatchRender.SetUseNet(self, n, on) was going to be the answer but I havn't been able to get it to work.

      In the main body of the script I set dBatch = c4d.documents.GetBatchRender().
      Later in the script I call batchRender definition.

      def batchRender(dFilePath, objName):
          dBatchCount = dBatch.GetElementCount() #number of items already in the batch render
          dBatchCount += 1
          dBatch.AddFile(dFilePath +"/" + objName + ".c4d", dBatchCount)
          ####enable Team Render for item
          dBatch.SetUseNet(dBatchCount,True)
      
      

      The script doesn't return any errors but the Team Render box is never activated.

      c73ee49b-3898-4e8e-9d52-88713b6560af-image.png

      Any insight is appreciated.

      Thanks,
      .del

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

        Hi,

        For now, it look more like a bug. I need to figure out why before creating a bug entry.
        I found out that if you add the files first and after in another loop enable them to use teamrender, it works a lot better.

        Could you please check if it could fix your issue?

        for index, file in enumerate(c4dFiles):
                   br.AddFile(file, br.GetElementCount())
           
               for index in range(0, br.GetElementCount()):        
                   br.SetUseNet(index, True)
        

        cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • .
          .del
          last edited by

          Thanks Manuel. I was able to work that concept into the overall script.

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

            (Yes, I notice that the thread has been closed, and marked as solved, and I probably shouldn't barge in, but it seems the original script error has never been addressed, so I must mansplain because that's the obnoxious guy I am.)

            Two points:

            1. The error in the script above is that the index used in SetUseNet is wrong.
              The indices in the BatchRender element list begin at 0, so the first valid index is 0, and the last is GetElementCount()-1.
              dBatchCount starts as GetElementCount(), which is fine as counter, but as an index, it is the first unused index.
              Then this counter is increased += 1, so now it is the second unused index after the list.
              When AddFile is called with that index, it simply adds the file as last element because it cannot leave empty gaps in the list. It returns True although it didn't use the desired index - it used index-1.
              Now SetUseNet is called with the same index. The reason it fails is that this index is not the index that AddFile actually used. This index is not even valid. There is no element with that index. So, nothing happens.
              If you use dBatchCount-1 as index at this point, or simply never increase dBatchCount in the first place, the script works fine.

            2. The actual API error is that SetUseNet does not raise an IndexError as the docs claim.
              (Other methods like GetElementStatus do.)

            Okay, I go annoy someone else now.

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