Skip to content Flash-fx website
flash-fx logo image1
flash-fx logo image2
Simple solutions to complex problems. Historical swordsmanship Great online resource and forums relating to Maya and 3D.
Home << 3D << Tools/Scripts << import/export .obj range

import/export .obj range

Download script


/*
Script : importExportObjRange
   Purpose: Cycles through an animation sequence and exports the selected object as separate .obj files
            Also imports a range of external .obj files
   Author : Simon Mann www.flash-fx.net
   Version: v 0.1.1
   Todo   : User Interface for easy use
*/


/* variables to alter */
startFrame = 1				/* starting frame of selected object you want to export */
endFrame = 3				/* ending frame of selected object you want to export */
fileName = "/exportObj_"    /* will be stored in the scenes folder as the specified filename */
fileType = ".obj"			/* filetype extension to use */
objName = "thisObj"			/* EXPORT ONLY - name to rename object to before exporting */



/* command to run the export script
exportObjData startFrame endFrame fileName fileType objName
*/

/* command to run the import script
importObjData startFrame endFrame fileName fileType
*/



/* only alter below here if you know what you are doing ;o) */
function exportObjData startFrame endFrame fileName fileType objName =
(
	/* gets list of all export plugins */
	exportClasses = exporterPlugin.classes
	/* sets movie to first frame (set to 1 to skip frame zero */
	sliderTime = startFrame
    /* go through specified range */
	for i in startFrame to endFrame do
	(
        /* get the currently selected objects name */
		$.name = objName + i as string
        /* export the current object as a .obj file with the default settings
		exportFile (GetDir #scene + fileName + i as string + fileType) #noPrompt selectedOnly:True using:exportClasses[14]
        /* move not the next frame */
		sliderTime += 1
	)
)

function importObjData startFrame endFrame fileName fileType =
(
	/* gets list of all export plugins */
	importClasses = importerPlugin.classes
    /* go through specified range */
	for i in startFrame to endFrame do
	(
        /* import the specified .obj file
		importFile (GetDir #scene + fileName + i as string + fileType) #noPrompt using:importClasses[10]
	)
)

Copyright

© 2007
Simon Mann
http://www.flash-fx.net