Home Technical Talk

exportFile #noprompt in MAXscript

polycounter lvl 17
Offline / Send Message
Funky Bunnies polycounter lvl 17
Heyo peepz,

I've been looking around to check if there's a solution to this.

I'm using exportFile (fullFilePath + ".WRL") #noPrompt in a export script

But apparently sometimes max doesn't export normals with our WRL exporter when run via script because the the #noPrompt flag avoids the export dialog and just uses defaults. Once the user exports a WRL manually with the dialog and the greyed out checkbox for "Export Normals" is ensured to be checked, the scripts work fine. This has only happened 2 times that I know of on 2 or 10 computers over like the last year or so, so I don't really know what's causing it.


So I was wondering if any of you have had this issue?
and if you've found/thought of a way around it?
Is there some place to set the defaults of an exporter class?

thanks!

Replies

  • FortyOne
    Options
    Offline / Send Message
    just making sure first, when you say "greyed out checkbox" do you mean that you can not change it from one to the other or do you just mean that its checked?

    I would say yes and no. Its gonna be a little tricky i think, but you could always have a test export run for you which will set the default for you.
    http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/transfering-uvw-data-via-maxscript/

    This link will give you an idea of how someone uses this for exporting UVWs with creating its own custom noPrompt. You could use this method to export with out using the "#noPrompt" . If it uses too much memory you could always have it just run a callback when you start up max to run a quick export once to save the setting you were going for so that when you do us the "#noPrompt" It should work with the last export settings.
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    You will need to trawl about for it but Im pretty sure all those exporters have INI files thats you can access manually from max script. I'd ask RenderHJS, i think he did it in tex tools.
  • Funky Bunnies
    Options
    Offline / Send Message
    Funky Bunnies polycounter lvl 17
    FortyOne, yes I mean that in the dialog it's impossible to export it without normals but somehow 2 people have gotten it to export without normals. I've considered just exporting a test wrl on max startup and then deleting it that way but I was hoping there was a more elegant solution haha

    r_fletch_r, thanks, that's what I was hoping but I can't seem to find it, I'll give rhjs a holla!
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    well before I got your PM I already read this thread and r_feltch_r's comment ;)

    copypastepixel wrote a initial great script to export a OBJ file with some default modifications using binary hacks
    http://www.polycount.com/forum/showthread.php?t=71230

    I used parts of his technique in TexTools for the "fn_40__unwrap_with_roadkill.ms" script (you can find it in the TexTools_...mzp file). The code that you are after in this regards is:
    ...
    fn killroad_OverwriteGWObjConfig =(
    		local version = (maxVersion())[1];
    		if version == 11000 then( -- max 2009 only
    			
    			fn fnWriteBinary dataFile data =(
    				local d = fopen dataFile "wb"
    				for i in data do(
    					WriteByte d i
    				)
    				FClose  d;
    			)
    			
    			local inputCfgPath = ((getDir #plugcfg) + "\\"+"gw_objimp.cfg")
    			local outputCfgPath =  ((getDir #plugcfg) + "\\"+"gw_objexp.cfg")
    			fnWriteBinary inputCfgPath #(5, 0, 0, 0, 39, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, -128, 63, 2, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 11, 0, 0, 0, 0, 0, 0, 0)
    			fnWriteBinary outputCfgPath #(16, 0, 0, 0, 86, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -128, 63, 0, 0, 1, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 46, 47, 109, 97, 112, 115, 47, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 60, 78, 79, 78, 69, 62)
    			
    		)else if version >= 12000 then( -- max 2010
    			local iniPath_exportSettings = objExp.getIniName()
    			setINISetting iniPath_exportSettings "Geometry" "FlipZyAxis" "1"
    			setINISetting iniPath_exportSettings "Geometry" "Shapes" "0"
    			setINISetting iniPath_exportSettings "Geometry" "ExportHiddenObjects" "0"
    			setINISetting iniPath_exportSettings "Geometry" "FaceType" "2"--polygons
    			setINISetting iniPath_exportSettings "Geometry" "TextureCoords" "1"
    			setINISetting iniPath_exportSettings "Geometry" "Normals" "0"
    			setINISetting iniPath_exportSettings "Geometry" "SmoothingGroups" "0"
    			setINISetting iniPath_exportSettings "Geometry" "ObjScale" "1.000000"
    			
    			setINISetting iniPath_exportSettings "Output" "RelativeIndex" "0"
    			setINISetting iniPath_exportSettings "Output" "Target" "0"
    			setINISetting iniPath_exportSettings "Output" "Precision" "4"
    			
    			--new discovered settings by copypastepixel that are important for roadkill,see:
    			--http://boards.polycount.net/showpost.php?p=1115492&postcount=16
    			setINISetting iniPath_exportSettings "Optimize" "optVertex" "0"
    			setINISetting iniPath_exportSettings "Optimize" "optNormals" "0"
    			setINISetting iniPath_exportSettings "Optimize" "optTextureCoords" "0"
    			
    			
    			local iniPath_importSettings = objImp.getIniName()
    			setINISetting iniPath_importSettings "General" "ResetScene" "0"
    			
    			setINISetting iniPath_importSettings "Objects" "SingleMesh" "1"
    			setINISetting iniPath_importSettings "Objects" "Retriangulate" "0"
    			setINISetting iniPath_importSettings "Objects" "AsEditablePoly" "1"--get it back as a poly
    
    			setINISetting iniPath_importSettings "Geometry" "SmoothingGroups" "0"
    			setINISetting iniPath_importSettings "Geometry" "TextureCoords" "1"
    		)
    	)
    
    I would not suggest usign the binary stuff because pbviously he reverse engeneerd or debugged using other tools to see what bits he needed to flip. But with 2010+ it should be easier as you can most likely just modify a ASCI ini file.
    After that you simply export using for example:
    try(
    	file_url = "c:\\some\\kind\\of\\path.fileType";
    	exportFile (file_url) #noPrompt selectedOnly:true
    )catch(
    	messagebox("error exporting")
    )
    


    Side notes from my experience on other export scripts:
    I never had that isssue but then again all I ever exported with scripts was standard stuff like FBX and OBJ. The only issue I got recently with another script exporting from within 3dsMax was getting heaps, meaning 3dsmax stuttered and trying to export the next item in a loop while still exporting the previous one. It happened many times to me with the FBX exporter, never though with the OBJ exporter.
Sign In or Register to comment.