macroscript icon

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Display Modes
  10 October 2011
macroscript icon

Hi. I have created a mzp package containing a macroscript, a scriptfile and the icon files. Installing the mzp works fine and the script can be used immediately. Unfortunately max doesn't find the icon files until the next restart. So draging the macro onto a toolbar will produce an empty square button. I find this rather ugly. Is there a way to force max to reevaluate the ui/icons folder, or to tell my script to search for the icon itself? what is the correct workflow here? help appreciated.
 
  10 October 2011
colorMan.reinitIcons()
__________________
Bobo
 
  12 December 2011
Thanks for the info Bobo. Very handy that this can be done without restarting 3ds max.

Is there a way of reloading macroscripts in a similar kind of way after installing one?

Example:
Install macroscript into maxRoot/UI/Macroscripts directory.
Somehow run the macroscript.
Macroscript is now available in customise>customise UI.

I have tried to do this with a fileIn, but it has a negative side effect of copying the macroscript to a new file in the userMacros directory. Is there any way around this? Ideally I'd like to be able to install a scripted tool with a macroscript for ui access and not require 3ds max to be restarted to see it in the customise ui options.

Thanks for any help.
Tim
 
  12 December 2011
Found it, there's a huge amount of documentation on it that I somehow missed


macros.load()


Cheers
 
  12 December 2011
Originally Posted by TimHawker: Thanks for the info Bobo. Very handy that this can be done without restarting 3ds max.

Is there a way of reloading macroscripts in a similar kind of way after installing one?

Example:
Install macroscript into maxRoot/UI/Macroscripts directory.
Somehow run the macroscript.
Macroscript is now available in customise>customise UI.

I have tried to do this with a fileIn, but it has a negative side effect of copying the macroscript to a new file in the userMacros directory. Is there any way around this? Ideally I'd like to be able to install a scripted tool with a macroscript for ui access and not require 3ds max to be restarted to see it in the customise ui options.

Thanks for any help.
Tim


There is a page in the Help discussing MacroScripts for New or Casual users. Read it!

The copying of the file to the userMacros folder is NOT a negative effect. It is the way it works! You should NEVER EVER put your scripts there, nor under ui/macroscripts. Max is supposed to manage these.

When you write your own MacroScript, store its definition in an .MS file somewhere else. When you press Ctrl+E or perform fileIn(), any MacroScript() definition in the .MS file will produce a new .MCR file with prefix the Category and suffix the Name of the script in the Usermacros folder. This ensures that next time you launch Max, the MCR files will be loaded at the right time during the booting process even if the .MS file is not loaded automatically. In fact, your .MS file should typically NOT be in a startup folder. Now if you want to update those .MCRs in the middle of the Max session, open the source .MS file from whatever non-startup folder you stored it in, make your changes and press Ctrl+E and your .MCRs will be updated again. NEVER edit the actual .MCRs in the Usermacros folder, because if you ever run the source .MS file again, they will be overwritten!
If you download a new version of the .MS source from the internet for example, running that file using MAXScript>Run Script, drag&drop into Max or filein() will also update the respective .MCR files it makes...

It might sound convoluted, but it works really well once you understand how it works.

BEWARE: If there is an error in your macroscript, MAXScript might open the .MCR file from Usermacros and not the real MS source. Be careful where you fix the error - if you fix it in the .MCR in Usermacros, the changes could be lost if you ever run the MS source again!

Also note that opening an shipping MacroScript (stored in ui\macroscripts) for editing will make a copy into \Usermacros because on Vista and Win7, the Program Files folders are locked for saving. Since Usermacros MCRs are loaded after the shipping macros, your modified copy will always override the shipping version.
__________________
Bobo
 
  12 December 2011
Thanks again Bobo. This all makes really good sense.

I do have one question though regarding installing/uninstalling custom tools written in maxscript.

When I drop a mzp into the viewport and press install from the UI it creates, it copies over a few .ms files. If I understand correctly I am meant to evaluate the macroscript instead of copying it over to usermacros? This will place the macroscript in the usermacros directory, and then that macroscript can be used to load any required scripts if it they have not been previously loaded.

When I drop the same mzp into the viewport and press uninstall from the UI, what is the best way to uninstall the mcr file that was previously created by the filein? Will it's name always be consistent (ie category name then macroscript name) so I can find it via a doesFileExist string comparison?

Thanks for any help.
Tim
 
  12 December 2011
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:31 PM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.