picky style edits with screen/view/drawing, also remove own bad example doc.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 25 Aug 2011 15:49:52 +0000 (15:49 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 25 Aug 2011 15:49:52 +0000 (15:49 +0000)
doc/python_api/examples/bpy.types.BlendDataLibraries.load.py
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_view.c

index 42e2a71..5e7022c 100644 (file)
@@ -23,11 +23,6 @@ with bpy.data.libraries.load(filepath) as (data_from, data_to):
         setattr(data_to, attr, getattr(data_from, attr))
 
 
-# the 'data_to' variables lists are
-with bpy.data.libraries.load(filepath) as (data_from, data_to):
-    data_to.scenes = ["Scene"]
-
-
 # the loaded objects can be accessed from 'data_to' outside of the context
 # since loading the data replaces the strings for the datablocks or None
 # if the datablock could not be loaded.
index dd7d2ca..76ed989 100644 (file)
@@ -530,14 +530,11 @@ static void ui_draw_but_CHARTAB(uiBut *but)
        int charmax = G.charmax;
        
        /* FO_BUILTIN_NAME font in use. There are TTF FO_BUILTIN_NAME and non-TTF FO_BUILTIN_NAME fonts */
-       if(!strcmp(G.selfont->name, FO_BUILTIN_NAME))
-       {
-               if(G.ui_international == TRUE)
-               {
+       if(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
+               if(G.ui_international == TRUE) {
                        charmax = 0xff;
                }
-               else
-               {
+               else {
                        charmax = 0xff;
                }
        }
@@ -562,16 +559,13 @@ static void ui_draw_but_CHARTAB(uiBut *but)
        cs = G.charstart;
 
        /* Set the font, in case it is not FO_BUILTIN_NAME font */
-       if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME))
-       {
+       if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
                // Is the font file packed, if so then use the packed file
-               if(G.selfont->packedfile)
-               {
+               if(G.selfont->packedfile) {
                        pf = G.selfont->packedfile;             
                        FTF_SetFont(pf->data, pf->size, 14.0);
                }
-               else
-               {
+               else {
                        char tmpStr[256];
                        int err;
 
@@ -580,10 +574,8 @@ static void ui_draw_but_CHARTAB(uiBut *but)
                        err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
                }
        }
-       else
-       {
-               if(G.ui_international == TRUE)
-               {
+       else {
+               if(G.ui_international == TRUE) {
                        FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0);
                }
        }
@@ -595,8 +587,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
        glRectf((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax));
 
        glColor3ub(0,  0,  0);
-       for(y = 0; y < 6; y++)
-       {
+       for(y = 0; y < 6; y++) {
                // Do not draw more than the category allows
                if(cs > charmax) break;
 
@@ -676,23 +667,19 @@ static void ui_draw_but_CHARTAB(uiBut *but)
        glShadeModel(GL_FLAT);
 
        /* Return Font Settings to original */
-       if(U.fontsize && U.fontname[0])
-       {
+       if(U.fontsize && U.fontname[0]) {
                result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize);
        }
-       else if (U.fontsize)
-       {
+       else if (U.fontsize) {
                result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
        }
 
-       if (result == 0)
-       {
+       if (result == 0) {
                result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11);
        }
        
        /* resets the font size */
-       if(G.ui_international == TRUE)
-       {
+       if(G.ui_international == TRUE) {
                // uiSetCurFont(but->block, UI_HELV);
        }
 }
@@ -1604,7 +1591,6 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select))
 #endif
        {
                a= i*aspect;
-
        }
 
        for(; i--; a-=aspect) {
index 3bd29f8..d7eba8c 100644 (file)
@@ -800,8 +800,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
        if(!act_iter) return;
 
        /* (3) add a new controller */
-       if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED)
-       {
+       if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED) {
                cont = (bController *)ob->controllers.last;
 
                /* (4) link the sensor->controller->actuator */
index 412c023..c3a0f43 100644 (file)
@@ -1103,8 +1103,7 @@ int ui_id_icon_get(bContext *C, ID *id, int big)
        int iconid= 0;
        
        /* icon */
-       switch(GS(id->name))
-       {
+       switch(GS(id->name)) {
                case ID_BR:
                        iconid= ui_id_brush_get_icon(C, id);
                        break;
index 80a65d3..5e875e4 100644 (file)
@@ -533,8 +533,7 @@ int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2)
        dir = area_getorientation(sa1, sa2);
        /*printf("dir is : %i \n", dir);*/
        
-       if (dir < 0)
-       {
+       if (dir < 0) {
                if (sa1 ) sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
                if (sa2 ) sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
                return 0;
index 1410331..0ac3085 100644 (file)
@@ -1544,8 +1544,7 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
        
        /* subtractwidth of regions on opposite side 
         * prevents dragging regions into other opposite regions */
-       for (ar=sa->regionbase.first; ar; ar=ar->next)
-       {
+       for (ar=sa->regionbase.first; ar; ar=ar->next) {
                if (ar == scalear)
                        continue;
                
@@ -2021,12 +2020,12 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
  */
 
 typedef struct sAreaJoinData
-       {
-               ScrArea *sa1;   /* first area to be considered */
-               ScrArea *sa2;   /* second area to be considered */
-               ScrArea *scr;   /* designed for removal */
-               
-       } sAreaJoinData;
+{
+       ScrArea *sa1;   /* first area to be considered */
+       ScrArea *sa2;   /* second area to be considered */
+       ScrArea *scr;   /* designed for removal */
+
+} sAreaJoinData;
 
 
 /* validate selection inside screen, set variables OK */
index 3133ad1..638d197 100644 (file)
@@ -2843,18 +2843,17 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
        Object *ob= base->object;
        Object *obedit= scene->obedit;
        Mesh *me= ob->data;
-       Material *ma=NULL;
        EditMesh *em= me->edit_mesh;
        int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha, i;
 
-       /* If we are drawing shadows and any of the materials don't cast a shadow, then don't draw the object */
-       if (v3d->flag2 & V3D_RENDER_SHADOW)
-       {
-               for(i=0; i<ob->totcol; ++i)
-               {
-                       ma = give_current_material(ob, i);
-                       if (ma && !(ma->mode & MA_SHADBUF))
+       /* If we are drawing shadows and any of the materials don't cast a shadow,
+        * then don't draw the object */
+       if (v3d->flag2 & V3D_RENDER_SHADOW) {
+               for(i=0; i<ob->totcol; ++i) {
+                       Material *ma= give_current_material(ob, i);
+                       if (ma && !(ma->mode & MA_SHADBUF)) {
                                return 1;
+                       }
                }
        }
        
@@ -6125,8 +6124,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
        }
 
        /* draw code for smoke */
-       if((md = modifiers_findByType(ob, eModifierType_Smoke)))
-       {
+       if((md = modifiers_findByType(ob, eModifierType_Smoke))) {
                SmokeModifierData *smd = (SmokeModifierData *)md;
 
                // draw collision objects
@@ -6518,7 +6516,6 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
 
        switch( ob->type) {
        case OB_MESH:
-       {
                if(ob->mode & OB_MODE_EDIT) {
                        Mesh *me= ob->data;
                        EditMesh *em= me->edit_mesh;
@@ -6552,8 +6549,9 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
 
                        EM_free_index_arrays();
                }
-               else bbs_mesh_solid(scene, ob);
-       }
+               else {
+                       bbs_mesh_solid(scene, ob);
+               }
                break;
        case OB_CURVE:
        case OB_SURF:
index 9249d4d..80da75b 100644 (file)
@@ -1141,12 +1141,10 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
        glRectf(x1i, y1i, x2i, y2i);
 
 #ifdef VIEW3D_CAMERA_BORDER_HACK
-       {
-               if(view3d_camera_border_hack_test == TRUE) {
-                       glColor4fv(view3d_camera_border_hack_col);
-                       glRectf(x1i+1, y1i+1, x2i-1, y2i-1);
-                       view3d_camera_border_hack_test= FALSE;
-               }
+       if(view3d_camera_border_hack_test == TRUE) {
+               glColor4fv(view3d_camera_border_hack_col);
+               glRectf(x1i+1, y1i+1, x2i-1, y2i-1);
+               view3d_camera_border_hack_test= FALSE;
        }
 #endif
 
index 979a602..0e8dd38 100644 (file)
@@ -372,12 +372,12 @@ static void calctrackballvec(rcti *rect, int mx, int my, float *vec)
        y/= (float)((rect->ymax - rect->ymin)/2);
 
        d = sqrt(x*x + y*y);
-       if (d < radius * (float)M_SQRT1_2)      /* Inside sphere */
-               z = sqrt(radius*radius - d*d);
-       else
-       {                       /* On hyperbola */
-               t = radius / (float)M_SQRT2;
-               z = t*t / d;
+       if (d < radius * (float)M_SQRT1_2) { /* Inside sphere */
+               z= sqrt(radius*radius - d*d);
+       }
+       else { /* On hyperbola */
+               t= radius / (float)M_SQRT2;
+               z= t*t / d;
        }
 
        vec[0]= x;
@@ -1620,8 +1620,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
        vod= op->customdata;
 
        /* if one or the other zoom position aren't set, set from event */
-       if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my"))
-       {
+       if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) {
                RNA_int_set(op->ptr, "mx", event->x);
                RNA_int_set(op->ptr, "my", event->y);
        }
@@ -1834,8 +1833,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event)
        vod= op->customdata;
 
        /* if one or the other zoom position aren't set, set from event */
-       if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my"))
-       {
+       if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) {
                RNA_int_set(op->ptr, "mx", event->x);
                RNA_int_set(op->ptr, "my", event->y);
        }
index ed0b264..c484591 100644 (file)
@@ -840,8 +840,7 @@ void project_int_noclip(ARegion *ar, const float vec[3], int adr[2])
                adr[0] = (int)floor(fx); 
                adr[1] = (int)floor(fy);
        }
-       else
-       {
+       else {
                adr[0] = ar->winx / 2;
                adr[1] = ar->winy / 2;
        }
@@ -904,8 +903,7 @@ void project_float_noclip(ARegion *ar, const float vec[3], float adr[2])
                adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];
                adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
        }
-       else
-       {
+       else {
                adr[0] = ar->winx / 2.0f;
                adr[1] = ar->winy / 2.0f;
        }