Material.GetPreview()
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/08/2010 at 15:28, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R10-R11
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;---------
I'm trying to get the preview bitmap of a Material before it is created in the document. A fake BaseDocument with an inserted Material has been created. The Material and channels have been set up and mat->Update(TRUE, FALSE) has been called but it always returns NULL on GetPreview().Must the BaseDocument be inserted? I hope not as this is solely for showing a preview of how the Material will look when created by my Tool plugin.
Maybe there is need of mat->Message(MSG_UPDATE) after mat->Update()?
So far nothing seems to work and inserting the document leads to crashing.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/08/2010 at 03:34, xxxxxxxx wrote:
It seems that the material still needs to render the preview after inserting it into an document. When I try to obtain the preview I only get the striped background as bitmap. It is not NULL though. Also it doesn't make a difference if it is inserted into an document or not (even an existing document).
I'll have to ask the developers if this is possible.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/08/2010 at 06:16, xxxxxxxx wrote:
Just to be thorough, I'm currently testing in R10.1 and unable to get a preview bitmap. Is it in R11 or R11.5 that it doesn't return NULL for you?
Also, it really isn't the fake document insertion leading to crashes but the removal (doc->Remove()). Either way, this isn't a reasonable solution to insert documents.
This is a material preview being shown in the A.M. dialog of a Tool plugin (which makes it all the more fun).
Thanks, Matthias, and I'll await the response.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/08/2010 at 22:08, xxxxxxxx wrote:
Any news, Matthias?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/08/2010 at 11:28, xxxxxxxx wrote:
Anything?
I've added an object (Cube) to the fake document and Texture tags to it set to each material to be previewed. This did nothing.
SetHDirty(HDIRTY_MASK_MATERIAL) did nothing.
Still not sure if a customgui_matpreview would be useful here since this is mainly for plugin materials and shaders.
Maybe a BackgroundHandler is required?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/08/2010 at 02:20, xxxxxxxx wrote:
It's not possible with Materials that have not yet created their previews, which is the case here.
You can use RenderMaterialPreview from the Material Preview library instead. It's currently documented as private but it should be pretty self explainatory.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/08/2010 at 11:15, xxxxxxxx wrote:
Works like a charm! Thanks!!!