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

    Cloning a shader [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 541 Views
    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.
    • H Offline
      Helper
      last edited by

      On 04/03/2015 at 02:00, xxxxxxxx wrote:

      I have a material from which I want to copy a shader to a tag with a texture field.
      So I get the material, get the shader, clone it and copy it to the tag texture field.

      This does not work

          cloneShd = mat1[c4d.MATERIAL_COLOR_SHADER]
          shd = cloneShd.GetClone()
      

      When I do not use a clone it works!

          shd = mat1[c4d.MATERIAL_COLOR_SHADER]
      

      What am I doing wrong here?

      -Pim

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 04/03/2015 at 02:13, xxxxxxxx wrote:

        Have you inserted the clone into the tag using BaseList2D.InsertShader()?

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 04/03/2015 at 06:14, xxxxxxxx wrote:

          Originally posted by xxxxxxxx

          Have you inserted the clone into the tag using BaseList2D.InsertShader()?

          No, I use it in a VRay tag to set the texture.

          tag[c4d.VRAYLIGHTTAG_AREA_RECT_TEX] = shd
          

          Without the clone it works fine. Using a clone, the texture does not seem to be filled.

          -Pim

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 04/03/2015 at 06:34, xxxxxxxx wrote:

            You have to insert it, else it won't have any connection to the document.

              
            shd = mat1[c4d.MATERIAL_COLOR_SHADER].GetClone()   
            tag.InsertShader(shd)   
            tag[c4d.VRAYLIGHTTAG_AREA_RECT_TEX] = shd   
            
            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 04/03/2015 at 08:27, xxxxxxxx wrote:

              Strange things are happening with this post.

              On my  mobile I received a message that a post was added by Yannick saying:

              "This is a limitation of the python api.
              For such situations the c++ api provides the "AliasTrans" class but the python api does not implement this classand c4datom.getclone() misses the AliasTrans parameter."

              Did I quote you correctly Yannick?

              -Pim

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 04/03/2015 at 08:36, xxxxxxxx wrote:

                Originally posted by xxxxxxxx

                You have to insert it, else it won't have any connection to the document.

                 
                shd = mat1[c4d.MATERIAL_COLOR_SHADER].GetClone()   
                tag.InsertShader(shd)   
                tag[c4d.VRAYLIGHTTAG_AREA_RECT_TEX] = shd   
                

                Great, it is working now.
                I guess when I use the original it is already inserted (somewhere?) and the clone is still to be inserted.

                -Pim

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  On 04/03/2015 at 08:44, xxxxxxxx wrote:

                  Exactly the shader you create a clone of has already been inserted into the material.

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