picky style edits with screen/view/drawing, also remove own bad example doc.

This commit is contained in:
Campbell Barton
2011-08-25 15:49:52 +00:00
parent b44a82f3c4
commit b7eac1edcf
10 changed files with 48 additions and 79 deletions

View File

@@ -23,11 +23,6 @@ with bpy.data.libraries.load(filepath) as (data_from, data_to):
setattr(data_to, attr, getattr(data_from, attr)) 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 # 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 # since loading the data replaces the strings for the datablocks or None
# if the datablock could not be loaded. # if the datablock could not be loaded.

View File

@@ -530,14 +530,11 @@ static void ui_draw_but_CHARTAB(uiBut *but)
int charmax = G.charmax; int charmax = G.charmax;
/* FO_BUILTIN_NAME font in use. There are TTF FO_BUILTIN_NAME and non-TTF FO_BUILTIN_NAME fonts */ /* 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(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
{ if(G.ui_international == TRUE) {
if(G.ui_international == TRUE)
{
charmax = 0xff; charmax = 0xff;
} }
else else {
{
charmax = 0xff; charmax = 0xff;
} }
} }
@@ -562,16 +559,13 @@ static void ui_draw_but_CHARTAB(uiBut *but)
cs = G.charstart; cs = G.charstart;
/* Set the font, in case it is not FO_BUILTIN_NAME font */ /* 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 // Is the font file packed, if so then use the packed file
if(G.selfont->packedfile) if(G.selfont->packedfile) {
{
pf = G.selfont->packedfile; pf = G.selfont->packedfile;
FTF_SetFont(pf->data, pf->size, 14.0); FTF_SetFont(pf->data, pf->size, 14.0);
} }
else else {
{
char tmpStr[256]; char tmpStr[256];
int err; int err;
@@ -580,10 +574,8 @@ static void ui_draw_but_CHARTAB(uiBut *but)
err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0); err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
} }
} }
else else {
{ if(G.ui_international == TRUE) {
if(G.ui_international == TRUE)
{
FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0); 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)); glRectf((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax));
glColor3ub(0, 0, 0); glColor3ub(0, 0, 0);
for(y = 0; y < 6; y++) for(y = 0; y < 6; y++) {
{
// Do not draw more than the category allows // Do not draw more than the category allows
if(cs > charmax) break; if(cs > charmax) break;
@@ -676,23 +667,19 @@ static void ui_draw_but_CHARTAB(uiBut *but)
glShadeModel(GL_FLAT); glShadeModel(GL_FLAT);
/* Return Font Settings to original */ /* 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); 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); 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); result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11);
} }
/* resets the font size */ /* resets the font size */
if(G.ui_international == TRUE) if(G.ui_international == TRUE) {
{
// uiSetCurFont(but->block, UI_HELV); // uiSetCurFont(but->block, UI_HELV);
} }
} }
@@ -1604,7 +1591,6 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select))
#endif #endif
{ {
a= i*aspect; a= i*aspect;
} }
for(; i--; a-=aspect) { for(; i--; a-=aspect) {

View File

@@ -800,8 +800,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
if(!act_iter) return; if(!act_iter) return;
/* (3) add a new controller */ /* (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; cont = (bController *)ob->controllers.last;
/* (4) link the sensor->controller->actuator */ /* (4) link the sensor->controller->actuator */

View File

@@ -1103,8 +1103,7 @@ int ui_id_icon_get(bContext *C, ID *id, int big)
int iconid= 0; int iconid= 0;
/* icon */ /* icon */
switch(GS(id->name)) switch(GS(id->name)) {
{
case ID_BR: case ID_BR:
iconid= ui_id_brush_get_icon(C, id); iconid= ui_id_brush_get_icon(C, id);
break; break;

View File

@@ -533,8 +533,7 @@ int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2)
dir = area_getorientation(sa1, sa2); dir = area_getorientation(sa1, sa2);
/*printf("dir is : %i \n", dir);*/ /*printf("dir is : %i \n", dir);*/
if (dir < 0) if (dir < 0) {
{
if (sa1 ) sa1->flag &= ~AREA_FLAG_DRAWJOINFROM; if (sa1 ) sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
if (sa2 ) sa2->flag &= ~AREA_FLAG_DRAWJOINTO; if (sa2 ) sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
return 0; return 0;

View File

@@ -1544,8 +1544,7 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
/* subtractwidth of regions on opposite side /* subtractwidth of regions on opposite side
* prevents dragging regions into other opposite regions */ * 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) if (ar == scalear)
continue; continue;
@@ -2021,12 +2020,12 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
*/ */
typedef struct sAreaJoinData typedef struct sAreaJoinData
{ {
ScrArea *sa1; /* first area to be considered */ ScrArea *sa1; /* first area to be considered */
ScrArea *sa2; /* second area to be considered */ ScrArea *sa2; /* second area to be considered */
ScrArea *scr; /* designed for removal */ ScrArea *scr; /* designed for removal */
} sAreaJoinData; } sAreaJoinData;
/* validate selection inside screen, set variables OK */ /* validate selection inside screen, set variables OK */

View File

@@ -2843,18 +2843,17 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
Object *ob= base->object; Object *ob= base->object;
Object *obedit= scene->obedit; Object *obedit= scene->obedit;
Mesh *me= ob->data; Mesh *me= ob->data;
Material *ma=NULL;
EditMesh *em= me->edit_mesh; EditMesh *em= me->edit_mesh;
int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha, i; 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 we are drawing shadows and any of the materials don't cast a shadow,
if (v3d->flag2 & V3D_RENDER_SHADOW) * then don't draw the object */
{ if (v3d->flag2 & V3D_RENDER_SHADOW) {
for(i=0; i<ob->totcol; ++i) for(i=0; i<ob->totcol; ++i) {
{ Material *ma= give_current_material(ob, i);
ma = give_current_material(ob, i); if (ma && !(ma->mode & MA_SHADBUF)) {
if (ma && !(ma->mode & MA_SHADBUF))
return 1; return 1;
}
} }
} }
@@ -6125,8 +6124,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
} }
/* draw code for smoke */ /* draw code for smoke */
if((md = modifiers_findByType(ob, eModifierType_Smoke))) if((md = modifiers_findByType(ob, eModifierType_Smoke))) {
{
SmokeModifierData *smd = (SmokeModifierData *)md; SmokeModifierData *smd = (SmokeModifierData *)md;
// draw collision objects // draw collision objects
@@ -6518,7 +6516,6 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
switch( ob->type) { switch( ob->type) {
case OB_MESH: case OB_MESH:
{
if(ob->mode & OB_MODE_EDIT) { if(ob->mode & OB_MODE_EDIT) {
Mesh *me= ob->data; Mesh *me= ob->data;
EditMesh *em= me->edit_mesh; EditMesh *em= me->edit_mesh;
@@ -6552,8 +6549,9 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
EM_free_index_arrays(); EM_free_index_arrays();
} }
else bbs_mesh_solid(scene, ob); else {
} bbs_mesh_solid(scene, ob);
}
break; break;
case OB_CURVE: case OB_CURVE:
case OB_SURF: case OB_SURF:

View File

@@ -1141,12 +1141,10 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
glRectf(x1i, y1i, x2i, y2i); glRectf(x1i, y1i, x2i, y2i);
#ifdef VIEW3D_CAMERA_BORDER_HACK #ifdef VIEW3D_CAMERA_BORDER_HACK
{ if(view3d_camera_border_hack_test == TRUE) {
if(view3d_camera_border_hack_test == TRUE) { glColor4fv(view3d_camera_border_hack_col);
glColor4fv(view3d_camera_border_hack_col); glRectf(x1i+1, y1i+1, x2i-1, y2i-1);
glRectf(x1i+1, y1i+1, x2i-1, y2i-1); view3d_camera_border_hack_test= FALSE;
view3d_camera_border_hack_test= FALSE;
}
} }
#endif #endif

View File

@@ -372,12 +372,12 @@ static void calctrackballvec(rcti *rect, int mx, int my, float *vec)
y/= (float)((rect->ymax - rect->ymin)/2); y/= (float)((rect->ymax - rect->ymin)/2);
d = sqrt(x*x + y*y); d = sqrt(x*x + y*y);
if (d < radius * (float)M_SQRT1_2) /* Inside sphere */ if (d < radius * (float)M_SQRT1_2) { /* Inside sphere */
z = sqrt(radius*radius - d*d); z= sqrt(radius*radius - d*d);
else }
{ /* On hyperbola */ else { /* On hyperbola */
t = radius / (float)M_SQRT2; t= radius / (float)M_SQRT2;
z = t*t / d; z= t*t / d;
} }
vec[0]= x; vec[0]= x;
@@ -1620,8 +1620,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
vod= op->customdata; vod= op->customdata;
/* if one or the other zoom position aren't set, set from event */ /* 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, "mx", event->x);
RNA_int_set(op->ptr, "my", event->y); 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; vod= op->customdata;
/* if one or the other zoom position aren't set, set from event */ /* 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, "mx", event->x);
RNA_int_set(op->ptr, "my", event->y); RNA_int_set(op->ptr, "my", event->y);
} }

View File

@@ -840,8 +840,7 @@ void project_int_noclip(ARegion *ar, const float vec[3], int adr[2])
adr[0] = (int)floor(fx); adr[0] = (int)floor(fx);
adr[1] = (int)floor(fy); adr[1] = (int)floor(fy);
} }
else else {
{
adr[0] = ar->winx / 2; adr[0] = ar->winx / 2;
adr[1] = ar->winy / 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[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]; adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
} }
else else {
{
adr[0] = ar->winx / 2.0f; adr[0] = ar->winx / 2.0f;
adr[1] = ar->winy / 2.0f; adr[1] = ar->winy / 2.0f;
} }