Home Technical Talk

3ds max- how to export a FBX file without pop up windows?

kurt_hectic
polycounter lvl 10
Offline / Send Message
kurt_hectic polycounter lvl 10
Hey,

Here's script I cut from some other one. It's a single button which do an "export selected mesh".

Are you able to add to this some code, please ;) ?
-export as fbx (has to be changeable in the code)
-export without pop up windows! (use the last settings; settings could be changed in the file>export>export as pop up window)
-use name of the mesh as the file name
-save it in the provided path (has to be changeable in the code)

At the end of the day we will get an "one click" export button.
ollout ExportPrep "Export Prep" width:80 height:30
(

    button btnExpSel "Export Sel" toolTip:"Export Selected"
    
    on btnApEP pressed do
    (
    
    local mySpot = [0, 0, 0]
        Undo on
    for obj in selection do
    (
    resetxform obj -- This line will cause the max 5 to error, either delete it or add two - to the begining of the line.  By Doing so your Xform will no longer reset.
    collapsestack obj
    case rdoXP.state of
    (
      1: mySpot.x = obj.min.x
      2: mySpot.x = obj.center.x
      3: mySpot.x = obj.max.x
    )
    case rdoYP.state of
    (
      1: mySpot.y = obj.min.y
      2: mySpot.y = obj.center.y
      3: mySpot.y = obj.max.y
    )
    case rdoZP.state of
    (
      1: mySpot.z = obj.min.z
      2: mySpot.z = obj.center.z
      3: mySpot.z = obj.max.z
    )
    obj.pivot = mySpot + [spnXOs.value, spnYOs.value, spnZOs.value]
    obj.pos = [0+spnXPos.value, 0+spnYPos.value, 0+spnZPos.value]
    )
    )
    
    on btnExpSel pressed do
    (
    actionMan.executeAction 0 "40373"  -- File: Export Selected
    )
    

)CreateDialog ExportPrep
)


Replies

  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    You're using those horrible 'actionMan' snippets of code. Never use those! They're like shortcuts/wrappers for the actual code that are completely useless.

    Use this:
    fn ExportStatic nodes exportpath=
    (
    
    
    pluginManager.loadClass FBXEXPORTER
    
    FBXExporterSetParam "SmoothingGroups"  true
    FBXExporterSetParam "SmoothMeshExport" false
    FBXExporterSetParam "Triangulate"  false
    FBXExporterSetParam "Animation" false
    FBXExporterSetParam "Lights"  false
    FBXExporterSetParam "ASCII"  true
    
    select nodes
    
    exportFile exportpath #noPrompt selectedonly:true
    
    )
    
  • Noors
    Options
    Offline / Send Message
    Noors greentooth
    Rollout ExportPrep "Export Prep" width:80 height:30
    (
        button btnExpSel "Export Sel" toolTip:"Export Selected"
        
        on btnExpSel pressed do
        (
            sel = selection as array
            fileName = sel[1].name
            folder = @"D:\Data\MyFiles\" --your path
            ext=".fbx" --your extension
            exportFile (folder+fileName+ext) #noPrompt selectedonly: true
        )
    )
    CreateDialog ExportPrep
    
    

    Since you want to be able to change the extension...
    Assuming you select a valid object and that the folder already exists.
  • kurt_hectic
    Options
    Offline / Send Message
    kurt_hectic polycounter lvl 10
    Thank you guys!


    tumblr_m1cslt9euN1rn95k2o1_250.gif
Sign In or Register to comment.