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

Leif Andersen leif.a.andersen at gmail.com
Wed Jun 16 21:12:48 CEST 2010


Revision: 29495
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29495
Author:   leifandersen
Date:     2010-06-16 21:12:48 +0200 (Wed, 16 Jun 2010)

Log Message:
-----------
1.  I added a exec function for view_show(), which is currently about the same as it's invoke function.  I also changed screen_set_image_output to check for null before using the . operator.  Although it still won't work in background mode, you can use it in the python console.

2.  Fixed up the tests testing for setup.  TODO, I'm making the tests I'm currently using for debugging more permanent, if for nothing else, the should make good regression tests.

Modified Paths:
--------------
    branches/soc-2010-leifandersen/source/blender/editors/render/render_internal.c
    branches/soc-2010-leifandersen/tests/pyunit/ops/CMakeLists.txt

Added Paths:
-----------
    branches/soc-2010-leifandersen/tests/pyunit/ops/physics/
    branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt
    branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle.py
    branches/soc-2010-leifandersen/tests/pyunit/ops/wm/
    branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt
    branches/soc-2010-leifandersen/tests/pyunit/ops/wm/pawns.blend
    branches/soc-2010-leifandersen/tests/pyunit/ops/wm/setup.py

Removed Paths:
-------------
    branches/soc-2010-leifandersen/tests/pyunit/ops/particle.py
    branches/soc-2010-leifandersen/tests/pyunit/ops/pawns.blend
    branches/soc-2010-leifandersen/tests/pyunit/ops/setup.py

Modified: branches/soc-2010-leifandersen/source/blender/editors/render/render_internal.c
===================================================================
--- branches/soc-2010-leifandersen/source/blender/editors/render/render_internal.c	2010-06-16 19:07:20 UTC (rev 29494)
+++ branches/soc-2010-leifandersen/source/blender/editors/render/render_internal.c	2010-06-16 19:12:48 UTC (rev 29495)
@@ -221,7 +221,7 @@
 		sa= CTX_wm_area(C);
 	}
 	else if(scene->r.displaymode==R_OUTPUT_SCREEN) {
-		if (CTX_wm_area(C)->spacetype == SPACE_IMAGE)
+		if (CTX_wm_area(C) != NULL && CTX_wm_area(C)->spacetype == SPACE_IMAGE)
 			area_was_image = 1;
 
 		/* this function returns with changed context */
@@ -817,6 +817,38 @@
 	return OPERATOR_FINISHED;
 }
 
+static int render_view_show_exec(bContext *C, wmOperator *unused, wmEvent *event)
+{
+	ScrArea *sa= find_area_showing_r_result(C);
+
+	/* test if we have a temp screen in front */
+	if(CTX_wm_window(C)->screen->full==SCREENTEMP) {
+		wm_window_lower(CTX_wm_window(C));
+	}
+	/* determine if render already shows */
+	else if(sa) {
+		SpaceImage *sima= sa->spacedata.first;
+
+		if(sima->flag & SI_PREVSPACE) {
+			sima->flag &= ~SI_PREVSPACE;
+
+			if(sima->flag & SI_FULLWINDOW) {
+				sima->flag &= ~SI_FULLWINDOW;
+				ED_screen_full_prevspace(C, sa);
+			}
+			else if(sima->next) {
+				ED_area_newspace(C, sa, sima->next->spacetype);
+				ED_area_tag_redraw(sa);
+			}
+		}
+	}
+	else {
+		screen_set_image_output(C, event->x, event->y);
+	}
+
+	return OPERATOR_FINISHED;
+}
+
 void RENDER_OT_view_show(struct wmOperatorType *ot)
 {
 	/* identifiers */
@@ -826,5 +858,7 @@
 
 	/* api callbacks */
 	ot->invoke= render_view_show_invoke;
+	ot->exec= render_view_show_exec;
+
 	ot->poll= ED_operator_screenactive;
 }

Modified: branches/soc-2010-leifandersen/tests/pyunit/ops/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/CMakeLists.txt	2010-06-16 19:07:20 UTC (rev 29494)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/CMakeLists.txt	2010-06-16 19:12:48 UTC (rev 29495)
@@ -1,5 +1,2 @@
-ADD_TEST(Ops_Particle_Test ${Blender_BINARY_DIR}/bin/blender -b -P ${Blender_BINARY_DIR}/tests/pyunit/ops/particle.py)
-SET_TESTS_PROPERTIES(Ops_Particle_Test PROPERTIES PASS_REGULAR_EXPRESSION "OK")
-
-ADD_TEST(Ops_Setup_Test ${Blender_BINARY_DIR}/bin/blender -b -P ${Blender_BINARY_DIR}/tests/pyunit/ops/setup.py)
-SET_TESTS_PROPERTIES(Ops_Setup_Test PROPERTIES PASS_REGULAR_EXPRESSION "OK")
+ADD_SUBDIRECTORY(wm)
+ADD_SUBDIRECTORY(physics)

Deleted: branches/soc-2010-leifandersen/tests/pyunit/ops/particle.py
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/particle.py	2010-06-16 19:07:20 UTC (rev 29494)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/particle.py	2010-06-16 19:12:48 UTC (rev 29495)
@@ -1,24 +0,0 @@
-import bpy
-import tests
-import unittest
-
-class TestParticles(unittest.TestCase):
-    def setUp(self):
-        tests.objects.reset_objects()
-        tests.scenes.reset_scenes()
-        tests.build.mesh.cube("Cube")
-        cube = bpy.data.objects['Cube']
-        bpy.ops.object.particle_system_add({"object":cube})
-
-
-    def test_particle_generation(self):
-        part = bpy.data.particles[0]
-        part.type = 'HAIR'
-
-def suite():
-    return unittest.TestSuite([
-unittest.TestLoader().loadTestsFromTestCase(TestParticles),
-])
-
-if __name__ == "__main__":
-    unittest.TextTestRunner(verbosity=2).run(suite())

Deleted: branches/soc-2010-leifandersen/tests/pyunit/ops/pawns.blend
===================================================================
(Binary files differ)

Added: branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt	                        (rev 0)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt	2010-06-16 19:12:48 UTC (rev 29495)
@@ -0,0 +1,2 @@
+ADD_TEST(Ops_Particle_Test ${Blender_BINARY_DIR}/bin/blender -b -P ${Blender_BINARY_DIR}/tests/pyunit/ops/particle.py)
+SET_TESTS_PROPERTIES(Ops_Particle_Test PROPERTIES PASS_REGULAR_EXPRESSION "OK")

Copied: branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle.py (from rev 29410, branches/soc-2010-leifandersen/tests/pyunit/ops/particle.py)
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle.py	                        (rev 0)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle.py	2010-06-16 19:12:48 UTC (rev 29495)
@@ -0,0 +1,25 @@
+import bpy
+import tests
+import unittest
+
+class TestParticles(unittest.TestCase):
+    def setUp(self):
+        tests.objects.reset_objects()
+        tests.scenes.reset_scenes()
+        tests.build.mesh.cube("Cube")
+        cube = bpy.data.objects['Cube']
+        bpy.ops.object.particle_system_add({"object":cube})
+
+
+    def test_hair_generation(self):
+        part = bpy.data.particles[0]
+        part.type = 'HAIR'
+        bpy.ops.render.render()
+
+def suite():
+    return unittest.TestSuite([
+unittest.TestLoader().loadTestsFromTestCase(TestParticles),
+])
+
+if __name__ == "__main__":
+    unittest.TextTestRunner(verbosity=2).run(suite())

Deleted: branches/soc-2010-leifandersen/tests/pyunit/ops/setup.py
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/setup.py	2010-06-16 19:07:20 UTC (rev 29494)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/setup.py	2010-06-16 19:12:48 UTC (rev 29495)
@@ -1,31 +0,0 @@
-import bpy
-import tests
-import unittest
-
-class TestSetUp(unittest.TestCase):
-
-    # No setUp required for this test, as we'll be testing the various setUp methods here
-    def setUp(self):
-        pass
-
-
-    def test_factory_default(self):
-        bpy.ops.wm.read_homefile(factory=True)
-
-    def test_users_default(self):
-        bpy.ops.wm.read_homefile(factory=False)
-
-    def test_no_params(self):
-        bpy.ops.wm.read_homefile()
-
-    # Not sure what paramaters are apropriate here, as nothing has yet worked in the console either...
-    def test_load_empty_scene(self):
-        bpy.ops.wm.open_mainfile(filename="pawns.blend")
-
-def suite():
-    return unittest.TestSuite([
-unittest.TestLoader().loadTestsFromTestCase(TestSetUp),
-])
-
-if __name__ == "__main__":
-    unittest.TextTestRunner(verbosity=2).run(suite())

Added: branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt	                        (rev 0)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt	2010-06-16 19:12:48 UTC (rev 29495)
@@ -0,0 +1,2 @@
+ADD_TEST(Ops_Setup_Test ${Blender_BINARY_DIR}/bin/blender -b -P ${Blender_BINARY_DIR}/tests/pyunit/ops/setup.py)
+SET_TESTS_PROPERTIES(Ops_Setup_Test PROPERTIES PASS_REGULAR_EXPRESSION "OK")

Copied: branches/soc-2010-leifandersen/tests/pyunit/ops/wm/pawns.blend (from rev 29410, branches/soc-2010-leifandersen/tests/pyunit/ops/pawns.blend)
===================================================================
(Binary files differ)

Copied: branches/soc-2010-leifandersen/tests/pyunit/ops/wm/setup.py (from rev 29410, branches/soc-2010-leifandersen/tests/pyunit/ops/setup.py)
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/wm/setup.py	                        (rev 0)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/wm/setup.py	2010-06-16 19:12:48 UTC (rev 29495)
@@ -0,0 +1,30 @@
+import bpy
+import tests
+import unittest
+
+class TestSetUp(unittest.TestCase):
+
+    # No setUp required for this test, as we'll be testing the various setUp methods here
+    def setUp(self):
+        pass
+
+
+    def test_factory_default(self):
+        bpy.ops.wm.read_homefile(factory=True)
+
+    def test_users_default(self):
+        bpy.ops.wm.read_homefile(factory=False)
+
+    def test_no_params(self):
+        bpy.ops.wm.read_homefile()
+
+    def test_load_empty_scene(self):
+        bpy.ops.wm.open_mainfile(filepath="pawns.blend")
+
+def suite():
+    return unittest.TestSuite([
+unittest.TestLoader().loadTestsFromTestCase(TestSetUp),
+])
+
+if __name__ == "__main__":
+    unittest.TextTestRunner(verbosity=2).run(suite())





More information about the Bf-blender-cvs mailing list