Material Link

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

On 16/07/2003 at 04:46, xxxxxxxx wrote:

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

---------
Hello,
I am trying to read the LINK from TextureTag, but I always get a
NULL - Pointer . The other datas from TextureTag could I read.
Here is some part of my code:
 
void explore_tag(BaseObject *base)
{
 BaseContainer bc;
 BaseMaterial *bmat = NULL;
 BaseList2D  *bl = NULL;
 BaseTag   *tag = base->GetFirstTag();
 BaseDocument *doc = GetActiveDocument();

for (; tag!=NULL; tag = tag->GetNext())
 {
  GePrint("    TAGS: "+tag->GetName());
  bc = tag->GetData();
  
  //  bl = bc.GetLink(TEXTURETAG_MATERIAL,doc);
  //bmat = bc.GetMaterialLink(TEXTURETAG_MATERIAL,doc); 
 
  bmat = bc.GetMaterialLink(TEXTURETAG_MATERIAL,doc);

if (bmat) GePrint("BaseMaterial vorhanden");
  Real x = bc.GetReal(TEXTURETAG_LENGTHX);
  Real y = bc.GetReal(TEXTURETAG_LENGTHY);
  GePrint("X: "+RTS(x)+"  Y: "+RTS(y));
  LONG mapping = bc.GetLong(TEXTURETAG_PROJECTION);
  String res = bc.GetString(TEXTURETAG_RESTRICTION);
  GePrint("Restriction:  "+res);
  switch (mapping)
  {
  case (0) : GePrint("Kugel-Mapping");break;
  case (1) : GePrint("Zylinder-Mapping");break;
  case (2) : GePrint("Fläche-Mapping");break;
  case (3) : GePrint("Quader-Mapping");break;
  case (4) : GePrint("Frontal-Mapping");break;
  case (5) : GePrint("Spat-Mapping");break;
  case (6) : GePrint("UVW-Mapping");break;
  case (7) : GePrint("Shrink-Mapping");break;
  }
 }
}
 
Where is the problem or error ??

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

On 02/03/2007 at 04:21, xxxxxxxx wrote:

*bump*

same problem here. didnt want to start a new topic.

BaseTag *baset = obj->GetTag(Ttexture,0);
BaseContainer basec = baset->GetData();

BaseMaterial *bm = basec.GetMaterialLink(TEXTURETAG_MATERIAL, doc);

always returns a null-pointer. could use some help

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

On 02/03/2007 at 11:49, xxxxxxxx wrote:

Try this instead:

GeData data;  
ttag->GetParameter(DescID(TEXTURETAG_MATERIAL), data, NULL);  
Material* mat = static_cast<Material*>(data.GetLink(doc, Mbase));  
if (!mat) return FALSE;

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

On 03/03/2007 at 04:03, xxxxxxxx wrote:

thank you. works very well.