Home Technical Talk
The BRAWL² Tournament Challenge has been announced!

It starts May 12, and ends Sept 12. Let's see what you got!

https://polycount.com/discussion/237047/the-brawl²-tournament

Maxscript filename into save field

polycounter lvl 6
Offline / Send Message
pointcache polycounter lvl 6
Hey guys i wrote some scripts that help to speed up exporting and i want one more addition.
  1. --Fast save overwrite 2 step script
  2. --STEP 1 - export file with this script, it will store location of the file
  3. --Filename should be equal to the name of the object
  4.  
  5. if selection.count != 0 do
  6. (
  7. actionMan.executeAction 0 "40373"
  8. ::path1 = sysInfo.currentdir + "//" + $.name
  9. )

you select object and press shift+ctrl+1 and you get straight to this window
a63c6879dc.png





now i want the name field of the export dialog to be already filled with object name. Im digging into it myself, but maybe someone already knows that. thank you guys.

Replies

  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Use exportFile command.

    exportFile "Path" #noPrompt selectedOnly:true using:FBXEXP

    You can set the settings by loading class like
    1. pluginManager.loadClass FBXExporter
    2. FBXExporterSetParam "SmoothingGroups" true
    3. ....

    if you are deadset on using the UI, look into UIAccessor but seems redundant
  • pointcache
    Offline / Send Message
    pointcache polycounter lvl 6
    thanks i was considering that, but came up with simple solution,
    1. if selection.count != 0 do
    2. (
    3. local Clipboard = dotNetClass "Clipboard"
    4. Clipboard.Clear()
    5. Clipboard.SetText selection[1].name
    6. actionMan.executeAction 0 "40373"
    7. ::path1 = sysInfo.currentdir + "//" + $.name
    8. )

    i just have to press ctrl+v after window appears to paste object name
    i will probably make a macro with MacroGamer for that.
  • Swordslayer
    Offline / Send Message
    Swordslayer interpolator
    UIAccessor way isn't hard either:
    1. fn pasteSelName =
    2. (
    3. local hwnd = dialogMonitorOps.getWindowHandle()
    4.  
    5. if UIAccessor.GetWindowText hwnd == "Select File to Export" then
    6. (
    7. for ctrl in (windows.getChildrenHWND hwnd)
    8. where ctrl[4] == "ComboBoxEx32" do UIAccessor.SetWindowText ctrl[1] selection[1].name
    9. true
    10. )
    11. else false
    12. )
    13.  
    14. if selection.count != 0 do
    15. (
    16. dialogMonitorOps.enabled = true
    17. dialogMonitorOps.interactive = false
    18. dialogMonitorOps.registerNotification pasteSelName id:#export_name
    19. actionMan.executeAction 0 "40373"
    20. dialogMonitorOps.unRegisterNotification id:#export_name
    21. dialogMonitorOps.enabled = false
    22.  
    23. ::path1 = sysInfo.currentdir + "//" + selection[1].name
    24. )
  • monster
    Offline / Send Message
    monster polycounter
    Maybe I' m not understanding something, but you just use the filename parameter of the save dialog.
    1. --Make the path
    2. fName = (sysInfo.currentdir + "/filename.fbx")
    3.  
    4. --Update the path with a save dialog
    5. fName = getSaveFileName filename:fName
    6.  
    7. --Export the file, if the user didn't press cancel
    8. if fName != undefined do exportFile fName #noPrompt selectedOnly:true
Sign In or Register to comment.