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

    How to copy channels with shaders?

    Scheduled Pinned Locked Moved SDK Help
    11 Posts 0 Posters 1.0k 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 10/12/2004 at 05:06, xxxxxxxx wrote:

      I found out that I used the wrong document with AliasTrans Init command, so the first part of my question is solved now 🙂

      Could someone please shed some light on how to copy individual channels (including shaders or textures) to another material?

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 10/12/2004 at 07:14, xxxxxxxx wrote:

        Hi,

        channels should be cloneable too as GetClone() is in the baseclass Atom. You can use an aliastranslator also here. Even easier would even be to use CopyTo() 🙂

        HTH

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 10/12/2004 at 08:14, xxxxxxxx wrote:

          Hi Katachi,
          I already tried this, but it doesn't seem to work (nothing happens with CopyTo(), still have to check GetClone()).
          Here is a simplified copy of the script:

            
          AutoAlloc <AliasTrans> trans;  
          if (trans->Init(doc))  
          {  
          channel1=mat1->GetChannel(CHANNEL_COLOR);  
          channel2=mat2->GetChannel(CHANNEL_COLOR);  
          mat1->CopyTo(mat2, 0, trans);  
          trans->Translate(TRUE);       
          EventAdd();  
          }  
          

          This does nothing. Am I missing something obvious?
          GetClone works fine for the whole material though.
          Meanwhie I found a brute force way to do it with GetShader() and InsertUnder() combinations. Thought it would be easier 🙂

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 11/12/2004 at 06:41, xxxxxxxx wrote:

            Hmm, I haven´t tried it yet but maybe replace the 0 with NULL instead

            mat1->CopyTo(mat2, NULL, trans);

            You should also send a message to the material to notify it of the changes. But otherwise it looks correct to me. 😕

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 11/12/2004 at 09:32, xxxxxxxx wrote:

              No! The second argument is 'LONG flags'. Even if NULL is defined as 0, the argument still should be 0 to avoid confusion - this is not a memory reference.

              Robert

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 11/12/2004 at 09:49, xxxxxxxx wrote:

                What if the Flag COPY_NO_HIERARCHY is defined as 0? And if he passes 0 then the shaders which are children of the BaseChannel might not be copied. If it isn´t defined as 0 then this makes no difference and passing 0 is ok.

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 11/12/2004 at 10:16, xxxxxxxx wrote:

                  Luckily, none of the flags are defined as 0. 🙂

                  I'm a strong believer in defining even the 'nothing' flag such that:

                  #define COPY_UNUSED 0

                  would be part of my list of flag definitions, for instance.

                  Robert

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 11/12/2004 at 10:36, xxxxxxxx wrote:

                    ah ok, yes, I would add my vote for such a flag then. This would surely erase such confusions. 🙂

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

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 13/12/2004 at 06:14, xxxxxxxx wrote:

                      Thank you all for your input so far. I have it working now.
                      Can someone point me to the right direction where the Illumination settings of a material are stored (such as amount of generated GI, shading type, quality of loaded textures etc.)?
                      I cannot find anything about this in the SDK. Only those channels are documented that can be switched on and off via SetChannelState().

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

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 13/12/2004 at 06:41, xxxxxxxx wrote:

                        Ah, ok, found it in Mmaterial.h.

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