On 09/05/2015 at 19:44, xxxxxxxx wrote:
Cinema 4D Version: 15+
Platform: Windows ;
Language(s) : C++ ;
from documentation "it is private",
in old thread I asked about procedural textures caching, found that the best solution is getting the preview.
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:
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:
MatPreviewGenerateImage* image = (MatPreviewGenerateImage* )data;
Int32 w = image->pDest->GetBw();
Int32 h = image->pDest->GetBh();
BaseContainer bcRender = image->pDoc->GetActiveRenderData()->GetData();
image->pDest->Clear(0, 0, 0);
image->lResult = RenderDocument(image->pDoc, bcRender, nullptr, nullptr, image->pDest,
RENDERFLAGS_EXTERNAL | RENDERFLAGS_PREVIEWRENDER, image->pThread);
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.
On 11/05/2015 at 10:47, xxxxxxxx wrote:
RenderShaderPreview() is marked as private and you should not use it as it might only be useful in a certain context. If you use it you do this on your own risk since the functionality may change.
For docpath you can use the path delivered by GetDocumentPath(), pShaderClone is a clone of the original shader created with GetClone(). So something like this could work but as said before the function is marked as private:
BaseShader* clone = (BaseShader* )shader->GetClone(COPYFLAGS_0,nullptr);
On 11/05/2015 at 14:28, xxxxxxxx wrote:
thanks a lot Sebastian!!
any alternative to RenderShaderPreview() ? I just want the preview of the texture , any possible consistent alternative should be ok.
On 12/05/2015 at 01:04, xxxxxxxx wrote:
the alternative is to sample the shader yourself using Sample(). This was discussed recently:
On 12/05/2015 at 08:29, xxxxxxxx wrote:
the above code works like a charm!! thanks a lot Sebastian
for the "doc" variable, I'm using this: "Shader->GetDocument()->GetDocumentPath()" , is this ok? "this will be used in a preprocess inside a RenderDocument() call"
On 12/05/2015 at 09:40, xxxxxxxx wrote:
nvm, I think I was too hasty, found "vps->doc" which should be what I need for the task.
On 16/05/2015 at 21:29, xxxxxxxx wrote:
you can mark this as solved, "and hopefully tell me how to mark it as solved , kinda noob in using forums"
On 18/07/2015 at 19:20, xxxxxxxx wrote:
sorry for opening this again, but there is a follow up question:
there is a data that I need, which is Float rCurrentTime.
there are 2 cases:
1- Xbitmap, there is a calculate button for animations, how to do a similar behavior. (I just need the remapped time)
2- any other Xbase, for example Xnoise, and it is animated, how to get the animated time.
On 20/07/2015 at 05:40, xxxxxxxx wrote:
the rCurrentTime parameter seems to be the document time in seconds. But as said before, RenderShaderPreview() is no function that should be used by third party developers and no more support can be given.