InitGLImage is executed continuously



  • On 26/10/2015 at 13:23, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   16 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hello.

    I have created a Material Plugin with shader link parameters.
    In InitGLImage, i read the shaders and based on their value i fill the returned bitmap.
    There is a problem though that causes InitGLImage to be executed continuously (without end) and I don't know what causes that.

    In this case, InitGLImage is invoked without prior Init execution.
    Another problem is that it is not always reproducable.

    What may cause that ?

    Thank you for your time.



  • On 27/10/2015 at 01:10, xxxxxxxx wrote:

    Hello !

    I think i found the issue, which is i call manually the EventAdd(EVENT_FORCEREDRAW).

    To avoid this issue, i need to call it every time the user changes the current frame of animation track bar.
    How can i do that ?

    Thank you.



  • On 27/10/2015 at 02:34, xxxxxxxx wrote:

    Hello,

    can you elaborate this a little bit more? Where and when do you call EventAdd(EVENT_FORCEREDRAW)? What exactly do you want to achieve in the end?

    Best wishes,
    Sebastian



  • On 27/10/2015 at 03:29, xxxxxxxx wrote:

    Hello !

    I want to support animated textures in my plugin.
    User enters a bitmap as texture.

    Every time the final texture has to be calculated i do the following:
    I retrieve the latest number in texture's name, i modify it according to document's current frame and i return this name for process. After that i update the viewport by calling EventAdd(EVENT_FORCEREDRAW).

    The problem is that the same procedure is used in InitGLImage as well, because i need the texture update the material's bitmap.

    Thank you.



  • On 27/10/2015 at 10:21, xxxxxxxx wrote:

    Hello,

    you say that you modify the filename and "process" the new file. Does that mean that you load that file? If so, you already have the loaded image file in the material and you could use that image in InitGLImage().

    Best wishes,
    Sebastian



  • On 27/10/2015 at 12:55, xxxxxxxx wrote:

    Hello,

    When InitGLImage is executed for the first time, i use the material data to produce the bitmap required.
    That means i also read the shader's name and based on the documents current frame, I load the correct texture. After processing everything, i return the bitmap result in InitGlImage.

    The problem comes when the user manually moves the animation track bar around. 
    InitGLImage is not executed and the viewport image is not updated.

    Thank you.



  • On 28/10/2015 at 09:19, xxxxxxxx wrote:

    Hello,

    InitGLImage() is usually invoked when a parameter of the material is changed. I haven't found a way to accomplish what you want and I'm not sure if a plugin can do that. There is a PLUGINFLAG_MATERIAL_GLIMAGE_TIMECHANGE flag but I could not find a way to use it properly.

    Best wishes,
    Sebastian



  • On 29/10/2015 at 04:52, xxxxxxxx wrote:

    Hello.

    By enabling the "Animate Preview" checkbox in C4D materials, the animated texture is updated when someone moves the animation track bar.
    I want to do that with my Material Plugin as well.

    Thank you.



  • On 29/10/2015 at 06:31, xxxxxxxx wrote:

    Hello,

    the standard material of Cinema 4D is no plugin so it might not be possible to recreate all of its functionality in a plugin. The standard material does not use InitGLImage() to create the viewport preview. You can see that the other materials (Danel, Nukei, etc.) also do not offer the "Animate Preview" option.

    It seems that a material has to handle different OpenGL messages itself to define the viewport preview; these messages are currently undocumented and no further support can be given on this topic.

    Best wishes,
    Sebastian


Log in to reply