[Closed] Find Directory Path for animation/FBX exporter
Copy and paste fail. Sorry about that. Aside from minor time-saving scripts this tool is the most complex thing I’ve tried. Thank you guys for your patients and help.
For this sequence what is the method for opening the fbx dialogue at this location, instead of automatically saving?
fn exportFBX assets fbxFilePath=(
exportFile fbxFilePath #noPrompt selectedOnly:True using:FBXEXP
)
You are right about pathConfig.appendPath auto-resolving. I missed it.
dir = @"c:\\Temp//New//"
file = @"////somename.jpg"
pathconfig.appendpath dir file
--> "c:\Temp\New\somename.jpg"
And with .net path class
fn setNewFbx newdir: filename: =
(
filename = if filename == unsupplied then maxfilename else filename
if filename == "" then return null else
(
filename = (dotnetclass "System.IO.Path").ChangeExtension filename ".fbx"
if doesDirectoryExist newdir then pathConfig.appendPath newdir (filenameFromPath filename) else null
)
)
remove #noPrompt
fn exportFBX assets fbxFilePath=(
exportFile fbxFilePath selectedOnly:True using:FBXEXP
)
I don’t think prompt is the correct term. I would like to seed the complete dialog window for exporting and FBX, but pathed to location in the script.
Similar to using the command “max file export selected”, except not using the default export path.
If you wish to control the possible FBX export options , look at the command FBXExporterSetParam to set each of your FBX preferences. This has a parameter for each entry in the FBX dialog.
I have a single function I use to set my settings.
commented out lines are unused in my project
fn setFBX=
(
FBXExporterSetParam "Animation" true --Even for props?
FBXExporterSetParam "ASCII" false -- binaries are smaller
FBXExporterSetParam "AxisConversionMethod" "Animation"
FBXExporterSetParam "BakeAnimation"true
-- FBXExporterSetParam "BakeFrameStart" --derived from length of playback range
-- FBXExporterSetParam "BakeFrameEnd"
-- FBXExporterSetParam "BakeFrameStep"
-- FBXExporterSetParam "BakeResampleAnimation"
FBXExporterSetParam "Cameras" false
-- FBXExporterSetParam "CAT2HIK"
-- FBXExporterSetParam "ColladaTriangulate"
-- FBXExporterSetParam "ColladaSingleMatrix"
-- FBXExporterSetParam "ColladaFrameRate"
FBXExporterSetParam "Convert2Tiff" false
--FBXExporterSetParam "ConvertUnit" "cm" --should be Auto if SYSTEM UNITS are correct
FBXExporterSetParam "EmbedTextures"false
FBXExporterSetParam "FileVersion" "FBX201300"
FBXExporterSetParam "FilterKeyReducer" false
FBXExporterSetParam "GeomAsBone" false
FBXExporterSetParam "GenerateLog" true
FBXExporterSetParam "Lights" false
--FBXExporterSetParam "LoadExportPresetFile"--this very code block negates a need for a preset
FBXExporterSetParam "NormalsPerPoly"false--Motion Builder setting
FBXExporterSetParam "PointCache" false--VERTEX ANIMATION
--FBXExporterSetParam "PopSettings"--for 'one click' operations
FBXExporterSetParam "Preserveinstances" false
--FBXExporterSetParam "PushSettings--for 'one click' operations
FBXExporterSetParam "Removesinglekeys" false
--FBXExporterSetParam "Resampling"
--FBXExporterSetParam "ResetExport"--Loads the Autodesk Media & Entertainment export preset.
--FBXExporterSetParam "ScaleFactor" 1.0 --should be Auto if SYSTEM UNITS are correct
--FBXExporterSetParam "SelectionSet"--VERTEX ANIMATION
--FBXExporterSetParam "SelectionSetExport"--VERTEX ANIMATION
FBXExporterSetParam "Shape" true
FBXExporterSetParam "Skin" true
FBXExporterSetParam "ShowWarnings" false
FBXExporterSetParam "SmoothingGroups" true
FBXExporterSetParam "SmoothMeshExport" false--for turbosmooth
--FBXExporterSetParam "SplitAnimationIntoTakes"
FBXExporterSetParam "TangentSpaceExport" falset
FBXExporterSetParam "Triangulate"false
FBXExporterSetParam "UpAxis" "Y"
FBXExporterSetParam "UseSceneName" false
)
Thank you, I did come across the options for FBX parameters, but its actually more then I need.
The problem I’m try to solve for is exporting to a specific director outside of sources files tree, but because of in irregular naming conventions for the new directory, I’m not able to form a method to find the desired folder based on the current file. As an interim solution, I would like to direct the export to a specific folder, then manually select the rest of the path to export.
getSavePath will prompt the user to browse for a save location and return the chosen directory.
dir=getSavePath()