THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/10/2008 at 08:11, xxxxxxxx wrote:
Check for the layer type and get the link to the shader with layer->GetParameter(LAYER_S_PARAM_SHADER_LINK, d). See code below for an example.
> \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \> StopAllThreads(); \> \> BaseMaterial \*mat = NULL; \> mat = doc->GetFirstMaterial(); \> if(!mat) return TRUE; \> \> BaseChannel \*chn = NULL; \> chn = mat->GetChannel(CHANNEL_COLOR); \> if(!chn) return TRUE; \> \> PluginShader \*shd = NULL; \> shd = chn->GetShader(); \> if(!shd) return TRUE; \> \> if(shd->GetType() == Xlayer) \> { \> LayerShader \*lshd = (LayerShader\* )shd; \> LayerShaderLayer \*layer = NULL; \> layer = lshd->GetFirstLayer(); \> while(layer) \> { \> if(layer->GetType() == TypeShader) \> { \> GeData d; \> if(!layer->GetParameter(LAYER_S\_PARAM_SHADER_LINK, d)) continue; \> BaseLink \*shdlink = NULL; \> shdlink = (BaseLink\* )d.GetVoid(); \> if(!shdlink) continue; \> BaseContainer \*data = shdlink->GetLink(doc, Xbase)->GetDataInstance(); \> //shdlink->GetLink() is the shader and data is the shader's container \> } \> layer = layer->GetNext(); \> } \> } \> \> return TRUE; \> } \>
cheers,
Matthias