[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60087] trunk/blender/source/tools/CTS: Fix up the Blender application script for COLLADA CTS.

Nathan Letwory nathan at letworyinteractive.com
Thu Sep 12 23:15:17 CEST 2013


Revision: 60087
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60087
Author:   jesterking
Date:     2013-09-12 21:15:17 +0000 (Thu, 12 Sep 2013)
Log Message:
-----------
Fix up the Blender application script for COLLADA CTS.
Update version number.
Fix typo in README.txt.
Whitespace changes.

Modified Paths:
--------------
    trunk/blender/source/tools/CTS/FBlender.py
    trunk/blender/source/tools/CTS/README.txt

Modified: trunk/blender/source/tools/CTS/FBlender.py
===================================================================
--- trunk/blender/source/tools/CTS/FBlender.py	2013-09-12 21:04:02 UTC (rev 60086)
+++ trunk/blender/source/tools/CTS/FBlender.py	2013-09-12 21:15:17 UTC (rev 60087)
@@ -1,3 +1,4 @@
+#
 # Written by Nathan Letwory: Letwory Interactive | Studio Lumikuu
 # http://www.letworyinteractive.com/b | http://www.lumikuu.com
 # for Blender Foundation
@@ -10,9 +11,9 @@
 
 class FBlender(FApplication):
     """Presents Blender to the testing framework"""
-    
+
     __SCRIPT_EXTENSION = ".py"
-    
+
     def __init__(self, configDict):
         """__init__() -> FBlender"""
         FApplication.__init__(self, configDict)
@@ -25,41 +26,39 @@
         self.__testRenderCount = 0
         self.__blenderCommandLine = None
         self.__workingDir = None
-    
+
     def GetPrettyName(self):
         """GetPrettyName() -> str
-        
+
         Implements FApplication.GetPrettyName()
-        
+
         """
-        return "Blender 2.59"
-    
+        return "Blender 2.68a"
+
     def GetSettingsForOperation(self, operation):
         """GetSettingsForOperation(operation) -> list_of_FSettingEntry
-        
+
         Implements FApplication.GetSettingsForOperation()
 
-	TODO: Figure out how we can/should use these, esp. for animation tests
-        
         """
         if (operation == IMPORT):
             return []
         elif (operation == EXPORT):
             return []
-        elif (operation == RENDER): 
+        elif (operation == RENDER):
             return []
         else:
             return []
-    
+
     def BeginScript(self, workingDir):
         """BeginScript(workingDir) -> None'
-        
+
         Implements FApplication.BeginScript()
-        
+
         """
-        pyFilename = ("script" + str(self.applicationIndex) + 
+        pyFilename = ("script" + str(self.applicationIndex) +
                 FBlender.__SCRIPT_EXTENSION)
-        blenderPyFilename = ("blenderScript" + str(self.applicationIndex) + 
+        blenderPyFilename = ("blenderScript" + str(self.applicationIndex) +
                 FBlender.__SCRIPT_EXTENSION)
         self.__script = open(os.path.join(workingDir, pyFilename), "w")
         self.__blenderScript = open(os.path.join(workingDir, blenderPyFilename), "w")
@@ -71,21 +70,21 @@
 import sys
 
 import_dae = sys.argv[-1]
+default_dae = sys.argv[-4]
 export_dae = sys.argv[-3]
-default_dae = sys.argv[-4]
 
 print("default .dea for testing: {}\\n".format(default_dae))
 
 print("importing: {}\\n".format(import_dae))
 img=sys.argv[-2]
 img=img.replace("\\\\", "\\\\\\\\")
-bpy.ops.wm.collada_import(filepath=import_dae)
+bpy.ops.wm.collada_import(filepath=import_dae, import_units=True)
 for o in bpy.data.objects:
     print("\\t{}\\n".format(o.name))
 
 if len(bpy.data.cameras)==0:
     print("no camera found, importing {}".format(default_dae))
-    bpy.ops.wm.collada_import(filepath=default_dae)
+    bpy.ops.wm.collada_import(filepath=default_dae, import_units=True)
     for o in bpy.data.objects:
         o.select = True if o.name == 'delete_me' else False
     print("cleaning after {} import".format(default_dae))
@@ -106,7 +105,7 @@
 bpy.data.scenes[0].render.resolution_y = 512
 bpy.data.scenes[0].render.resolution_percentage = 100
 bpy.data.scenes[0].render.use_antialiasing = False
-bpy.data.scenes[0].render.alpha_mode = 'STRAIGHT'
+bpy.data.scenes[0].render.alpha_mode = 'TRANSPARENT'
 
 bpy.ops.render.render(animation=False, write_still=True)
 
@@ -114,98 +113,99 @@
 
 print("\\n\\ndone testing.\\n\\n")"""
         )
-        
+
         self.__testImportCount = 0
         self.__testRenderCount = 0
         self.__workingDir = workingDir
-    
+
     def EndScript(self):
         """EndScript() -> None
-        
+
         Implements FApplication.EndScript()
-        
+
         """
         self.__blenderScript.close()
         self.__script.close()
-    
+
     def RunScript(self):
         """RunScript() -> None
-        
+
         Implements FApplication.RunScript()
-        
+
         """
         if (not os.path.isfile(self.configDict["blenderPath"])):
             print "Blender does not exist"
             return True
-        
+
         print ("start running " + os.path.basename(self.__script.name))
         command = ("\"" + self.configDict["pythonExecutable"] + "\" " +
                    "\"" + self.__script.name + "\"")
-        
+
         returnValue = subprocess.call(command)
-        
+
         if (returnValue == 0):
             print "finished running " + os.path.basename(self.__script.name)
         else:
             print "crashed running " + os.path.basename(self.__script.name)
-        
+
         return (returnValue == 0)
-    
+
     def WriteImport(self, filename, logname, outputDir, settings, isAnimated, cameraRig, lightingRig):
         """WriteImport(filename, logname, outputDir, settings, isAnimated, cameraRig, lightingRig) -> list_of_str
+
         """
         outputFormat = ".png"
-        
-        command = ("\"" + self.configDict["blenderPath"] + "\" --background -noaudio \"" + self.configDict["blenderEmpty"] + "\" -o ")
-        
+
+        command = ("\"" + self.configDict["blenderPath"] + "\" -b \"" + self.configDict["blenderEmpty"] + "\" -o ")
+
         baseName = FUtils.GetProperFilename(filename)
         self.__currentImportProperName = baseName
         outputFilename = os.path.join(outputDir, baseName + "_out" + ".dae")
         self.__currentFilename = outputFilename
         imageFilename = os.path.join(outputDir, "result" + outputFormat)
         self.__currentImageName = imageFilename
-        command = (command + "\"" + imageFilename + "\" --python \"" + self.__blenderScript.name + "\" -- \""+ self.configDict["blenderDefaultDae"] +"\" \"" + outputFilename + "\" \"" + imageFilename + "\" \"" + filename+"\"")
-        
+        command = (command + "\"" + imageFilename + "\" -P \"" + self.__blenderScript.name + "\" --factory-startup -- \""+ self.configDict["blenderDefaultDae"] +"\" \"" + outputFilename + "\" \"" + imageFilename + "\" \"" + filename+"\"")
+
         print "***Importing: %s" % (filename)
-        print "   Command %s" % (command)        
+        print "   Command %s" % (command)
 
         self.__blenderCommandLine = command
-        
+
         self.WriteCrashDetect(self.__script, command, logname)
-        
+
         self.__testImportCount = self.__testImportCount + 1
-        
+
         return [os.path.normpath(outputFilename)]
-        
-    
+
+
     def WriteRender(self, logname, outputDir, settings, isAnimated, cameraRig, lightingRig):
         """WriteRender(logname, outputDir, settings, isAnimated, cameraRig, lightingRig) -> list_of_str
-        
+
         Implements FApplication.WriteRender()
-        
+
         """
         print "***Render outputDir: %s" % (outputDir)
 
         command = self.__blenderCommandLine
-        
+
         print "***Rendering: %s" % (self.__currentImageName)
-        print "   Command %s" % (command)        
+        print "   Command %s" % (command)
 
         self.WriteCrashDetect(self.__script, command, logname)
-        
-        self.__testRenderCount = self.__testRenderCount + 1        
+
+        self.__testRenderCount = self.__testRenderCount + 1
         return [os.path.normpath(self.__currentImageName),]
 
-    
+
     def WriteExport(self, logname, outputDir, settings, isAnimated, cameraRig, lightingRig):
         """WriteImport(logname, outputDir, settings, isAnimated, cameraRig, lightingRig) -> list_of_str
-        
+
         Implements FApplication.WriteExport()
-        
+
         """
         print "***Export outputDir: %s" % (outputDir)
         command = self.__blenderCommandLine
-        print "   Command %s" % (command)        
+        print "   Command %s" % (command)
         self.WriteCrashDetect(self.__script, command, logname)
-        
+
         return [os.path.normpath(self.__currentFilename)]

Modified: trunk/blender/source/tools/CTS/README.txt
===================================================================
--- trunk/blender/source/tools/CTS/README.txt	2013-09-12 21:04:02 UTC (rev 60086)
+++ trunk/blender/source/tools/CTS/README.txt	2013-09-12 21:15:17 UTC (rev 60087)
@@ -19,7 +19,7 @@
 
 3. Copy empty.blend to the root directory of your CTS installation
 
-4. Modify config.py in the root directory of your CTS installation:
+4. Modify config.txt in the root directory of your CTS installation:
 
 blenderPath		d:\blenderdev\buildcmake\bin\Debug\blender.exe
 blenderEmpty		d:\blenderdev\COLLADA\CTS\empty.blend




More information about the Bf-blender-cvs mailing list