Jump to content

Recommended Posts

Posted (edited)

Hey, I'm looking for a MaxScript that automatically move my objects to the scene origin (0,0,0) and export them as .FBX (MAX to UDK)

 

I found a script that does exactly that but If I select my collision and my mesh, it creates 2 separate .FBX instead of combining them into a single one.

(UCX_SM_Cage.fbx) + (SM_Cage.fbx) instead of  SM_Cage.fbx(which contains the collision info of UCX_SM_Cage)

 

 

Also, maybe it would be great to have a place to share useful scripts. Like Unwrapping, exporting, etc?

Edited by tr0nic
Posted

Not sure it warrants a whole forum (that's normally only done if there are too many posts about a subject for one forum), but a sticky thread about it might be good. I could sticky this one if you want to keep the OP up to date with links to posts in the thread with useful stuff? :)

Posted

I haven't seen this done in Max but I've seen it used in Maya Using MEL and it worked just fine except for one thing - you always has to specify where you want to export it to with a browser window but there's probably a workaround for that.

Posted

OK, give me a head count guys. I can create a third creative forum for coding, I just don't want to take up space up the forum home page if it'll only get like one post a week.

 

I've no problem with coding stuff being posted in the 3D/2D forums (depending on whether it relates to 3D or 2D implementations) but I appreciate it feels a bit weird and a proper coding forum would be more ideal.

Posted (edited)

Hey, I'm looking for a MaxScript that automatically move my objects to the scene origin (0,0,0) and export them as .FBX (MAX to UDK)

 

I found a script that does exactly that but If I select my collision and my mesh, it creates 2 separate .FBX instead of combining them into a single one.

(UCX_SM_Cage.fbx) + (SM_Cage.fbx) instead of  SM_Cage.fbx(which contains the collision info of UCX_SM_Cage)

 

 

Also, maybe it would be great to have a place to share useful scripts. Like Unwrapping, exporting, etc?

 

Here is the code you want. Unfortunately, the forum is formatting it poorly, so you will have to make due.

 

Please be aware that this kind of scenario assumes that all objects have pivot points at the same location before you export. To handle exporting props at location in Wall Worm, I had to build into my exporters an option to MOVE THE WORLD, so to speak, at export time instead of this scenario. But since we have no control over options in FBX, this is probably as close as it gets.

 

(

 --First see if there is a selection

 if selection.count > 0 then (

  

  --Prompt the artist to choose the file name to save this as

  local filename = getSaveFileName caption:"Save as FBX at Origin" types:"Autidesk FBX (*.fbx)|*.fbx" historyCategory:"Saved FBX"

 

  --Only run the export if the user actually chose a file

  if filename != undefined then (

   

   --Run all transform calculations in World space

   in coordsys world (

   

    --Store the original position

    local oldTransform = for obj in selection  collect obj.pos

    

    --Move all the objects to the origin

    selection.pos = [0,0,0]

    --Run the export

    exportFile filename #noPrompt  selectedOnly:true using:FBXExP

    --Now put all the toys back where you found them

    for index = 1 to selection.count do (

     

     obj = selection[index]

     obj.pos = oldTransform[index]

    )

   )

  ) else (

   messagebox "File was not saved."

  )

 ) else (

  messagebox "Nothing was selected"

 )

)

 

Edit: it formatted fair without being in a CODE tag.

Edited by shawnolson
Posted

i'd be in for a scripting forum :) in terms of fbx exporting, if you want to export the same asset over and over again, it might make to store meta data in a user created attribute with the export path or at least the export name, to prevent repeatedly answering the same dialog - or using the render node's name as the export name.

Posted (edited)

It was only a suggestion.. if you don't like it, don't do it! I wasn't sure if it was ok to post this in the 3d creative forum!

Thanks ShawnOlson, I will try this over the week-end! I have a basic scripting class at school so I should be ok understanding your code ;)

Edited by tr0nic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...