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

    ToolData detect change of active object [SOLVED]

    SDK Help
    0
    2
    284
    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 02/01/2017 at 01:47, xxxxxxxx wrote:

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

      ---------
      I am wondering how to detect when the user selects a different object, from within a ToolData plugin.
      Making another object the active one results in an EVMSG_CHANGE being sent, but this is a coremessage and thus not captured by the ToolData::Message method.

      I know I could store the current active object (via its GUID, or other value) as a member in the instance of the ToolData class and keep checking until the current active object is different from the stored value. But this checking is only triggered when MouseInput, GetCursorInfo, or other methods are called. Methods which only get called when the mouse cursor is over the viewport.
      While I would like to prepare some data as soon as the user selects another object (in the object manager), and not wait until the mouse cursor is moved into the viewport in order to detect the change.

      A workaround would be to perform the checking of the EVMSG_CHANGE in a MessageData plugin ... but how to trigger the ToolData plugin from the MessageData one? Sending a SpecialEventAdd again is only captured as a coremessage.

      I've looked through the SDK, done some searches in this forum. But not knowing what keywords to search for doesn't make it easier to find a solution.

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

        On 02/01/2017 at 02:58, xxxxxxxx wrote:

        OK, got the workaround working. Sending a message to the ToolData plugin is as easy as

        BasePlugin* plugin = FindPlugin( <pluginID>, <plugintype> )
        if (plugin) plugin->Message( <whatever> );

        Took me a few days before posting the question, and of course, once posted I found my own answer.

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