Commit: 563724a2ab5218f6aafb940d00e7382dd3bdaed0
Author: Campbell Barton
Date:   Mon Mar 30 04:24:16 2015 +1100
Branches: temp-modifier-deltamush-experimental
https://developer.blender.org/rB563724a2ab5218f6aafb940d00e7382dd3bdaed0

minor rename RNA/flags

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

M       release/scripts/startup/bl_ui/properties_data_modifier.py
M       source/blender/editors/object/object_modifier.c
M       source/blender/makesdna/DNA_modifier_types.h
M       source/blender/makesrna/intern/rna_modifier.c
M       source/blender/modifiers/intern/MOD_deltamush.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 112254f..a463bdc 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1387,12 +1387,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         sub.prop(md, "use_invert_vertex_group", text="", 
icon='ARROW_LEFTRIGHT')
 
     def DELTAMUSH(self, layout, ob, md):
-        if md.bind:
-            layout.operator("object.deltamush_bind", text="Unbind")
-        else:
-            layout.operator("object.deltamush_bind", text="Bind")
-        layout.prop(md, "only_smooth");
-        layout.prop(md, "pin_bounds");
+        is_bind = md.is_bind
+        layout.operator("object.deltamush_bind", text="Unbind" if is_bind else 
"Bind")
+        layout.prop(md, "use_only_smooth");
+        layout.prop(md, "use_pin_boundary");
         layout.label(text="Smoothing Details")
         layout.prop(md, "iterations")
         layout.prop(md, "lambda_factor", text="Factor")
diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index 06d746c..b7b5ce3 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1832,7 +1832,7 @@ static int deltamush_bind_exec(bContext *C, wmOperator 
*op)
                return OPERATOR_CANCELLED;
        }
 
-       mmd->dm_flags = mmd->dm_flags ^ MOD_DELTAMUSH_BIND;
+       mmd->flag ^= MOD_DELTAMUSH_BIND;
        DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
 
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index 6c96bfd..c130908 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1297,7 +1297,7 @@ typedef struct DeltaMushModifierData {
        float *smooth_weights;
        float lambda;
        char defgrp_name[64];  /* MAX_VGROUP_NAME */
-       short repeat, dm_flags;
+       short repeat, flag;
 
        unsigned int boundverts, pad;
 } DeltaMushModifierData;
@@ -1305,8 +1305,8 @@ typedef struct DeltaMushModifierData {
 /* Delta Mush modifier flags */
 enum {
        MOD_DELTAMUSH_BIND = (1 << 1),
-       MOD_DELTAMUSH_SHOWSMOOTH = (1 << 2),
-       MOD_DELTAMUSH_PINBOUNDS = (1 << 3),
+       MOD_DELTAMUSH_ONLY_SMOOTH = (1 << 2),
+       MOD_DELTAMUSH_PIN_BOUNDARY = (1 << 3),
 };
 
 typedef struct UVWarpModifierData {
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 855a2b0..6757258 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2157,19 +2157,20 @@ static void rna_def_modifier_deltamush(BlenderRNA *brna)
        RNA_def_property_string_funcs(prop, NULL, NULL, 
"rna_DeltaMushModifier_defgrp_name_set");
        RNA_def_property_update(prop, 0, "rna_DeltaMushModifier_update");
 
-       prop = RNA_def_property(srna, "bind", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "dm_flags", 
MOD_DELTAMUSH_BIND);
+       prop = RNA_def_property(srna, "is_bind", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DELTAMUSH_BIND);
        RNA_def_property_ui_text(prop, "Bind current shape", "");
+       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-       prop = RNA_def_property(srna, "only_smooth", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "dm_flags", 
MOD_DELTAMUSH_SHOWSMOOTH);
+       prop = RNA_def_property(srna, "use_only_smooth", PROP_BOOLEAN, 
PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", 
MOD_DELTAMUSH_ONLY_SMOOTH);
        RNA_def_property_ui_text(prop, "Display Smoothing Only", 
                "Display the effects of smoothing without reconstructing the 
surface");
        RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-       prop = RNA_def_property(srna, "pin_bounds", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "dm_flags", 
MOD_DELTAMUSH_PINBOUNDS);
+       prop = RNA_def_property(srna, "use_pin_boundary", PROP_BOOLEAN, 
PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", 
MOD_DELTAMUSH_PIN_BOUNDARY);
        RNA_def_property_ui_text(prop, "Pin Boundaries",
                "Excludes vertices on a mesh boundary from being smoothed");
        RNA_def_property_update(prop, 0, "rna_DeltaMushModifier_update");
diff --git a/source/blender/modifiers/intern/MOD_deltamush.c 
b/source/blender/modifiers/intern/MOD_deltamush.c
index a65f765..fb02f27 100644
--- a/source/blender/modifiers/intern/MOD_deltamush.c
+++ b/source/blender/modifiers/intern/MOD_deltamush.c
@@ -73,7 +73,7 @@ static void initData(ModifierData *md)
 {
        DeltaMushModifierData *dmmd = (DeltaMushModifierData *)md;
 
-       dmmd->dm_flags = MOD_DELTAMUSH_PINBOUNDS;
+       dmmd->flag = MOD_DELTAMUSH_PIN_BOUNDARY;
        dmmd->boundverts = 0;
        dmmd->deltas = NULL;
        dmmd->positions = NULL;
@@ -142,11 +142,11 @@ static CustomDataMask requiredDataMask(Object 
*UNUSED(ob), ModifierData *md)
 static void update_weights(Object *ob, DeltaMushModifierData *dmmd, 
DerivedMesh *dm)
 {
        MDeformVert *dvert = NULL;
-       float w;
-       int defgrp_index, i;
-       int numVerts = dm->getNumVerts(dm);
+       int defgrp_index;
+       const unsigned int numVerts = (unsigned int)dm->getNumVerts(dm);
 
        modifier_get_vgroup(ob, dm, dmmd->defgrp_name, &dvert, &defgrp_index);
+
        if (!dmmd->smooth_weights && dvert) {
                dmmd->smooth_weights = MEM_callocN(sizeof(float) * (size_t) 
numVerts, "delta mush weight cache");
        }
@@ -154,9 +154,11 @@ static void update_weights(Object *ob, 
DeltaMushModifierData *dmmd, DerivedMesh
                MEM_freeN(dmmd->smooth_weights);
                dmmd->smooth_weights = NULL;
        }
+
        if (dmmd->smooth_weights && dvert) {
+               unsigned int i;
                for (i = 0; i < numVerts; i++, dvert++) {
-                       w = defvert_find_weight(dvert, defgrp_index);
+                       const float w = defvert_find_weight(dvert, 
defgrp_index);
                        if (dmmd->smooth_weights[i] != w) {
                                dmmd->smooth_weights[i] = w;
                                if (dmmd->deltas) {
@@ -171,25 +173,26 @@ static void update_weights(Object *ob, 
DeltaMushModifierData *dmmd, DerivedMesh
 
 static void find_boundaries(DerivedMesh *dm, short *adjacent_counts)
 {
-       MPoly *polys = dm->getPolyArray(dm);
-       MLoop *loops = dm->getLoopArray(dm);
-       MEdge *edges = dm->getEdgeArray(dm);
-       int numFaces, numLoops, numEdges, i, j;
-       numEdges = dm->getNumEdges(dm);
-       numFaces = dm->getNumPolys(dm);
+       const MPoly *mpoly = dm->getPolyArray(dm);
+       const MLoop *mloop = dm->getLoopArray(dm);
+       const MEdge *medge = dm->getEdgeArray(dm);
+       unsigned int mpoly_num, medge_num, i;
+       medge_num = (unsigned int)dm->getNumEdges(dm);
+       mpoly_num = (unsigned int)dm->getNumPolys(dm);
        /* count the number of adjacent faces */
-       for (i = 0; i < numFaces; i++) {
-               MPoly *p = &polys[i];
-               numLoops = p->totloop;
-               for (j = 0; j < numLoops; j++) {
-                       adjacent_counts[loops[p->loopstart + j].v]++;
+       for (i = 0; i < mpoly_num; i++) {
+               const MPoly *p = &mpoly[i];
+               const int totloop = p->totloop;
+               int j;
+               for (j = 0; j < totloop; j++) {
+                       adjacent_counts[mloop[p->loopstart + j].v]++;
                }
        }
        /* subtract one from the count for each connected edge - if th count 
ends up as zero, edge is not a boundary */
        /* this may also consider some other non-manifold edges as boundaries */
-       for (i = 0; i < numEdges; i++) {
-               adjacent_counts[edges[i].v1]--;
-               adjacent_counts[edges[i].v2]--;
+       for (i = 0; i < medge_num; i++) {
+               adjacent_counts[medge[i].v1]--;
+               adjacent_counts[medge[i].v2]--;
        }
 }
 
@@ -460,7 +463,7 @@ static void smooth_verts(
 {
        short *boundaries = NULL;
 
-       if (dmmd->dm_flags & MOD_DELTAMUSH_PINBOUNDS) {
+       if (dmmd->flag & MOD_DELTAMUSH_PIN_BOUNDARY) {
                boundaries = MEM_callocN((size_t)numVerts * sizeof(short), 
"delta mush boundary data");
                find_boundaries(dm, boundaries);
        }
@@ -597,7 +600,7 @@ static void calc_deltas(
        dmmd->boundverts = numVerts;
        /* allocate deltas if they have not yet been allocated, otheriwse we 
will just write over them */
        if (!dmmd->deltas) {
-               dmmd->deltas = MEM_mallocN((size_t)(numVerts * 3) * 
sizeof(float), "delta mush deltas");
+               dmmd->deltas = MEM_mallocN((size_t)numVerts * sizeof(float[3]), 
"delta mush deltas");
        }
 
        smooth_verts(dmmd, dm, smooth_vertex_cos, numVerts);
@@ -628,8 +631,8 @@ static void deltamushmodifier_do(
         float(*vertexCos)[3], unsigned int numVerts)
 {
        DeltaMushModifierData *dmmd = (DeltaMushModifierData *)md;
-       const bool use_bind = (dmmd->dm_flags & MOD_DELTAMUSH_BIND) != 0;
-       const bool use_only_smooth = (dmmd->dm_flags & 
MOD_DELTAMUSH_SHOWSMOOTH)  != 0;
+       const bool use_bind = (dmmd->flag & MOD_DELTAMUSH_BIND) != 0;
+       const bool use_only_smooth = (dmmd->flag & MOD_DELTAMUSH_ONLY_SMOOTH)  
!= 0;
 
        if (UNLIKELY(use_bind == false)) {
                freeBind(dmmd);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to