[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45416] trunk/blender/source/blender/bmesh /operators/bmo_primitive.c: Small improvement to bmo icosphere primitive: instead of calling n times the subdivide bmo with one cut, call it once, with the right number of cuts (which is (2^(n-1)) - 1).

Bastien Montagne montagne29 at wanadoo.fr
Thu Apr 5 08:47:14 CEST 2012


Revision: 45416
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45416
Author:   mont29
Date:     2012-04-05 06:47:14 +0000 (Thu, 05 Apr 2012)
Log Message:
-----------
Small improvement to bmo icosphere primitive: instead of calling n times the subdivide bmo with one cut, call it once, with the right number of cuts (which is (2^(n-1)) - 1).

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/operators/bmo_primitive.c

Modified: trunk/blender/source/blender/bmesh/operators/bmo_primitive.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_primitive.c	2012-04-05 06:46:18 UTC (rev 45415)
+++ trunk/blender/source/blender/bmesh/operators/bmo_primitive.c	2012-04-05 06:47:14 UTC (rev 45416)
@@ -420,12 +420,12 @@
 
 	dia *= 200.0f;
 
-	for (a = 1; a < subdiv; a++) {
+	if (subdiv > 1) {
 		BMOperator bmop;
 
 		BMO_op_initf(bm, &bmop,
 		             "esubd edges=%fe smooth=%f numcuts=%i gridfill=%b beauty=%i",
-		             EDGE_MARK, dia, 1, TRUE, B_SPHERE);
+		             EDGE_MARK, dia, (1 << (subdiv-1)) - 1, TRUE, B_SPHERE);
 		BMO_op_exec(bm, &bmop);
 		BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
 		BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_EDGE, EDGE_MARK);




More information about the Bf-blender-cvs mailing list