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
    • Recent
    • Tags
    • Users
    • Login

    Get active tool

    Scheduled Pinned Locked Moved SDK Help
    15 Posts 0 Posters 1.3k Views
    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 Offline
      Helper
      last edited by

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

      On 07/04/2009 at 08:57, xxxxxxxx wrote:

      To set the current tool, use BaseDocument::SetAction(). That enables the tool by its ID (should work with plugin tools as well - best to test). You can't 'do' anything with the tool though. Tools aren't commands, they are tools and require user interaction thereafter.

      Not sure what you are after. 🙂

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

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

        On 07/04/2009 at 09:15, xxxxxxxx wrote:

        I just want to call a button (see CloneTool ->"Apply" or ClothTag->"Calculate"). I know that a tool is not just a button, but a tool might contain a button.

        The new Coffee SDK contains CallButton(...) which does exactly what I want to do, just in C++ 🙂

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

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

          On 07/04/2009 at 09:42, xxxxxxxx wrote:

          You might need to do it this way:

          object = FindPlugin(...);
          DescriptionCommand descCMD;
          descCMD.id = DescID(DescLevel(id,DTYPE_BUTTON,0));
          Py_RETURN_BOOL(object->Message(MSG_DESCRIPTION_COMMAND, &descCMD;));

          I'm just not sure if all of the possibilities in the FindPlugin() part will result in valid 'plugin' ids that result in a BasePlugin* being returned.

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

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

            On 08/04/2009 at 03:44, xxxxxxxx wrote:

            hi, doesn't work either. Hmm..

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

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

              On 08/04/2009 at 04:24, xxxxxxxx wrote:

              This seems to work. I used the CreatePolygon tool to test.

              > \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \>      LONG tool_id = doc->GetAction(); \> \>      BasePlugin \*tool = NULL; \>      tool = FindPlugin(tool_id, C4DPL_TOOL); \> \>      if(!tool) return FALSE; \> \>      DescriptionCommand dc; \>      dc.id = DescID(MDATA_CREATEPOLYGON_BUTTON); \>      tool->Message(MSG_DESCRIPTION_COMMAND, &dc;); \> \>      EventAdd(); \> \>      return TRUE; \> } \>

              cheers,
              Matthias

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

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

                On 08/04/2009 at 06:40, xxxxxxxx wrote:

                This works fine here, too. In my case its the Apply Button of the Clone Tool. But I will check that again and I will tell you what I did wrong.

                cheers,
                Shawni

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

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

                  On 13/04/2009 at 08:49, xxxxxxxx wrote:

                  Hi, I guess I've the correct IDs.

                  > \>      CallCommand(450000042); \>      LONG tool_id = doc->GetAction(); // select the Clone tool \> \>      BasePlugin \*tool = NULL; \>      tool = FindPlugin(tool_id, C4DPL_TOOL); \> \>      if(!tool) return FALSE; \> \>      DescriptionCommand dc; \>      dc.id = DescID(MDATA_APPLY); \>      tool->Message(MSG_DESCRIPTION_COMMAND, &dc;); \> \>      EventAdd(); \>

                  Any suggestions? Thanks.

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

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

                    On 14/04/2009 at 03:00, xxxxxxxx wrote:

                    It seems that the DescriptionToolData Apply, New Transform and Reset Values buttons are triggered differently. I have asked the developers how the CallButton() command is working internally.

                    cheers,
                    Matthias

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

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

                      On 20/04/2009 at 04:08, xxxxxxxx wrote:

                      heyho, any news?

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

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

                        On 21/04/2009 at 01:05, xxxxxxxx wrote:

                        Quote: Originally posted by Shawni on 20 April 2009
                        >
                        > * * *
                        >
                        > heyho, any news?
                        >
                        >
                        > * * *

                        Sorry, not yet.

                        cheers,
                        Matthias

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

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

                          On 28/04/2009 at 01:20, xxxxxxxx wrote:

                          Hope it's not too late, anyways here is the working code.

                          > \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \>      LONG tool_id = doc->GetAction(); \> \>      BasePlugin \*tool = NULL; \>      tool = FindPlugin(tool_id, C4DPL_TOOL); \>      if (!tool) return FALSE; \> \>      BaseContainer msg(BFM_ACTION); \>      msg.SetLong(BFM_ACTION_ID, 1440); \>      msg.SetLong(BFM_ACTION_VALUE, TRUE); \> \>      DescriptionCommand dc; \>      dc.id = DescID(DescLevel(MDATA_APPLY, DTYPE_BUTTON, tool->GetType())); \> \>      DescriptionCheckUpdate du; \>      du.doc = doc; \>      du.descid = &dc.id; \>      du.drawflags = 0; \> \>      tool->Message(MSG_DESCRIPTION_COMMAND, (void\* )&dc;); \>      tool->Message(MSG_DESCRIPTION_CHECKUPDATE, (void\* )&du;); \>      tool->Message(MSG_DESCRIPTION_USERINTERACTION_END); \>      tool->Message(MSG_TOOL_RESTART); \> \>      EventAdd(); \> \>      return TRUE; \> } \>

                          As you can see you have too send some more messages to make it work. This should work with every button. It's almost identically with internal code for CallButton().

                          cheers,
                          Matthias

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

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

                            On 28/04/2009 at 02:10, xxxxxxxx wrote:

                            hey Matthias, wow, thank you! Works fine.

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