THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/10/2005 at 12:32, xxxxxxxx wrote:
Cinema 4D Version: 9
Platform: Windows ;
Language(s) : C.O.F.F.E.E ;
helloa people, i am new with coffee and plugins.
i know how to create a plugin that makes objects, and i know how to attach every object a Coffeetag and also other tags....
now i want to know how to create a new Material, say a simple Blue COLOR, and then tag that material to the Object, i dont see how to do this.
On 20/10/2005 at 16:22, xxxxxxxx wrote:
For materials, you need at least two things:
2. Texture Tag
Optionally, you may need polygon/point selections to which to restrict the Texture Tag's material application (Selection setting of the Texture tag in the A.M.).
The Texture Tag points to the Material, thus providing a link between the Object and the Material. The Material is used for specifying texturing properties. These are broken into Channels (such as Color, Diffusion, Bump, Luminance etc.).
First thing you'll need to do is create a Material and a Texture Tag, insert the Texture Tag into the Object, insert the Material into the Document, and make reference to the Material from the Texture Tag. Then you can set channels and their containers (something like this - untested) :
// obj is BaseObject to receive Texture Tag
if (!(document = obj->GetDocument())) return FALSE;
if (!(material = AllocMaterial(Mmaterial))) return FALSE;
if (!(texturetag = AllocTag(Ttexture))) return FALSE;
if (!obj->InsertTag(texturetag)) return FALSE;
if (!document->InsertMaterial(material)) return FALSE;
if (!(channel = material->GetChannel(CHANNEL_COLOR))) return FALSE;
if (!(container = channel->GetContainer())) return FALSE;
container->SetData(CH_COLOR, vector(1.0, 0.0, 0.0)); // Make the Color red
On 21/10/2005 at 00:15, xxxxxxxx wrote:
it works fine, now i can create materials.