Texture tags in a generator

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

On 08/10/2009 at 11:12, xxxxxxxx wrote:

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

---------
Hi,

in my generator I have created some objects. Now I want to attach texture tags to those objects and link a material in those tags. The material is given by the user and linked in the description of my generator.

This is how I retrieve the material that the user has linked:

> BaseMaterial \*Mat     = (BaseMaterial\* )bc->GetLink(MY_MAT_LINK, doc);

So far it works, "Mat" is not NULL.

Now I create a texture tag on an object in my virtual hierarchy and want to link the material there:

> if (Mat) { \>      BaseTag     \*MatTag = BaseTag::Alloc(Ttexture); \>      if (MatTag) { \>           MatTag->GetDataInstance()->SetLink(TEXTURETAG_MATERIAL, Mat); \>           MatTag->GetDataInstance()->SetLong(TEXTURETAG_PROJECTION, TEXTURETAG_PROJECTION_FLAT); \>           MatTag->GetDataInstance()->SetReal(TEXTURETAG_LENGTHX, MatScale); \>           MatTag->GetDataInstance()->SetReal(TEXTURETAG_LENGTHY, MatScale); \>           PolyPlane->InsertTag(MatTag); \>      } \> } \>

I does not crash, but the material is also not linked. When I convert my generator object with "c" and look into the texture tag, the link field is empty. Why?

Thanks in advance for any help!

Cheers,
Jack

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

On 08/10/2009 at 11:29, xxxxxxxx wrote:

mat->SetMaterial()

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

On 08/10/2009 at 11:50, xxxxxxxx wrote:

Oh wait. I just saw, there's a class TextureTag. Using its function SetMaterial(), I can successfully assign the material.

Anyway, I am not quite sure how to set the projection (attribute TEXTURETAG_PROJECTION) and the X/Y scale (TEXTURETAG_LENGTHX and TEXTURETAG_LENGTHY).

EDIT: Thanks, Samir. Didn't see that at first. But the projection and scaling would still be interesting to know.

Greetings,
Jack

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

On 08/10/2009 at 12:18, xxxxxxxx wrote:

OK, got that one, too:

> if (Mat) { \>      TextureTag     \*MatTag = TextureTag::Alloc(); \>      if (MatTag) { \>           MatTag->SetMaterial(Mat); \>           GeData dat = GeData(TEXTURETAG_PROJECTION_CUBIC); \>           MatTag->SetParameter(DescID(TEXTURETAG_PROJECTION), dat, NULL); \>           dat = GeData(MatScale); \>           MatTag->SetParameter(DescID(TEXTURETAG_LENGTHX), dat, NULL); \>           MatTag->SetParameter(DescID(TEXTURETAG_LENGTHY), dat, NULL); \>           PolyPlane->InsertTag(MatTag); \>      } \> } \>

I would like to have some more information in the SDK about which parameters of which objects/tags may be accessed via GetDataInstance() and which of them need GetParameter/SetParameter.

The question that remains is: How can I set the TEXTURETAG_ROTATION of the Texture Tag? In the .res file it uses CUSTOMGUI SUBDESCRIPTION, but I can't find any information about how to set the vector.

Cheers,
Jack

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

On 08/10/2009 at 12:34, xxxxxxxx wrote:

It's still a VECTOR type so you use GeData(Vector(x,y,z)); (or something similar).

dat = GeData(Vector(0,0,0));
MatTag->SetParameter(DescID(TEXTURETAG_ROTATION), dat, NULL);

CUSTOMGUI SUBDESCRIPTION simply describes the display interface for the type.

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

On 08/10/2009 at 13:40, xxxxxxxx wrote:

Aaah, ok :D Thank you!
I'll never stop learning (and that's a good thing).

Well, the first result of my last speed programming session (1.5 days) can be seen here:
http://forums.cgsociety.org/showthread.php?p=6144271#post6144271

I'll continue working on it from time to time.

Cheers,
Jack