[Bf-blender-cvs] [c117245] alembic_basic_io: Pre-allocate UVs array.

Kévin Dietrich noreply at git.blender.org
Thu Jul 21 00:33:37 CEST 2016


Commit: c117245516879e5e5c8b7c62735e86ed3c8f3bf6
Author: Kévin Dietrich
Date:   Wed Jul 20 22:11:30 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rBc117245516879e5e5c8b7c62735e86ed3c8f3bf6

Pre-allocate UVs array.

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

M	source/blender/alembic/intern/abc_customdata.cc

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

diff --git a/source/blender/alembic/intern/abc_customdata.cc b/source/blender/alembic/intern/abc_customdata.cc
index 84dfc52..ebf1b2b 100644
--- a/source/blender/alembic/intern/abc_customdata.cc
+++ b/source/blender/alembic/intern/abc_customdata.cc
@@ -66,15 +66,19 @@ static void get_uvs(const CDStreamConfig &config,
 
 	if (!config.pack_uvs) {
 		int cnt = 0;
+		uvidx.resize(config.totloop);
+		uvs.resize(config.totloop);
+
 		for (int i = 0; i < num_poly; ++i) {
 			MPoly &current_poly = polygons[i];
 			MLoopUV *loopuvpoly = mloopuv_array + current_poly.loopstart + current_poly.totloop;
 
-			for (int j = 0; j < current_poly.totloop; ++j) {
-				loopuvpoly--;
-				uvidx.push_back(cnt++);
-				Imath::V2f uv(loopuvpoly->uv[0], loopuvpoly->uv[1]);
-				uvs.push_back(uv);
+			for (int j = 0; j < current_poly.totloop; ++j, ++cnt) {
+				--loopuvpoly;
+
+				uvidx[cnt] = cnt;
+				uvs[cnt][0] = loopuvpoly->uv[0];
+				uvs[cnt][1] = loopuvpoly->uv[1];
 			}
 		}
 	}




More information about the Bf-blender-cvs mailing list