Get Shader channel



  • 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



  • 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



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


Log in to reply