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

    Get Shader channel

    SDK Help
    0
    3
    416
    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
      Helper
      last edited by

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

      On 28/05/2003 at 10:46, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   8.100 
      Platform:      Mac OSX  ; 
      Language(s) :   C.O.F.F.E.E  ;  C++  ;

      ---------
      Hello,
      I am having difficulties to get the material channel that my shader is loaded to. I found this script from Mikael here in the forum, but it will only give the right channel id when the shader is used on the first level.

      LONG GetShaderChannel(PluginShader* s)
      {
       if (!s) return CHANNEL_ANY;

      GeListHead* h = s->GetListHead();
       if (!h) return CHANNEL_ANY;

      Material* m = static_cast<Material*>(h->GetParent());
       if (!m || m->GetType() != Mmaterial) return CHANNEL_ANY;

      for (int c = 0; c < MAXCHANNELS; ++c)
       {
        BaseChannel* chn = m->GetChannel(c);
        if (!chn) continue;

      if (chn->GetShader() == s)
        {
         return c;
        }
       }
       
       return CHANNEL_ANY;
      }

      Using SLA shader trees and using the plugin shader somewhere in there makes it impossible to find out the right material channel the shader is used in. Any ideas?
      Regards,
      Arndt

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

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

        On 28/05/2003 at 12:22, xxxxxxxx wrote:

        I had a message in v2.0-2.1 but removed it from 2.5. Unless MAXON added a message I do not believe there is a way ( I could always be wrong ). You might want to request that from the SDK guys.

        Best Regards,
        bt

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

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

          On 01/06/2003 at 10:33, xxxxxxxx wrote:

          Sorry, but the limitations of the hack cannot currently be overcome.

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