Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Detecting render state in a scenehook

    SDK Help
    0
    10
    824
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      On 03/03/2013 at 11:23, xxxxxxxx wrote:

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

      ---------
      Hello,

      I am struggling with getting the information if my current SceneHookData::Execute() call is done from within a rendering or not.

      The passed execution flags contain a bit named "_Render" but it is never set.
      I also cannot use CheckIsRunning because it returns true when e.g. the editor scene hook is called and there is a rendering running in the picture viewer.

      So I am wondering how to get this bit of information in the aforementioned execute function?

      Thank you iA

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 06/03/2013 at 05:47, xxxxxxxx wrote:

        Anyone an idea? I really am in need of finding a solution for this.. :frowning2:

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 06/03/2013 at 06:19, xxxxxxxx wrote:

          reminds mehttp://www.at2-software.com/board/viewtopic.php?p=1597#p1597
          sorry, miss your notification...

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 06/03/2013 at 06:25, xxxxxxxx wrote:

            Are you not able to check the different rendering types ala:

            if (CheckIsRunning(CHECKISRUNNING_EXTERNALRENDERING)) // do this  
            else if (CheckIsRunning(CHECKISRUNNING_EDITORRENDERING)) // do that
            
            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 06/03/2013 at 06:33, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              Are you not able to check the different rendering types ala:

              if (CheckIsRunning(CHECKISRUNNING_EXTERNALRENDERING)) // do this  
              else if (CheckIsRunning(CHECKISRUNNING_EDITORRENDERING)) // do that
              

              Hi,

              thanks but unfortunately not, because that's not the issue.

              For example: If the user clicks to render to the picture viewer and the render scenehook execute() is called and CheckIsRunning returns true. Now due to the click of the user the editor scene hook execute() is also called and CheckIsRunning is then true too. So there is no way to identify which code should now be called, the one for rendering or for editor. Editor rendering is of no relevance as it is either running or the user is working. In any case my code will call the editor code. But with a running renderer I don't know where my scene hook is called from currently (which would be no problem if the render flag would be set 🙂 ).

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                On 06/03/2013 at 07:06, xxxxxxxx wrote:

                Hi Katachi,

                MSG_MULTI_RENDERNOTIFICATION is sent to each node in the document before rendering. You can
                catch this message and set a flag in your node.

                Bool MySceneHook::Message(GeListNode\* node, LONG msgType, void\* pData) {
                    switch (msgType) {
                    case MSG_MULTI_RENDERNOTIFICATION: {
                        auto data = static_cast<RenderNotificationData\*>(pData);
                        this->rendering = TRUE;
                        this->external = data->external;
                        break;
                
                
                    }
                    return SceneHookData::Message(node, msgType, pData);
                }
                

                -Niklas

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

                  On 06/03/2013 at 07:09, xxxxxxxx wrote:

                  excellent idea Niklas. Thanks!

                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    On 06/03/2013 at 07:24, xxxxxxxx wrote:

                    For completeness: works just fine.

                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

                      On 06/03/2013 at 10:44, xxxxxxxx wrote:

                      I was half-awake so that was my only consideration but Niklas got it exactly.  If only I had a brain. 🙂

                      Best of luck on whatever you're doing Samir!

                      1 Reply Last reply Reply Quote 0
                      • H
                        Helper
                        last edited by

                        On 07/03/2013 at 07:18, xxxxxxxx wrote:

                        hehe 🙂 thanks Robert.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post