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

    Notification on change of active document

    SDK Help
    0
    17
    2.2k
    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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 09/02/2012 at 14:53, xxxxxxxx wrote:

      That was me.
      I cross posted with Steve. And he's a lot more experienced than I am. So I deleted my post.
      Sorry for the confusion.

      We've been told several times here from support about trying to do certain things from a dialog window is illegal. Since you weren't getting any replies. I just thought I'd throw that out there as maybe a possible area that might be causing you trouble.

      For example: I have a resource based dialog window plugin that I use for RD purposes.
      It uses the same GeDialog class and external .res file structure for the dialog window as the attribute method works on say: a tag or object type plugins.
      If I launch my plugin and leave the dialog window open. Then I switch to another document. My plugin no longer works. But if I switch back to the document that was running when I launched the plugin. It works again.

      I'm not sure if that relates to your problem though.

      -ScottA

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 09/02/2012 at 15:08, xxxxxxxx wrote:

        @MighT42: Check out the cinema4dsdk example and the activeobject.cpp file. I guess you're looking for the EVMSG_CHANGE message.

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 09/02/2012 at 15:09, xxxxxxxx wrote:

          Hi Scott,
          sorry for my part of the confusion.
          As I'm in the early stages of C4D plugins, I'm thankful for any thought I can get hold on. I think my current situation is not that complicated and as everything's working smoothly at the moment, I hope to publish some source tomorrow. In that way anybody can have a look, if I'm messing with BFM_SYNC_MESSAGE.
          Thanks for taking the time,
          Andreas

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 09/02/2012 at 15:34, xxxxxxxx wrote:

            s_rath,
            thanks, EVMSG_CHANGE seems to work. Actually I see no difference in behaviour using either EVMSG_CHANGE or BFM_SYNC_MESSAGE. Only one I've to implement in CoreMessage() and the other in Message(). So I'm still a bit curious, where's the difference (perhaps run context of Message() and CoreMessage()?). Will stick with EVMSG_CHANGE, though.
            How did you come to know the behaviour of EVMSG_CHANGE, from the docs ("Sent by the EventAdd() function") and activeobject.c source, I guessed EVMSG_CHANGE would have to be sent manually via EventAdd().
            Thanks a lot,
            Andreas

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 10/02/2012 at 03:55, xxxxxxxx wrote:

              Thanks for your PM, I was very puzzled by it but I think Scott's post clears it up!

              Whether or not I'm more experienced than Scott or not I don't know, but that doesn't mean what I did was the right way (or even if there is a 'right way'), just that it worked for me. In the end, whatever method you choose, if it's legal within the SDK context and it works, then it's good as far as I can see.

              Cheers,

              Steve

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 10/02/2012 at 06:32, xxxxxxxx wrote:

                EVMSG_CHANGE is the way to go. Then get the current active document with GetActiveDocument().

                Btw. s_rath is one of our developers, so he usally knows what he's talking aboput 😉

                cheers,
                Matthias

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 10/02/2012 at 09:37, xxxxxxxx wrote:

                  Matthias,
                  thanks for clarification.
                  Is there a way for noobs like I am, to tell if a forum member is one of Maxon's developers? It would keep me from asking stupid "How did you come to know..." questions.

                  If I could place a wish, I'd like to have a bit more detailed information on messaging and run context in SDK docs. For example, I still feel a bit unsure, when to implement Message() or CoreMessage().  CoreMessage() sounded so fundamental, like here you can get _all_ messages, but then you _really_ need to know, what to do with them, like care for context and locking...
                  Now it sounds more like a second message queue.

                  Please don't mind, I know the problems of documenting APIs very well  (and the "fun", that's provided, when doing so) and Maxon has done a pretty good job already.
                  Thanks,
                  Andreas

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

                    On 07/01/2013 at 15:15, xxxxxxxx wrote:

                    Originally posted by xxxxxxxx

                    EVMSG_CHANGE is the way to go. Then get the current active document with GetActiveDocument().

                    Btw. s_rath is one of our developers, so he usally knows what he's talking aboput 😉

                    cheers,
                    Matthias

                    Could someone be so kind and explain that in 'stupid mode' for me ? I am currently also in the
                    situation, that i want know when the active docment has been changed. I would also like
                    to know when the user tries to merge a document with another one. I am listening for core
                    messages from a message plugin.

                    I am not sure how I am meant to use EVMSG_CHANGE, because it is being sent all the time, 
                    as it is the message for 'something has changed'. Am I meant to do a boolean comparison of  
                    the currently active document against the last known document, after I got EVMSG_CHANGE ? 
                    That does not sound right to me and seems to be a rather extreme solution. Is there some 
                    reading counterpart to BaseDocument.SendInfo() which I can use ?

                    My plugin is recieving the ID 1018490 on documented related actions (new, load, switch). 
                    Does someone know the string identifier of that ID. I could not find it in the cinema4d folder.

                    just for clarification - I am still on python, as stated in my sig.

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

                      On 09/01/2013 at 04:56, xxxxxxxx wrote:

                      sorry for the rather impatient bump, but i still have not found a solution or this
                      on my own, but i would really like know an answer on that.

                      1. what is the string ID for 1018490 and is it reliable as an ID to indicate actions on the active basedocument ?
                      2. how am I meant to use EVMSG_CHANGE in this whole context ?

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

                        On 09/01/2013 at 15:11, xxxxxxxx wrote:

                        Since you aren't getting any replies. I'll just mention that the only way I personally know how to get a specific document event (load,merged,saved) rather than the generic event that EVMSG_CHANGE produces. Is to use a C++ SceneHookData plugin.

                        This section of the plugin is what gets the specific event that occurs:

                        Bool MySceneHook::Message(GeListNode *node, LONG type, void *data)  
                        {  
                           switch(type)  
                           {  
                            case MSG_DOCUMENTINFO:  
                               {  
                                 DocumentInfoData *info = (DocumentInfoData* )data;  
                                 if(info->type == MSG_DOCUMENTINFO_TYPE_LOAD)  
                                  {  
                                    GePrint("document loaded");  
                                  }  
                          
                                 if(info->type == MSG_DOCUMENTINFO_TYPE_MERGE)  
                                  {  
                                    GePrint("document Merged");  
                                  }  
                          
                                 if(info->type == MSG_DOCUMENTINFO_TYPE_SAVE_AFTER)  
                                  {  
                                    GePrint("document Saved");  
                                  }  
                               }  
                           }  
                          
                          return TRUE;  
                        }
                        

                        I've never tried to make a SceneHookData plugin with python. But it looks like they split it up into two separate python plugins SceneLoaderData & SceneSaverData plugins.
                        If there's a short cut way to get merged, saved , loaded messages without using a scene plugin. I don't know it. But maybe someone else does.

                        -ScottA

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

                          On 09/01/2013 at 17:03, xxxxxxxx wrote:

                          hey scott,

                          thanks for your answer, unfortunately there is no way to implement a SceneHookData plugin in
                          python right now. Steve also mentioned this approach at the beginning of the thread. Also to 
                          my understanding the python classes c4d.plugins.SceneLoaderData and SceneSaverData are 
                          just the wrappers for the respective cpp classes SceneLoaderData and SceneSaverData.
                          There is the method c4d.documents.BaseDoucment.FindSceneHook() which takes one 
                          ID as its parameter. This might be some kind of solution for my problem, but i have neither
                          an idea which ID i have to use, nor what i should do with the result, a Baselist2D. I also
                          still believe that there are message ids being send from what steve has written in the 
                          beginning of the thread, it just seems to depend on the message method from which you 
                          are listening from, wether you are able to recieve them or not.

                          this whole ID thing ( 'it is documented in the maxon folder, just search for the files' ) shows
                          its uly face again 😞

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

                            On 14/01/2013 at 01:03, xxxxxxxx wrote:

                            i know it is rather impolite to constantly self-bump your own threads, but i would still
                            really like to know an answer on this.

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