On 13/12/2014 at 10:27, xxxxxxxx wrote:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ;
I'm trying to get the material preview image from the selected material. And put it on a button in a GeDialog.
It mostly works. But there's one small glitch.
If I create a new material with the GeDialog open. The preview image seems to be not quite finished yet when the GeDialog is trying to assign it to the button. And the button's image is blank.
But...If I click on the material again after it's been created. The image shows up on the button.
using myButton->Redraw() does not fix the problem.
If I use: ShowBitmap(preview)
instead of: myButton->SetImage(mat->GetPreview(0), TRUE, FALSE);
What I get is a material preview with nothing but an alpha background.
Is there some way that I can test if a preview has been fully rendered?
In past cases like this. I've had to use a Callback() method which will only output when a task is finished. And This feels like one of those times.
I'm trying to figure out how to write the RenderPreviewImageCallback(). But I'm not having much luck with it yet.