On 07/09/2015 at 00:59, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R16
Platform: Windows ;
Language(s) : C++ ;
---------
Greetings !
I need to implement a Preview image for a material Data plugin.
So, inside message method of material data, i use the MATPREVIEW_GENERATE_IMAGE case to generate the image. The generated image might take 2-3 seconds to be calculated.
So instead of freezing the gui i run the implementation in a different thread and i use RENDERRESULT_OK
or RENDERRESULT_USERBREAK depending on whether it is ready or not.
There are 2 cases the MATPREVIEW_GENERATE_IMAGE is executed. The first one is when modify a material parameter and the preview has to be recalculated. It enters multiple times in MATPREVIEW_GENERATE_IMAGE until the image has been generated completed. In this case i return RENDERRESULT_OK to indicate that it has been completed. Everything works fine.
The other case this code (MATPREVIEW_GENERATE_IMAGE) is executed is when you create a new material and the material icon on the bottom left of cinema 4D has to be calculated. In this case, even if i use RENDERRESULT_USERBREAK flag, it won't enter again.
What do i have to do to allow the newly added material to generate it's icon in this specific menu, the way it does as a preview paramater in the Attribute section.
Thank you for your time.