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