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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Selection-Status of RenderData

    Cinema 4D SDK
    2
    6
    686
    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.
    • lasselauchL
      lasselauch
      last edited by lasselauch

      Hi all,

      I'm looking for a way to detect the selected not active RenderData via python, but had no luck.
      Any ideas?! Isn't that possible?

      def main():
          rdata = doc.GetFirstRenderData()
          while rdata:
      	   print rdata.GetBit(c4d.BIT_ACTIVERENDERDATA)
      	   print rdata.GetBit(c4d.BITACTIVE)
      
      	   rdata = rdata.GetNext()
      
      if __name__=='__main__':
          main()
      

      Cheers,
      Lasse

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

        hello,

        you can check the bits using the mask '8'
        we don't have any variable set for that value, so be aware, this "magic number" could change in the future.

        import c4d
        # Welcome to the world of Python
        
        # Check if the render settint are selected and print the result
        
        
        def GetNextRenderSetting( rs ):
            # Retrieves the next node avaiable
            if rs is None:
                return None
            if rs.GetDown() is not None:
                return rs.GetDown()
            while rs.GetNext() is None and rs.GetUp() is not None:
                rs = rs.GetUp()
            return rs.GetNext()
        
        
        
        
        def main():
            # Retrieves the first Render Data
            rdata = doc.GetFirstRenderData()
            
            while rdata:
                # Checks the bits to see if the render data setting is selected.
                # This magic number may changes in a futur release.
                print rdata.GetBit(8)
                
                # retrieves the next render setting without using a recursive method
                rdata = GetNextRenderSetting(rdata)
        
        # Execute main()
        if __name__=='__main__':
            main()
        

        Cheers
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        lasselauchL 1 Reply Last reply Reply Quote 2
        • lasselauchL
          lasselauch @Manuel
          last edited by

          Interesting @m_magalhaes !

          Can I ask how you found out about this number? Is there any way for us to find this of our own..?

          Thanks & Cheers,
          Lasse

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

            @lasselauch said in Selection-Status of RenderData:

            how you found out about this number?

            First, @s_bach found it and told me about this number.

            In the source file, there's this code.

            #define RENDERSETTINGS_BIT_SELECTED		(1 << 3)
            

            As it's not exposed, you can't use RENDERSETTINGS_BIT_SELECTED, only the value : 8

            Cheers
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

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

              hello,

              this thread will be considered as Solved tomorrow is you have nothing to add.

              Cheers
              Manuel

              MAXON SDK Specialist

              MAXON Registered Developer

              lasselauchL 1 Reply Last reply Reply Quote 0
              • lasselauchL
                lasselauch @Manuel
                last edited by

                @m_magalhaes 👏 👍

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