diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-05 06:30:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-05 06:30:30 +0400 |
commit | d0412a1981266064aab38ca47f5d72ef9192e783 (patch) | |
tree | 754a541f99f511cb65c66256b7a8dca7d2673279 /source/blender | |
parent | 936af71e9755d1f1aab05576dabb7eea73a962c2 (diff) | |
parent | 4acab3eb33db20eef89d0159199429c690b0f2df (diff) |
svn merge ^/trunk/blender -r43864:43887
Diffstat (limited to 'source/blender')
27 files changed, 148 insertions, 77 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index a045f47cb40..8752defcc15 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -197,6 +197,7 @@ void BLF_dir_free(char **dirs, int count); #define BLF_KERNING_DEFAULT (1<<3) #define BLF_MATRIX (1<<4) #define BLF_ASPECT (1<<5) +#define BLF_TEXFILTER (1<<6) #define BLF_DRAW_STR_DUMMY_MAX 1024 diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index d9282978562..ebf9ff4db39 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -57,5 +57,7 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +add_definitions(-DGLEW_STATIC) + blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript index 1a86d0ad671..c46960d2311 100644 --- a/source/blender/blenfont/SConscript +++ b/source/blender/blenfont/SConscript @@ -9,7 +9,7 @@ incs += ' #/extern/glew/include' incs += ' ' + env['BF_FREETYPE_INC'] incs += ' ' + env['BF_GETTEXT_INC'] -defs = [] +defs = ['GLEW_STATIC'] if sys.platform == 'win32' or env['OURPLATFORM'] == 'linuxcross': defs.append('_WIN32') diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index f0cfcdc97b9..ab7ef8072a9 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -54,6 +54,8 @@ #include "blf_internal_types.h" #include "blf_internal.h" +#define _BLF_PADDING 3 +#define _BLF_MIPMAP_LEVELS 3 GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi) { @@ -87,7 +89,11 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font) gc->cur_tex= -1; gc->x_offs= 0; gc->y_offs= 0; - gc->pad= 3; + /* Increase padding for each mipmap level: 0->3, 1->4, 2->6, 3->10, ... */ + if (font->flags & BLF_TEXFILTER) + gc->pad= pow(2, _BLF_MIPMAP_LEVELS) + 2; + else + gc->pad= _BLF_PADDING; gc->num_glyphs= font->face->num_glyphs; gc->rem_glyphs= font->face->num_glyphs; @@ -296,13 +302,17 @@ void blf_glyph_free(GlyphBLF *g) static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, float y2) { - + /* When a string is being rendered as individual glyphs (as in the game + * engine), the leading edge needs to be raised a fraction to prevent + * z-fighting for kerned characters. - z0r */ + const float twist = (dx1 - dx) * 0.0002f; + glBegin(GL_QUADS); glTexCoord2f(uv[0][0], uv[0][1]); - glVertex2f(dx, y1); + glVertex3f(dx, y1, twist); glTexCoord2f(uv[0][0], uv[1][1]); - glVertex2f(dx, y2); + glVertex3f(dx, y2, twist); glTexCoord2f(uv[1][0], uv[1][1]); glVertex2f(dx1, y2); @@ -405,6 +415,15 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y) glBindTexture(GL_TEXTURE_2D, g->tex); glTexSubImage2D(GL_TEXTURE_2D, 0, g->xoff, g->yoff, g->width, g->height, GL_ALPHA, GL_UNSIGNED_BYTE, g->bitmap); + if (font->flags & BLF_TEXFILTER) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, + _BLF_MIPMAP_LEVELS); + glGenerateMipmap(GL_TEXTURE_2D); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + } glPopClientAttrib(); g->uv[0][0]= ((float)g->xoff) / ((float)gc->p2_width); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index ca0898a7085..e2d12c04bf2 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -1152,7 +1152,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) spring->kl = MAX2(mface[i].v4, mface[i].v2); spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest); spring->type = CLOTH_SPRING_TYPE_SHEAR; - spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0f; BLI_linklist_append ( &edgelist[spring->ij], spring ); BLI_linklist_append ( &edgelist[spring->kl], spring ); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 4c2c05e473f..4f3fc40616b 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -496,7 +496,7 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat copy_v3_v3(plane, tmat[1]); cross_v3_v3v3(mat[0], normal, plane); - if(len_v3(mat[0]) < 1e-3) { + if(len_v3(mat[0]) < 1e-3f) { copy_v3_v3(plane, tmat[0]); cross_v3_v3v3(mat[0], normal, plane); } @@ -1265,7 +1265,7 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr /* If the curve is cyclic, enable looping around if the time is * outside the bounds 0..1 */ if ((curvetime < 0.0f) || (curvetime > 1.0f)) { - curvetime -= floor(curvetime); + curvetime -= floorf(curvetime); } } else { diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 318165af804..5feeb4c300d 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1987,7 +1987,7 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim for (a=0; prevbezt && bezt && (a < fcu->totvert-1); a++, prevbezt=bezt, bezt++) { /* use if the key is directly on the frame, rare cases this is needed else we get 0.0 instead. */ - if(fabs(bezt->vec[1][0] - evaltime) < SMALL_NUMBER) { + if(fabsf(bezt->vec[1][0] - evaltime) < SMALL_NUMBER) { cvalue= bezt->vec[1][1]; } /* evaltime occurs within the interval defined by these two keyframes */ diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index a8f89b0a1eb..9edcc7a73e8 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -1583,7 +1583,7 @@ typedef struct WipeZone { static void precalc_wipe_zone(WipeZone *wipezone, WipeVars *wipe, int xo, int yo) { wipezone->flip = (wipe->angle < 0); - wipezone->angle = tan(DEG2RAD(fabsf(wipe->angle))); + wipezone->angle = tanf(DEG2RADF(fabsf(wipe->angle))); wipezone->xo = xo; wipezone->yo = yo; wipezone->width = (int)(wipe->edgeWidth*((xo+yo)/2.0f)); @@ -1602,9 +1602,9 @@ static float in_band(float width,float dist,int side,int dir) return (float)side; if(side == 1) - alpha = (dist+0.5*width) / (width); + alpha = (dist+0.5f*width) / (width); else - alpha = (0.5*width-dist) / (width); + alpha = (0.5f*width-dist) / (width); if(dir == 0) alpha = 1-alpha; diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index ca2aeca8f36..b9772b1f3b4 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -561,7 +561,7 @@ void BLI_init_srgb_conversion(void) for (i = 0; i < 0x10000; i++) { float f = linearrgb_to_srgb(index_to_float(i))*255.0f; if (f <= 0) BLI_color_to_srgb_table[i] = 0; - else if (f < 255) BLI_color_to_srgb_table[i] = (unsigned short)(f*0x100+.5); + else if (f < 255) BLI_color_to_srgb_table[i] = (unsigned short)(f*0x100+0.5f); else BLI_color_to_srgb_table[i] = 0xff00; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index b2a75b508a0..2f7a59fa575 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5388,6 +5388,30 @@ static void *restore_pointer_by_name(Main *mainp, ID *id, int user) return NULL; } +static int lib_link_seq_clipboard_cb(Sequence *seq, void *arg_pt) +{ + Main *newmain = (Main *)arg_pt; + + if(seq->sound) { + seq->sound = restore_pointer_by_name(newmain, (ID *)seq->sound, 0); + seq->sound->id.us++; + } + + if(seq->scene) + seq->scene = restore_pointer_by_name(newmain, (ID *)seq->scene, 1); + + if(seq->scene_camera) + seq->scene_camera = restore_pointer_by_name(newmain, (ID *)seq->scene_camera, 1); + + return 1; +} + +static void lib_link_clipboard_restore(Main *newmain) +{ + /* update IDs stored in sequencer clipboard */ + seqbase_recursive_apply(&seqbase_clipboard, lib_link_seq_clipboard_cb, newmain); +} + /* called from kernel/blender.c */ /* used to link a file (without UI) to the current UI */ /* note that it assumes the old pointers in UI are still valid, so old Main is not freed */ @@ -5595,6 +5619,9 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) sa= sa->next; } } + + /* update IDs stored in all possible clipboards */ + lib_link_clipboard_restore(newmain); } static void direct_link_region(FileData *fd, ARegion *ar, int spacetype) diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index fdccf5d4baa..3f851938a83 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -148,7 +148,7 @@ static void animchan_sync_group (bAnimContext *UNUSED(ac), bAnimListElem *ale) /* if one matches, sync the selection status */ if (pchan) { - if (pchan->bone->flag & BONE_SELECTED) + if (pchan->bone && pchan->bone->flag & BONE_SELECTED) agrp->flag |= AGRP_SELECTED; else agrp->flag &= ~AGRP_SELECTED; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 9b7c49023c5..93cb0f8ae97 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1533,8 +1533,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc zoomx= (float)width / (scopes->track_preview->x-2*margin); zoomy= (float)height / (scopes->track_preview->y-2*margin); - off_x= ((int)track_pos[0]-track_pos[0]+0.5)*zoomx; - off_y= ((int)track_pos[1]-track_pos[1]+0.5)*zoomy; + off_x= ((int)track_pos[0]-track_pos[0]+0.5f)*zoomx; + off_y= ((int)track_pos[1]-track_pos[1]+0.5f)*zoomy; drawibuf= scale_trackpreview_ibuf(scopes->track_preview, track_pos, width, height, margin); diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index dbc153de108..c528d8cd078 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -109,7 +109,7 @@ static float get_fluid_viscosity(FluidsimSettings *settings) return 2.0e-3; case 1: /* manual */ default: - return (1.0/pow(10.0, settings->viscosityExponent)) * settings->viscosityValue; + return (1.0f/powf(10.0f, settings->viscosityExponent)) * settings->viscosityValue; } } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 1e989cce14a..681ab3a1492 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -476,7 +476,6 @@ static void image_undo_restore(bContext *C, ListBase *lb) } ibuf= BKE_image_get_ibuf(ima, NULL); - use_float = ibuf->rect_float ? 1 : 0; if(ima && ibuf && strcmp(tile->ibufname, ibuf->name)!=0) { /* current ImBuf filename was changed, probably current frame @@ -493,6 +492,8 @@ static void image_undo_restore(bContext *C, ListBase *lb) if (ima->gen_type != tile->gen_type || ima->source != tile->source) continue; + use_float = ibuf->rect_float ? 1 : 0; + if (use_float != tile->use_float) continue; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 308534ab35c..65c38540df3 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3153,7 +3153,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, dx = cache->mouse[0] - cache->initial_mouse[0]; dy = cache->mouse[1] - cache->initial_mouse[1]; - cache->vertex_rotation = -atan2(dx, dy) * cache->bstrength; + cache->vertex_rotation = -atan2f(dx, dy) * cache->bstrength; sd->draw_anchored = 1; copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse); diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index 6a56de26689..f902422ab43 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -450,7 +450,7 @@ void CLIP_OT_graph_view_all(wmOperatorType *ot) void ED_clip_graph_center_current_frame(Scene *scene, ARegion *ar) { View2D *v2d = &ar->v2d; - float extra = (v2d->cur.xmax - v2d->cur.xmin) / 2.0; + float extra = (v2d->cur.xmax - v2d->cur.xmin) / 2.0f; /* set extents of view to start/end frames */ v2d->cur.xmin = (float)CFRA - extra; diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 2bb40ce51f4..c13a5202c19 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -170,7 +170,7 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) for (x = 0; x < ibuf->x; x++) { unsigned char * rgb = src + 4 * (ibuf->x * y + x); - float v = (float)rgb_to_luma_byte(rgb) / 255.0; + float v = (float)rgb_to_luma_byte(rgb) / 255.0f; unsigned char * p = tgt; p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index debc17137f4..f20532c80bd 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -5458,9 +5458,9 @@ static void headerTimeTranslate(TransInfo *t, char *str) /* apply snapping + frame->seconds conversions */ if (autosnap == SACTSNAP_STEP) { if (doTime) - val= floor((double)val/secf + 0.5f); + val= floorf((double)val/secf + 0.5f); else - val= floor(val + 0.5f); + val= floorf(val + 0.5f); } else { if (doTime) diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index cc486b75245..a6672130dc3 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -126,12 +126,6 @@ void GPU_extensions_init(void) if(strstr(vendor, "ATI")) { GG.device = GPU_DEVICE_ATI; GG.driver = GPU_DRIVER_OFFICIAL; - - /* ATI X1xxx cards (R500 chipset) lack full support for npot textures - * although they report the GLEW_ARB_texture_non_power_of_two extension. - */ - if(strstr(renderer, "X1")) - GG.npotdisabled = 1; } else if(strstr(vendor, "NVIDIA")) { GG.device = GPU_DEVICE_NVIDIA; @@ -147,17 +141,6 @@ void GPU_extensions_init(void) else if(strstr(renderer, "Mesa DRI R") || (strstr(renderer, "Gallium ") && strstr(renderer, " on ATI "))) { GG.device = GPU_DEVICE_ATI; GG.driver = GPU_DRIVER_OPENSOURCE; - /* ATI 9500 to X2300 cards support NPoT textures poorly - * Incomplete list http://dri.freedesktop.org/wiki/ATIRadeon - * New IDs from MESA's src/gallium/drivers/r300/r300_screen.c - */ - if(strstr(renderer, "R3") || strstr(renderer, "RV3") || - strstr(renderer, "R4") || strstr(renderer, "RV4") || - strstr(renderer, "RS4") || strstr(renderer, "RC4") || - strstr(renderer, "R5") || strstr(renderer, "RV5") || - strstr(renderer, "RS600") || strstr(renderer, "RS690") || - strstr(renderer, "RS740")) - GG.npotdisabled = 1; } else if(strstr(renderer, "Nouveau") || strstr(vendor, "nouveau")) { GG.device = GPU_DEVICE_NVIDIA; @@ -180,6 +163,21 @@ void GPU_extensions_init(void) GG.driver = GPU_DRIVER_ANY; } + if(GG.device == GPU_DEVICE_ATI) { + /* ATI 9500 to X2300 cards support NPoT textures poorly + * Incomplete list http://dri.freedesktop.org/wiki/ATIRadeon + * New IDs from MESA's src/gallium/drivers/r300/r300_screen.c + */ + if(strstr(renderer, "R3") || strstr(renderer, "RV3") || + strstr(renderer, "R4") || strstr(renderer, "RV4") || + strstr(renderer, "RS4") || strstr(renderer, "RC4") || + strstr(renderer, "R5") || strstr(renderer, "RV5") || + strstr(renderer, "RS600") || strstr(renderer, "RS690") || + strstr(renderer, "RS740") || strstr(renderer, "X1") || + strstr(renderer, "X2")) + GG.npotdisabled = 1; + } + GG.os = GPU_OS_UNIX; #ifdef _WIN32 GG.os = GPU_OS_WIN; @@ -202,11 +200,6 @@ int GPU_glsl_support(void) int GPU_non_power_of_two_support(void) { - /* Exception for buggy ATI/Apple driver in Mac OS X 10.5/10.6, - * they claim to support this but can cause system freeze */ - if(GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_MAC, GPU_DRIVER_OFFICIAL)) - return 0; - if(GG.npotdisabled) return 0; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 8d2dc32e47c..84d1b3c92ad 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -298,7 +298,7 @@ static void meshdeformModifier_do( fac= 1.0f - fac; } - if (fac <= 0.0) { + if (fac <= 0.0f) { continue; } } diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 43b8dc21300..ebc9a61f604 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -35,18 +35,20 @@ #include "py_capi_utils.h" -#include "BLI_string_utf8.h" /* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */ +/* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */ +#include "BLI_string_utf8.h" #ifdef _WIN32 /* BLI_setenv */ #include "BLI_path_util.h" #endif /* array utility function */ -int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix) +int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length, + const PyTypeObject *type, const short is_double, const char *error_prefix) { PyObject *value_fast; - int value_len; - int i; + Py_ssize_t value_len; + Py_ssize_t i; if (!(value_fast=PySequence_Fast(value, error_prefix))) { return -1; @@ -463,7 +465,8 @@ void PyC_SetHomePath(const char *py_path_bundle) if (py_path_bundle==NULL) { /* Common enough to have bundled *nix python but complain on OSX/Win */ #if defined(__APPLE__) || defined(_WIN32) - fprintf(stderr, "Warning! bundled python not found and is expected on this platform. (if you built with CMake: 'install' target may have not been built)\n"); + fprintf(stderr, "Warning! bundled python not found and is expected on this platform. " + "(if you built with CMake: 'install' target may have not been built)\n"); #endif return; } @@ -492,7 +495,8 @@ void PyC_SetHomePath(const char *py_path_bundle) /* cant use this, on linux gives bug: #23018, TODO: try LANG="en_US.UTF-8" /usr/bin/blender, suggested 22008 */ /* mbstowcs(py_path_bundle_wchar, py_path_bundle, FILE_MAXDIR); */ - BLI_strncpy_wchar_from_utf8(py_path_bundle_wchar, py_path_bundle, sizeof(py_path_bundle_wchar) / sizeof(wchar_t)); + BLI_strncpy_wchar_from_utf8(py_path_bundle_wchar, py_path_bundle, + sizeof(py_path_bundle_wchar) / sizeof(wchar_t)); Py_SetPythonHome(py_path_bundle_wchar); // printf("found python (wchar_t) '%ls'\n", py_path_bundle_wchar); diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index 17d83ca6567..2cab464a9d7 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -35,7 +35,8 @@ PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...); PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...); void PyC_FileAndNum(const char **filename, int *lineno); void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */ -int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix); +int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length, + const PyTypeObject *type, const short is_double, const char *error_prefix); /* follow http://www.python.org/dev/peps/pep-0383/ */ PyObject * PyC_UnicodeFromByte(const char *str); diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index 7860762059c..39780e7e257 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -112,7 +112,9 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args) return NULL; if (WM_operatortype_find(opname, TRUE) == NULL) { - PyErr_Format(PyExc_ValueError, "Macro Define: '%s' is not a valid operator id", opname); + PyErr_Format(PyExc_ValueError, + "Macro Define: '%s' is not a valid operator id", + opname); return NULL; } @@ -123,7 +125,9 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args) ot = WM_operatortype_find(macroname, TRUE); if (!ot) { - PyErr_Format(PyExc_ValueError, "Macro Define: '%s' is not a valid macro or hasn't been registered yet", macroname); + PyErr_Format(PyExc_ValueError, + "Macro Define: '%s' is not a valid macro or hasn't been registered yet", + macroname); return NULL; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 11e79fdee2a..fa2a20a10e6 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2571,7 +2571,8 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject return NULL; } else if (key_slice->start == Py_None && key_slice->stop == Py_None) { - /* note, no significant advantage with optimizing [:] slice as with collections but include here for consistency with collection slice func */ + /* note, no significant advantage with optimizing [:] slice as with collections + * but include here for consistency with collection slice func */ Py_ssize_t len = (Py_ssize_t)pyrna_prop_array_length(self); return pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len); } @@ -2834,7 +2835,8 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *key) const char *keyname = _PyUnicode_AsString(key); if (keyname == NULL) { - PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.__contains__: expected a string or a typle of strings"); + PyErr_SetString(PyExc_TypeError, + "bpy_prop_collection.__contains__: expected a string or a typle of strings"); return -1; } @@ -5102,7 +5104,14 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject #ifdef DEBUG_STRING_FREE - // if (PyList_GET_SIZE(string_free_ls)) printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_GET_SIZE(string_free_ls)); + /* + if (PyList_GET_SIZE(string_free_ls)) { + printf("%.200s.%.200s(): has %d strings\n", + RNA_struct_identifier(self_ptr->type), + RNA_function_identifier(self_func), + (int)PyList_GET_SIZE(string_free_ls)); + } + */ Py_DECREF(string_free_ls); #undef DEBUG_STRING_FREE #endif @@ -5126,7 +5135,10 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject PyTypeObject pyrna_struct_meta_idprop_Type = { PyVarObject_HEAD_INIT(NULL, 0) "bpy_struct_meta_idprop", /* tp_name */ - sizeof(PyHeapTypeObject), /* tp_basicsize */ // XXX, would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's + + /* NOTE! would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's */ + sizeof(PyHeapTypeObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ NULL, /* tp_dealloc */ @@ -5380,16 +5392,16 @@ PyTypeObject pyrna_prop_Type = { PyTypeObject pyrna_prop_array_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "bpy_prop_array", /* tp_name */ + "bpy_prop_array", /* tp_name */ sizeof(BPy_PropertyArrayRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* tp_itemsize */ /* methods */ (destructor)pyrna_prop_array_dealloc, /* tp_dealloc */ NULL, /* printfunc tp_print; */ NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ - NULL,/* subclassed */ /* tp_repr */ + NULL,/* subclassed */ /* tp_repr */ /* Method suites for standard classes */ diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index 782e0b59388..669355c9977 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -1408,7 +1408,7 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f occlusion= (1.0f-correction)*(1.0f-occ); CLAMP(occlusion, 0.0f, 1.0f); if(correction != 0.0f) - occlusion += correction*exp(-occ); + occlusion += correction*expf(-occ); if(env) { /* sky shading using bent normal */ diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 0d5aed7dadb..807a3d7d0eb 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -245,7 +245,7 @@ int testclip(const float v[4]) /* if we set clip flags, the clipping should be at least larger than epsilon. prevents issues with vertices lying exact on borders */ - abs4= fabs(v[3]) + FLT_EPSILON; + abs4= fabsf(v[3]) + FLT_EPSILON; if( v[0] < -abs4) c+=1; else if( v[0] > abs4) c+=2; diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 621e5449223..f7da70b6c77 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -457,9 +457,10 @@ void WM_event_print(wmEvent *event) #endif /* NDEBUG */ -static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int popup) +/* (caller_owns_reports == TRUE) when called from python */ +static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int caller_owns_reports) { - if(popup) { + if (caller_owns_reports == FALSE) { /* popup */ if(op->reports->list.first) { /* FIXME, temp setting window, see other call to uiPupMenuReports for why */ wmWindow *win_prev= CTX_wm_window(C); @@ -478,10 +479,15 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int pop } if(retval & OPERATOR_FINISHED) { - if(G.f & G_DEBUG) - wm_operator_print(C, op); /* todo - this print may double up, might want to check more flags then the FINISHED */ - - BKE_reports_print(op->reports, RPT_DEBUG); /* print out reports to console. */ + if(G.f & G_DEBUG) { + /* todo - this print may double up, might want to check more flags then the FINISHED */ + wm_operator_print(C, op); + } + + if (caller_owns_reports == FALSE) { + BKE_reports_print(op->reports, RPT_DEBUG); /* print out reports to console. */ + } + if (op->type->flag & OPTYPE_REGISTER) { if(G.background == 0) { /* ends up printing these in the terminal, gets annoying */ /* Report the python string representation of the operator */ @@ -492,7 +498,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int pop } } - /* if the caller owns them them handle this */ + /* if the caller owns them, handle this */ if (op->reports->list.first && (op->reports->flag & RPT_OP_HOLD) == 0) { wmWindowManager *wm = CTX_wm_manager(C); @@ -574,7 +580,7 @@ static int wm_operator_exec(bContext *C, wmOperator *op, int repeat) } if (retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED) && repeat == 0) - wm_operator_reports(C, op, retval, 0); + wm_operator_reports(C, op, retval, FALSE); if(retval & OPERATOR_FINISHED) wm_operator_finished(C, op, repeat); @@ -817,10 +823,11 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P /* Note, if the report is given as an argument then assume the caller will deal with displaying them * currently python only uses this */ - if (!(retval & OPERATOR_HANDLED) && retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED)) + if (!(retval & OPERATOR_HANDLED) && (retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED))) { /* only show the report if the report list was not given in the function */ - wm_operator_reports(C, op, retval, (reports==NULL)); - + wm_operator_reports(C, op, retval, (reports != NULL)); + } + if(retval & OPERATOR_HANDLED) ; /* do nothing, wm_operator_exec() has been called somewhere */ else if(retval & OPERATOR_FINISHED) { @@ -829,7 +836,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P else if(retval & OPERATOR_RUNNING_MODAL) { /* grab cursor during blocking modal ops (X11) * Also check for macro - * */ + */ if(ot->flag & OPTYPE_BLOCKING || (op->opm && op->opm->type->flag & OPTYPE_BLOCKING)) { int bounds[4] = {-1,-1,-1,-1}; int wrap; @@ -1335,7 +1342,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand } if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) - wm_operator_reports(C, op, retval, 0); + wm_operator_reports(C, op, retval, FALSE); if(retval & OPERATOR_FINISHED) { wm_operator_finished(C, op, 0); |