コード例 #1
0
	def doIt(self,argList):
		argData = MArgDatabase( self.syntax(), argList )

		(options, targets) = self._parseArgs( argData )
		
		undoQueue = mc.undoInfo( query=True, state=True )

		try:
			try:
				mc.undoInfo( state=False )
				
				scene = Scene.Scene()
				
				file = options[kFileFlag]
				ext = os.path.splitext(file)[1]
				if ext == ".mas":
					raise npy.Errors.BadArgumentError( "Exporting to a .mas file is not yet supported." )
				elif ext == ".cdl":
					pass
				else:
					raise npy.Errors.BadArgumentError( "Please provide a Massive setup (.mas) or agent (.cdl) file." )
				
				fileHandle = open(file, "w")
				
				scene = Scene.Scene()
				MayaScene.dump(scene, targets[0])
				if scene.agentSpecs():
					CDLWriter.write(fileHandle, scene.agentSpecs()[0])
				
			finally:
				mc.undoInfo( state=undoQueue )
		except npy.Errors.AbortError:
			self.displayError("Export cancelled by user")
		except:
			raise
コード例 #2
0
ファイル: MsvEvolve.py プロジェクト: zildjian/massiveImporter
def main():
    input = "R:/massive/test/cdl/man/CDL/man_relative.cdl"
    output = "R:/scratch/out.cdl"

    agentSpec = CDLReader.read(input, ["fuzzy"])
    fileHandle = open(output, "w")
    CDLWriter.write(fileHandle, agentSpec)
    fileHandle.close()

    os.system('xdiff.exe %s %s' % (input, output))
コード例 #3
0
ファイル: MsvEvolve.py プロジェクト: UIKit0/massiveImporter
def main():
	input = "R:/massive/test/cdl/man/CDL/man_relative.cdl"
	output =  "R:/scratch/out.cdl"

	agentSpec = CDLReader.read(input, ["fuzzy"])
	fileHandle = open(output, "w")
	CDLWriter.write(fileHandle, agentSpec)
	fileHandle.close()
	
	os.system('xdiff.exe %s %s' % (input, output))
コード例 #4
0
    def doIt(self, argList):
        argData = MArgDatabase(self.syntax(), argList)

        (options, targets) = self._parseArgs(argData)

        undoQueue = mc.undoInfo(query=True, state=True)

        try:
            try:
                mc.undoInfo(state=False)

                scene = Scene.Scene()

                file = options[kFileFlag]
                ext = os.path.splitext(file)[1]
                if ext == ".mas":
                    raise npy.Errors.BadArgumentError(
                        "Exporting to a .mas file is not yet supported.")
                elif ext == ".cdl":
                    pass
                else:
                    raise npy.Errors.BadArgumentError(
                        "Please provide a Massive setup (.mas) or agent (.cdl) file."
                    )

                fileHandle = open(file, "w")

                scene = Scene.Scene()
                MayaScene.dump(scene, targets[0])
                if scene.agentSpecs():
                    CDLWriter.write(fileHandle, scene.agentSpecs()[0])

            finally:
                mc.undoInfo(state=undoQueue)
        except npy.Errors.AbortError:
            self.displayError("Export cancelled by user")
        except:
            raise
コード例 #5
0
ファイル: TestIO.py プロジェクト: UIKit0/massiveImporter
	def testFuzzy(self):
		'''	Read and write fuzzy nodes from a test file.
			
			Read the fuzzy nodes from a test file, write them out again, and
			compare the two files. They should be identical except for a
			comment at the beginning of the files. '''
		input = "R:/massive/testdata/cdl/man/CDL/fuzzy_nodes.cdl"
	
		agentSpec = CDLReader.read(input, ["fuzzy"])
		
		nodes = agentSpec.brain.nodes()
		self.assertEqual(30, len(nodes))

		fileHandle = open(self.scratchFile, "w")
		CDLWriter.write(fileHandle, agentSpec)
		fileHandle.close()
	
		inputHandle = open(input, "r")
		scratchHandle = open(self.scratchFile, "r")
		inputLines = inputHandle.readlines()[1:]
		scratchLines = scratchHandle.readlines()[1:]
		inputHandle.close()
		scratchHandle.close()
		self.assertEqual(inputLines, scratchLines)