[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51413] trunk/blender: code cleanup: minor style change & quiet warning, also add assert for BM_vert_splice() to check for invalid use.

Campbell Barton ideasman42 at gmail.com
Fri Oct 19 05:08:03 CEST 2012


Revision: 51413
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51413
Author:   campbellbarton
Date:     2012-10-19 03:07:58 +0000 (Fri, 19 Oct 2012)
Log Message:
-----------
code cleanup: minor style change & quiet warning, also add assert for BM_vert_splice() to check for invalid use.

Modified Paths:
--------------
    trunk/blender/intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl
    trunk/blender/source/blender/bmesh/intern/bmesh_core.c
    trunk/blender/source/blender/modifiers/intern/MOD_particlesystem.c

Modified: trunk/blender/intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl
===================================================================
--- trunk/blender/intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl	2012-10-19 02:38:50 UTC (rev 51412)
+++ trunk/blender/intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl	2012-10-19 03:07:58 UTC (rev 51413)
@@ -20,25 +20,24 @@
 #include "oslutil.h"
 
 shader node_rgb_ramp(
-    color ramp_color[RAMP_TABLE_SIZE] = {0.0},
-    float ramp_alpha[RAMP_TABLE_SIZE] = {0.0},
+	color ramp_color[RAMP_TABLE_SIZE] = {0.0},
+	float ramp_alpha[RAMP_TABLE_SIZE] = {0.0},
 
-    float Fac = 0.0,
-    output color Color = color(0.0, 0.0, 0.0),
-    output float Alpha = 1.0
-    )
+	float Fac = 0.0,
+	output color Color = color(0.0, 0.0, 0.0),
+	output float Alpha = 1.0)
 {
-    float f = clamp(Fac, 0.0, 1.0) * (RAMP_TABLE_SIZE - 1);
+	float f = clamp(Fac, 0.0, 1.0) * (RAMP_TABLE_SIZE - 1);
 
-    int i = (int)f;
-    float t = f - (float)i;
+	int i = (int)f;
+	float t = f - (float)i;
 
-    Color = ramp_color[i];
-    Alpha = ramp_alpha[i];
+	Color = ramp_color[i];
+	Alpha = ramp_alpha[i];
 
-    if (t > 0.0) {
-        Color = (1.0 - t) * Color + t * ramp_color[i + 1];
-        Alpha = (1.0 - t) * Alpha + t * ramp_alpha[i + 1];
-    }
+	if (t > 0.0) {
+		Color = (1.0 - t) * Color + t * ramp_color[i + 1];
+		Alpha = (1.0 - t) * Alpha + t * ramp_alpha[i + 1];
+	}
 }
 

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_core.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_core.c	2012-10-19 02:38:50 UTC (rev 51412)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_core.c	2012-10-19 03:07:58 UTC (rev 51413)
@@ -1607,10 +1607,10 @@
 				BMESH_ASSERT(edok != FALSE);
 			}
 
-			/* deallocate edg */
+			/* deallocate edge */
 			bm_kill_only_edge(bm, ke);
 
-			/* deallocate verte */
+			/* deallocate vertex */
 			bm_kill_only_vert(bm, kv);
 
 			/* Validate disk cycle lengths of ov, tv are unchanged */
@@ -1619,7 +1619,7 @@
 			edok = bmesh_disk_validate(valence2, tv->e, tv);
 			BMESH_ASSERT(edok != FALSE);
 
-			/* Validate loop cycle of all faces attached to oe */
+			/* Validate loop cycle of all faces attached to 'oe' */
 			for (i = 0, l = oe->l; i < radlen; i++, l = l->radial_next) {
 				BMESH_ASSERT(l->e == oe);
 				edok = bmesh_verts_in_edge(l->v, l->next->v, oe);
@@ -1800,6 +1800,10 @@
  * Merges two verts into one (\a v into \a vtarget).
  *
  * \return Success
+ *
+ * \warning This does't work for collapsing edges,
+ * where \a v and \a vtarget are connected by an edge
+ * (assert checks for this case).
  */
 int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *vtarget)
 {
@@ -1827,6 +1831,7 @@
 		bmesh_disk_edge_remove(e, v);
 		bmesh_edge_swapverts(e, v, vtarget);
 		bmesh_disk_edge_append(e, vtarget);
+		BLI_assert(e->v1 != e->v2);
 	}
 
 	BM_CHECK_ELEMENT(v);

Modified: trunk/blender/source/blender/modifiers/intern/MOD_particlesystem.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_particlesystem.c	2012-10-19 02:38:50 UTC (rev 51412)
+++ trunk/blender/source/blender/modifiers/intern/MOD_particlesystem.c	2012-10-19 03:07:58 UTC (rev 51413)
@@ -131,7 +131,7 @@
 	ParticleSystemModifierData *psmd = (ParticleSystemModifierData *) md;
 	ParticleSystem *psys = NULL;
 	int needsFree = 0;
-	float cfra = BKE_scene_frame_get(md->scene);
+	/* float cfra = BKE_scene_frame_get(md->scene); */  /* UNUSED */
 
 	if (ob->particlesystem.first)
 		psys = psmd->psys;




More information about the Bf-blender-cvs mailing list