[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30128] branches/soc-2010-leifandersen/ tests/render: 1.

Leif Andersen leif.a.andersen at gmail.com
Thu Jul 8 19:46:56 CEST 2010


Revision: 30128
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30128
Author:   leifandersen
Date:     2010-07-08 19:46:56 +0200 (Thu, 08 Jul 2010)

Log Message:
-----------
1.  Started making my own CSS, rather than simply using a pre_built one.

2.  Added, and than removed all of the animation blend files after the size becaome >230 MB.  Will place them in a seperate package.

3.  Because of #2, set back to only test the images.

4.  -v works again, both on images and animations.

Modified Paths:
--------------
    branches/soc-2010-leifandersen/tests/render/run.py

Removed Paths:
-------------
    branches/soc-2010-leifandersen/tests/render/anim/cubesphere/
    branches/soc-2010-leifandersen/tests/render/anim/cubesphere.blend

Deleted: branches/soc-2010-leifandersen/tests/render/anim/cubesphere.blend
===================================================================
(Binary files differ)

Modified: branches/soc-2010-leifandersen/tests/render/run.py
===================================================================
--- branches/soc-2010-leifandersen/tests/render/run.py	2010-07-08 17:46:50 UTC (rev 30127)
+++ branches/soc-2010-leifandersen/tests/render/run.py	2010-07-08 17:46:56 UTC (rev 30128)
@@ -62,14 +62,12 @@
         '''Renders a single image of the first frame of the blend file.
             Also changes output_path slightly'''
 
-        # The old way of running the command: TODO, remove when certain Popen() works.
-        # command = BLENDER_BIN + " -b " + self.blend_path + " -o " + self.test_path + "_#### -F PNG -x 1 -f 1"
-        # os.system(command)
-
-        p = Popen([BLENDER_BIN, '-b', self.blend_path, '-o', self.test_path + '_####', '-F', 'PNG', '-x', '1', '-f', '1'], stdout=PIPE, stderr=PIPE, stdin=PIPE)
-        p.wait()
         if VERBOSE:
-            print p.communicate()[0]
+            command = BLENDER_BIN + ' -b ' + self.blend_path + ' -o ' + self.test_path + '_#### -F PNG -x 1 -f 1'
+            os.system(command)
+        else:
+            p = Popen([BLENDER_BIN, '-b', self.blend_path, '-o', self.test_path + '_####', '-F', 'PNG', '-x', '1', '-f', '1'], stdout=None, stderr=None, stdin=None)
+            p.wait()
 
         self.test_path += '_0001.png'
         try:
@@ -169,16 +167,13 @@
 
     def render_test(self):
         ''''''
-        #The old way, TODO, remove when certain Popen() works.
-        command = BLENDER_BIN + " -b " + self.blend_path + " -o " + string.replace(self.test_path, '_0001.png', '') + "_#### -F PNG -x 1 -a"
-        os.system(command)
+        if VERBOSE:
+            command = BLENDER_BIN + " -b " + self.blend_path + " -o " + string.replace(self.test_path, '_0001.png', '') + "_#### -F PNG -x 1 -a"
+            os.system(command)
+        else:
+            p = Popen([BLENDER_BIN, '-b', self.blend_path, '-o', string.replace(self.test_path, '_0001.png', '') + '_####', '-F', 'PNG', '-x', '1', '-a'], stdout=None, stderr=None, stdin=None)
+            p.wait()
 
-        # TODO, for some reason, this seems to kill the whole program (I think PIPE is getting full, will replace
-        #p = Popen([BLENDER_BIN, '-b', self.blend_path, '-o', string.replace(self.test_path, '_0001.png', '') + '_####', '-F', 'PNG', '-x', '1', '-a'], stdout=PIPE, stderr=PIPE, stdin=PIPE)
-        #p.wait()
-        #if VERBOSE:
-        #    print p.communicate()[0]
-
         try:
             for imagename in self.test_path_arr:
                 im = Image.open(imagename)
@@ -271,7 +266,6 @@
 def get_image_cases(folder):
     '''Returns all of the image blend files in the folder'''
     cases = []
-    print ''
     for filename in os.listdir(sys.path[0]):
         if filename.find('.blend') != -1:
             blend_path = os.path.join(sys.path[0], filename)
@@ -281,10 +275,23 @@
             cases.append(test_case)
     return cases
 
+def get_animation_cases(folder):
+    '''Returns all of the animation blend files in the folder'''
+    cases = []
+    for filename in os.listdir(os.path.join(sys.path[0], 'anim')):
+        if filename.find('.blend') != -1:
+            blend_path = os.path.join(sys.path[0], 'anim', filename)
+            good_path = os.path.join(sys.path[0], 'anim', string.replace(filename, '.blend', ''))
+            test_path = os.path.join(sys.path[0], 'output', string.replace(filename, '.blend', ''))
+            test_case = AnimationTestCase(blend_path, good_path, test_path)
+            cases.append(test_case)
+    return cases
 
+
 def console_output(cases):
     '''Displays the final output to the console.  The output that will be shown if the -v flag isn't used'''
     failed = []
+    print ''
     for test_case in cases:
         if test_case.passed == False:
             failed.append(test_case)
@@ -300,8 +307,7 @@
     ''''''
     file = open(output_file, "w")
     file.write('<html><head>\n')
-    file.write('<link rel="stylesheet" href="_static/default.css" type="text/css" />\n')
-    file.write('<link rel="stylesheet" href="_static/pygments.css" type="text/css" />\n')
+    file.write('<link rel="stylesheet" href="style.css" type="text/css" />\n')
     file.write('<title>Render Test Output</title>\n</head>\n')
     file.write('<body>\n')
     file.write('<div class="noprint" id="navcontainer"><a href="http://www.blender.org/"><img width="140" height="50" title="blender.org home page" alt="blender.org home page" src="http://www.blender.org/fileadmin/site/_gfx/nav-home.png"></a><a href="http://www.blender.org/features-gallery/"><img width="140" height="50" title="Features & Gallery" alt="Features & Gallery" src="http://www.blender.org/fileadmin/site/_gfx/nav-features.png"></a><a href="http://www.blender.org/download/get-blender/"><img width="140" height="50" title="Download" alt="Download" src="http://www.blender.org/fileadmin/site/_gfx/nav-download.png"></a><a href="http://www.blender.org/education-help/"><img width="140" height="50" title="Tutorials & Help" alt="Tutorials & Help" src="http://www.blender.org/fileadmin/site/_gfx/nav-help.png"></a><a href="http://www.blender.org/community/user-community/"><img width="140" height="50" title="Community" alt="Community" src="http://www.blender.org/fileadmin/site/_gfx/nav-community.png"></a><a href="http://www.blender.org/development/"><img width="140" height="50" title="Development" alt="Development" src="http://www.blender.org/fileadmin/site/_gfx/nav-development-on.png"></a><a href="http://www.blender.org/e-shop/"><img width="140" height="50" title="e-Shop" alt="e-Shop" src="http://www.blender.org/fileadmin/site/_gfx/nav-eshop.png"></a></div> ')
@@ -365,7 +371,10 @@
 
 def anim_output(animation, output_location):
     file = open(output_location, 'w')
-    file.write('<html>\n<head><title>' + animation.name + '</title></head>\n')
+    file.write('<html><head>\n')
+    file.write('<link rel="stylesheet" href="_static/default.css" type="text/css" />\n')
+    file.write('<link rel="stylesheet" href="_static/pygments.css" type="text/css" />\n')
+    file.write('<title>' + animation.name + '</title></head>\n')
     file.write('<body>\n')
     file.write('<h1>' + animation.name + '</h1>')
     file.write('<table border="1"\n')
@@ -389,6 +398,13 @@
         i+=1
     file.write('</table>\n</body>\n</html>')
 
+def generate_css(filepath):
+    file = open(filepath, 'w')
+    file.write('#navcontainer {height: 50px;margin: 0 auto;position: relative;width: 980px;}\n')
+    file.write('#navcontainer img {width: 140px;height: 50px;}\n')
+    file.write('#pageheader  {background-image:url("bg.png");height:80px;position:relative;}\n')
+    file.write('body {font-family: "Lucida Grande","Lucida Sans Unicode","Lucida Sans","Lucida",Verdana,sans-serif;font-size: 12px;line-height: 145%;background-color: #000000;color: #ffffff;min-width: 980px;margin: 0;padding: 0;}\n')
+    file.close()
 
 if __name__ == "__main__":
     # Case list, can contain both image cases, and animation cases
@@ -413,7 +429,7 @@
     
     # Get cases, unless told not to.
     if RUN_IMAGES:
-        cases = get_cases(sys.path[0])
+        cases = get_image_cases(sys.path[0])
         cases.sort(key=lambda case: case.name)
 
     # Run cases
@@ -428,6 +444,9 @@
             print 'FAILED'
 
     # Output Result
+    print 'Generating Output'
+    generate_css(os.path.join(HTML_OUTPUT, 'style.css'))
+    generate_output(cases, os.path.join(HTML_OUTPUT, 'index.html'))
     console_output(cases)
-    generate_output(cases, os.path.join(HTML_OUTPUT, 'index.html'))
+    print 'Check index.html for more information'
 





More information about the Bf-blender-cvs mailing list