Problem: tag->GetMaterial()->GetName();

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

On 16/01/2007 at 01:38, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   9.6 
Platform:   Windows  ;   
Language(s) :   C.O.F.F.E.E  ;

---------
Hi, All!
I the beginner in programming on C.O.F.F.E.E. I have faced a problem.
I need to choose the first object to which the concrete material is appropriated.

In COFFEE SDK:
   1. texture tag have a fuction GetMaterial();
   2. material have a function GetName();
   
Why next code don't work:

  
    main(doc,op)  
    {  
    var tag0=op->GetFirstTag();  
     if (!tag0) {println("No Tags!"); return FALSE;}  
     while (tag0->GetType()!= TAG_TEXTURE)  
      {  
       tag0=tag0->GetNext();  
       if (!tag0) return FALSE;  
      }  
   var MatName=tag0->GetMaterial()->GetName();  
   println(MatName);  
    }     

In result: Member not found

🙂

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

On 16/01/2007 at 04:00, xxxxxxxx wrote:

ãûûûû
ñìàðè
> >>[Marker] GetMaterial();
>>>Returns the marker of the current material.r
òîåñòü òà ôóíêöèÿ âîçâðàùàåò íå ìàòåðèàë, à êàêîéòî ñöóêî ìàðêåð. Äàëåå ââîäèøü â ïîèñêå ïî õåëïó ñëîâî marker, íàõîäèøü òàêóþ ôóíêöèþ
[BaseMaterial] FindMaterial([Marker ,string] m);
Íó è ñîîòâåòñòâåííî êîä:
 var tag0=op->GetFirstTag();
     if (!tag0) {println("No Tags!"); return FALSE;}
     while (tag0->GetType()!= TAG_TEXTURE)
      {
       tag0=tag0->GetNext();
       if (!tag0)
     return FALSE;
  }
var MatMark=tag0->GetMaterial();
var doc = GetActiveDocument() ;
var mat=doc->FindMaterial(MatMark);
var matName = mat->GetName();
println(matName);

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

On 16/01/2007 at 04:07, xxxxxxxx wrote:

Excuse me for russian. This guy understand me.
And I think it is clear without words.

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

On 16/01/2007 at 04:20, xxxxxxxx wrote:

You get the name of the material like this:

tag0#TEXTURETAG_MATERIAL->GetName()

With #TEXTURETAG_MATERIAL you get the material attached to the texture tag.

cheers,
Matthias

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

On 16/01/2007 at 13:19, xxxxxxxx wrote:

Matthias, many thanks! All has turned out!