Error creating a new material with Alloc

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

On 16/01/2008 at 09:16, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   10.5 
Platform:      Mac OSX  ; 
Language(s) :     C++  ;

---------
OK, here it is. My first C++ question :)

I want to create a new material. Isn't this done with:

> BaseMaterial *mat = Alloc(Mmaterial);

I get a compiler error:

> error: 'Alloc' was not declared in this scope

Anyone?

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

On 16/01/2008 at 10:22, xxxxxxxx wrote:

Hello,

better to use
BaseMaterial *mat = BaseMaterial::Alloc(Mbase);

Cheers
Renato

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

On 16/01/2008 at 10:24, xxxxxxxx wrote:

BaseMaterial* mat = BaseMaterial::Alloc(Mmaterial);

There is no generic Alloc() method. Use the static Alloc() associated with the class type.

X-post. :)

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

On 16/01/2008 at 11:51, xxxxxxxx wrote:

OK, I'm now trying to use this new material, called 'mat' and assign it to a TextureTag. Like this:

> BaseContainer *container = tag- >GetDataInstance();
> container->SetData(TEXTURETAG_MATERIAL, mat);

I get a new compiler error:

> error: conversion from 'BaseMaterial*' to 'const GeData' is ambiguous

What does this mean? Should work like this, no?

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

On 16/01/2008 at 12:44, xxxxxxxx wrote:

((TextureTag* )tag)->SetMaterial(material);

Seems easy enough. :)

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

On 16/01/2008 at 14:28, xxxxxxxx wrote:

Hm, I think this is easy enough. But what if I really really wanted to use containers for this? :)

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

On 16/01/2008 at 15:21, xxxxxxxx wrote:

You could try:

container->SetLink(TEXTURETAG_MATERIAL, mat);

or

container->SetData(TEXTURETAG_MATERIAL, GeData(mat));

but I can't guarantee that these work. :)

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

On 21/01/2008 at 02:12, xxxxxxxx wrote:

Check the example below if you really want to use a container.

> _
> AutoAlloc <BaseLink> link;
> if(!link) return FALSE;
>
> link->SetLink(mat); //mat is my Basematerial
>
> GeData d(link);
>      ttag->SetParameter(DescLevel(TEXTURETAG_MATERIAL),d,NULL);
> _

cheers,
Matthias