Activate/Deactivate Material Channel

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

On 26/03/2008 at 04:51, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   10.111 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
Hi all.

I want to generate a material and switch off the specular channel which is on by default. How can I do that?

> \> BaseContainer \*cont= mat->GetDataInstance(); \> cont->SetLong(MATERIAL_USE_SPECULAR, 0); \> mat->Message(MSG_UPDATE); \> EventAdd(); \>

The above code does not work, no matter if I use SetLong or Set Bool. When I print the IDs from that container
using cont->GetIndexId() the ID 2009 (MATERIAL_USE_SPECULAR) does not exist.
Any ideas? Thanks in advance...

Yakuza

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

On 26/03/2008 at 05:18, xxxxxxxx wrote:

Try this:

> mat->SetChannelState(CHANNEL_SPECULAR, FALSE);

Oh, and if you want to change parameters of materials:

> BaseContainer matData = mat->GetData();
> matData.SetReal(MATERIAL_TRANSPARENCY_REFRACTION, 1.56);
> mat->SetData(matData,TRUE);
>
> mMat->Update(TRUE,TRUE);      //UPDATE THUMBNAIL
> mMat->Message(MSG_UPDATE);

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

On 26/03/2008 at 05:35, xxxxxxxx wrote:

omg, that's simple 🙂
i didn't find this in the documentation because i only looked in BaseMaterial and Channel 😕

thank you very much!

Yakuza

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

On 19/01/2009 at 08:59, xxxxxxxx wrote:

i tried using:

mat->SetchannelState(channel_SPECULAR, FALSE); but got the following

error C2039: 'SetChannelState' : is not a member of 'BaseMaterial'

it would appear by yakuza's most recent statement that it is? how can one deactivate the specular?

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

On 19/01/2009 at 10:31, xxxxxxxx wrote:

The 'mMaterial' is of type Material which is a subclass of BaseMaterial. So *downcast* it(if possible and allowed) and try it again.

If yu take a look at the SDK Documentation, you see that GetChannelState is just a member of Material and not of BaseMaterial.

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

On 19/01/2009 at 16:12, xxxxxxxx wrote:

it seems a little unintuitive for something that affects materials to not be readily available within BaseMaterial. i will look into downcasting, if possible.

does anyone else have another alternative?

thanks, shawni

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

On 19/01/2009 at 16:37, xxxxxxxx wrote:

It is not unintuitive at all. A plugin material for instance can have a completly different structure than Cinema's standard material. In case of a plugin material you work with the material's description elements directly.

cheers,
Matthias

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

On 19/01/2009 at 16:59, xxxxxxxx wrote:

stand corrected.