[Bf-blender-cvs] [79a51f0] master: cdderivedmesh: don't prepare a normal buffer when selecting, even if we skip creating the selection color layer.

Antony Riakiotakis noreply at git.blender.org
Tue Jul 28 18:24:28 CEST 2015


Commit: 79a51f0839cab9e166a9fc4a0f6ea794cea4db03
Author: Antony Riakiotakis
Date:   Tue Jul 28 18:23:59 2015 +0200
Branches: master
https://developer.blender.org/rB79a51f0839cab9e166a9fc4a0f6ea794cea4db03

cdderivedmesh: don't prepare a normal buffer when selecting, even
if we skip creating the selection color layer.

===================================================================

M	source/blender/blenkernel/intern/cdderivedmesh.c

===================================================================

diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 5945a34..6a76603 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -652,31 +652,33 @@ static void cdDM_drawMappedFaces(
 	totpoly = dm->getNumPolys(dm);
 
 	/* if we do selection, fill the selection buffer color */
-	if ((G.f & G_BACKBUFSEL) && !(flag & DM_DRAW_SKIP_SELECT)) {
-		Mesh *me = userData;
-		unsigned int *fi_map;
+	if (G.f & G_BACKBUFSEL) {
+		if (!(flag & DM_DRAW_SKIP_SELECT)) {
+			Mesh *me = userData;
+			unsigned int *fi_map;
 
-		findex_buffer = GPU_buffer_alloc(dm->drawObject->tot_loop_verts * sizeof(int), false);
-		fi_map = GPU_buffer_lock(findex_buffer, GPU_BINDING_ARRAY);
+			findex_buffer = GPU_buffer_alloc(dm->drawObject->tot_loop_verts * sizeof(int), false);
+			fi_map = GPU_buffer_lock(findex_buffer, GPU_BINDING_ARRAY);
 
-		if (fi_map) {
-			for (i = 0; i < totpoly; i++, mpoly++) {
-				int selcol = 0xFFFFFFFF;
-				const int orig = (index_mp_to_orig) ? index_mp_to_orig[i] : i;
+			if (fi_map) {
+				for (i = 0; i < totpoly; i++, mpoly++) {
+					int selcol = 0xFFFFFFFF;
+					const int orig = (index_mp_to_orig) ? index_mp_to_orig[i] : i;
 
-				if ((orig != ORIGINDEX_NONE) && (!useHide || !(me->mpoly[orig].flag & ME_HIDE))) {
-					WM_framebuffer_index_get(orig + 1, &selcol);
-				}
+					if ((orig != ORIGINDEX_NONE) && (!useHide || !(me->mpoly[orig].flag & ME_HIDE))) {
+						WM_framebuffer_index_get(orig + 1, &selcol);
+					}
 
-				for (j = 0; j < mpoly->totloop; j++)
-					fi_map[start_element++] = selcol;
-			}
+					for (j = 0; j < mpoly->totloop; j++)
+						fi_map[start_element++] = selcol;
+				}
 
-			start_element = 0;
-			mpoly = cddm->mpoly;
+				start_element = 0;
+				mpoly = cddm->mpoly;
 
-			GPU_buffer_unlock(findex_buffer, GPU_BINDING_ARRAY);
-			GPU_buffer_bind_as_color(findex_buffer);
+				GPU_buffer_unlock(findex_buffer, GPU_BINDING_ARRAY);
+				GPU_buffer_bind_as_color(findex_buffer);
+			}
 		}
 	}
 	else {
@@ -792,7 +794,7 @@ static void cdDM_drawMappedFaces(
 
 	GPU_buffers_unbind();
 
-	if (G.f & G_BACKBUFSEL)
+	if (findex_buffer)
 		GPU_buffer_free(findex_buffer);
 
 }




More information about the Bf-blender-cvs mailing list