On 09/05/2015 at 19:44, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 15+
Platform: Windows ;
Language(s) : C++ ;
---------
from documentation "it is private",
https://developers.maxon.net/docs/Cinema4DCPPSDK/html/customgui__matpreview_8h.html#a610e9d34410135db7bcf74974b8eac66
in old thread I asked about procedural textures caching, found that the best solution is getting the preview.
https://plugincafe.maxon.net/topic/8072/10498_creating-instance-of-procedural-texture-write-it
RenderShaderPreview seems like what I want "or you suggest a better alternative if any"
so far I'm confused about how to use it!!
what I have:
1- BaseShader*
2- BaseBitmap* "with my specified size"
#### [RENDERRESULT]() RenderShaderPreview(const [Filename]()& docpath, [BaseShader]()* pShaderClone, [BaseShader]()* pOrigShader, [BaseThread]()* pThread, [BaseBitmap]()* pDest, [BaseDocument]()* pOriginalDoc, Real rCurrentTime, LONG lFlags = 0)_<_h4_>_
and from SimpleMaterial example in the SDK I have:
case MATPREVIEW_GENERATE_IMAGE:
{
MatPreviewGenerateImage* image = (MatPreviewGenerateImage* )data;
if (image->pDoc)
{
Int32 w = image->pDest->GetBw();
Int32 h = image->pDest->GetBh();
BaseContainer bcRender = image->pDoc->GetActiveRenderData()->GetData();
bcRender.SetFloat(RDATA_XRES, w);
bcRender.SetFloat(RDATA_YRES, h);
bcRender.SetInt32(RDATA_ANTIALIASING, ANTI_GEOMETRY);
if (image->bLowQuality)
bcRender.SetBool(RDATA_RENDERENGINE, RDATA_RENDERENGINE_PREVIEWSOFTWARE);
image->pDest->Clear(0, 0, 0);
image->lResult = RenderDocument(image->pDoc, bcRender, nullptr, nullptr, image->pDest,
RENDERFLAGS_EXTERNAL | RENDERFLAGS_PREVIEWRENDER, image->pThread);
}
return true;
break;
}
so I can see things in common, which are:
1- image->pDoc to BaseDocument* pOriginalDoc
2- image->pDest to BaseBitmap* pDest
3- image->pThread to BaseThread* pThread
4- image->rTime to Real rCurrentTime
5- lFlags in the function should be RENDER_PREVIEW_USE_BMP_SIZE
now "const Filename& docpath, BaseShader* pShaderClone,BaseShader* pOrigShader" confuses me.
I expect Filename& docpath to be the preview file "how to set it to Flat(2d)"
I expect BaseShader* pOrigShader to be the shader that I'm querying.
I don't expect anything about BaseShader* pShaderClone.