View Full Version : Add to toolbar
hiphopclown 07-04-2005, 01:22 AM Hi guys,
this is going to be a bit of a basic question, but ive created a number of small maxscripts, just small scripts that i use on a regular basis. I was wanting to add them to a toolbar, or a menu.
I cant however, for the life of me work out how to do this. From what i've read i'm not sure if this is possible? Im presuming they have to be macroscripts?
Cheers
|
|
Light
07-04-2005, 02:19 AM
Luke,
Scripts must be macroScripts if you want to use them in menus, quads, etc.
Either wrap your code with something like this:
macroScript symDisp category:"Light's Orionflame" tooltip:"Symmetric Display"
(
on execute do
(
-- YOUR CODE
)
)
OR
Select your code and drag it to a toolbar as this will create a new macro.
But I recommend the first method.
Light
hiphopclown
07-05-2005, 07:10 AM
how different are macro and maxscript, as in ive managed to teach myself how to write the scripts i need to do in maxscript, is there an easy way to translate between the two? as apposed to rewritting/learning how to do write macroscript
Macroscript and Maxscript are one and the same. Only real change is that macro header (or whatever it is)
macroScript symDisp category:"Light's Orionflame" tooltip:"Symmetric Display"
And macros are located different path in Max directory. [MAX]/UI/MacroScripts
Rest is just same old script. There really isn't that much to learn.
Impus
07-05-2005, 07:49 AM
There is a small but vital difference between maxscript and macroscript and that's how they are evaluated. I've found that macroscripts are evaluated at startup and as such ever time they are executed it's like executing a function rather then executing a script.
I'm also not to sure if max handles access functions defined in macroscripts too well.
This, if you're not sure how it works, can cause some major havoc with 'scope' of variables and object definitions.
I found the best way to use macroscripts is just have them execute a function (don't do any real scripting inside the macroscript). This will make sure the 'scope' is predictable and you shouldn't have any problems.
However after saying this the 'syntax' of macroscripts is exactly the same as any other script you just might have to play around with where and how things are predefined.
I'm fairly sure if you look at blurs scripts you'll see they don't do any real scripting inside the macro just have it execute functions - but I might be wrong.
magicm
07-05-2005, 09:18 AM
I cant however, for the life of me work out how to do this. From what i've read i'm not sure if this is possible? Im presuming they have to be macroscripts?
Not necessarily. The quickest way to add a script to the toolbar is by simply selecting the script and dragging it to the toolbar. This automatically turns the script into a macroscript by adding the appropriate headers.
- Martijn
hiphopclown
07-06-2005, 12:29 AM
ahh thanks for that, most of my scripts work now, few have a few errors but i can fiddle with them at a later date.
Just out of interest, how do i define a custom icon for a script button?
Light
07-06-2005, 04:21 AM
macroScript box category:"Objects Primitives" buttonText:"Box" tooltip:"Box" icon:#("Standard", 1)
Where Standard is the name of the icon [bitmap] file, and 1 is the # of the icon.
Light
CGTalk Moderation
07-06-2005, 04:21 AM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.