Loading textures
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/04/2004 at 09:30, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.207
Platform: Windows ;
Language(s) : C++ ;---------
I'm having a little trouble getting textures to be loaded. What I try to do is having a custom PluginObject, that uses a certain texture on itself. The object checks if the material is there, and if not, creates the material by itself. Inside this material, a texture is used in the color channel. I set the texture path using the BASECHANNEL_SUGGESTEDFOLDER container (since the textures reside inside the plugins own folder and can be found regardless of where the document is saved). The path correctly shows up in the material manager, but the texture is not loaded, the preview and render still show the standard grey surface. Only after I click into the image-path field and hit return the texture loads. Is there a special trick to (re)load the texture, or do I have to activate anything else than the color channel itself (I tried sending a MSG_UPDATE to both the channel and the material)?Tanks in advance,
MikeI
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/04/2004 at 17:54, xxxxxxxx wrote:
Just a quick question before I go through the trouble of setting up a test, did you try the Update() function as well? And EventAdd()?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/04/2004 at 03:41, xxxxxxxx wrote:
Well, thats the code I
m currently using. As per your suggestion I
ve added Update() (missed that one), the EventAdd() was already there (also tried with EVENT_FORCEREDRAW), but still no go. That whole part is called within the GetVirtualObjects() part of the plugin.matthres =doc->SearchMaterial("thres"); if(!matthres) { matthres=BaseMaterial::Alloc(Mmaterial); matthres->SetParameter(DescID(MATERIAL_USE_COLOR),TRUE,NULL); matthres->SetName("thres"); GeData dtest; Filename plugpath=GeGetPluginPath(); plugpath=(plugpath + Filename("rway_dis2.bmp")); BaseChannel *thresch=matthres->GetChannel(CHANNEL_COLOR); BaseContainer thresbc1=thresch->GetParameter(DescID(BASECHANNEL_SUGGESTEDFOLDER),dtest,0); thresbc1.SetFilename(BASECHANNEL_SUGGESTEDFOLDER,plugpath); thresch->SetData(thresbc1); thresch->Message(MSG_UPDATE); matthres->Update(TRUE,TRUE); doc->InsertMaterial(matthres); doc->Message(MSG_UPDATE); EventAdd(); }
May also be that my code has some flaw somewhere in it, its still trial and error for me the most way. Anyway, thanks for your help,
Mike
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/04/2004 at 01:26, xxxxxxxx wrote:
That's hell dangerous - you must NEVER call EventAdd, InsertMaterial or doc->Message(MSG_UPDATE) or make ANY modifications to a scene from within GetVirtualObjects! GetVirtualObjects is called threaded this means if you modify existing data other threads accessing the same data will crash.
Material creation should be done at a user interaction point, e.g. when the user changes the settings.
Same goes for EventAdd() - in GetVirtualObjects this will -in the worst case- create infinite drawing loops. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/04/2004 at 13:01, xxxxxxxx wrote:
ok, now that you mention it - yikes, you're right, thanks - seems I have been lucky so far. So, I guess safer would be inside the ::Message() part of the plugin. But, the problem still (just tried that) exists, the material does not update...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/04/2004 at 13:30, xxxxxxxx wrote:
About the original problem: you need to set folder and name separately. So BASECHANNEL_SUGGESTEDFOLDER should be set to GeGetPluginPath() and BASECHANNEL_TEXTURE to Filename("rway_dis2.bmp")... it should then work.