PDA

View Full Version : Coffee/getShaderContainer question


Neotokyo
04-29-2007, 09:40 PM
Hi all! :)

While trying to write a little coffee-script, I stumbled across a coffee command that confuses me:

I'd like to copy every data from one channel to another inside the same material.
Getting the channel-container (bc = channel->GetContainer()) and copying it into another channel (channel2->SetContainer(bc)) works fine.
Even the BASECHANNEL_SHADERID, or rather the shader is placed right, but it's impossible for me to copy the shader-settings/attributes.
C4D_SDK 95 says, "bc = channel->GetShaderContainer()" returns the shader-settings, but this bc is empty.
I need the possibility to copy the settings of a shader (e.g. noise-parameters) from one channel to another. (I know the way to do that via copy/paste, but that's not what I'm looking for, I'd like to use the GetShaderContainer)


var mat1 = doc->FindMaterial("Mat.1");

var channel1 = mat1->GetChannel(CHANNEL_COLOR);
var shader_settings1 = channel1->GetShaderContainer(); //returns nothing?
var channel2 = mat1->GetChannel(CHANNEL_BUMP);
channel2->SetShaderContainer(shader_settings1);


Thanks
Nina

Darter
04-29-2007, 10:30 PM
The Color and Bump channels have different groups of settings. The only setting the two channels have in common is Texture. You can copy the Color channel texture to the Bump channel texture like this: mat1#MATERIAL_BUMP_SHADER = mat1#MATERIAL_COLOR_SHADER;

This can be done for any setting different channels have in common. Just drag the setting from the Material manager into the Script editor.

CGTalk Moderation
04-29-2007, 10:30 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.