Create Material Filename Track
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/09/2008 at 03:45, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.5
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;---------
Hi,I am currently trying to set a material's Filename property by using a timeline Track. I successfully did this for object animation in C++ already. I can't seem to find the correct way to create the following Track:
Material->Bitmap->File
How do I create this track to change the Filename for specific frames? (I somehow don't seem to fully understand the correct use of DescID, DescLevel)
Many thanks
Markus
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/09/2008 at 04:01, xxxxxxxx wrote:
Here is how you access the filename of a texture in the color channel of a standard material.
>
\> Bool MenuTest::Execute(BaseDocument \*doc) \> { \> BaseMaterial \*mat = NULL; \> mat = doc->GetFirstMaterial(); \> if(!mat) return TRUE; \> \> BaseChannel \*ch = NULL; \> ch = mat->GetChannel(CHANNEL_COLOR); \> if(!ch) return TRUE; \> \> PluginShader \*sh = NULL; \> sh = ch->GetShader(); \> if(!sh || sh->GetType()!=Xbitmap) return TRUE; \> \> BaseContainer \*data = sh->GetDataInstance(); \> \> Filename fn = data->GetFilename(BITMAPSHADER_FILENAME); \> \> GePrint(fn.GetString()); \> \> \> \> return TRUE; \> } \>
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/09/2008 at 05:43, xxxxxxxx wrote:
Hello Matthias,
thanks for your quick answer.
I already found an example like this, what I'd like to achieve though, is to create a CTrack which changes the Filename based on a certain Frame. I was able to create a Timeline track in Cinema 4D (Material->Bitmap->File) and change the filename manually inserting new keys. How do I replicate this behaviour in C++?
I am tryint to create the CTrack but couldn't figure out how to access the Filename property. Furthermore SetValue only seems to work with "Real" values and there doesn't seem to be a SetString method for keys (although I seem to be able to insert "String"-keys using the Cinema 4D timeline interface.
Many Thanks
Markus
edit:
To clear up what I mean:
In Cinema 4D I open the timeline, open the material (which displays Bitmap), right click on Bitmap, add property track->File. On this track I can create keys being strings that point to a specific file. This is the behaviour I am trying to duplicate in C++.
edit2:
have been trying this so far:
>
\> CTrack\* texture_track; \> CKey\* current_key = NULL; \> \> current_key = CKey::Alloc(); \> \> texture_track = CTrack::Alloc (bg_material, DescID(DescLevel(BASECHANNEL_TEXTURE,DTYPE_TEXTURE,0))); \> \> current_key->SetTime(texture_track->GetCurve(),BaseTime(1, 30)); \> current_key->SetGeData(texture_track->GetCurve(), GeData("Text")); \> texture_track->GetCurve()->InsertKey(current_key); \>
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/09/2008 at 07:54, xxxxxxxx wrote:
This should work:
>
\> BaseMaterial \*mat = NULL; \> mat = doc->GetFirstMaterial(); \> if(!mat) return TRUE; \> \> BaseChannel \*ch = NULL; \> ch = mat->GetChannel(CHANNEL_COLOR); \> if(!ch) return TRUE; \> \> PluginShader \*sh = NULL; \> sh = ch->GetShader(); \> if(!sh) \> { \> sh = PluginShader::Alloc(Xbitmap); \> if(!sh) return FALSE; \> BaseContainer \*data = mat->GetDataInstance(); \> data->SetLink(MATERIAL_COLOR_SHADER, sh); \> mat->InsertShader(sh, NULL); \> } \> \> else if(sh->GetType()!=Xbitmap) return TRUE; \> \> CTrack \*track = NULL; \> track = CTrack::Alloc(sh,DescLevel(BITMAPSHADER_FILENAME,DTYPE_FILENAME,0)); \> if(!track) return FALSE; \> \> sh->InsertTrackSorted(track); \> \> BaseTime time = doc->GetTime(); \> \> CKey \*key = NULL; \> key = track->GetCurve()->AddKey(time); if (!key) return FALSE; \> \> Filename fn("test.jpg"); \> \> GeData data(fn); \> \> key->SetGeData(track->GetCurve(), data); \> key->SetInterpolation(track->GetCurve(), CINTER_STEP); \>
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/09/2008 at 08:47, xxxxxxxx wrote:
Many Thanks Matthias,
getting the shader was what I was missing.
Works like charm.
Markus