forked from bartvdbraak/blender
svn merge ^/trunk/blender -r43864:43887
This commit is contained in:
commit
d0412a1981
@ -39,6 +39,9 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
|
||||
else:
|
||||
cxxflags.append('-ffast-math'.split())
|
||||
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
|
||||
incs.append(env['BF_PTHREADS_INC'])
|
||||
|
||||
# optimized kernel
|
||||
if env['WITH_BF_RAYOPTIMIZATION']:
|
||||
optim_cxxflags = []
|
||||
|
@ -20,29 +20,54 @@
|
||||
#define __UTIL_THREAD_H__
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
#include <pthread.h>
|
||||
#include <queue>
|
||||
|
||||
#include "util_function.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#if 0
|
||||
/* use boost for mutexes */
|
||||
|
||||
/* Use STL for threading */
|
||||
|
||||
using std::thread;
|
||||
using std::thread_mutex;
|
||||
typedef std::lock_guard thread_scoped_lock;
|
||||
using std::condition_variable;
|
||||
|
||||
#else
|
||||
|
||||
/* Use boost for threading */
|
||||
|
||||
using boost::thread;
|
||||
typedef boost::mutex thread_mutex;
|
||||
typedef boost::mutex::scoped_lock thread_scoped_lock;
|
||||
typedef boost::condition_variable thread_condition_variable;
|
||||
|
||||
#endif
|
||||
/* own pthread based implementation, to avoid boost version conflicts with
|
||||
dynamically loaded blender plugins */
|
||||
|
||||
class thread {
|
||||
public:
|
||||
thread(boost::function<void(void)> run_cb_)
|
||||
{
|
||||
joined = false;
|
||||
run_cb = run_cb_;
|
||||
|
||||
pthread_create(&pthread_id, NULL, run, (void*)this);
|
||||
}
|
||||
|
||||
~thread()
|
||||
{
|
||||
if(!joined)
|
||||
join();
|
||||
}
|
||||
|
||||
static void *run(void *arg)
|
||||
{
|
||||
((thread*)arg)->run_cb();;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool join()
|
||||
{
|
||||
return pthread_join(pthread_id, NULL) == 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
boost::function<void(void)> run_cb;
|
||||
pthread_t pthread_id;
|
||||
bool joined;
|
||||
};
|
||||
|
||||
/* Thread Safe Queue to pass tasks from one thread to another. Tasks should be
|
||||
* pushed into the queue, while the worker thread waits to pop the next task
|
||||
|
@ -69,7 +69,7 @@ def CLIP_camera_for_clip(context, clip):
|
||||
if ob.type == 'CAMERA':
|
||||
for con in ob.constraints:
|
||||
if con.type == 'CAMERA_SOLVER':
|
||||
cur_clip = scene.clip if con.use_active_clip else con.clip
|
||||
cur_clip = scene.active_clip if con.use_active_clip else con.clip
|
||||
|
||||
if cur_clip == clip:
|
||||
return ob
|
||||
@ -834,6 +834,7 @@ class CLIP_OT_setup_tracking_scene(Operator):
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class CLIP_OT_track_settings_as_default(Operator):
|
||||
"""Copy tracking settings from active track to default settings"""
|
||||
|
||||
|
@ -493,7 +493,8 @@ class ShapeTransfer(Operator):
|
||||
|
||||
def execute(self, context):
|
||||
ob_act = context.active_object
|
||||
objects = [ob for ob in context.selected_editable_objects if ob != ob_act]
|
||||
objects = [ob for ob in context.selected_editable_objects
|
||||
if ob != ob_act]
|
||||
|
||||
if 1: # swap from/to, means we cant copy to many at once.
|
||||
if len(objects) != 1:
|
||||
|
@ -829,7 +829,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||
row.prop(md, "octree_depth")
|
||||
row.prop(md, "scale")
|
||||
|
||||
if md.mode == "SHARP":
|
||||
if md.mode == 'SHARP':
|
||||
layout.prop(md, "sharpness")
|
||||
|
||||
layout.prop(md, "remove_disconnected_pieces")
|
||||
|
@ -128,9 +128,12 @@ class CLIP_PT_tools_marker(Panel):
|
||||
col.separator()
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(settings, "use_default_red_channel", text="R", toggle=True)
|
||||
row.prop(settings, "use_default_green_channel", text="G", toggle=True)
|
||||
row.prop(settings, "use_default_blue_channel", text="B", toggle=True)
|
||||
row.prop(settings, "use_default_red_channel",
|
||||
text="R", toggle=True)
|
||||
row.prop(settings, "use_default_green_channel",
|
||||
text="G", toggle=True)
|
||||
row.prop(settings, "use_default_blue_channel",
|
||||
text="B", toggle=True)
|
||||
|
||||
col.separator()
|
||||
|
||||
@ -155,7 +158,8 @@ class CLIP_PT_tools_marker(Panel):
|
||||
col.prop(settings, "default_pattern_match", text="")
|
||||
|
||||
col.separator()
|
||||
col.operator('clip.track_settings_as_default', text="Copy From Active Track")
|
||||
col.operator('clip.track_settings_as_default',
|
||||
text="Copy From Active Track")
|
||||
|
||||
|
||||
class CLIP_PT_tools_tracking(Panel):
|
||||
|
@ -21,6 +21,7 @@ import bpy
|
||||
from bpy.types import Header, Menu, Panel
|
||||
from .properties_paint_common import UnifiedPaintPanel
|
||||
|
||||
|
||||
class ImagePaintPanel(UnifiedPaintPanel):
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
|
@ -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
|
||||
|
||||
|
@ -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}")
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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);
|
||||
|
@ -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 );
|
||||
|
@ -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 {
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -298,7 +298,7 @@ static void meshdeformModifier_do(
|
||||
fac= 1.0f - fac;
|
||||
}
|
||||
|
||||
if (fac <= 0.0) {
|
||||
if (fac <= 0.0f) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
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,9 +823,10 @@ 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 */
|
||||
@ -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);
|
||||
|
@ -136,8 +136,8 @@ void BL_print_game_line(int fontid, const char* text, int size, int dpi, float*
|
||||
/* the actual drawing */
|
||||
glColor4fv(color);
|
||||
|
||||
BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER);
|
||||
/* multiply the text matrix by the object matrix */
|
||||
BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT);
|
||||
BLF_matrix(fontid, mat);
|
||||
|
||||
/* aspect is the inverse scale that allows you to increase */
|
||||
@ -149,7 +149,7 @@ void BL_print_game_line(int fontid, const char* text, int size, int dpi, float*
|
||||
BLF_position(fontid, 0, 0, 0);
|
||||
BLF_draw(fontid, (char *)text, 65535);
|
||||
|
||||
BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT);
|
||||
BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER);
|
||||
}
|
||||
|
||||
void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int height)
|
||||
|
@ -294,8 +294,8 @@ void GPC_RenderTools::RenderText3D( int fontid,
|
||||
/* the actual drawing */
|
||||
glColor3fv(color);
|
||||
|
||||
BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER);
|
||||
/* multiply the text matrix by the object matrix */
|
||||
BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT);
|
||||
BLF_matrix(fontid, mat);
|
||||
|
||||
/* aspect is the inverse scale that allows you to increase */
|
||||
@ -307,7 +307,7 @@ void GPC_RenderTools::RenderText3D( int fontid,
|
||||
BLF_position(fontid, 0, 0, 0);
|
||||
BLF_draw(fontid, text, 65535);
|
||||
|
||||
BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT);
|
||||
BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@ http://www.gnu.org/copyleft/lesser.txt.
|
||||
|
||||
#include "GL/glew.h"
|
||||
|
||||
#include "KX_PythonInit.h"
|
||||
#include "Texture.h"
|
||||
#include "ImageBase.h"
|
||||
#include "FilterSource.h"
|
||||
@ -41,7 +42,13 @@ http://www.gnu.org/copyleft/lesser.txt.
|
||||
ImageViewport::ImageViewport (void) : m_alpha(false), m_texInit(false)
|
||||
{
|
||||
// get viewport rectangle
|
||||
glGetIntegerv(GL_VIEWPORT, m_viewport);
|
||||
RAS_Rect rect = KX_GetActiveEngine()->GetCanvas()->GetWindowArea();
|
||||
m_viewport[0] = rect.GetLeft();
|
||||
m_viewport[1] = rect.GetBottom();
|
||||
m_viewport[2] = rect.GetWidth();
|
||||
m_viewport[3] = rect.GetHeight();
|
||||
|
||||
//glGetIntegerv(GL_VIEWPORT, m_viewport);
|
||||
// create buffer for viewport image
|
||||
m_viewportImage = new BYTE [4 * getViewportSize()[0] * getViewportSize()[1]];
|
||||
// set attributes
|
||||
|
Loading…
Reference in New Issue
Block a user