tutorial written by Mobi on 1st April 2003
Sorry about the delay for this one but here we go!!
This tutorial is *very* general - it covers how to make a button, to do something. Told you it was general!! Ok, so specifcally, we will make a button the creates and renames a sphere, simple I know but like I always say - principle,principle,principle. Well OK this is the first time Ive said it...but you get the idea...
Be careful now, this is hard! Click "View>Custom Toolbars>New Toolbar" and name it "Test".
There you have your first custom toolbar!
Now we will make a button to put in it. XSi makes this bit of programming far easier than you can imagine so all you creatives out there dont stress about this techie part!
Get a primitive polygon sphere "Get>Primitive>Polygon Mesh>Sphere", name it "MySphere" and colour it red "Get>Material>Lambert" and use these settings:
We will now make a button that will do this for us i.e. create a red polygon sphere called "MySphere".
At the bottom of the display click the script icon: The script window will open.
This contains a log of EVERYTHING you do in XSi. You can see the primitive being created, the renaming and the lambert shader. To make a button all you have to do is drag the text you want for the button function into the toolbar!
So, highlight all the text from "CreatePrim.." to the last line of the lambert shader:
Left click the text *AND HOLD THE BUTTON* drag the text into the toolbar window we created earlier and let go. A pop up window appears, this may look scary but just change "Command/Button Name" to "RedSphere" (as thats what the script does!)
At this stage just ignore the rest - click "OK". Delete the "MySphere so you have an empty scene. Now, simply click the "RedSphere" button in your toolbar and up pops a red sphere called "MySphere"!.
You will notice if you look in the script window only "Script X" (x being the script number dont worry wat yours is) appears this time, not all the lines of code we copied.
Im sure you can see the power of this, incidentally, if you close the tool bar you can re-open it by clicking "View>Custom Toolbars>XXX" where XXX is the name of your toolbar!
Until next time happy XSi-ing....!
Copyright © 2003 BallisticPanda.com. All