December 11th, 2006
I’ve just been invited to give one half of a two hour lecture at GDC 07. The talk is titled, “Advanced Tool Writing for 3ds Max and Maya”. I’ll be doing the 3ds Max part.
This talk is in addition to the Technical Artist roundtable sessions I will be running at GDC 07.
From a rejected talk for GDC 06 to a roundtable and talk at GDC 07. I’ve definitely achieved my goal of participating at an industry conference.
Posted in Technical Art | No Comments »
December 6th, 2006
I stumbled across the following line of code while reading through a MaxScript this morning:
size_label.text = (((siz * 100) as integer) / 100)) as string
That’s a multiply, cast, divide, and cast to get a float shown as a string reprensentation of an integer. The same operation can be done with just two casts as:
size_label.text = (siz as integer) as string
When you recast a float as an integer the decimal points get dropped automatically. Multiplying a float by a value to shift the decimal point, converting the result to an integer, and dividing by the same value will also give you a result with no decimal places. It’s slower and more obtuse, though.
Posted in Technical Art | No Comments »
October 20th, 2006
Yes, I know, a month without posts. I’m the suck. I really should be putting more and better tech art bits up here. My only excuse is that with work, the change over from Max 8 to 9, and a fourteen month old daughter who is starting to walk I’ve been a bit distracted.
Anyway, DJ JoeG from upstate NY pulled himself away from playing MaxJack long enough to ask if I could gin up a script that would give him the Selection Set dropdown list in a floating dialog window.
But of course, Joe….but of course.
Just put JoesSelSetList in your \ui\macroscripts folder and either restart Max or do a macros.load() command from the Listener. You’ll find the tool, “Floating Selection Set List”, under the “Joe’s Tools” category in the Customize UI dialog. Assign it to a hotkey, put it on a quad menu, or drag it to the tool bar.
Due to an oversight in MaxScript the only time the dropdown list won’t update itself is when you make changes to the selection sets, either making new ones, deleting existing ones, or renaming them. This has been fixed in Max 9 and the script file is smart enough to detect if you’re running 9 (lucky bastards) and add enable that functionality for you.
Enjoy!
Posted in Technical Art | No Comments »
September 18th, 2006
I’ve just finished an UltraEdit macro that uses the bookmarks within UE as a form of visual breakpoints for the MXSDebugger. Just load the attached .MAC file in to UE’s macro list to make use of it.
You can download the file here.
When you run the macro the following steps happen:
- Your current file is saved
- At any point in the file where a bookmark is found a “break();” statement is added to the beginning of that line
- The file is saved off as a new temporary .ms file (c:\MXSTemp.ms).
- The new file is executed in Max via the MXSCOM bridge
- The temporary file is closed
- Your original file is reloaded
- The editing cursor is positioned at the start of the line you were on when you executed the script.
Current Limitations
- You must have a user tool configured to run the MXSCOM bridge. This tool must be named “Run MAXScript”.
- If you’re trying this on a newly created file it will be saved off to C:\Program Files\IDM Computer Solutions\UltraEdit-32\Edit#, where “Edit#” is the name of the tab in UltraEdit. Either save your new file off before you run the macro or remember to do so afterwards.
- I wanted the macro to either only use, or ignore, named bookmarks so you could still have regular bookmarks in your file. Sadly, the macro language in UE doesn’t support querying bookmarks for their names.
- Sometimes you will come back to your original file after you run the macro and your bookmarks will be gone. UltraEdit stores per file bookmark information in its main application INI file. This file is not updated when you save a document, only when UE is closed. This leads to the unfortunate problem of a new file being closed and opened without UltraEdit being closed and the bookmark information being lost. It doesn’t happen every time, so UE must be temporarily storing that data in memory somewhere.
Posted in Technical Art | No Comments »
September 7th, 2006
By design any nodes placed into the Max scene are oriented so their local z-axis is perpendicular to the construction plane of the viewport in which they are placed. In order to have objects with their +z-axis aligned with the world coordinate system +z-axis you have to place the object in either the perspective or the top viewport. This recently became an issue at Volition, as we wanted to use a scripted helper object to specify snap-points for objects in game. The scripted helper’s axis orientation is directly relevant to how objects are snapped to it. Having the helper placed at different rotations based on something as arbitrary as a viewport selection was counterintuitive. Having the artists constantly reorienting their helper nodes after creation was becoming time consuming.
I figured it would be an easy thing to fix. All I needed to do was to set the rotation of the new node to quat (0 0 0 1) as it was being created…
tool create
(
on mousePoint clickno do (
if (clickno == 1) then (
delegate.shape = “sh-snappoint”
nodeTM.pos = gridPoint
nodeTM.rotation = (quat 0 0 0 1)
) else (
#stop
)
)
)
This didn’t change the behavior at all. The nodes were still coming in oriented relative to the viewport in which they were placed. Confused, I put a “print (nodeTM.rotation as string)” line after the nodeTM.rotation = … line. The script started telling me that each placed node had a rotation of (quat 0 0 0 1), which was good. Each node still ended up in viewport relative orientations, though. querying their .rotation property after they were in the scene yielded rotations other than the default. Somehow, somewhere, Max was overriding my desired rotation before the node was attached to the scene.
After some forum posts with Autodesk it turns out that you have to use getCPTM(), which returns the construction plane to world transform matrix, set the view transformation matrix to that, and then set nodeTM to be equal to the transform matrix of the mouse position on the active grid in world coordinates multiplied by the inverse of the newly set view transformation matrix. Then a placed node will always be oriented to the world.
You might need to read that through a few times. I know I did!
The correct code is:
tool create
(
on mousePoint clickno do (
if (clickno == 1) then (
delegate.shape = “sh-snappoint”
viewTM = getCPTM()
nodeTM = (transMatrix worldPoint) * (inverse viewTM)
) else (
#stop
)
)
)
Posted in Technical Art | No Comments »
August 24th, 2006
Here’s a MaxScript oddity I just discovered.
Evaluate the following script n times.
if (rlt_test != undefined) then (
destroyDialog rlt_test
)
(
rollout rlt_test “Test”
(
)
createDialog rlt_test width:100 height:100
)
You’ll get n dialogs stacked on top of each other. The if test at the top of the script is never triggering due to the fact that (rlt_test != undefined) is always incorrectly evaluating to “true”. Now change the first line to remove the parentheses around the if test conditional, so it reads:
if rlt_test != undefined then (
Now re-evaluate the script n times. You’ll only get one dialog. The if test is now evaluating properly. Why does enclosing the boolean used in the if test inside of parentheses cause the test to evaluate incorrectly?
Put the parentheses back and put this line at the very top of the script:
print (rlt_test as string)
and evaluate again.
On (n > 1) runs of the script you’ll see “Rollout:rlt_test” printed to the listener but the if test will still evaluate to true.
It’s almost as if the parentheses are forcing rlt_test to be declared as a new variable inside of them, local only to that parenthesis block. If that’s the case then putting if test conditionals inside of parenthesis for either order of operations or readability’s sake (Volition’s coding standards state that all if tests should be enclosed in parenthesis) could cause problems if variables are used in the if test.
Posted in Technical Art | No Comments »
August 23rd, 2006
Granted, I’ve only tried to use the forums over on http://area.autodesk.com for a day but my initial impression is not favorable.
There is no hierarchical navigation from one forum to another. The only way to switch forums is to use the “Discussions” button on the top of the page which takes you back to the forum synopsis page. The problem with the forum synopsis page is that it doesn’t list all of the forums, only five or so from each product category. You have to click the “Show all forums” button in the product category in which you are interested to get a list of forums for that product.
That’s three mouse clicks and an amount of searching to switch forums. On the old forum system changing discussion forums was a one click operation.
Supposedly the Area can be read via RSS and read & posted to via NNTP. I can’t get Sage to recognize the RSS feed information and there’s no page with the pertinent information to set up NNTP access.
The forums on the Area are a step backwards. I hope Autodesk doesn’t fracture the community with this “upgrade”.
Posted in Technical Art | No Comments »
August 22nd, 2006
1) Autodesk carried over the discussion topics from the old boards.
2) The new forums can be read via the web, NNTP, or RSS.
Posted in Technical Art | No Comments »
August 21st, 2006
http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython
I can only get the download link to work in IE for some reason. For those not in the know Iron Python is Python built against .NET so you have access to the entire .NET class hierarchy, including Windows.Forms, from within Python.
There is a VisualStudio.Net IronPython integration sample at http://blogs.msdn.com/aaronmar/archive/2006/02/16/…
Posted in Technical Art | No Comments »
August 21st, 2006
Yost Group..er Autodesk…er Kinetix..er Discreet..er Autodesk has locked all of the forums over at http://support.discreet.com. This is the final step before they move everything over to http://area.autodesk.com. Area is the new combined AutoCad, Max, Maya, Viz, etc… community portal. Area goes live tomorrow (8/22). I don’t know how long the old support boards will be up for old topic searches.
The old support boards were my main source of information, inspiration, and help when I learned MaxScript. I never met anyone on those forums who wasn’t curteous, friendly, and helpful. Kees, Swami, Bobo, Paul Neale, et. al. were and are the nicest group of industry peers anyone could hope to know.
I’ll kind of miss the old boards. I hope the discussions are as friendly, lively, and helpful over in the new Area.
Posted in Technical Art | No Comments »