Selection-Status of RenderData



  • 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



  • 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



  • 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



  • @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



  • hello,

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

    Cheers
    Manuel




Log in to reply