MSG_MULTI_RENDERNOTIFICATION with Command Plugin..



  • On 03/09/2015 at 01:27, xxxxxxxx wrote:

    Hi,

    I understand that a Command plugin doesn't receive the MSG_MULTI_RENDERNOTIFICATION message ( in fact there's no info in the Python docs for R15 on what the Message function does receive )..

    I'd like to somehow use MSG_MULTI_RENDERNOTIFICATION to toggle when a render has started and when it has finished, in combination with c4d.CheckIsRunning(c4d.CHECKISRUNNING_EDITORRENDERING).

    I can use CheckIsRunning inside the Command plugin ok, but i don't want to continually poll this until the render has finished, hence why i think i need the MSG_MULTI_RENDERNOTIFICATION..

    How best would i go about this?  Can i force the active doc to message the Command plugin when it receives that message?  Or should i set up a MessageData plugin for this, and if so how would i call it and get it to pass on the message to my Command plugin?

    Thanks for any help on this.



  • On 03/09/2015 at 02:59, xxxxxxxx wrote:

    Hello,

    MSG_MULTI_RENDERNOTIFICATION is send to the document and all it's content. CommandData plugins and MessageData plugins are not part of the document, so they don't receive that message.

    With "toggle" you mean to implement CommandData.GetState? In this case I don't see anything wrong to use CheckIsRunning() to enable or disable your command.

    Best wishes,
    Sebastian



  • On 03/09/2015 at 07:30, xxxxxxxx wrote:

    No, by toggle i just mean set a variable to True if rendering or false otherwise.

    Actually what i need is, to do something 'when rendering has finished'..

    So CheckIsRunning() is useful, but i'd have to continually run CheckIsRunning() until the render had stopped, to know it had finished..

    Any suggestions?



  • On 03/09/2015 at 09:50, xxxxxxxx wrote:

    Hello,

    I still don't fully understand what you are trying to do. What has a command data plugin to do with what you describe?

    Best wishes,
    Sebastian



  • On 03/09/2015 at 12:51, xxxxxxxx wrote:

    Hi Sebastian,

    Basically, i have a plugin, which allows the user to choose from preset render settings, and then hit a Test Render button to render to either the viewport or picture viewer with the chosen render settings.

    This works fine, applying the various preset render settings - however, i need to be able to reapply the settings that were there before the preset was applied.  So the users render settings are stored, then the preset settings are applied, and then once the render is complete the users settings are re-applied.

    So i need a way to know when a render is finished, so that the settings can be reapplied.

    I've tried applying the settings immediately after starting the render, but for some reason that causes the renders to use the newly applied settings even though they are applied AFTER starting the render..  Have also considered setting some kind of delay timer, to apply a time after starting render, to prevent this from happening, but it's not ideal..

    So - simple question, how can i find out when a render has finished?



  • On 04/09/2015 at 00:44, xxxxxxxx wrote:

    Hello,

    I'm not sure if it is possible to do what you want in Python. When one renders a document in the Picture Viewer this is done handling a copy of the original document. The document rendered is not the original document anymore. This means while the document is rendering in the PV, the user could close or switch the current document in the editor. So when you "reset" the settings it would be on the wrong document.

    If you just want to preview a single frame you could render that frame yourself using RenderDocument() and then show that frame in the PV using ShowBitmap().

    To truly detect if the rendering of a document finished you probably need something inside that document. Typically this would be a SceneHook, but this class is only available in the C++ API.

    Best wishes,
    Sebastian



  • On 04/09/2015 at 02:50, xxxxxxxx wrote:

    Yeah i was aware of the document clone thing..

    RenderDocument()/ShowBitmap() is a useful tip i have never tried that, thanks.

    In the meantime i think i will just assign the 're-apply user settings' to a Restore Settings button or something similar.  It would be useful to know if there was a way to intercept that MSG_MULTI_RENDERNOTIFICATION message from a Command plugin, but i guess it just might not be possible.

    Thanks for the help it is much appreciated.



  • On 04/09/2015 at 07:21, xxxxxxxx wrote:

    If you install Apex, you get the MSG_MULTI_RENDERNOTIFICATION send to Python via PluginMessage().
    I've tested it on OSX only yet, there could be ABI compatibility problems on Windows.

    https://github.com/nr-plugins/apex/wiki/Redirected-Messages

    You can grab an OSX build for R15+ from the releases page.

    Edit  I've just added a Windows build as well, seems to work fine.



  • On 06/09/2015 at 16:09, xxxxxxxx wrote:

    Thanks Niklas that's a really interesting solution.  I've reworked the plugin to work around the problem, but will definitely bear this in mind for similar future issues..


Log in to reply