style cleanup

This commit is contained in:
Campbell Barton 2013-04-08 04:39:09 +00:00
parent 45669ebbc6
commit fcf137dbd7
12 changed files with 46 additions and 44 deletions

@ -472,9 +472,11 @@ void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int of
return NULL; return NULL;
} }
/**
* Finds the first element of listbase which contains the specified pointer value
* at the specified offset, returning NULL if not found.
*/
void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset) void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
/* finds the first element of listbase which contains the specified pointer value
at the specified offset, returning NULL if not found. */
{ {
Link *link = NULL; Link *link = NULL;
const void *ptr_iter; const void *ptr_iter;
@ -493,9 +495,11 @@ at the specified offset, returning NULL if not found. */
return NULL; return NULL;
} }
/* same as above but find reverse */ /* same as above but find reverse */
/**
* Finds the last element of listbase which contains the specified pointer value
* at the specified offset, returning NULL if not found.
*/
void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset) void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
/* finds the last element of listbase which contains the specified pointer value
at the specified offset, returning NULL if not found. */
{ {
Link *link = NULL; Link *link = NULL;
const void *ptr_iter; const void *ptr_iter;
@ -514,9 +518,11 @@ at the specified offset, returning NULL if not found. */
return NULL; return NULL;
} }
/**
* Returns the 1-based index of the first element of listbase which contains the specified
* null-terminated string at the specified offset, or -1 if not found.
*/
int BLI_findstringindex(const ListBase *listbase, const char *id, const int offset) int BLI_findstringindex(const ListBase *listbase, const char *id, const int offset)
/* returns the 1-based index of the first element of listbase which contains the specified
null-terminated string at the specified offset, or -1 if not found. */
{ {
Link *link = NULL; Link *link = NULL;
const char *id_iter; const char *id_iter;

@ -6764,7 +6764,7 @@ static void lib_link_linestyle(FileData *fd, Main *main)
break; break;
} }
} }
for (m = linestyle->alpha_modifiers.first; m; m = m->next){ for (m = linestyle->alpha_modifiers.first; m; m = m->next) {
switch (m->type) { switch (m->type) {
case LS_MODIFIER_DISTANCE_FROM_OBJECT: case LS_MODIFIER_DISTANCE_FROM_OBJECT:
{ {
@ -6774,7 +6774,7 @@ static void lib_link_linestyle(FileData *fd, Main *main)
break; break;
} }
} }
for (m = linestyle->thickness_modifiers.first; m; m = m->next){ for (m = linestyle->thickness_modifiers.first; m; m = m->next) {
switch (m->type) { switch (m->type) {
case LS_MODIFIER_DISTANCE_FROM_OBJECT: case LS_MODIFIER_DISTANCE_FROM_OBJECT:
{ {
@ -10461,11 +10461,11 @@ static void expand_linestyle(FileData *fd, Main *mainvar, FreestyleLineStyle *li
if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT)
expand_doit(fd, mainvar, ((LineStyleColorModifier_DistanceFromObject *)m)->target); expand_doit(fd, mainvar, ((LineStyleColorModifier_DistanceFromObject *)m)->target);
} }
for (m = linestyle->alpha_modifiers.first; m; m = m->next){ for (m = linestyle->alpha_modifiers.first; m; m = m->next) {
if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT)
expand_doit(fd, mainvar, ((LineStyleAlphaModifier_DistanceFromObject *)m)->target); expand_doit(fd, mainvar, ((LineStyleAlphaModifier_DistanceFromObject *)m)->target);
} }
for (m = linestyle->thickness_modifiers.first; m; m = m->next){ for (m = linestyle->thickness_modifiers.first; m; m = m->next) {
if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT)
expand_doit(fd, mainvar, ((LineStyleThicknessModifier_DistanceFromObject *)m)->target); expand_doit(fd, mainvar, ((LineStyleThicknessModifier_DistanceFromObject *)m)->target);
} }

@ -2326,10 +2326,10 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
for (srl = sce->r.layers.first; srl; srl = srl->next) { for (srl = sce->r.layers.first; srl; srl = srl->next) {
writestruct(wd, DATA, "SceneRenderLayer", 1, srl); writestruct(wd, DATA, "SceneRenderLayer", 1, srl);
for(fmc = srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) { for (fmc = srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) {
writestruct(wd, DATA, "FreestyleModuleConfig", 1, fmc); writestruct(wd, DATA, "FreestyleModuleConfig", 1, fmc);
} }
for(fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) { for (fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) {
writestruct(wd, DATA, "FreestyleLineSet", 1, fls); writestruct(wd, DATA, "FreestyleLineSet", 1, fls);
} }
} }

@ -125,10 +125,10 @@ void ZCombineMaskOperation::executePixel(float output[4], float x, float y, Pixe
float fac = mask[0]; float fac = mask[0];
// multiply mask with alpha, if mask == 0 color1, else color2 make sure // multiply mask with alpha, if mask == 0 color1, else color2 make sure
float mfac = 1.0f-fac; float mfac = 1.0f - fac;
output[0] = color1[0]*mfac + color2[0]*fac; output[0] = color1[0] * mfac + color2[0] * fac;
output[1] = color1[1]*mfac + color2[1]*fac; output[1] = color1[1] * mfac + color2[1] * fac;
output[2] = color1[2]*mfac + color2[2]*fac; output[2] = color1[2] * mfac + color2[2] * fac;
output[3] = max(color1[3], color2[3]); output[3] = max(color1[3], color2[3]);
} }
@ -144,13 +144,13 @@ void ZCombineMaskAlphaOperation::executePixel(float output[4], float x, float y,
float fac = mask[0]; float fac = mask[0];
// multiply mask with alpha, if mask == 0 color1, else color2 make sure // multiply mask with alpha, if mask == 0 color1, else color2 make sure
float mfac = 1.0f-fac; float mfac = 1.0f - fac;
float alpha = color1[3]*mfac + color2[3]*fac; float alpha = color1[3] * mfac + color2[3] * fac;
float facalpha = fac * alpha; float facalpha = fac * alpha;
mfac = 1.0f-facalpha; mfac = 1.0f - facalpha;
output[0] = color1[0]*mfac + color2[0]*facalpha; output[0] = color1[0] * mfac + color2[0] * facalpha;
output[1] = color1[1]*mfac + color2[1]*facalpha; output[1] = color1[1] * mfac + color2[1] * facalpha;
output[2] = color1[2]*mfac + color2[2]*facalpha; output[2] = color1[2] * mfac + color2[2] * facalpha;
output[3] = max(color1[3], color2[3]); output[3] = max(color1[3], color2[3]);
} }

@ -547,7 +547,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
} }
/* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack. /* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack.
Only for images, sound and fonts */ * Only for images, sound and fonts */
if (id && BKE_pack_check(id)) { if (id && BKE_pack_check(id)) {
but = uiDefIconButO(block, BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0, but = uiDefIconButO(block, BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0,
UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack")); UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack"));

@ -640,13 +640,13 @@ static int stencil_fit_image_aspect_exec(bContext *C, wmOperator *UNUSED(op))
float orig_area, stencil_area, factor; float orig_area, stencil_area, factor;
ED_image_get_uv_aspect(ima, NULL, &aspx, &aspy); ED_image_get_uv_aspect(ima, NULL, &aspx, &aspy);
orig_area = aspx*aspy; orig_area = aspx * aspy;
stencil_area = br->stencil_dimension[0]*br->stencil_dimension[1]; stencil_area = br->stencil_dimension[0] * br->stencil_dimension[1];
factor = sqrt(stencil_area / orig_area); factor = sqrt(stencil_area / orig_area);
br->stencil_dimension[0] = factor*aspx; br->stencil_dimension[0] = factor * aspx;
br->stencil_dimension[1] = factor*aspy; br->stencil_dimension[1] = factor * aspy;
} }
return OPERATOR_FINISHED; return OPERATOR_FINISHED;

@ -381,11 +381,11 @@ static void sculpt_orig_vert_data_update(SculptOrigVertData *orig_data,
/**********************************************************************/ /**********************************************************************/
/* Returns true if the stroke will use dynamic topology, false /* Returns true if the stroke will use dynamic topology, false
otherwise. * otherwise.
*
Factors: some brushes like grab cannot do dynamic topology. * Factors: some brushes like grab cannot do dynamic topology.
Others, like smooth, are better without. Same goes for alt- * Others, like smooth, are better without. Same goes for alt-
key smoothing. */ * key smoothing. */
static int sculpt_stroke_dynamic_topology(const SculptSession *ss, static int sculpt_stroke_dynamic_topology(const SculptSession *ss,
const Brush *brush) const Brush *brush)
{ {

@ -962,10 +962,6 @@ void recalcData(TransInfo *t)
else if (t->spacetype == SPACE_CLIP) { else if (t->spacetype == SPACE_CLIP) {
recalcData_spaceclip(t); recalcData_spaceclip(t);
} }
if (t->options & CTX_MASK) {
}
} }
void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis, short options) void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis, short options)

@ -98,7 +98,7 @@ void AppCanvas::init()
static bool firsttime = true; static bool firsttime = true;
if (firsttime) { if (firsttime) {
_Renderer = new BlenderStrokeRenderer; _Renderer = new BlenderStrokeRenderer;
if(!StrokeRenderer::loadTextures()) { if (!StrokeRenderer::loadTextures()) {
cerr << "unable to load stroke textures" << endl; cerr << "unable to load stroke textures" << endl;
return; return;
} }

@ -650,7 +650,7 @@ void Controller::ComputeSteerableViewMap()
// FIXME !! again! // FIXME !! again!
img[i] = new GrayImage(_pView->width(), _pView->height()); img[i] = new GrayImage(_pView->width(), _pView->height());
for (unsigned int y = 0; y < img[i]->height(); ++y) { for (unsigned int y = 0; y < img[i]->height(); ++y) {
for(unsigned int x = 0; x < img[i]->width(); ++x) { for (unsigned int x = 0; x < img[i]->width(); ++x) {
//img[i]->setPixel(x, y, (float)qGray(qimg.pixel(x, y)) / 255.0f); //img[i]->setPixel(x, y, (float)qGray(qimg.pixel(x, y)) / 255.0f);
img[i]->setPixel(x, y, (float)qGray(qimg.pixel(x, y))); img[i]->setPixel(x, y, (float)qGray(qimg.pixel(x, y)));
//float c = qGray(qimg.pixel(x, y)); //float c = qGray(qimg.pixel(x, y));
@ -664,7 +664,7 @@ void Controller::ComputeSteerableViewMap()
#if 0 #if 0
qimg = QImage(_pView->width(), _pView->height(), 32); qimg = QImage(_pView->width(), _pView->height(), 32);
for (unsigned int y = 0; y < img[i]->height(); ++y) { for (unsigned int y = 0; y < img[i]->height(); ++y) {
for(unsigned int x = 0; x < img[i]->width(); ++x) { for (unsigned int x = 0; x < img[i]->width(); ++x) {
float v = img[i]->pixel(x, y); float v = img[i]->pixel(x, y);
qimg.setPixel(x, y, qRgb(v, v, v)); qimg.setPixel(x, y, qRgb(v, v, v));
} }

@ -1089,8 +1089,8 @@ static void do_render_3d(Render *re)
#ifdef WITH_FREESTYLE #ifdef WITH_FREESTYLE
/* Freestyle */ /* Freestyle */
if( re->r.mode & R_EDGE_FRS) if (re->r.mode & R_EDGE_FRS)
if(!re->test_break(re->tbh)) if (!re->test_break(re->tbh))
add_freestyle(re); add_freestyle(re);
#endif #endif
@ -2361,10 +2361,10 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene) void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene)
{ {
re->result_ok= 0; re->result_ok= 0;
if(render_initialize_from_main(re, bmain, scene, NULL, NULL, scene->lay, 0, 0)) { if (render_initialize_from_main(re, bmain, scene, NULL, NULL, scene->lay, 0, 0)) {
do_render_fields_blur_3d(re); do_render_fields_blur_3d(re);
} }
re->result_ok= 1; re->result_ok = 1;
} }
#endif #endif

@ -308,7 +308,7 @@ void BL_MakeScreenShot(bScreen *screen, ScrArea *curarea, const char *filename)
Scene *scene = (screen)? screen->scene: NULL; Scene *scene = (screen)? screen->scene: NULL;
ImageFormatData im_format; ImageFormatData im_format;
if(scene) if (scene)
im_format = scene->r.im_format; im_format = scene->r.im_format;
else else
BKE_imformat_defaults(&im_format); BKE_imformat_defaults(&im_format);