[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60830] branches/soc-2013-sketch_mesh/ source/blender: Style cleanup: Coding Style.
Alexander Pinzon
apinzonf at gmail.com
Thu Oct 17 19:49:06 CEST 2013
Revision: 60830
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60830
Author: apinzonf
Date: 2013-10-17 17:49:06 +0000 (Thu, 17 Oct 2013)
Log Message:
-----------
Style cleanup: Coding Style.
Modified Paths:
--------------
branches/soc-2013-sketch_mesh/source/blender/makesdna/DNA_modifier_types.h
branches/soc-2013-sketch_mesh/source/blender/makesrna/intern/rna_modifier.c
branches/soc-2013-sketch_mesh/source/blender/modifiers/intern/MOD_laplaciandeform.c
Modified: branches/soc-2013-sketch_mesh/source/blender/makesdna/DNA_modifier_types.h
===================================================================
--- branches/soc-2013-sketch_mesh/source/blender/makesdna/DNA_modifier_types.h 2013-10-17 16:05:57 UTC (rev 60829)
+++ branches/soc-2013-sketch_mesh/source/blender/makesdna/DNA_modifier_types.h 2013-10-17 17:49:06 UTC (rev 60830)
@@ -1280,7 +1280,7 @@
typedef struct LaplacianDeformModifierData {
ModifierData modifier;
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ char anchor_grp_name[64]; /* MAX_VGROUP_NAME */
int total_verts, repeat;
float *vertexco;
void *cacheSystem;
Modified: branches/soc-2013-sketch_mesh/source/blender/makesrna/intern/rna_modifier.c
===================================================================
--- branches/soc-2013-sketch_mesh/source/blender/makesrna/intern/rna_modifier.c 2013-10-17 16:05:57 UTC (rev 60829)
+++ branches/soc-2013-sketch_mesh/source/blender/makesrna/intern/rna_modifier.c 2013-10-17 17:49:06 UTC (rev 60830)
@@ -777,7 +777,7 @@
static void rna_LaplacianDeformModifier_vgroup_set(PointerRNA *ptr, const char *value)
{
LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)ptr->data;
- rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
+ rna_object_vgroup_name_set(ptr, value, lmd->anchor_grp_name, sizeof(lmd->anchor_grp_name));
}
#else
@@ -3679,7 +3679,7 @@
RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_string_sdna(prop, NULL, "anchor_grp_name");
RNA_def_property_ui_text(prop, "Vertex Group for Anchors",
"Name of Vertex Group which determines Anchors");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianDeformModifier_vgroup_set");
Modified: branches/soc-2013-sketch_mesh/source/blender/modifiers/intern/MOD_laplaciandeform.c
===================================================================
--- branches/soc-2013-sketch_mesh/source/blender/modifiers/intern/MOD_laplaciandeform.c 2013-10-17 16:05:57 UTC (rev 60829)
+++ branches/soc-2013-sketch_mesh/source/blender/modifiers/intern/MOD_laplaciandeform.c 2013-10-17 17:49:06 UTC (rev 60830)
@@ -41,32 +41,32 @@
#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "BKE_editmesh_bvh.h"
+#include "BKE_report.h"
#include "MOD_modifiertypes.h"
#include "MOD_util.h"
#include "ONL_opennl.h"
-struct BLaplacianSystem {
+typedef struct LaplacianSystem {
bool is_matrix_computed;
bool has_solution;
int total_verts;
int total_edges;
int total_anchors;
int repeat;
- char defgrp_name[64]; /* Vertex Group name*/
+ char anchor_grp_name[64]; /* Vertex Group name*/
float (*co)[3]; /* Original vertex coordinates*/
float (*no)[3]; /* Original vertex normal*/
float (*delta)[3]; /* Differential Coordinates*/
int *index_anchors; /* Static vertex index list*/
int *unit_verts; /* Unit vectors of projected edges onto the plane orthogonal to n*/
- BMVert ** verts; /* Vertex order by index*/
+ BMVert **verts; /* Vertex order by index*/
BMesh *bm; /* Bmesh structure pointer*/
NLContext *context; /* System for solve general implicit rotations*/
-};
-typedef struct BLaplacianSystem LaplacianSystem;
+} LaplacianSystem;
-static LaplacianSystem * newLaplacianSystem()
+static LaplacianSystem *newLaplacianSystem()
{
- LaplacianSystem * sys;
+ LaplacianSystem *sys;
sys = MEM_callocN(sizeof(LaplacianSystem), "DeformCache");
if (!sys) {
return NULL;
@@ -77,7 +77,7 @@
sys->total_edges = 0;
sys->total_anchors = 0;
sys->repeat = 1;
- sys->defgrp_name[0] = '\0';
+ sys->anchor_grp_name[0] = '\0';
sys->co = NULL;
sys->no = NULL;
sys->delta = NULL;
@@ -89,7 +89,8 @@
return sys;
}
-static LaplacianSystem * initLaplacianSystem(int totalVerts, int totalEdges, int totalFaces, int totalAnchors, char defgrpName[64], int iterations)
+static LaplacianSystem *initLaplacianSystem(int totalVerts, int totalEdges, int totalFaces, int totalAnchors,
+ char defgrpName[64], int iterations)
{
LaplacianSystem *sys = newLaplacianSystem();
if (!sys) {
@@ -101,15 +102,15 @@
sys->total_edges = totalEdges;
sys->total_anchors = totalAnchors;
sys->repeat = iterations;
- BLI_strncpy(sys->defgrp_name, defgrpName, sizeof(sys->defgrp_name));
- sys->co = (float (*)[3])MEM_callocN(sizeof(float)*(totalVerts*3), "DeformCoordinates");
- sys->no = (float (*)[3])MEM_callocN(sizeof(float)*(totalVerts*3), "DeformNormals");
- sys->delta = (float (*)[3])MEM_callocN(sizeof(float)*totalVerts*3, "DeformDeltas");
+ BLI_strncpy(sys->anchor_grp_name, defgrpName, sizeof(sys->anchor_grp_name));
+ sys->co = (float (*)[3])MEM_callocN(sizeof(float)*(totalVerts * 3), "DeformCoordinates");
+ sys->no = (float (*)[3])MEM_callocN(sizeof(float)*(totalVerts * 3), "DeformNormals");
+ sys->delta = (float (*)[3])MEM_callocN(sizeof(float)*totalVerts * 3, "DeformDeltas");
sys->index_anchors = (int *)MEM_callocN(sizeof(int)*(totalAnchors), "DeformAnchors");
sys->unit_verts = (int *)MEM_callocN(sizeof(int)*totalVerts, "DeformUnitVerts");
sys->verts = (BMVert**)MEM_callocN(sizeof(BMVert*)*(totalVerts), "DeformVerts");
- memset(sys->no, 0.0, sizeof(float)*totalVerts*3);
- memset(sys->delta, 0.0, sizeof(float)*totalVerts*3);
+ memset(sys->no, 0.0, sizeof(float)*totalVerts * 3);
+ memset(sys->delta, 0.0, sizeof(float)*totalVerts * 3);
return sys;
}
@@ -121,17 +122,23 @@
}
}
-static void deleteLaplacianSystem(LaplacianSystem * sys)
+static void deleteLaplacianSystem(LaplacianSystem *sys)
{
- if (!sys) return;
+ if (!sys) {
+ return;
+ }
deleteVoidPointer(sys->co);
deleteVoidPointer(sys->no);
deleteVoidPointer(sys->delta);
deleteVoidPointer(sys->index_anchors);
deleteVoidPointer(sys->unit_verts);
deleteVoidPointer(sys->verts);
- if (sys->bm) BM_mesh_free(sys->bm);
- if (sys->context) nlDeleteContext(sys->context);
+ if (sys->bm) {
+ BM_mesh_free(sys->bm);
+ }
+ if (sys->context) {
+ nlDeleteContext(sys->context);
+ }
deleteVoidPointer(sys);
}
static float cotan_weight(float *v1, float *v2, float *v3)
@@ -143,13 +150,14 @@
cross_v3_v3v3(c, a, b);
clen = len_v3(c);
- if (clen < FLT_EPSILON)
+ if (clen < FLT_EPSILON){
return 0.0f;
+ }
return dot_v3v3(a, b) / clen;
}
-static void initLaplacianMatrix( LaplacianSystem * sys)
+static void initLaplacianMatrix( LaplacianSystem *sys)
{
float v1[3], v2[3], v3[3], v4[3], no[3];
float w2, w3, w4;
@@ -198,13 +206,15 @@
copy_v3_v3( v1, sys->co[idv1]);
copy_v3_v3( v2, sys->co[idv2]);
copy_v3_v3( v3, sys->co[idv3]);
- if (has_4_vert) copy_v3_v3(v4, sys->co[idv4]);
+ if (has_4_vert) {
+ copy_v3_v3(v4, sys->co[idv4]);
+ }
if (has_4_vert) {
- w2 = (cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2)) /2.0f ;
- w3 = (cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3)) /2.0f ;
- w4 = (cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1)) /2.0f;
+ w2 = (cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2)) / 2.0f ;
+ w3 = (cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3)) / 2.0f ;
+ w4 = (cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1)) / 2.0f;
sys->delta[idv1][0] -= v4[0] * w4;
sys->delta[idv1][1] -= v4[1] * w4;
@@ -242,7 +252,7 @@
}
}
-static void computeImplictRotations(LaplacianSystem * sys)
+static void computeImplictRotations(LaplacianSystem *sys)
{
BMEdge *e;
BMIter eiter;
@@ -269,7 +279,7 @@
BLI_array_append(vidn, i);
ln = BLI_array_count(vidn);
minj = 1000000.0f;
- for (j = 0; j < (ln-1); j++) {
+ for (j = 0; j < ln - 1; j++) {
vid = vidn[j];
copy_v3_v3(qj, sys->co[vid]);
sub_v3_v3v3(vj, qj, sys->co[i]);
@@ -287,7 +297,7 @@
}
}
-static void rotateDifferentialCoordinates(LaplacianSystem * sys)
+static void rotateDifferentialCoordinates(LaplacianSystem *sys)
{
BMFace *f;
BMVert *v, *v2;
@@ -325,7 +335,7 @@
vin[j] = BM_elem_index_get(v2);
}
lvin = j;
- for (j=0; j<lvin; j++ ) {
+ for (j = 0; j < lvin; j++) {
vn[j][0] = nlGetVariable(0, vin[j]);
vn[j][1] = nlGetVariable(1, vin[j]);
vn[j][2] = nlGetVariable(2, vin[j]);
@@ -349,9 +359,9 @@
sub_v3_v3(uij, dun);
normalize_v3(uij);
cross_v3_v3v3(e2, ni, uij);
- fni[0] = alpha*ni[0] + beta*uij[0] + gamma*e2[0];
- fni[1] = alpha*ni[1] + beta*uij[1] + gamma*e2[1];
- fni[2] = alpha*ni[2] + beta*uij[2] + gamma*e2[2];
+ fni[0] = alpha*ni[0] + beta * uij[0] + gamma * e2[0];
+ fni[1] = alpha*ni[1] + beta * uij[1] + gamma * e2[1];
+ fni[2] = alpha*ni[2] + beta * uij[2] + gamma * e2[2];
if (len_v3(fni) > FLT_EPSILON) {
nlRightHandSideSet(0, i, fni[0]);
@@ -366,7 +376,7 @@
}
}
-static void laplacianDeformPreview(LaplacianSystem * sys, float (*vertexCos)[3])
+static void laplacianDeformPreview(LaplacianSystem *sys, float (*vertexCos)[3])
{
struct BMesh *bm;
int vid, i, j, n, na;
@@ -374,7 +384,7 @@
n = sys->total_verts;
na = sys->total_anchors;
- if (!sys->is_matrix_computed){
+ if (!sys->is_matrix_computed) {
nlNewContext();
sys->context = nlGetCurrent();
@@ -386,12 +396,12 @@
nlSolverParameteri(NL_NB_RIGHT_HAND_SIDES, 3);
nlBegin(NL_SYSTEM);
- for (i=0; i<n; i++) {
+ for (i = 0; i < n; i++) {
nlSetVariable(0, i, sys->co[i][0]);
nlSetVariable(1, i, sys->co[i][1]);
nlSetVariable(2, i, sys->co[i][2]);
}
- for (i=0; i<na; i++) {
+ for (i = 0; i < na; i++) {
vid = sys->index_anchors[i];
nlSetVariable(0, vid, sys->verts[vid]->co[0]);
nlSetVariable(1, vid, sys->verts[vid]->co[1]);
@@ -403,13 +413,12 @@
initLaplacianMatrix(sys);
computeImplictRotations(sys);
- for (i=0; i<n; i++) {
+ for (i = 0; i < n; i++) {
nlRightHandSideSet(0, i, sys->delta[i][0]);
nlRightHandSideSet(1, i, sys->delta[i][1]);
nlRightHandSideSet(2, i, sys->delta[i][2]);
}
-
- for (i=0; i<na; i++) {
+ for (i = 0; i < na; i++) {
vid = sys->index_anchors[i];
nlRightHandSideSet(0, n + i , sys->co[vid][0]);
nlRightHandSideSet(1, n + i , sys->co[vid][1]);
@@ -420,15 +429,15 @@
nlEnd(NL_MATRIX);
nlEnd(NL_SYSTEM);
- if (nlSolveAdvanced(NULL, NL_TRUE) ) {
+ if (nlSolveAdvanced(NULL, NL_TRUE)) {
sys->has_solution = true;
- for (j=1; j<= sys->repeat; j++) {
+ for (j = 1; j <= sys->repeat; j++) {
nlBegin(NL_SYSTEM);
nlBegin(NL_MATRIX);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list