Notifications
Clear all

[Closed] making a new toolbar on startup

Hello, does anyone know how to make a toolbar after you install a plugin?

Just like the Vray toolbar show up after install of Vray. This is not just a startup script because once you close the toolbar it does not come back until you want it from menu. It looks like it make it into a .UI file.

Any help with this would be great.

16 Replies

oh… do you really want to know how to do this right? do you want to provide a ‘service’ when with your tools it automatically setups your toolbar? but before that you have to find on this forum my thoughts why I am absolutely against this practice…

but i can tell it again… but before that i want to tell a previous story …

on one of the mxs or max related forums someone showed how to do these kind of things… how to make and setup your own toolbar…

I disagreed with him, said that the task is more complicated, and what he does is wrong. but people did’t believe me…

more! now several develop teams are using his technique… Who? Havok, NVidia, MassFX, several now built-in tools…

Below i will post a script… it’s macroscript. i’ve minimized the version to just show the problem…


global DTS_MaxMenuCleanup
(
   struct MaxMenuCleanup
   (
      /************ the actual list is much longer *************/
      parasites = 
      #(
         "Cloth", "Havok Content Tools", "Help", "Physics", 
         "Rigs", "PhysX Clothing", "PhysX Destruction", "Forces ", "Show UI", "Simulation", "Rigid Bodies", "Constraints" 
      ),
      doc,
      
      fn findByKey list key = 
      (
         local n = 0
         for k=1 to list.count while n == 0 where list[k][1] == key do n = k
         n
      ),
      fn cleanupMenuUI filename: saveFile:off = 
      (
         if filename == unsupplied do filename = getOpenFilename caption:"Open Menu File" types:"Menu File (.mnux)|*.mnux"
         if filename != undefined and doesfileexist filename do
         (
            if iskindof (doc = dotnetobject "System.Xml.XmlDocument") dotnetobject do
            (
               doc.Load filename
               titles = doc.SelectNodes "//Menu[@title]"
               
               groups = #()
               count = 0
               for i=0 to titles.count-1 do 
               (
                  item = titles.item[i]
                  title = item.GetAttribute "title"
                  if (finditem parasites title) > 0 do
                  (
                     shit = item.selectnodes "Item[contains(@actionID,'Havok')]"
                     if (k = findByKey groups title) > 0 then
                     (
                        if item.ParentNode != undefined do 
                        (
                           item.ParentNode.RemoveChild item
                           count += shit.count + 1
                        )
                     )
                     if k == 0 do k = (append groups #(title, #())).count
                     append groups[k][2] item
                  )
               )
               case saveFile of 
               (
                  true: doc.Save filename
                  #prompt:
                  (
                     if count > 0 then
                     (
                        title = "Warning!"
                        message = "I found " + count as string + " parasite records.
Do you want to delete them?"
                        if (queryBox message title:title beep:on) do 
                        (
                           doc.Save filename
                        )
                     )
                     else
                     (
                        title = "Congratulation!"
                        message = "There is no Parasite records."
                        messageBox message title:title beep:off
                     )
                  )
               )
            )
         )
         #(count, filename)
      ),
      fn cleanupCurrentMenuUI filename: saveFile:on =
      (
         cleanupMenuUI filename:filename saveFile:saveFile
      ),
      
      on create do 
      (
         filename = menuMan.getMenuFile()
         data = cleanupCurrentMenuUI filename:filename saveFile:#prompt
         /************* un-comment next line if you really want to clean *********
         if doesfileexist data[2] do menuMan.loadMenuFile data[2]
         *******************************************************************************/
      )
   )
   DTS_MaxMenuCleanup = MaxMenuCleanup()
   ok
)

run it… and many of you will be surprised.

my comments be continued…

i specially removed the algorithm which founds ALL duplicated records and left only the most common… you can extend ‘parasites’ list in my structure.
the number of records depends on the environment you work.

please post your number. the maximum what i saw was ~15,000

I have none in any of my max versions

So…

I guess what you are saying is add your tool bar to
filename = menuMan.getMenuFile()
if it is not in there? But check first with your code.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i are just lucky because you probably not use Havok, PhysX, MassFx toolbars

It looks like if I add an XML entry 2x 3dsmax cleans up after it’s self and removes it.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

what version of max do you use?

maybe 2017+ does do it automatically. all versions before as know don’t do it

you can add any number of identical elements to XML.

Right now I’m texting with 2017

But I have 2013->2018

C++ XML sure is easier then this DOT net stuff.

There must be a simple sample of just adding a DAMN child

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

so you want to know how to add a child to XML first?

the problem with specifically mnux file is that you have to add a valid element. there should a thread about it… i remember that i posted the .net code how to do it. of course it’s in archive somewhere. but i need to search

Page 1 / 2