[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29405] branches/render25: Render Branch: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r29385 :29404

Campbell Barton ideasman42 at gmail.com
Fri Jun 11 14:40:22 CEST 2010


Revision: 29405
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29405
Author:   campbellbarton
Date:     2010-06-11 14:40:22 +0200 (Fri, 11 Jun 2010)

Log Message:
-----------
Render Branch: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r29385:29404

Modified Paths:
--------------
    branches/render25/release/scripts/op/console_python.py
    branches/render25/release/scripts/ui/properties_game.py
    branches/render25/source/blender/blenkernel/intern/cdderivedmesh.c
    branches/render25/source/blender/blenkernel/intern/object.c
    branches/render25/source/blender/blenkernel/intern/subsurf_ccg.c
    branches/render25/source/blender/editors/space_view3d/drawobject.c
    branches/render25/source/blender/makesrna/intern/rna_ID.c
    branches/render25/source/blender/makesrna/intern/rna_curve.c
    branches/render25/source/blender/makesrna/intern/rna_particle.c
    branches/render25/source/blender/makesrna/intern/rna_scene.c

Modified: branches/render25/release/scripts/op/console_python.py
===================================================================
--- branches/render25/release/scripts/op/console_python.py	2010-06-11 11:56:09 UTC (rev 29404)
+++ branches/render25/release/scripts/op/console_python.py	2010-06-11 12:40:22 UTC (rev 29405)
@@ -33,7 +33,7 @@
     '''
     helper function for console operators
     currently each text datablock gets its own
-    console - bpython_code.InteractiveConsole()
+    console - code.InteractiveConsole()
     ...which is stored in this function.
 
     console_id can be any hashable type
@@ -44,21 +44,24 @@
 
     if consoles is None:
         consoles = get_console.consoles = {}
+    else:
+        # check if clearning the namespace is needed to avoid a memory leak.
+        # the window manager is normally loaded with new blend files
+        # so this is a reasonable way to deal with namespace clearing.
+        # bpy.data hashing is reset by undo so cant be used.
+        hash_prev = getattr(get_console, "consoles_namespace_hash", 0)
+        hash_next = hash(bpy.context.manager)
 
-    # clear all dead consoles, use text names as IDs
-    # TODO, find a way to clear IDs
-    '''
-    for console_id in list(consoles.keys()):
-        if console_id not in bpy.data.texts:
-            del consoles[id]
-    '''
+        if hash_prev != hash_next:
+            get_console.consoles_namespace_hash = hash_next
+            consoles.clear()
 
     console_data = consoles.get(console_id)
 
     if console_data:
         console, stdout, stderr = console_data
 
-        # XXX, bug in python 3.1.2 ?
+        # XXX, bug in python 3.1.2 ? (worked in 3.1.1)
         # seems there is no way to clear StringIO objects for writing, have to make new ones each time.
         import io
         stdout = io.StringIO()

Modified: branches/render25/release/scripts/ui/properties_game.py
===================================================================
--- branches/render25/release/scripts/ui/properties_game.py	2010-06-11 11:56:09 UTC (rev 29404)
+++ branches/render25/release/scripts/ui/properties_game.py	2010-06-11 12:40:22 UTC (rev 29405)
@@ -30,11 +30,12 @@
     def poll(self, context):
         ob = context.active_object
         rd = context.scene.render
-        return ob and ob.game and (rd.engine == 'BLENDER_GAME')
+        return ob and ob.game and (rd.engine in self.COMPAT_ENGINES)
 
 
 class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
     bl_label = "Physics"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -163,11 +164,12 @@
 
 class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
     bl_label = "Collision Bounds"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def poll(self, context):
         game = context.object.game
         rd = context.scene.render
-        return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine == 'BLENDER_GAME')
+        return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in self.COMPAT_ENGINES)
 
     def draw_header(self, context):
         game = context.active_object.game
@@ -203,11 +205,12 @@
 
     def poll(self, context):
         rd = context.scene.render
-        return (rd.engine == 'BLENDER_GAME')
+        return (rd.engine in self.COMPAT_ENGINES)
 
 
 class RENDER_PT_game(RenderButtonsPanel):
     bl_label = "Game"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -219,6 +222,7 @@
 
 class RENDER_PT_game_player(RenderButtonsPanel):
     bl_label = "Standalone Player"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -256,6 +260,7 @@
 
 class RENDER_PT_game_stereo(RenderButtonsPanel):
     bl_label = "Stereo"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -315,6 +320,7 @@
 
 class RENDER_PT_game_shading(RenderButtonsPanel):
     bl_label = "Shading"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -343,6 +349,7 @@
 
 class RENDER_PT_game_performance(RenderButtonsPanel):
     bl_label = "Performance"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -368,6 +375,7 @@
 
 class RENDER_PT_game_sound(RenderButtonsPanel):
     bl_label = "Sound"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -390,12 +398,13 @@
 
     def poll(self, context):
         scene = context.scene
-        return (scene.render.engine == 'BLENDER_GAME') and (scene.world is not None)
+        return (scene.render.engine in self.COMPAT_ENGINES) and (scene.world is not None)
 
 
 class WORLD_PT_game_context_world(WorldButtonsPanel):
     bl_label = ""
     bl_show_header = False
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def poll(self, context):
         rd = context.scene.render
@@ -424,6 +433,7 @@
 
 class WORLD_PT_game_world(WorldButtonsPanel):
     bl_label = "World"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -443,11 +453,12 @@
 
 class WORLD_PT_game_mist(WorldButtonsPanel):
     bl_label = "Mist"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def draw_header(self, context):
         world = context.world
 
-        self.layout.prop(world.mist, "enabled", text="")
+        self.layout.prop(world.mist, "use_mist", text="")
 
     def draw(self, context):
         layout = self.layout
@@ -455,7 +466,7 @@
         world = context.world
         wide_ui = context.region.width > narrowui
 
-        layout.active = world.mist.enabled
+        layout.active = world.mist.use_mist
         split = layout.split()
 
         col = split.column()
@@ -468,6 +479,7 @@
 
 class WORLD_PT_game_physics(WorldButtonsPanel):
     bl_label = "Physics"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout

Modified: branches/render25/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/cdderivedmesh.c	2010-06-11 11:56:09 UTC (rev 29404)
+++ branches/render25/source/blender/blenkernel/intern/cdderivedmesh.c	2010-06-11 12:40:22 UTC (rev 29405)
@@ -853,48 +853,42 @@
 		}
 	}
 	else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
-		int state = 1;
-		int prevstate = 1;
 		int prevstart = 0;
 		GPU_vertex_setup(dm);
 		GPU_normal_setup(dm);
 		if( useColors && mc )
 			GPU_color_setup(dm);
 		if( !GPU_buffer_legacy(dm) ) {
+			int tottri = dm->drawObject->nelements/3;
 			glShadeModel(GL_SMOOTH);
-			for( i = 0; i < dm->drawObject->nelements/3; i++ ) {
+
+			for( i = 0; i < tottri; i++ ) {
 				int actualFace = dm->drawObject->faceRemap[i];
 				int drawSmooth = (mf[actualFace].flag & ME_SMOOTH);
-				int dontdraw = 0;
+				int draw = 1;
+
 				if(index) {
 					orig = index[actualFace];
 					if(setDrawOptions && orig == ORIGINDEX_NONE)
-						dontdraw = 1;
+						draw = 0;
 				}
 				else
 					orig = actualFace;
-				if( dontdraw ) {
-					state = 0;
+
+				if(setDrawOptions && !setDrawOptions(userData, orig, &drawSmooth))
+					draw = 0;
+
+				/* Goal is to draw as long of a contiguous triangle
+				   array as possible, so draw when we hit either an
+				   invisible triangle or at the end of the array */
+				if(!draw || i == tottri - 1) {
+					if(prevstart != i)
+						/* Add one to the length (via `draw')
+						   if we're drawing at the end of the array */
+						glDrawArrays(GL_TRIANGLES,prevstart*3, (i-prevstart+draw)*3);
+					prevstart = i + 1;
 				}
-				else {
-					if(!setDrawOptions || setDrawOptions(userData, orig, &drawSmooth)) {
-						state = 1;
-					}
-					else {
-						state = 0;
-					}
-				}
-				if( prevstate != state && prevstate == 1 ) {
-					if( i-prevstart > 0 ) {
-						glDrawArrays(GL_TRIANGLES,prevstart*3,(i-prevstart)*3);
-					}
-					prevstart = i;
-				}
-				prevstate = state;
 			}
-			if(state==1) {
-				glDrawArrays(GL_TRIANGLES,prevstart*3,dm->drawObject->nelements-prevstart*3);
-			}
 			glShadeModel(GL_FLAT);
 		}
 		GPU_buffer_unbind();

Modified: branches/render25/source/blender/blenkernel/intern/object.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/object.c	2010-06-11 11:56:09 UTC (rev 29404)
+++ branches/render25/source/blender/blenkernel/intern/object.c	2010-06-11 12:40:22 UTC (rev 29405)
@@ -1286,6 +1286,7 @@
 	
 	for (md=ob->modifiers.first; md; md=md->next) {
 		ModifierData *nmd = modifier_new(md->type);
+		BLI_strncpy(nmd->name, md->name, sizeof(nmd->name));
 		modifier_copyData(md, nmd);
 		BLI_addtail(&obn->modifiers, nmd);
 	}

Modified: branches/render25/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/subsurf_ccg.c	2010-06-11 11:56:09 UTC (rev 29404)
+++ branches/render25/source/blender/blenkernel/intern/subsurf_ccg.c	2010-06-11 12:40:22 UTC (rev 29405)
@@ -2328,6 +2328,7 @@
 	int gridInternalEdges;
 	MEdge *medge = NULL;
 	MFace *mface = NULL;
+	int *orig_indices;
 	FaceVertWeight *qweight, *tweight;
 
 	DM_from_template(&ccgdm->dm, dm, DM_TYPE_CCGDM,
@@ -2437,6 +2438,7 @@
 
 	faceFlags = ccgdm->faceFlags = MEM_callocN(sizeof(char)*2*totface, "faceFlags");
 
+	orig_indices = (int*)ccgdm->dm.getFaceDataArray(&ccgdm->dm, CD_ORIGINDEX);
 	for(index = 0; index < totface; ++index) {
 		CCGFace *f = ccgdm->faceMap[index].face;
 		int numVerts = ccgSubSurf_getFaceNumVerts(f);
@@ -2450,6 +2452,9 @@
 		ccgdm->faceMap[index].startEdge = edgeNum;
 		ccgdm->faceMap[index].startFace = faceNum;
 
+		if(orig_indices)
+			orig_indices[faceNum] = origIndex;
+
 		/* set the face base vert */
 		*((int*)ccgSubSurf_getFaceUserData(ss, f)) = vertNum;
 

Modified: branches/render25/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/render25/source/blender/editors/space_view3d/drawobject.c	2010-06-11 11:56:09 UTC (rev 29404)
+++ branches/render25/source/blender/editors/space_view3d/drawobject.c	2010-06-11 12:40:22 UTC (rev 29405)
@@ -868,25 +868,17 @@
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list