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
    • Register
    • Register
    • Login

    Setting texture path to a RS Domelight with python

    Cinema 4D SDK
    r25 python
    3
    2
    788
    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.
    • R
      Ryan_Territory
      last edited by ferdinand

      Hey!

      So for context I'm busy with my first cinema integration plugin, its a multi DCC app that i already have working with Houdini/Maya.

      I'm trying to create a dome light, adjust some parameters and link the hdr texture file to the texture input.

      Seem to be having a hard time trying to find an API reference or examples of this being done and script log doesn't seem to help much with this as it only responds with the command 'c4d.REDSHIFT_LIGHT_DOME_TEX0' which cant take a string.

      If anyone can help point me in the right direction would be much appreciated.

      Iv stripped a script down to absolutely bare bones for an example:

      import c4d
      
      
      def main():
          
          doc = c4d.documents.GetActiveDocument()
          hdri_path = ''
          
          # Create Light
          light = c4d.BaseObject(1036751)
             
          # Set the attributes
          light[c4d.REDSHIFT_LIGHT_TYPE] = 4
          
          # Set Texture
          #light[c4d.REDSHIFT_LIGHT_DOME_TEX0] = hdri_path
          #c4d.REDSHIFT_LIGHT_DOME_TEX0
       
          # Insert the light into the scene
          doc.InsertObject(light)
      
      
      if __name__=='__main__':
          main()
          c4d.EventAdd()
      
      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @Ryan_Territory
        last edited by ferdinand

        Hello @Ryan_Territory,

        Welcome to the Plugin Café forum and the Cinema 4D development community, it is great to have you with us!

        Getting Started

        Before creating your next postings, we would recommend making yourself accustomed with our Forum and Support Guidelines, as they line out details about the Maxon SDK Group support procedures. Of special importance are:

        • Support Procedures: Scope of Support: Lines out the things we will do and what we will not do.
        • Support Procedures: Confidential Data: Most questions should be accompanied by code but code cannot always be shared publicly. This section explains how to share code confidentially with Maxon.
        • Forum Structure and Features: Lines out how the forum works.
        • Structure of a Question: Lines out how to ask a good technical question. It is not mandatory to follow this exactly, but you should follow the idea of keeping things short and mentioning your primary question in a clear manner.

        About your First Question

        This exact question of yours has been asked before here for C++. Find a Python variant of the code below. For the technical details, I would recommend reading the older thread.

        Cheers,
        Ferdinand

        Result:
        557e9ddd-793a-4d07-aa6e-5ffd7ad05687-image.png

        Code:

        import c4d
        
        # Define #Orslight, only must be done in pre 2023.0 API versions.
        c4d.Orslight: int = 1036751
        
        
        def main():
            
            doc = c4d.documents.GetActiveDocument()
            
            # Create Light
            light = c4d.BaseObject(c4d.Orslight)
               
            # Set the attributes
            light[c4d.REDSHIFT_LIGHT_TYPE] = c4d.REDSHIFT_LIGHT_TYPE_DOME
            
            # Define the texture parameter ID.
            texturePathId: c4d.DescID = c4d.DescID(
            # 1st DescLevel for the outer unexposed datatype of "Texture".
            c4d.DescLevel(
              c4d.REDSHIFT_LIGHT_DOME_TEX0, # The parameter ID (12000) for "Texture"
              1036765,                      # The datatype ID for for "Texture", this type is not exposed, 
                                            # we must use the raw ID.
              c4d.Orslight                  # The creator ID, Orslight in this case.
            ),
            # 2nd DescLevel for the inner exposed datatype of "Texture.Path". 
            c4d.DescLevel(
              c4d.REDSHIFT_FILE_PATH,       # The sub-channel parameter ID (1000) for "Texture.Path"
              c4d.DTYPE_STRING,             # The data type ID of this component, string in this case.
              0                             # The creator ID, I just went with undefined here.
            ))
        
            light[texturePathId] = "asset:///file_c622e9ad3ea0e159"
         
            # Insert the light into the scene
            doc.InsertObject(light)
            c4d.EventAdd()
        
        
        if __name__=='__main__':
            main()
        

        MAXON SDK Specialist
        developers.maxon.net

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