Ability to differentiate between "Export" and "Export Selected" during maxscript's export callback?


#1

I have a validation script that automatically runs when someone exports a file that looks at every object and makes sure it follows specific naming conventions and other sanity checks.

However, I only really care about validating objects that are being exported. If an artist is only exporting their selected objects I don’t really want to spit out warnings about other irrelevant objects in the file if I don’t have to.

I’m using callbacks.addScript #postExport to link the script, but I don’t see anyway of determining what objects are actually being exported or what export setting is being used. Has anyone ever done this or know of a workaround? Thanks!


#2

if users export files using max interface only (not any sort of scripted exporter) then you can listen to WM_COMMAND message of max main window to determine which one was used

40011 “Export File”
40373 “Export Selected”

or you can replace exportFile with your own wrapper

ef = exportFile -- saving reference to original function
globalVars.remove #exportFile

/*
    exportFile <filename_string> [#noPrompt] [selectedOnly:<boolean>] [using:<maxclass>]
    no idea how can we pass second optional #noPropmt argument as in the original function
*/
fn exportFile filename selectedOnly:false using:unsupplied = 
(       	
        ::ef filename #noPrompt selectedOnly:selectedOnly using:using
)

exportFile (GetDir #export) selectedOnly:true using:FBXEXP

#3

this is tough! :upside_down_face:


#4

Cool, thanks! This seems promising for what I want, I’ll look into it,