Extracting the Texturename from a Materia
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/04/2007 at 00:32, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.6
Platform:
Language(s) : C++ ;---------
I need the Texturename (and path) from the colorchannel in a material.Following the examples I found here, thats my code:
BaseMaterial* mat = P406Exporter.doc->GetFirstMaterial(); BaseChannel* pChannel = mat->GetChannel(CHANNEL_COLOR); if (pChannel) { // Extract full image file path Filename suggestedFolder = pChannel->GetData().GetFilename(BASECHANNEL_SUGGESTEDFOLDER); String map = pChannel->GetData().GetString(BASECHANNEL_TEXTURE); Filename fullpath = suggestedFolder + Filename(map); }
But the filename is always empty.
GenerateTexturePath(P406Exporter.doc->GetDocumentPath(), Filename(pChannel->GetData().GetString(BASECHANNEL_TEXTURE)), Filename(), &path;) ;
This one returns an empty filename too.
I had no problems accessing other values in the different channels, but this seems to be stored different than the other values.
I find it a little confusing how the values are stored and I somehow never now how to access them (getParameter, getContainer, getData, getDataInstance)Any suggestions are welcome
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/04/2007 at 01:08, xxxxxxxx wrote:
This is how you get the complete path including the name of the file for your texture. bc is the BaseContainer of the BaseChannel.
Filename path = bc.GetFilename(BASECHANNEL_SUGGESTEDFOLDER);
if(!path.Content()) path = doc->GetDocumentPath();
Filename file = bc.GetString(BASECHANNEL_TEXTURE);
path = path+file;
GePrint(path.GetString());hope this helps
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/04/2007 at 02:11, xxxxxxxx wrote:
Yes, it works perfectly.
Thanks for the help