style cleanup
authorCampbell Barton <ideasman42@gmail.com>
Tue, 22 May 2012 16:24:09 +0000 (16:24 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 22 May 2012 16:24:09 +0000 (16:24 +0000)
also fix example for mesh uv's

doc/python_api/examples/bpy.types.Mesh.py
source/blender/editors/interface/interface_widgets.c
source/blender/editors/object/object_modifier.c
source/blender/editors/sculpt_paint/paint_mask.c
source/blender/editors/space_file/fsmenu.c
source/blender/modifiers/intern/MOD_skin.c

index 1ee5118df6de3f7d5591668f3a8267bd0f56b21b..d30303f3b0515d08bada77807bfc2c09f265dbe3 100644 (file)
@@ -28,7 +28,7 @@ This example script prints the vertices and UV's for each polygon, assumes the a
 import bpy
 
 me = bpy.context.object.data
-uv_layer = me.uv.layers.active.data
+uv_layer = me.uv_layers.active.data
 
 for poly in me.polygons:
     print("Polygon index: %d, length: %d" % (poly.index, poly.loop_total))
index 3824dcf0724c92fc681c336af8af15dcc1fefc13..2edc2b22e7e91be541ee3e067f88eae56802d888 100644 (file)
@@ -1165,11 +1165,13 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
        
        if (fstyle->kerning == 1)
                BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
-       
-       //      ui_rasterpos_safe(x, y, but->aspect);
-//     if (but->type==IDPOIN) transopts= 0;    // no translation, of course!
-//     else transopts= ui_translate_buttons();
-       
+
+#if 0
+       ui_rasterpos_safe(x, y, but->aspect);
+       if (but->type == IDPOIN) transopts = 0; // no translation, of course!
+       else transopts = ui_translate_buttons();
+#endif
+
        /* cut string in 2 parts - only for menu entries */
        if ((but->block->flag & UI_BLOCK_LOOP)) {
                if (ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS) == 0) {
@@ -3135,9 +3137,9 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
                                /* no text, with icon */
                                else if (!but->str[0] && but->icon) {
                                        if (but->flag & UI_ICON_PREVIEW)
-                                               wt= widget_type(UI_WTYPE_MENU_ICON_RADIO); /* no arrows */
+                                               wt = widget_type(UI_WTYPE_MENU_ICON_RADIO); /* no arrows */
                                        else
-                                               wt= widget_type(UI_WTYPE_MENU_RADIO);  /* with arrows */
+                                               wt = widget_type(UI_WTYPE_MENU_RADIO);  /* with arrows */
                                }
                                /* with menu arrows */
                                else
index 47557f49b9f97715cbc28c683ad629c1330bcce4..9e891353f3590fcf87e48e23c18879a84a4f88d4 100644 (file)
@@ -161,7 +161,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
                        /* ensure that grid paint mask layer is created */
                        ED_sculpt_mask_layers_ensure(ob, (MultiresModifierData *)new_md);
                }
-               else if(type == eModifierType_Skin) {
+               else if (type == eModifierType_Skin) {
                        /* ensure skin-node customdata exists */
                        modifier_skin_customdata_ensure(ob);
                }
@@ -1139,7 +1139,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
        }
 
-       CTX_DATA_BEGIN (C, Object *, selob, selected_editable_objects)
+       CTX_DATA_BEGIN(C, Object *, selob, selected_editable_objects)
        {
                if (selob->type == OB_MESH && selob != ob) {
                        secondob = selob;
@@ -1372,13 +1372,13 @@ static void modifier_skin_customdata_ensure(Object *ob)
 static int skin_poll(bContext *C)
 {
        return (!CTX_data_edit_object(C) &&
-               edit_modifier_poll_generic(C, &RNA_SkinModifier, (1<<OB_MESH)));
+               edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH)));
 }
 
 static int skin_edit_poll(bContext *C)
 {
        return (CTX_data_edit_object(C) &&
-               edit_modifier_poll_generic(C, &RNA_SkinModifier, (1<<OB_MESH)));
+               edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH)));
 }
 
 static void skin_root_clear(BMesh *bm, BMVert *bm_vert, GHash *visited)
@@ -1389,7 +1389,7 @@ static void skin_root_clear(BMesh *bm, BMVert *bm_vert, GHash *visited)
        BM_ITER_ELEM (bm_edge, &bm_iter, bm_vert, BM_EDGES_OF_VERT) {
                BMVert *v2 = BM_edge_other_vert(bm_edge, bm_vert);
 
-               if(!BLI_ghash_lookup(visited, v2)) {
+               if (!BLI_ghash_lookup(visited, v2)) {
                        MVertSkin *vs = CustomData_bmesh_get(&bm->vdata,
                                                             v2->head.data,
                                                             CD_MVERT_SKIN);
@@ -1405,7 +1405,7 @@ static void skin_root_clear(BMesh *bm, BMVert *bm_vert, GHash *visited)
 
 static int skin_root_mark_exec(bContext *C, wmOperator *UNUSED(op))
 {
-       Object *ob= CTX_data_edit_object(C);
+       Object *ob = CTX_data_edit_object(C);
        Mesh *me = ob->data;
        BMesh *bm = me->edit_btmesh->bm;
        BMVert *bm_vert;
@@ -1417,8 +1417,8 @@ static int skin_root_mark_exec(bContext *C, wmOperator *UNUSED(op))
        modifier_skin_customdata_ensure(ob);
 
        BM_ITER_MESH (bm_vert, &bm_iter, bm, BM_VERTS_OF_MESH) {
-               if(!BLI_ghash_lookup(visited, bm_vert) &&
-                  bm_vert->head.hflag & BM_ELEM_SELECT)
+               if (!BLI_ghash_lookup(visited, bm_vert) &&
+                   bm_vert->head.hflag & BM_ELEM_SELECT)
                {
                        MVertSkin *vs = CustomData_bmesh_get(&bm->vdata,
                                                             bm_vert->head.data,
@@ -1436,7 +1436,7 @@ static int skin_root_mark_exec(bContext *C, wmOperator *UNUSED(op))
        BLI_ghash_free(visited, NULL, NULL);
 
        DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+       WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
 }
@@ -1451,7 +1451,7 @@ void OBJECT_OT_skin_root_mark(wmOperatorType *ot)
        ot->exec = skin_root_mark_exec;
        
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 typedef enum {
@@ -1461,7 +1461,7 @@ typedef enum {
 
 static int skin_loose_mark_clear_exec(bContext *C, wmOperator *op)
 {
-       Object *ob= CTX_data_edit_object(C);
+       Object *ob = CTX_data_edit_object(C);
        Mesh *me = ob->data;
        BMesh *bm = me->edit_btmesh->bm;
        BMVert *bm_vert;
@@ -1487,7 +1487,7 @@ static int skin_loose_mark_clear_exec(bContext *C, wmOperator *op)
        }
 
        DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+       WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
 }
@@ -1495,9 +1495,10 @@ static int skin_loose_mark_clear_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_skin_loose_mark_clear(wmOperatorType *ot)
 {
        static EnumPropertyItem action_items[] = {
-       {SKIN_LOOSE_MARK, "MARK", 0, "Mark", "Mark selected vertices as loose"},
-       {SKIN_LOOSE_CLEAR, "CLEAR", 0, "Clear", "Set selected vertices as not loose"},
-       {0, NULL, 0, NULL, NULL}};
+               {SKIN_LOOSE_MARK, "MARK", 0, "Mark", "Mark selected vertices as loose"},
+               {SKIN_LOOSE_CLEAR, "CLEAR", 0, "Clear", "Set selected vertices as not loose"},
+               {0, NULL, 0, NULL, NULL}
+       };
 
        ot->name = "Skin Mark/Clear Loose";
        ot->description = "Mark/clear selected vertices as loose";
@@ -1507,14 +1508,14 @@ void OBJECT_OT_skin_loose_mark_clear(wmOperatorType *ot)
        ot->exec = skin_loose_mark_clear_exec;
        
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        RNA_def_enum(ot->srna, "action", action_items, SKIN_LOOSE_MARK, "Action", NULL);
 }
 
 static int skin_radii_equalize_exec(bContext *C, wmOperator *UNUSED(op))
 {
-       Object *ob= CTX_data_edit_object(C);
+       Object *ob = CTX_data_edit_object(C);
        Mesh *me = ob->data;
        BMesh *bm = me->edit_btmesh->bm;
        BMVert *bm_vert;
@@ -1532,7 +1533,7 @@ static int skin_radii_equalize_exec(bContext *C, wmOperator *UNUSED(op))
        }
 
        DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+       WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
 }
@@ -1547,20 +1548,20 @@ void OBJECT_OT_skin_radii_equalize(wmOperatorType *ot)
        ot->exec = skin_radii_equalize_exec;
        
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static void skin_armature_bone_create(Object *skin_ob,
-                                                                         MVert *mvert, MEdge *medge,
-                                                                         bArmature *arm,
-                                                                         BLI_bitmap edges_visited,
-                                                                         const MeshElemMap *emap,
-                                                                         EditBone *parent_bone,
-                                                                         int parent_v)
+                                      MVert *mvert, MEdge *medge,
+                                      bArmature *arm,
+                                      BLI_bitmap edges_visited,
+                                      const MeshElemMap *emap,
+                                      EditBone *parent_bone,
+                                      int parent_v)
 {
        int i;
 
-       for(i = 0; i < emap[parent_v].count; i++) {
+       for (i = 0; i < emap[parent_v].count; i++) {
                int endx = emap[parent_v].indices[i];
                const MEdge *e = &medge[endx];
                EditBone *bone;
@@ -1568,14 +1569,14 @@ static void skin_armature_bone_create(Object *skin_ob,
                int v;
 
                /* ignore edge if already visited */
-               if(BLI_BITMAP_GET(edges_visited, endx))
+               if (BLI_BITMAP_GET(edges_visited, endx))
                        continue;
                BLI_BITMAP_SET(edges_visited, endx);
 
                v = (e->v1 == parent_v ? e->v2 : e->v1);
 
                bone = MEM_callocN(sizeof(EditBone),
-                                                  "skin_armature_bone_create EditBone");
+                                  "skin_armature_bone_create EditBone");
 
                bone->parent = parent_bone;
                bone->layer = 1;
@@ -1589,23 +1590,23 @@ static void skin_armature_bone_create(Object *skin_ob,
                BLI_addtail(arm->edbo, bone);
 
                /* add bDeformGroup */
-               if((dg = ED_vgroup_add_name(skin_ob, bone->name))) {
+               if ((dg = ED_vgroup_add_name(skin_ob, bone->name))) {
                        ED_vgroup_vert_add(skin_ob, dg, parent_v, 1, WEIGHT_REPLACE);
                        ED_vgroup_vert_add(skin_ob, dg, v, 1, WEIGHT_REPLACE);
                }
                
                skin_armature_bone_create(skin_ob,
-                                                                 mvert, medge,
-                                                                 arm,
-                                                                 edges_visited,
-                                                                 emap,
-                                                                 bone,
-                                                                 v);
+                                         mvert, medge,
+                                         arm,
+                                         edges_visited,
+                                         emap,
+                                         bone,
+                                         v);
        }
 }
 
 static Object *modifier_skin_armature_create(struct Scene *scene,
-                                                                                        Object *skin_ob)
+                                             Object *skin_ob)
 {
        BLI_bitmap edges_visited;
        DerivedMesh *deform_dm;
@@ -1623,10 +1624,10 @@ static Object *modifier_skin_armature_create(struct Scene *scene,
 
        /* add vertex weights to original mesh */
        CustomData_add_layer(&me->vdata,
-                                                CD_MDEFORMVERT,
-                                                CD_CALLOC,
-                                                NULL,
-                                                me->totvert);
+                            CD_MDEFORMVERT,
+                            CD_CALLOC,
+                            NULL,
+                            me->totvert);
        
        arm_ob = BKE_object_add(scene, OB_ARMATURE);
        BKE_object_transform_copy(arm_ob, skin_ob);
@@ -1638,19 +1639,19 @@ static Object *modifier_skin_armature_create(struct Scene *scene,
 
        mvert_skin = CustomData_get_layer(&me->vdata, CD_MVERT_SKIN);
        create_vert_edge_map(&emap, &emap_mem,
-                                                me->medge, me->totvert, me->totedge);
+                            me->medge, me->totvert, me->totedge);
 
        edges_visited = BLI_BITMAP_NEW(me->totedge, "edge_visited");
 
        /* note: we use EditBones here, easier to set them up and use
-        * edit-armature functions to convert back to regular bones */
-       for(v = 0; v < me->totvert; v++) {
-               if(mvert_skin[v].flag & MVERT_SKIN_ROOT) {
+       * edit-armature functions to convert back to regular bones */
+       for (v = 0; v < me->totvert; v++) {
+               if (mvert_skin[v].flag & MVERT_SKIN_ROOT) {
                        EditBone *bone = NULL;
 
                        /* Unless the skin root has just one adjacent edge, create
-                          a fake root bone (have it going off in the Y direction
-                          (arbitrary) */
+                        * a fake root bone (have it going off in the Y direction
+                        * (arbitrary) */
                        if (emap[v].count > 1) {
                                bone = MEM_callocN(sizeof(EditBone), "EditBone");
 
@@ -1664,14 +1665,14 @@ static Object *modifier_skin_armature_create(struct Scene *scene,
                                BLI_addtail(arm->edbo, bone);
                        }
                        
-                       if(emap[v].count >= 1) {
+                       if (emap[v].count >= 1) {
                                skin_armature_bone_create(skin_ob,
-                                                                                 mvert, me->medge,
-                                                                                 arm,
-                                                                                 edges_visited,
-                                                                                 emap,
-                                                                                 bone,
-                                                                                 v);
+                                                         mvert, me->medge,
+                                                         arm,
+                                                         edges_visited,
+                                                         emap,
+                                                         bone,
+                                                         v);
                        }
                }
        }
@@ -1698,7 +1699,7 @@ static int skin_armature_create_exec(bContext *C, wmOperator *op)
        arm_ob = modifier_skin_armature_create(scene, ob);
 
        /* add a modifier to connect the new armature to the mesh */
-       arm_md= (ArmatureModifierData*)modifier_new(eModifierType_Armature);
+       arm_md = (ArmatureModifierData *)modifier_new(eModifierType_Armature);
        if (arm_md) {
                skin_md = edit_modifier_property_get(op, ob, eModifierType_Skin);
                BLI_insertlinkafter(&ob->modifiers, skin_md, arm_md);
@@ -1709,7 +1710,7 @@ static int skin_armature_create_exec(bContext *C, wmOperator *op)
                DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+       WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1733,7 +1734,7 @@ void OBJECT_OT_skin_armature_create(wmOperatorType *ot)
        ot->exec = skin_armature_create_exec;
        
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
        edit_modifier_properties(ot);
 }
 
@@ -1926,7 +1927,7 @@ static void oceanbake_free(void *customdata)
 /* called by oceanbake, only to check job 'stop' value */
 static int oceanbake_breakjob(void *UNUSED(customdata))
 {
-       //OceanBakeJob *ob= (OceanBakeJob *)customdata;
+       //OceanBakeJob *ob = (OceanBakeJob *)customdata;
        //return *(ob->stop);
        
        /* this is not nice yet, need to make the jobs list template better 
index 000f43b0dec00b4f0b49c789514a1a1a1eaa12b2..919d2173bd2a37ad9057bd6991feffd78c560e2b 100644 (file)
@@ -106,13 +106,13 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
                } BLI_pbvh_vertex_iter_end;
                
                BLI_pbvh_node_mark_update(nodes[i]);
-               if(BLI_pbvh_type(pbvh) == PBVH_GRIDS)
+               if (BLI_pbvh_type(pbvh) == PBVH_GRIDS)
                        multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
        }
        
        sculpt_undo_push_end();
 
-       if(nodes)
+       if (nodes)
                MEM_freeN(nodes);
 
        ED_region_tag_redraw(ar);
index ac3cc15fe888c85bb51ce879f4d8c751e001df41..6d2381e64d594bba26b269b6f84b7509d30c4cdb 100644 (file)
@@ -440,7 +440,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
                }
                
                /* Finally get user favorite places */
-               if(read_bookmarks) {
+               if (read_bookmarks) {
                        list = LSSharedFileListCreate(NULL, kLSSharedFileListFavoriteItems, NULL);
                        pathesArray = LSSharedFileListCopySnapshot(list, &seed);
                        pathesCount = CFArrayGetCount(pathesArray);
index c20ae7348289573dec2d37a973d1140e5de55275..9d2ce657bde14e5fb19d106f5ff6528c0e41a39a 100644 (file)
@@ -600,17 +600,17 @@ static SkinNode *build_frames(const MVert *mvert, int totvert,
 
 static void calc_edge_mat(float mat[3][3], const float a[3], const float b[3])
 {
-       float Z[3] = {0, 0, 1};
+       const float z_up[3] = {0, 0, 1};
        float dot;
 
        /* X = edge direction */
        sub_v3_v3v3(mat[0], b, a);
        normalize_v3(mat[0]);
 
-       dot = dot_v3v3(mat[0], Z);
+       dot = dot_v3v3(mat[0], z_up);
        if (dot > -1 + FLT_EPSILON && dot < 1 - FLT_EPSILON) {
                /* Y = Z cross x */
-               cross_v3_v3v3(mat[1], Z, mat[0]);
+               cross_v3_v3v3(mat[1], z_up, mat[0]);
                normalize_v3(mat[1]);
 
                /* Z = x cross y */