Revision: 40203
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40203
Author:   campbellbarton
Date:     2011-09-14 07:07:17 +0000 (Wed, 14 Sep 2011)
Log Message:
-----------
- use a flag define for bDeformGroup->flag rather than setting TRUE/FALSE
- rename RNA bDeformGroup.flag to "lock_weight"

Modified Paths:
--------------
    
branches/soc-2011-radish/source/blender/editors/interface/interface_templates.c
    branches/soc-2011-radish/source/blender/editors/object/object_vgroup.c
    branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/soc-2011-radish/source/blender/makesdna/DNA_object_types.h
    branches/soc-2011-radish/source/blender/makesrna/intern/rna_object.c

Modified: 
branches/soc-2011-radish/source/blender/editors/interface/interface_templates.c
===================================================================
--- 
branches/soc-2011-radish/source/blender/editors/interface/interface_templates.c 
    2011-09-14 05:56:25 UTC (rev 40202)
+++ 
branches/soc-2011-radish/source/blender/editors/interface/interface_templates.c 
    2011-09-14 07:07:17 UTC (rev 40203)
@@ -2125,10 +2125,10 @@
                uiBlockSetEmboss(block, UI_EMBOSS);
        }
        /* Jason was here: I need the RNA struct for vertex groups */
-       else if(RNA_struct_is_a(itemptr->type, &RNA_VertexGroup)) {
+       else if(itemptr->type == &RNA_VertexGroup) {
                uiItemL(sub, name, icon);
                uiBlockSetEmboss(block, UI_EMBOSS);
-               uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, 
itemptr, "flag", 0, 0, 0, 0, 0,  NULL);
+               uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, 
itemptr, "lock_weight", 0, 0, 0, 0, 0,  NULL);
        }
        else if(itemptr->type == &RNA_KeyingSetPath) {
                KS_Path *ksp = (KS_Path*)itemptr->data;

Modified: branches/soc-2011-radish/source/blender/editors/object/object_vgroup.c
===================================================================
--- branches/soc-2011-radish/source/blender/editors/object/object_vgroup.c      
2011-09-14 05:56:25 UTC (rev 40202)
+++ branches/soc-2011-radish/source/blender/editors/object/object_vgroup.c      
2011-09-14 07:07:17 UTC (rev 40203)
@@ -1306,7 +1306,7 @@
 {
        bDeformGroup *dg = ob->defbase.first;
        while(dg) {
-               dg->flag = TRUE;
+               dg->flag |= DG_LOCK_WEIGHT;
                dg = dg->next;
        }
 }
@@ -1315,7 +1315,7 @@
 {
        bDeformGroup *dg = ob->defbase.first;
        while(dg) {
-               dg->flag = FALSE;
+               dg->flag &= ~DG_LOCK_WEIGHT;
                dg = dg->next;
        }
 }

Modified: 
branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c 
2011-09-14 05:56:25 UTC (rev 40202)
+++ branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c 
2011-09-14 07:07:17 UTC (rev 40203)
@@ -363,7 +363,7 @@
        MFace *mf;
        unsigned int *mcol;
        int i, selected;
-       
+
        me= get_mesh(ob);
        if(me==NULL || me->totface==0) return;
 
@@ -442,9 +442,9 @@
                        faceverts[2]= mface->v3;
                        faceverts[3]= mface->v4;
                        for (i=0; i<3 || faceverts[i]; i++) {
-                               if(!((me->dvert+faceverts[i])->flag)) {
+                               if(me->dvert[faceverts[i]].flag) {
                                        // Jason
-                                       if(selectedVerts && 
!((me->mvert+faceverts[i])->flag & SELECT)) {
+                                       if(selectedVerts && 
((me->mvert[faceverts[i]].flag & SELECT) == 0)) {
                                                continue;
                                        }
 
@@ -1167,10 +1167,8 @@
        bDeformGroup *defgroup;
 
        for(i = 0, defgroup = ob->defbase.first; i < defbase_len && defgroup; 
defgroup = defgroup->next, i++) {
-               flags[i] = defgroup->flag;
-               if(flags[i]) {
-                       is_locked = TRUE;
-               }
+               flags[i] = ((defgroup->flag & DG_LOCK_WEIGHT) != 0);
+               is_locked |= flags[i];
        }
        if(is_locked){
                return flags;
@@ -1519,7 +1517,7 @@
        //                                              Jason: tdw, tuw
        MDeformWeight *dw, *uw, *tdw = NULL, *tuw;
        int vgroup= ob->actdef-1;
-
+       
        /* Jason was here */
        char *flags;
        char *bone_groups;
@@ -1569,7 +1567,7 @@
                dv = MEM_mallocN(sizeof (*(me->dvert+index)), 
"prevMDeformVert");
 
                dv->dw= MEM_dupallocN((me->dvert+index)->dw);
-               dv->flag = (me->dvert+index)->flag;
+               dv->flag = me->dvert[index].flag;
                dv->totweight = (me->dvert+index)->totweight;
                tdw = dw;
                tuw = uw;
@@ -1647,6 +1645,7 @@
        }
 }
 
+
 /* *************** set wpaint operator ****************** */
 
 static int set_wpaint(bContext *C, wmOperator *UNUSED(op))             /* 
toggle */
@@ -1808,7 +1807,7 @@
        struct WPaintData *wpd;
        Mesh *me;
        float mat[4][4], imat[4][4];
-
+       
        if(scene->obedit) return OPERATOR_CANCELLED;
        
        me= get_mesh(ob);
@@ -1819,14 +1818,13 @@
                ED_vgroup_data_create(&me->id);
                WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
        }
-
-
+       
        /* make mode data storage */
        wpd= MEM_callocN(sizeof(struct WPaintData), "WPaintData");
        paint_stroke_set_mode_data(stroke, wpd);
        view3d_set_viewcontext(C, &wpd->vc);
        wpd->vgroup_mirror= -1;
-
+       
        /*set up auto-normalize, and generate map for detecting which
          vgroups affect deform bones*/
        wpd->auto_normalize = ts->auto_normalize;
@@ -1881,7 +1879,7 @@
        if(me->editflag & ME_EDIT_MIRROR_X) {
                wpaint_mirror_vgroup_ensure(ob, &wpd->vgroup_mirror);
        }
-
+       
        return 1;
 }
 
@@ -1977,12 +1975,20 @@
        for(index=0; index<totindex; index++) {
                if(indexar[index] && indexar[index]<=me->totface) {
                        MFace *mface= me->mface + (indexar[index]-1);
+
+                       if(selectedVerts) {
+                               me->dvert[mface->v1].flag = 
(me->mvert[mface->v1].flag & SELECT);
+                               me->dvert[mface->v2].flag = 
(me->mvert[mface->v2].flag & SELECT);
+                               me->dvert[mface->v3].flag = 
(me->mvert[mface->v3].flag & SELECT);
+                               if(mface->v4) me->dvert[mface->v4].flag = 
(me->mvert[mface->v4].flag & SELECT);
+                       }
+                       else {
+                               me->dvert[mface->v1].flag= 1;
+                               me->dvert[mface->v2].flag= 1;
+                               me->dvert[mface->v3].flag= 1;
+                               if(mface->v4) me->dvert[mface->v4].flag= 1;
+                       }
                                        
-                       (me->dvert+mface->v1)->flag= selectedVerts ? 
((me->mvert+mface->v1)->flag & SELECT): 1;
-                       (me->dvert+mface->v2)->flag= selectedVerts ? 
((me->mvert+mface->v2)->flag & SELECT): 1;
-                       (me->dvert+mface->v3)->flag= selectedVerts ? 
((me->mvert+mface->v3)->flag & SELECT): 1;
-                       if(mface->v4) (me->dvert+mface->v4)->flag= 
selectedVerts ? ((me->mvert+mface->v4)->flag & SELECT): 1;
-                                       
                        if(brush->vertexpaint_tool==VP_BLUR) {
                                MDeformWeight *dw, *(*dw_func)(MDeformVert *, 
const int);
                                                
@@ -2304,15 +2310,14 @@
        Brush *brush = paint_brush(&vp->paint);
        Mesh *me = get_mesh(ob);
        MFace *mface= ((MFace*)me->mface) + index;
-
        unsigned int *mcol= ((unsigned int*)me->mcol) + 4*index;
        unsigned int *mcolorig= ((unsigned int*)vp->vpaint_prev) + 4*index;
        float alpha;
        int i;
-
+       
        if((vp->flag & VP_COLINDEX && mface->mat_nr!=ob->actcol-1) ||
           ((me->editflag & ME_EDIT_PAINT_MASK) && !(mface->flag & 
ME_FACE_SEL)))
-                  return;
+               return;
 
        if(brush->vertexpaint_tool==VP_BLUR) {
                unsigned int fcol1= mcol_blend( mcol[0], mcol[1], 128);

Modified: branches/soc-2011-radish/source/blender/makesdna/DNA_object_types.h
===================================================================
--- branches/soc-2011-radish/source/blender/makesdna/DNA_object_types.h 
2011-09-14 05:56:25 UTC (rev 40202)
+++ branches/soc-2011-radish/source/blender/makesdna/DNA_object_types.h 
2011-09-14 07:07:17 UTC (rev 40203)
@@ -67,6 +67,9 @@
 } bDeformGroup;
 #define MAX_VGROUP_NAME 32
 
+/* bDeformGroup->flag */
+#define DG_LOCK_WEIGHT 1
+
 /**
  * The following illustrates the orientation of the 
  * bounding box in local space

Modified: branches/soc-2011-radish/source/blender/makesrna/intern/rna_object.c
===================================================================
--- branches/soc-2011-radish/source/blender/makesrna/intern/rna_object.c        
2011-09-14 05:56:25 UTC (rev 40202)
+++ branches/soc-2011-radish/source/blender/makesrna/intern/rna_object.c        
2011-09-14 07:07:17 UTC (rev 40203)
@@ -1276,9 +1276,9 @@
        RNA_def_property_string_funcs(prop, NULL, NULL, 
"rna_VertexGroup_name_set");
        RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, 
"rna_Object_internal_update_data"); /* update data because modifiers may use 
[#24761] */
        /* Jason was here */
-       prop= RNA_def_property(srna, "flag", PROP_BOOLEAN, PROP_NONE);
+       prop= RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_ui_text(prop, "", "Maintain the relative weights for 
the group");
-       RNA_def_property_boolean_sdna(prop, "bDeformGroup", "flag", 0);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
        RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, 
"rna_Object_internal_update_data"); /* update data because modifiers may use 
[#24761] */
 
        prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);

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

Reply via email to