FSIC Messageboard
  Old Tech Info
  MAX Script Breakthough #2

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone! next newest topic | next oldest topic
Author Topic:   MAX Script Breakthough #2
Bryan Russell
Pilot
posted 01-07- 10:37 AM     Click Here to See the Profile for Bryan Russell   Click Here to Email Bryan Russell     Edit/Delete Message   Reply w/Quote
I think I finally wrestled MAX script into submission and I have made the following script for efficient export of LODs to OPS or any other program. This coupled with version B1.1.1 of OPS, which includes a bulk import, matched to Model name feature will enable a whole plane full of LODs to be imported at the press of a button. B1.1.1 will be out soon after I tidy it up. Here's the script. More comments than actual code, but I guess that can’t be a bad thing J


--**************************************
--* export_OBJ.ms :
--* The script is used to help with the export
--* of parts to OpenPlane Studio, or any other
--* program for that matter. It resets each
--* object back to its identity matrix (pivot
--* point to origin, rotations removed), exports
--* to a OBJ file and then returns the objects
--* back to the original matrix
--*


--***************************************
--* Forward declare the saved matrix list
--*
old_mat = #()

--**************************************
--* Change this to where you really want
--* the exported file to be
--*
export_filename = "d:\sdoe\hurricane.obj"

--**************************
--* This uses an incremented integer
--* rather than object iteration because
--* it needs the index for the saved list
--*
--* Note that this will re-position all
--* objects including cameras and lights
--* and helpers. You could refine it by using
--* the 'geometry' collection rather than
--* 'objects' but it doesn't make much
--* difference to the end result
--*
for i=1 to objects.count do
(
--**************************
--* Save the Existing Matrix
--* Information
--*
old_mat[i] = objects[i].transform

--****************************
--* Set to the Identity Matrix
--*
objects[i].transform=matrix3 1
)

--************************************
--* Export the file. Note that MAXr2.5 doesn't
--* Support "max file export" which will provide
--* a nice file selection dialog. However
--* exportFile does have its advantages in that
--* the file export will happen without user
--* intervention. Since MAX2OBJ saves the last
--* settings, you can either do a manual export
--* with the setting you want, or remove the
--* '#noPrompt' to get the MAX2OBJ dialogs.
--* For MAX r3.0 users who want the file selection
--* dialog replace this line with
--*
--* max file export
--*
exportFile export_filename #noPrompt


--***********************************
--* Now back to your regular programming!
--*
for i=1 to objects.count do
(
objects[i].transform= old_mat[i]
)

IP: Logged

JT
Pilot
posted 01-07- 12:06 PM     Click Here to See the Profile for JT   Click Here to Email JT     Edit/Delete Message   Reply w/Quote
Fantastic... can't wait to try this out! Thanks for your efforts.

IP: Logged

Tailslide
Pilot
posted 01-07- 04:07 PM     Click Here to See the Profile for Tailslide   Click Here to Email Tailslide     Edit/Delete Message   Reply w/Quote

Great! Did you manage to come up with a way to include only certain objects? I've got about 10 plane parts but 30 odds and sods sitting in the project I need to work on the plane that I don't want exported with it.

TS


IP: Logged

Tailslide
Pilot
posted 01-08- 03:43 PM     Click Here to See the Profile for Tailslide   Click Here to Email Tailslide     Edit/Delete Message   Reply w/Quote

Oh hey I missed the part about the batch import.. it won't matter if there's extra objects in the file. Good stuff !

TS

------------------
________________________
TS Aircombat

IP: Logged

Tailslide
Pilot
posted 01-17- 05:15 AM     Click Here to See the Profile for Tailslide   Click Here to Email Tailslide     Edit/Delete Message   Reply w/Quote

I finally got around to trying this.. it works in 3dsmax R3 but some of my pieces wind up getting rotated around.. is there a way to change this script so it just repositions and doesn't rotate the pieces?

(why is the script rotating them, is this desireable?)

TS

IP: Logged

Tailslide
Pilot
posted 01-17- 01:49 PM     Click Here to See the Profile for Tailslide   Click Here to Email Tailslide     Edit/Delete Message   Reply w/Quote

Ok got everything working ..

If you have rotated wings, flatten them out then align the pivot points to world then rotate them back. For all other pieces, you have to do a reset transformation. I still haven't been able to get my right wing to transfer right, it's a mirrored reference of the left hand wing so the pivot axis are also mirrored and the wing gets rotated on export.

TS

IP: Logged

Tailslide
Pilot
posted 01-17- 01:50 PM     Click Here to See the Profile for Tailslide   Click Here to Email Tailslide     Edit/Delete Message   Reply w/Quote

You also need to do a "reset scale" on your pivot points or some pieces will come out the wrong size after export.

TS

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | Fighter Squadron Information Center

(This site Copyright (c) 1999 Inertia LLC)

Powered by Infopop www.infopop.com © 2000
Ultimate Bulletin Board 5.45c