Update Shader Preview on texture file change



  • On 29/03/2016 at 16:00, xxxxxxxx wrote:

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

    ---------
    Note: this is for a third-party plugin under NDA utilizing other party's plugins so code examples may be limited:

    So, I have a Vray Light tag with a VrayShader in the AreaLight 'Light Rectangle' Texture slot.  The texture image file on the shader can be easily updated using our plugin and the view and renderer respond to this change.  The VrayShader itself will not update its Texture Preview image at all (which leaves the preview on the tag incorrect as well).  Even a button simulation (Reload Image...) will not do it (and I am positive that the button is being clicked with MSG_DESCRIPTION_COMMAND).  A real click on the button works.  Changing anything in the shader works if done physically (for real).  In code, nothing has worked.

    I have used Message(), SetDirty(), SetHDirty(), EventAdd(), MultiMessage(), shader->Edit() to make it active in the A.M. (maybe help, no).  I have Remove()'d the shader and reinserted it into the tag.  Nothing gets the shader preview to update beyond physical interaction with the shader itself.

    Any ideas beyond the many that have been tried so far?



  • On 29/03/2016 at 18:45, xxxxxxxx wrote:

    Addition:  I took the BitmapDistortionShader example and printed out the messages coming into its Message() method and it looks like this when the texture image is changed:

    BitmapDistortionShader.type = 19
    BitmapDistortionShader.type = 19
    BitmapDistortionShader.type = 16
    BitmapDistortionShader.type = 7
    BitmapDistortionShader.type = 17
    BitmapDistortionShader.type = 20
    BitmapDistortionShader.type = 31
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 1001090
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 1011147
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 1001090
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 1001090
    BitmapDistortionShader.type = 1011147
    BitmapDistortionShader.type = 14
    BitmapDistortionShader.type = 1001071
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 1001090
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 1001090
    BitmapDistortionShader.type = 14
    BitmapDistortionShader.type = 1001071
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 1001090
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 200000169
    BitmapDistortionShader.type = 1001090
    

    Wow!  No idea what void* msgData might accompany this onslaught of messages.  All that I know is that if HandleShaderMessage() is what is being used in the ShaderData::Message() method then it might require me to have some control of this to fix my aforementioned issue.



  • On 30/03/2016 at 07:27, xxxxxxxx wrote:

    Hi Robert,

    unfortunately we (SDK Team) can't help a lot here, as we have no insight in Vray. It's probably best to check with LAUBlab directly.
    You mentioned you tested Message(), but didn't say which message you tried. But I guess, you already tried to send MSG_UPDATE to the shader in question, right?



  • On 30/03/2016 at 08:05, xxxxxxxx wrote:

    MSG_UPDATE
    MSG_DESCRIPTION_COMMAND (to simulate the button click on Reload Image...)
    MSG_DESCRIPTION_VALIDATE
    MSG_DESCRIPTION_POSTSETPARAMETER
    MSG_DESCRIPTION_CHECKUPDATE

    We have been discussing this with LAUBlab but haven't had much success.  Since they are using the shader in a unique way (attached to a tag or object), that removes the possible use of Update(TRUE, TRUE) like a material using the shader.

    Thanks,


Log in to reply