• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

How to add item to a menu created by another plugin

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 3 Posters 267 Views 3 Watching
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.
  • P Offline
    ppoublan
    last edited by 4 Mar 2014, 13:28

    Dear all,
    I'm trying to test existence of a menu created by another plugin.
    The goal is to share same menu from different plugins, and create the menu if not already done by the other plugin, and add items to it.
    UI.menu returns id for plugins menu. Can it be used for non Sketchup menus ?
    I made some tests but did not succeeded. Has somebody already done this ?
    Yours
    Pascal

    1 Reply Last reply Reply Quote 0
    • T Offline
      tt_su
      last edited by 4 Mar 2014, 13:31

      Unfortunately this is currently not possible due to limitations of how menus are initialized internally in SketchUp.

      Can you describe the use case for adding your own menu items to another plugin's menu?

      1 Reply Last reply Reply Quote 0
      • P Offline
        ppoublan
        last edited by 4 Mar 2014, 13:38

        Hi Tom,
        The goal is to share menus between 2 plugins (for exemple 2 plugins from the same author), but that can be installed separately with no require link from one to the other.
        Idealy they (each plugin) even dont need to know the existence of the other, but want to share same submenu to not add too long list to the SU Plugins Menu.
        Any idea appreciated.
        Yours
        pascal

        1 Reply Last reply Reply Quote 0
        • T Offline
          tt_su
          last edited by 4 Mar 2014, 13:58

          If one of the plugins store the reference to it's submenu to and instance variable and implement a getter for that then it is possible for another plugin to get that plugin and attach more menus during startup. However, you only get once chance. After SketchUp has loaded the plugins during startup the menu references are useless.

          1 Reply Last reply Reply Quote 0
          • C Offline
            Chris Fullmer
            last edited by 4 Mar 2014, 15:32

            I do this with my plugins. They all get installed in a submenu called "CLF Tools" or something. It is possible because I know how to check to see if that submenu object exists. Then add to it if it does exist, or create it if it does not exist.

            So if you want to create a generic submenu system that others can use, like "Edge Plugins", you would have to set that up and others would have to implement your same system. In other words, the idea of plugins not knowing about the existence of one another is not likely, since they would have to work together.

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

            1 Reply Last reply Reply Quote 0
            • P Offline
              ppoublan
              last edited by 4 Mar 2014, 18:13

              @chris fullmer said:

              I do this with my plugins. They all get installed in a submenu called "CLF Tools" or something.

              This is what I would like to achieve.

              @chris fullmer said:

              It is possible because I know how to check to see if that submenu object exists. Then add to it if it does exist, or create it if it does not exist.

              Do not understand how you do this if the other plugin is not installed or not already loaded by SU ?
              But I will have a look at Edge to see if I understand how it works.
              Thanks for your answer
              Pascal

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              1 / 1
              • First post
                1/6
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement