[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54065] trunk/blender/source/blender/ modifiers/intern/MOD_meshcache.c: code cleanup: minor edits to mesh-cache formatting.
Campbell Barton
ideasman42 at gmail.com
Thu Jan 24 06:54:22 CET 2013
Revision: 54065
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54065
Author: campbellbarton
Date: 2013-01-24 05:54:17 +0000 (Thu, 24 Jan 2013)
Log Message:
-----------
code cleanup: minor edits to mesh-cache formatting.
Modified Paths:
--------------
trunk/blender/source/blender/modifiers/intern/MOD_meshcache.c
Modified: trunk/blender/source/blender/modifiers/intern/MOD_meshcache.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_meshcache.c 2013-01-24 04:33:29 UTC (rev 54064)
+++ trunk/blender/source/blender/modifiers/intern/MOD_meshcache.c 2013-01-24 05:54:17 UTC (rev 54065)
@@ -236,49 +236,46 @@
/* tricky shape key integration (slow!) */
if (mcmd->deform_mode == MOD_MESHCACHE_DEFORM_INTEGRATE) {
+ Mesh *me = ob->data;
+
/* we could support any object type */
- if (ob->type != OB_MESH) {
+ if (UNLIKELY(ob->type != OB_MESH)) {
modifier_setError(&mcmd->modifier, "'Integrate' only valid for Mesh objects");
}
+ else if (UNLIKELY(me->totvert != numVerts)) {
+ modifier_setError(&mcmd->modifier, "'Integrate' original mesh vertex mismatch");
+ }
+ else if (UNLIKELY(me->totpoly == 0)) {
+ modifier_setError(&mcmd->modifier, "'Integrate' requires faces");
+ }
else {
- Mesh *me = ob->data;
- if (me->totvert != numVerts) {
- modifier_setError(&mcmd->modifier, "'Integrate' original mesh vertex mismatch");
- }
- else {
- if (me->totpoly == 0) {
- modifier_setError(&mcmd->modifier, "'Integrate' requires faces");
- }
- else {
- /* the moons align! */
- int i;
+ /* the moons align! */
+ int i;
- float (*vertexCos_Source)[3] = MEM_mallocN(sizeof(*vertexCos_Source) * numVerts, __func__);
- float (*vertexCos_New)[3] = MEM_mallocN(sizeof(*vertexCos_New) * numVerts, __func__);
- MVert *mv = me->mvert;
+ float (*vertexCos_Source)[3] = MEM_mallocN(sizeof(*vertexCos_Source) * numVerts, __func__);
+ float (*vertexCos_New)[3] = MEM_mallocN(sizeof(*vertexCos_New) * numVerts, __func__);
+ MVert *mv = me->mvert;
- for (i = 0; i < numVerts; i++, mv++) {
- copy_v3_v3(vertexCos_Source[i], mv->co);
- }
+ for (i = 0; i < numVerts; i++, mv++) {
+ copy_v3_v3(vertexCos_Source[i], mv->co);
+ }
- BKE_mesh_calc_relative_deform(
- me->mpoly, me->totpoly,
- me->mloop, me->totvert,
+ BKE_mesh_calc_relative_deform(
+ me->mpoly, me->totpoly,
+ me->mloop, me->totvert,
- (const float (*)[3])vertexCos_Source, /* from the original Mesh*/
- (const float (*)[3])vertexCos_Real, /* the input we've been given (shape keys!) */
+ (const float (*)[3])vertexCos_Source, /* from the original Mesh*/
+ (const float (*)[3])vertexCos_Real, /* the input we've been given (shape keys!) */
- (const float (*)[3])vertexCos, /* the result of this modifier */
- vertexCos_New /* the result of this function */
- );
+ (const float (*)[3])vertexCos, /* the result of this modifier */
+ vertexCos_New /* the result of this function */
+ );
- /* write the corrected locations back into the result */
- memcpy(use_factor ? vertexCos : vertexCos_Real, vertexCos_New, sizeof(*vertexCos) * numVerts);
+ /* write the corrected locations back into the result */
+ memcpy(use_factor ? vertexCos : vertexCos_Real, vertexCos_New, sizeof(*vertexCos) * numVerts);
- MEM_freeN(vertexCos_Source);
- MEM_freeN(vertexCos_New);
- }
- }
+ MEM_freeN(vertexCos_Source);
+ MEM_freeN(vertexCos_New);
}
}
More information about the Bf-blender-cvs
mailing list