whitespace only, no functional change mixed tabs/spaces --> tabs.

This commit is contained in:
Campbell Barton 2011-04-21 13:11:51 +00:00
parent 2e9982f420
commit 210ee1ade4
87 changed files with 602 additions and 604 deletions

@ -373,7 +373,7 @@ void *MEM_mapallocN(size_t len, const char *str)
fd = open("/dev/zero", O_RDWR);
memh= mmap(0, len+sizeof(MemHead)+sizeof(MemTail),
PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
close(fd);
}
#else
@ -698,26 +698,26 @@ static void remlink(volatile localListBase *listbase, void *vlink)
static void rem_memblock(MemHead *memh)
{
remlink(membase,&memh->next);
if (memh->prev) {
if (memh->next)
remlink(membase,&memh->next);
if (memh->prev) {
if (memh->next)
MEMNEXT(memh->prev)->nextname = MEMNEXT(memh->next)->name;
else
else
MEMNEXT(memh->prev)->nextname = NULL;
}
}
totblock--;
mem_in_use -= memh->len;
if(memh->mmap) {
mmap_in_use -= memh->len;
if (munmap(memh, memh->len + sizeof(MemHead) + sizeof(MemTail)))
printf("Couldn't unmap memory %s\n", memh->name);
}
totblock--;
mem_in_use -= memh->len;
if(memh->mmap) {
mmap_in_use -= memh->len;
if (munmap(memh, memh->len + sizeof(MemHead) + sizeof(MemTail)))
printf("Couldn't unmap memory %s\n", memh->name);
}
else {
if(malloc_debug_memset && memh->len)
memset(memh+1, 255, memh->len);
free(memh);
free(memh);
}
}

@ -114,7 +114,7 @@ void *mmap(void *UNUSED(start), size_t len, int prot, int flags, int fd, off_t o
/*
if ( fd == -1 ) {
_set_errno( EBADF );
return MAP_FAILED;
return MAP_FAILED;
}
*/
@ -128,16 +128,16 @@ void *mmap(void *UNUSED(start), size_t len, int prot, int flags, int fd, off_t o
}
} else {
if ( !DuplicateHandle( GetCurrentProcess(), fhandle, GetCurrentProcess(),
&fhandle, 0, FALSE, DUPLICATE_SAME_ACCESS ) ) {
&fhandle, 0, FALSE, DUPLICATE_SAME_ACCESS ) ) {
return MAP_FAILED;
}
}
maphandle = CreateFileMapping(fhandle, NULL, prot_flags, 0, len, NULL);
if ( maphandle == 0 ) {
errno = EBADF;
errno = EBADF;
return MAP_FAILED;
}
}
ptr = MapViewOfFile(maphandle, access_flags, 0, offset, 0);
if ( ptr == NULL ) {
@ -159,7 +159,7 @@ void *mmap(void *UNUSED(start), size_t len, int prot, int flags, int fd, off_t o
mm->mmap = ptr;
mmap_addtail(mmapbase, mm);
return ptr;
return ptr;
}
/* munmap for windows */
@ -168,14 +168,14 @@ intptr_t munmap(void *ptr, intptr_t UNUSED(size))
MemMap *mm = mmap_findlink(mmapbase, ptr);
if (!mm) {
errno=EINVAL;
return -1;
return -1;
}
UnmapViewOfFile( mm->mmap );
CloseHandle( mm->maphandle );
CloseHandle( mm->fhandle);
mmap_remlink(mmapbase, mm);
free(mm);
return 0;
return 0;
}
/* --------------------------------------------------------------------- */
@ -233,16 +233,16 @@ static int mmap_get_prot_flags (int flags)
int prot = PAGE_NOACCESS;
if ( ( flags & PROT_READ ) == PROT_READ ) {
if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
} else {
prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READ : PAGE_READONLY;
}
} else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
} else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READ : PAGE_WRITECOPY;
} else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) {
prot = PAGE_EXECUTE_READ;
}
} else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) {
prot = PAGE_EXECUTE_READ;
}
return prot;
}
@ -251,16 +251,16 @@ static int mmap_get_access_flags (int flags)
int access = 0;
if ( ( flags & PROT_READ ) == PROT_READ ) {
if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
access = FILE_MAP_WRITE;
if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
access = FILE_MAP_WRITE;
} else {
access = (flags & PROT_EXEC) ? FILE_MAP_EXECUTE : FILE_MAP_READ;
}
} else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
} else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
access = FILE_MAP_COPY;
} else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) {
access = FILE_MAP_EXECUTE;
}
} else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) {
access = FILE_MAP_EXECUTE;
}
return access;
}

@ -196,7 +196,7 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
src1f= ibuf1->rect_float;
for (y = 0; y < 256; y++) {
float v = 1.0 * y / 255;
float v = 1.0 * y / 255;
v += cast->setup_y;
v *= cast->gain_y;
v = pow(v, cast->gamma_y);

@ -129,7 +129,7 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
src1f= ibuf1->rect_float;
for (y = 0; y < 256; y++) {
float v = 1.0 * y / 255;
float v = 1.0 * y / 255;
v += cast->setup_y;
v *= cast->gain_y;
v = pow(v, cast->gamma_y);

@ -66,7 +66,7 @@ static void precalculate(unsigned char * table, int level)
}
*table++ = ap;
}
}
}
}

@ -193,9 +193,9 @@ static void fill_out(ImBuf *out, float r, float g, float b, float a)
} else {
for (x=0;x < tot;x++) {
rect[0] = (int)(r * 255);
rect[1] = (int)(g * 255);
rect[2] = (int)(b * 255);
rect[3] = (int)(a * 255);
rect[1] = (int)(g * 255);
rect[2] = (int)(b * 255);
rect[3] = (int)(a * 255);
rect += 4;
}
}

@ -114,17 +114,17 @@ __declspec(dllexport) HRESULT vfGetPluginInfo(
static unsigned long getipaddress(const char * ipaddr)
{
struct hostent *host;
unsigned long ip;
struct hostent *host;
unsigned long ip;
if (((ip = inet_addr(ipaddr)) == INADDR_NONE)
&& strcmp(ipaddr, "255.255.255.255") != 0) {
if ((host = gethostbyname(ipaddr)) != NULL) {
memcpy(&ip, host->h_addr, sizeof(ip));
}
}
if (((ip = inet_addr(ipaddr)) == INADDR_NONE)
&& strcmp(ipaddr, "255.255.255.255") != 0) {
if ((host = gethostbyname(ipaddr)) != NULL) {
memcpy(&ip, host->h_addr, sizeof(ip));
}
}
return (ip);
return (ip);
}
static void my_send(SOCKET sock, char * str)
@ -363,12 +363,12 @@ HRESULT __stdcall VF_ReadDataFunc_Blen(
} while (strcmp(buf, "P6\n") != 0);
do {
rval = my_gets(s_in, buf, 256);
} while ( (buf[0] == '#' || buf[0] == '\n') && rval >= 0);
rval = my_gets(s_in, buf, 256);
} while ( (buf[0] == '#' || buf[0] == '\n') && rval >= 0);
if (sscanf(buf, "%d %d\n", &width, &height) != 2) {
if (sscanf(buf, "%d %d\n", &width, &height) != 2) {
goto errout;
}
}
if (width != c->width || height != c->height) {
goto errout;

@ -402,7 +402,7 @@ int AVI_is_avi (const char *name) {
/* at least one video track is needed */
return (movie_tracks != 0);
}
AviError AVI_open_movie (const char *name, AviMovie *movie) {

@ -42,102 +42,102 @@
#include "rgb32.h"
void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, int *size) {
if (from == to)
return buffer;
if (from != AVI_FORMAT_RGB24 &&
to != AVI_FORMAT_RGB24)
return avi_format_convert(movie, stream,
avi_format_convert (movie, stream, buffer, from, AVI_FORMAT_RGB24, size),
AVI_FORMAT_RGB24, to, size);
switch (to) {
case AVI_FORMAT_RGB24:
switch (from) {
case AVI_FORMAT_AVI_RGB:
buffer = avi_converter_from_avi_rgb (movie, stream, buffer, size);
break;
case AVI_FORMAT_MJPEG:
buffer = avi_converter_from_mjpeg (movie, stream, buffer, size);
break;
case AVI_FORMAT_RGB32:
buffer = avi_converter_from_rgb32 (movie, stream, buffer, size);
break;
default:
break;
}
break;
case AVI_FORMAT_AVI_RGB:
buffer = avi_converter_to_avi_rgb (movie, stream, buffer, size);
break;
case AVI_FORMAT_MJPEG:
buffer = avi_converter_to_mjpeg (movie, stream, buffer, size);
break;
case AVI_FORMAT_RGB32:
buffer = avi_converter_to_rgb32 (movie, stream, buffer, size);
break;
default:
break;
}
if (from == to)
return buffer;
return buffer;
if (from != AVI_FORMAT_RGB24 &&
to != AVI_FORMAT_RGB24)
return avi_format_convert(movie, stream,
avi_format_convert (movie, stream, buffer, from, AVI_FORMAT_RGB24, size),
AVI_FORMAT_RGB24, to, size);
switch (to) {
case AVI_FORMAT_RGB24:
switch (from) {
case AVI_FORMAT_AVI_RGB:
buffer = avi_converter_from_avi_rgb (movie, stream, buffer, size);
break;
case AVI_FORMAT_MJPEG:
buffer = avi_converter_from_mjpeg (movie, stream, buffer, size);
break;
case AVI_FORMAT_RGB32:
buffer = avi_converter_from_rgb32 (movie, stream, buffer, size);
break;
default:
break;
}
break;
case AVI_FORMAT_AVI_RGB:
buffer = avi_converter_to_avi_rgb (movie, stream, buffer, size);
break;
case AVI_FORMAT_MJPEG:
buffer = avi_converter_to_mjpeg (movie, stream, buffer, size);
break;
case AVI_FORMAT_RGB32:
buffer = avi_converter_to_rgb32 (movie, stream, buffer, size);
break;
default:
break;
}
return buffer;
}
int avi_get_data_id (AviFormat format, int stream) {
char fcc[5];
char fcc[5];
if (avi_get_format_type (format) == FCC("vids"))
sprintf (fcc,"%2.2ddc",stream);
else if (avi_get_format_type (format) == FCC("auds"))
sprintf (fcc,"%2.2ddc",stream);
else
return 0;
if (avi_get_format_type (format) == FCC("vids"))
sprintf (fcc,"%2.2ddc",stream);
else if (avi_get_format_type (format) == FCC("auds"))
sprintf (fcc,"%2.2ddc",stream);
else
return 0;
return FCC(fcc);
return FCC(fcc);
}
int avi_get_format_type (AviFormat format) {
switch (format) {
case AVI_FORMAT_RGB24:
case AVI_FORMAT_RGB32:
case AVI_FORMAT_AVI_RGB:
case AVI_FORMAT_MJPEG:
return FCC("vids");
break;
default:
return 0;
break;
}
switch (format) {
case AVI_FORMAT_RGB24:
case AVI_FORMAT_RGB32:
case AVI_FORMAT_AVI_RGB:
case AVI_FORMAT_MJPEG:
return FCC("vids");
break;
default:
return 0;
break;
}
}
int avi_get_format_fcc (AviFormat format) {
switch (format) {
case AVI_FORMAT_RGB24:
case AVI_FORMAT_RGB32:
case AVI_FORMAT_AVI_RGB:
return FCC("DIB ");
break;
case AVI_FORMAT_MJPEG:
return FCC("MJPG");
break;
default:
return 0;
break;
}
switch (format) {
case AVI_FORMAT_RGB24:
case AVI_FORMAT_RGB32:
case AVI_FORMAT_AVI_RGB:
return FCC("DIB ");
break;
case AVI_FORMAT_MJPEG:
return FCC("MJPG");
break;
default:
return 0;
break;
}
}
int avi_get_format_compression (AviFormat format) {
switch (format) {
case AVI_FORMAT_RGB24:
case AVI_FORMAT_RGB32:
case AVI_FORMAT_AVI_RGB:
return 0;
break;
case AVI_FORMAT_MJPEG:
return FCC("MJPG");
break;
default:
return 0;
break;
}
switch (format) {
case AVI_FORMAT_RGB24:
case AVI_FORMAT_RGB32:
case AVI_FORMAT_AVI_RGB:
return 0;
break;
case AVI_FORMAT_MJPEG:
return FCC("MJPG");
break;
default:
return 0;
break;
}
}

@ -1119,12 +1119,12 @@ float brush_curve_strength_clamp(Brush *br, float p, const float len)
* used for sculpt only */
float brush_curve_strength(Brush *br, float p, const float len)
{
if(p >= len)
p= 1.0f;
else
p= p/len;
if(p >= len)
p= 1.0f;
else
p= p/len;
return curvemapping_evaluateF(br->curve, 0, p);
return curvemapping_evaluateF(br->curve, 0, p);
}
/* TODO: should probably be unified with BrushPainter stuff? */

@ -793,7 +793,7 @@ void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float *vecout, const
/* basic error handler, if we dont do this blender will exit */
static int ErrorReportingFunction(int ErrorCode, const char *ErrorText)
{
fprintf(stderr, "%s:%d\n", ErrorText, ErrorCode);
fprintf(stderr, "%s:%d\n", ErrorText, ErrorCode);
return 1;
}
#endif

@ -254,7 +254,6 @@ int defgroup_find_index (Object *ob, bDeformGroup *dg)
if (eg == NULL) return -1;
return def_nr;
}
/* note, must be freed */

@ -492,7 +492,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
}
}
/* softbody collision */
if ((ob->type==OB_MESH) || (ob->type==OB_CURVE) || (ob->type==OB_LATTICE)) {
if(modifiers_isSoftbodyEnabled(ob) || modifiers_isClothEnabled(ob) || ob->particlesystem.first)

@ -889,7 +889,7 @@ void write_dxf(struct Scene *scene, char *str)
write_group(0, "SECTION");
write_group(2, "BLOCKS");
/* only write meshes we're using in this scene */
flag_listbase_ids(&G.main->mesh, LIB_DOIT, 0);
@ -1608,7 +1608,7 @@ static void dxf_read_arc(Scene *scene, int noob)
dia = (float) atof(val);
} else if (id==62) {
int colorid= atoi(val);
CLAMP(colorid, 1, 255);
dxf_col_to_rgb(colorid, &color[0], &color[1], &color[2]);
} else if (id==67) {

@ -80,10 +80,10 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
int checkerwidth= 32, dark= 1;
int x, y;
unsigned char *rect_orig= rect;
float *rect_float_orig= rect_float;
float h=0.0, hoffs=0.0, hue=0.0, s=0.9, v=0.9, r, g, b;
@ -191,7 +191,7 @@ static void checker_board_color_fill(unsigned char *rect, float *rect_float, int
for(y= 0; y < height; y++)
{
val= 0.1 + (y * (0.4 / height)); /* use a number lower then 1.0 else its too bright */
for(x= 0; x < width; x++)
{
@ -316,17 +316,17 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
BLF_size(mono, 54, 72); /* hard coded size! */
BLF_buffer(mono, rect_float, rect, width, height, 4);
for(y= 0; y < height; y+=step)
{
text[1]= '1';
for(x= 0; x < width; x+=step)
{
/* hard coded offset */
pen_x = x + 33;
pen_y = y + 44;
/* terribly crappy outline font! */
BLF_buffer_col(mono, 1.0, 1.0, 1.0, 1.0);
@ -338,7 +338,7 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
BLF_draw_buffer(mono, text);
BLF_position(mono, pen_x, pen_y+outline, 0.0);
BLF_draw_buffer(mono, text);
BLF_position(mono, pen_x-outline, pen_y-outline, 0.0);
BLF_draw_buffer(mono, text);
BLF_position(mono, pen_x+outline, pen_y+outline, 0.0);
@ -351,12 +351,12 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
BLF_buffer_col(mono, 0.0, 0.0, 0.0, 1.0);
BLF_position(mono, pen_x, pen_y, 0.0);
BLF_draw_buffer(mono, text);
text[1]++;
}
text[0]++;
}
/* cleanup the buffer. */
BLF_buffer(mono, NULL, NULL, 0, 0, 0);
}

@ -1314,12 +1314,12 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
case MA_RAMP_SOFT:
if (g){
float scr, scg, scb;
/* first calculate non-fac based Screen mix */
scr = 1.0f - (1.0f - col[0]) * (1.0f - *r);
scg = 1.0f - (1.0f - col[1]) * (1.0f - *g);
scb = 1.0f - (1.0f - col[2]) * (1.0f - *b);
*r = facm*(*r) + fac*(((1.0f - *r) * col[0] * (*r)) + (*r * scr));
*g = facm*(*g) + fac*(((1.0f - *g) * col[1] * (*g)) + (*g * scg));
*b = facm*(*b) + fac*(((1.0f - *b) * col[2] * (*b)) + (*b * scb));

@ -1376,7 +1376,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
p->x = 0.5f*(pos.x + neg.x);
p->y = 0.5f*(pos.y + neg.y);
p->z = 0.5f*(pos.z + neg.z);
if (i++ == RES) return;
if ((function(p->x, p->y, p->z)) > 0.0f){
@ -1691,11 +1691,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
mul_m4_m4m4(temp2, bob->obmat, obinv);
/* MetaBall transformation */
mul_m4_m4m4(mat, temp1, temp2);
invert_m4_m4(imat,mat);
mainb[a]->rad2= ml->rad*ml->rad;
mainb[a]->mat= (float*) mat;
mainb[a]->imat= (float*) imat;

@ -1465,7 +1465,7 @@ void create_vert_edge_map(ListBase **map, IndexNode **mem, const MEdge *medge, c
(*map) = MEM_callocN(sizeof(ListBase) * totvert, "vert edge map");
(*mem) = MEM_callocN(sizeof(IndexNode) * totedge * 2, "vert edge map mem");
node = *mem;
/* Find the users */
for(i = 0; i < totedge; ++i){
for(j = 0; j < 2; ++j, ++node) {

@ -4424,22 +4424,22 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
xvec[0] = 1.0f; xvec[1] = 0.0f; xvec[2] = 0.0f;
yvec[0] = 0.0f; yvec[1] = 1.0f; yvec[2] = 0.0f;
/* can happen with bad pointcache or physics calculation
* since this becomes geometry, nan's and inf's crash raytrace code.
* better not allow this. */
if( !finite(bb->vec[0]) || !finite(bb->vec[1]) || !finite(bb->vec[2]) ||
!finite(bb->vel[0]) || !finite(bb->vel[1]) || !finite(bb->vel[2]) )
{
zero_v3(bb->vec);
zero_v3(bb->vel);
zero_v3(xvec);
zero_v3(yvec);
zero_v3(zvec);
zero_v3(center);
/* can happen with bad pointcache or physics calculation
* since this becomes geometry, nan's and inf's crash raytrace code.
* better not allow this. */
if( !finite(bb->vec[0]) || !finite(bb->vec[1]) || !finite(bb->vec[2]) ||
!finite(bb->vel[0]) || !finite(bb->vel[1]) || !finite(bb->vel[2]) )
{
zero_v3(bb->vec);
zero_v3(bb->vel);
return;
}
zero_v3(xvec);
zero_v3(yvec);
zero_v3(zvec);
zero_v3(center);
return;
}
if(bb->align < PART_BB_VIEW)
onevec[bb->align]=1.0f;

@ -644,7 +644,7 @@ static void hammersley_create(float *out, int n, int seed, float amount)
for (p = 0.5, kk = k; kk; p *= 0.5, kk >>= 1)
if (kk & 1) /* kk mod 2 = 1 */
t += p;
out[2*k + 0]= fmod((double)k/(double)n + offs[0], 1.0);
out[2*k + 1]= fmod(t + offs[1], 1.0);
}

@ -1308,8 +1308,8 @@ static void ptcache_data_copy(void *from[], void *to[])
{
int i;
for(i=0; i<BPHYS_TOT_DATA; i++) {
/* note, durian file 03.4b_comp crashes if to[i] is not tested
* its NULL, not sure if this should be fixed elsewhere but for now its needed */
/* note, durian file 03.4b_comp crashes if to[i] is not tested
* its NULL, not sure if this should be fixed elsewhere but for now its needed */
if(from[i] && to[i])
memcpy(to[i], from[i], ptcache_data_size[i]);
}

@ -101,7 +101,7 @@ void BKE_report(ReportList *reports, ReportType type, const char *message)
Report *report;
int len;
/* in background mode always print otherwise there are cases the errors wont be displayed,
/* in background mode always print otherwise there are cases the errors wont be displayed,
* but still add to the report list since this is used for python exception handling */
if(G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) {
printf("%s: %s\n", report_type_str(type), message);

@ -333,12 +333,12 @@ void free_actuator(bActuator *act)
if(act->data) {
switch (act->type) {
case ACT_SOUND:
sa = (bSoundActuator *) act->data;
if(sa->sound)
id_us_min((ID *) sa->sound);
break;
}
case ACT_SOUND:
sa = (bSoundActuator *) act->data;
if(sa->sound)
id_us_min((ID *) sa->sound);
break;
}
MEM_freeN(act->data);
}

@ -1080,23 +1080,23 @@ float get_render_aosss_error(RenderData *r, float error)
/* helper function for the SETLOOPER macro */
Base *_setlooper_base_step(Scene **sce_iter, Base *base)
{
if(base && base->next) {
/* common case, step to the next */
return base->next;
}
if(base && base->next) {
/* common case, step to the next */
return base->next;
}
else if(base==NULL && (*sce_iter)->base.first) {
/* first time looping, return the scenes first base */
/* first time looping, return the scenes first base */
return (Base *)(*sce_iter)->base.first;
}
else {
/* reached the end, get the next base in the set */
}
else {
/* reached the end, get the next base in the set */
while((*sce_iter= (*sce_iter)->set)) {
base= (Base *)(*sce_iter)->base.first;
if(base) {
return base;
}
}
}
if(base) {
return base;
}
}
}
return NULL;
return NULL;
}

@ -2696,7 +2696,7 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
int numFaces = ccgSubSurf_getVertNumFaces(v);
float *co;
int i;
edge_sum[0]= edge_sum[1]= edge_sum[2]= 0.0;
face_sum[0]= face_sum[1]= face_sum[2]= 0.0;

@ -463,14 +463,14 @@ int constrain_rgb(float *r, float *g, float *b)
float w;
/* Amount of white needed is w = - min(0, *r, *g, *b) */
w = (0 < *r) ? 0 : *r;
w = (w < *g) ? w : *g;
w = (w < *b) ? w : *b;
w = -w;
/* Add just enough white to make r, g, b all positive. */
if (w > 0) {
*r += w; *g += w; *b += w;
return 1; /* Color modified to fit RGB gamut */

@ -473,7 +473,7 @@ int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], c
cross_v3_v3v3(q, s, e1);
v = f * dot_v3v3(d, q);
v = f * dot_v3v3(d, q);
if ((v < 0.0f)||((u + v) > 1.0f)) return 0;
*lambda = f * dot_v3v3(e2, q);
@ -519,7 +519,7 @@ int isect_ray_tri_v3(const float p1[3], const float d[3], const float v0[3], con
*lambda = f * dot_v3v3(e2, q);
if ((*lambda < 0.0f)) return 0;
if(uv) {
if(uv) {
uv[0]= u;
uv[1]= v;
}
@ -529,36 +529,36 @@ int isect_ray_tri_v3(const float p1[3], const float d[3], const float v0[3], con
int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float epsilon)
{
float p[3], s[3], e1[3], e2[3], q[3];
float a, f, u, v;
float p[3], s[3], e1[3], e2[3], q[3];
float a, f, u, v;
sub_v3_v3v3(e1, v1, v0);
sub_v3_v3v3(e2, v2, v0);
sub_v3_v3v3(e1, v1, v0);
sub_v3_v3v3(e2, v2, v0);
cross_v3_v3v3(p, d, e2);
a = dot_v3v3(e1, p);
if (a == 0.0f) return 0;
f = 1.0f/a;
cross_v3_v3v3(p, d, e2);
a = dot_v3v3(e1, p);
if (a == 0.0f) return 0;
f = 1.0f/a;
sub_v3_v3v3(s, p1, v0);
sub_v3_v3v3(s, p1, v0);
u = f * dot_v3v3(s, p);
if ((u < -epsilon)||(u > 1.0f+epsilon)) return 0;
u = f * dot_v3v3(s, p);
if ((u < -epsilon)||(u > 1.0f+epsilon)) return 0;
cross_v3_v3v3(q, s, e1);
cross_v3_v3v3(q, s, e1);
v = f * dot_v3v3(d, q);
if ((v < -epsilon)||((u + v) > 1.0f+epsilon)) return 0;
v = f * dot_v3v3(d, q);
if ((v < -epsilon)||((u + v) > 1.0f+epsilon)) return 0;
*lambda = f * dot_v3v3(e2, q);
if ((*lambda < 0.0f)) return 0;
*lambda = f * dot_v3v3(e2, q);
if ((*lambda < 0.0f)) return 0;
if(uv) {
uv[0]= u;
uv[1]= v;
}
if(uv) {
uv[0]= u;
uv[1]= v;
}
return 1;
return 1;
}
int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float *uv, const float threshold)
@ -2604,7 +2604,7 @@ static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float
aresult = (_mm_set_ps1(n[0])*gx + _mm_set_ps1(n[1])*gy + _mm_set_ps1(n[2])*gz)*angle;
/* sum together */
result= (fresult[0] + fresult[1] + fresult[2] + fresult[3])*(0.5f/(float)M_PI);
result= (fresult[0] + fresult[1] + fresult[2] + fresult[3])*(0.5f/(float)M_PI);
result= MAX2(result, 0.0f);
return result;

@ -672,7 +672,7 @@ static PBVHNode *pbvh_iter_next(PBVHIter *iter)
parents, this order is necessary for e.g. computing bounding boxes */
while(iter->stacksize) {
/* pop node */
/* pop node */
iter->stacksize--;
node= iter->stack[iter->stacksize].node;
@ -709,30 +709,30 @@ static PBVHNode *pbvh_iter_next(PBVHIter *iter)
static PBVHNode *pbvh_iter_next_occluded(PBVHIter *iter)
{
PBVHNode *node;
PBVHNode *node;
while(iter->stacksize) {
/* pop node */
iter->stacksize--;
node= iter->stack[iter->stacksize].node;
while(iter->stacksize) {
/* pop node */
iter->stacksize--;
node= iter->stack[iter->stacksize].node;
/* on a mesh with no faces this can happen
* can remove this check if we know meshes have at least 1 face */
if(node==NULL) return NULL;
/* on a mesh with no faces this can happen
* can remove this check if we know meshes have at least 1 face */
if(node==NULL) return NULL;
if(iter->scb && !iter->scb(node, iter->search_data)) continue; /* don't traverse, outside of search zone */
if(iter->scb && !iter->scb(node, iter->search_data)) continue; /* don't traverse, outside of search zone */
if(node->flag & PBVH_Leaf) {
/* immediately hit leaf node */
return node;
}
else {
pbvh_stack_push(iter, iter->bvh->nodes+node->children_offset+1, 0);
pbvh_stack_push(iter, iter->bvh->nodes+node->children_offset, 0);
}
}
if(node->flag & PBVH_Leaf) {
/* immediately hit leaf node */
return node;
}
else {
pbvh_stack_push(iter, iter->bvh->nodes+node->children_offset+1, 0);
pbvh_stack_push(iter, iter->bvh->nodes+node->children_offset, 0);
}
}
return NULL;
return NULL;
}
void BLI_pbvh_search_gather(PBVH *bvh,
@ -793,59 +793,59 @@ void BLI_pbvh_search_callback(PBVH *bvh,
}
typedef struct node_tree {
PBVHNode* data;
PBVHNode* data;
struct node_tree* left;
struct node_tree* right;
struct node_tree* left;
struct node_tree* right;
} node_tree;
static void node_tree_insert(node_tree* tree, node_tree* new_node)
{
if (new_node->data->tmin < tree->data->tmin) {
if (tree->left) {
node_tree_insert(tree->left, new_node);
}
else {
tree->left = new_node;
}
}
else {
if (tree->right) {
node_tree_insert(tree->right, new_node);
}
else {
tree->right = new_node;
}
}
if (new_node->data->tmin < tree->data->tmin) {
if (tree->left) {
node_tree_insert(tree->left, new_node);
}
else {
tree->left = new_node;
}
}
else {
if (tree->right) {
node_tree_insert(tree->right, new_node);
}
else {
tree->right = new_node;
}
}
}
static void traverse_tree(node_tree* tree, BLI_pbvh_HitOccludedCallback hcb, void* hit_data, float* tmin)
{
if (tree->left) traverse_tree(tree->left, hcb, hit_data, tmin);
if (tree->left) traverse_tree(tree->left, hcb, hit_data, tmin);
hcb(tree->data, hit_data, tmin);
hcb(tree->data, hit_data, tmin);
if (tree->right) traverse_tree(tree->right, hcb, hit_data, tmin);
if (tree->right) traverse_tree(tree->right, hcb, hit_data, tmin);
}
static void free_tree(node_tree* tree)
{
if (tree->left) {
free_tree(tree->left);
tree->left = 0;
}
if (tree->left) {
free_tree(tree->left);
tree->left = 0;
}
if (tree->right) {
free_tree(tree->right);
tree->right = 0;
}
if (tree->right) {
free_tree(tree->right);
tree->right = 0;
}
free(tree);
free(tree);
}
float BLI_pbvh_node_get_tmin(PBVHNode* node)
{
return node->tmin;
return node->tmin;
}
static void BLI_pbvh_search_callback_occluded(PBVH *bvh,
@ -1129,7 +1129,7 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot
GHash *map;
void *face, **faces;
unsigned i;
int tot;
int tot;
map = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "pbvh_get_grid_updates gh");
@ -1318,17 +1318,17 @@ static int ray_face_intersection(float ray_start[3], float ray_normal[3],
float *t0, float *t1, float *t2, float *t3,
float *fdist)
{
float dist;
float dist;
if ((isect_ray_tri_epsilon_v3(ray_start, ray_normal, t0, t1, t2, &dist, NULL, 0.1f) && dist < *fdist) ||
(t3 && isect_ray_tri_epsilon_v3(ray_start, ray_normal, t0, t2, t3, &dist, NULL, 0.1f) && dist < *fdist))
{
*fdist = dist;
return 1;
}
else {
return 0;
}
if ((isect_ray_tri_epsilon_v3(ray_start, ray_normal, t0, t1, t2, &dist, NULL, 0.1f) && dist < *fdist) ||
(t3 && isect_ray_tri_epsilon_v3(ray_start, ray_normal, t0, t2, t3, &dist, NULL, 0.1f) && dist < *fdist))
{
*fdist = dist;
return 1;
}
else {
return 0;
}
}
int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],

@ -381,64 +381,64 @@ static const char trailingBytesForUTF8[256] = {
int BLI_utf8_invalid_byte(const char *str, int length)
{
const unsigned char *p, *pend = (unsigned char*)str + length;
unsigned char c;
int ab;
const unsigned char *p, *pend = (unsigned char*)str + length;
unsigned char c;
int ab;
for (p = (unsigned char*)str; p < pend; p++) {
c = *p;
if (c < 128)
continue;
if ((c & 0xc0) != 0xc0)
goto utf8_error;
ab = trailingBytesForUTF8[c];
if (length < ab)
goto utf8_error;
length -= ab;
for (p = (unsigned char*)str; p < pend; p++) {
c = *p;
if (c < 128)
continue;
if ((c & 0xc0) != 0xc0)
goto utf8_error;
ab = trailingBytesForUTF8[c];
if (length < ab)
goto utf8_error;
length -= ab;
p++;
/* Check top bits in the second byte */
if ((*p & 0xc0) != 0x80)
goto utf8_error;
p++;
/* Check top bits in the second byte */
if ((*p & 0xc0) != 0x80)
goto utf8_error;
/* Check for overlong sequences for each different length */
switch (ab) {
/* Check for xx00 000x */
case 1:
if ((c & 0x3e) == 0) goto utf8_error;
continue; /* We know there aren't any more bytes to check */
/* Check for overlong sequences for each different length */
switch (ab) {
/* Check for xx00 000x */
case 1:
if ((c & 0x3e) == 0) goto utf8_error;
continue; /* We know there aren't any more bytes to check */
/* Check for 1110 0000, xx0x xxxx */
case 2:
if (c == 0xe0 && (*p & 0x20) == 0) goto utf8_error;
break;
/* Check for 1110 0000, xx0x xxxx */
case 2:
if (c == 0xe0 && (*p & 0x20) == 0) goto utf8_error;
break;
/* Check for 1111 0000, xx00 xxxx */
case 3:
if (c == 0xf0 && (*p & 0x30) == 0) goto utf8_error;
break;
/* Check for 1111 0000, xx00 xxxx */
case 3:
if (c == 0xf0 && (*p & 0x30) == 0) goto utf8_error;
break;
/* Check for 1111 1000, xx00 0xxx */
case 4:
if (c == 0xf8 && (*p & 0x38) == 0) goto utf8_error;
break;
/* Check for 1111 1000, xx00 0xxx */
case 4:
if (c == 0xf8 && (*p & 0x38) == 0) goto utf8_error;
break;
/* Check for leading 0xfe or 0xff,
and then for 1111 1100, xx00 00xx */
case 5:
if (c == 0xfe || c == 0xff ||
(c == 0xfc && (*p & 0x3c) == 0)) goto utf8_error;
break;
}
/* Check for leading 0xfe or 0xff,
and then for 1111 1100, xx00 00xx */
case 5:
if (c == 0xfe || c == 0xff ||
(c == 0xfc && (*p & 0x3c) == 0)) goto utf8_error;
break;
}
/* Check for valid bytes after the 2nd, if any; all must start 10 */
while (--ab > 0) {
if ((*(p+1) & 0xc0) != 0x80) goto utf8_error;
/* Check for valid bytes after the 2nd, if any; all must start 10 */
while (--ab > 0) {
if ((*(p+1) & 0xc0) != 0x80) goto utf8_error;
p++; /* do this after so we get usable offset - campbell */
}
}
}
}
return -1;
return -1;
utf8_error:

@ -3694,7 +3694,7 @@ static void lib_link_object(FileData *fd, Main *main)
ob->gpd= newlibadr_us(fd, ob->id.lib, ob->gpd);
ob->duplilist= NULL;
ob->id.flag -= LIB_NEEDLINK;
/* if id.us==0 a new base will be created later on */

@ -113,7 +113,7 @@ void delete_fcurve_keys(FCurve *fcu)
if(fcu->bezt==NULL) /* ignore baked curves */
return;
/* Delete selected BezTriples */
for (i=0; i < fcu->totvert; i++) {
if (fcu->bezt[i].f2 & SELECT) {

@ -471,7 +471,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
static int heat_ray_source_visible(LaplacianSystem *sys, int vertex, int source)
{
BVHTreeRayHit hit;
BVHTreeRayHit hit;
BVHCallbackUserData data;
MFace *mface;
float end[3];

@ -3031,7 +3031,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
/* This is a very strange test ... */
/**
Subdivide NURB surfaces - nzc 30-5-'00 -
Subdivision of a NURB curve can be effected by adding a
control point (insertion of a knot), or by raising the
degree of the functions used to build the NURB. The

@ -370,7 +370,7 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
/* and we adjust the position to fit within window */
width= block->maxx - block->minx;
height= block->maxy - block->miny;
/* avoid divide by zero below, caused by calling with no UI, but better not crash */
oldwidth= oldwidth > 0 ? oldwidth : MAX2(1, width);
oldheight= oldheight > 0 ? oldheight : MAX2(1, height);
@ -1284,7 +1284,7 @@ double ui_get_but_val(uiBut *but)
else if( but->pointype == FLO ) {
value= *(float *)but->poin;
}
return value;
}

@ -1196,10 +1196,10 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
#endif
name= BLI_strdup(name_ui);
iconid= ui_id_icon_get((bContext*)C, id, 1);
}
}
else {
name= RNA_struct_name_get_alloc(&itemptr, NULL, 0);
iconid = 0;
iconid = 0;
}
if(name) {

@ -238,8 +238,8 @@ static int group_add_exec(bContext *C, wmOperator *UNUSED(op))
if(ob == NULL)
return OPERATOR_CANCELLED;
group= add_group("Group");
add_to_group(group, ob, scene, NULL);
group= add_group("Group");
add_to_group(group, ob, scene, NULL);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
@ -264,12 +264,12 @@ static int group_link_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Group *group= BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group"));
Group *group= BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group"));
if(ELEM(NULL, ob, group))
return OPERATOR_CANCELLED;
add_to_group(group, ob, scene, NULL);
add_to_group(group, ob, scene, NULL);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);

@ -348,7 +348,7 @@ static void ED_vgroup_nr_vert_remove(Object *ob, int def_nr, int vertnum)
*/
if(dvert->dw[i].def_nr == def_nr) {
dvert->totweight--;
/* if there are still other deform weights
* attached to this vert then remove this
* deform weight, and reshuffle the others
@ -457,10 +457,10 @@ static void ED_vgroup_nr_vert_add(Object *ob, int def_nr, int vertnum, float wei
MEM_freeN(dv->dw);
}
dv->dw=newdw;
dv->dw[dv->totweight].weight=weight;
dv->dw[dv->totweight].def_nr=def_nr;
dv->totweight++;
break;
}

@ -2445,7 +2445,7 @@ static int weight_set_exec(bContext *C, wmOperator *op)
HairKey *hkey;
float weight;
ParticleBrushData *brush= &pset->brush[pset->brushtype];
float factor= RNA_float_get(op->ptr, "factor");
float factor= RNA_float_get(op->ptr, "factor");
weight= brush->strength;
edit= psys->edit;
@ -2477,8 +2477,8 @@ void PARTICLE_OT_weight_set(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_float(ot->srna, "factor", 1, 0, 1, "Factor", "", 0, 1);
RNA_def_float(ot->srna, "factor", 1, 0, 1, "Factor", "", 0, 1);
}
/************************ cursor drawing *******************************/

@ -1882,9 +1882,9 @@ static void calc_sculpt_plane(Sculpt *sd, Object *ob, PBVHNode **nodes, int totn
/* Projects a point onto a plane along the plane's normal */
static void point_plane_project(float intr[3], float co[3], float plane_normal[3], float plane_center[3])
{
sub_v3_v3v3(intr, co, plane_center);
mul_v3_v3fl(intr, plane_normal, dot_v3v3(plane_normal, intr));
sub_v3_v3v3(intr, co, intr);
sub_v3_v3v3(intr, co, plane_center);
mul_v3_v3fl(intr, plane_normal, dot_v3v3(plane_normal, intr));
sub_v3_v3v3(intr, co, intr);
}
static int plane_trim(StrokeCache *cache, Brush *brush, float val[3])
@ -1894,23 +1894,23 @@ static int plane_trim(StrokeCache *cache, Brush *brush, float val[3])
static int plane_point_side_flip(float co[3], float plane_normal[3], float plane_center[3], int flip)
{
float delta[3];
float d;
float delta[3];
float d;
sub_v3_v3v3(delta, co, plane_center);
d = dot_v3v3(plane_normal, delta);
sub_v3_v3v3(delta, co, plane_center);
d = dot_v3v3(plane_normal, delta);
if (flip) d = -d;
if (flip) d = -d;
return d <= 0.0f;
return d <= 0.0f;
}
static int plane_point_side(float co[3], float plane_normal[3], float plane_center[3])
{
float delta[3];
float delta[3];
sub_v3_v3v3(delta, co, plane_center);
return dot_v3v3(plane_normal, delta) <= 0.0f;
sub_v3_v3v3(delta, co, plane_center);
return dot_v3v3(plane_normal, delta) <= 0.0f;
}
static float get_offset(Sculpt *sd, SculptSession *ss)

@ -182,8 +182,8 @@ static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(eve
static void path_drop_copy(wmDrag *drag, wmDropBox *drop)
{
char pathname[FILE_MAXDIR+FILE_MAXFILE+2];
snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path);
char pathname[FILE_MAXDIR+FILE_MAXFILE+2];
snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path);
RNA_string_set(drop->ptr, "text", pathname);
}

@ -363,7 +363,7 @@ static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op))
int numfiles = filelist_numfiles(sfile->files);
int i;
int is_selected = 0;
sel.first = 0;
sel.last = numfiles-1;

@ -493,7 +493,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
layout->tile_h = textheight*3/2;
layout->height= (int)(v2d->cur.ymax - v2d->cur.ymin - 2*layout->tile_border_y);
layout->rows = layout->height / (layout->tile_h + 2*layout->tile_border_y);
column_widths(sfile->files, layout);
if (params->display == FILE_SHORTDISPLAY) {

@ -2201,12 +2201,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
case ACT_CAMERA:
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
ca= act->data;
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-24, (width-20)/2, 19, &(ca->ob), "Look at this Object");
uiDefButF(block, NUM, 0, "Height:", xco+10+(width-20)/2, yco-24, (width-20)/2, 19, &ca->height, 0.0, 20.0, 0, 0, "");
@ -2219,7 +2219,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButF(block, NUM, 0, "Max:", xco+20+(width)/2, yco-44, (width-60)/2, 19, &ca->max, 0.0, 20.0, 0, 0, "");
yco-= ysize;
break;
case ACT_EDIT_OBJECT:
@ -2311,7 +2311,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &eoa->type, 0.0, 0.0, 0, 0, "");
yco-= ysize;
break;
case ACT_CONSTRAINT:
@ -2319,7 +2319,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
if (coa->type == ACT_CONST_TYPE_LOC) {
ysize= 69;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);

@ -730,22 +730,22 @@ static void node_composit_buts_flip(uiLayout *layout, bContext *UNUSED(C), Point
static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
uiItemR(layout, ptr, "use_crop_size", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "relative", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "relative", 0, NULL, ICON_NONE);
col= uiLayoutColumn(layout, 1);
if (RNA_boolean_get(ptr, "relative")){
uiItemR(col, ptr, "rel_min_x", 0, "Left", ICON_NONE);
uiItemR(col, ptr, "rel_max_x", 0, "Right", ICON_NONE);
uiItemR(col, ptr, "rel_min_y", 0, "Up", ICON_NONE);
uiItemR(col, ptr, "rel_max_y", 0, "Down", ICON_NONE);
} else {
uiItemR(col, ptr, "min_x", 0, "Left", ICON_NONE);
uiItemR(col, ptr, "max_x", 0, "Right", ICON_NONE);
uiItemR(col, ptr, "min_y", 0, "Up", ICON_NONE);
uiItemR(col, ptr, "max_y", 0, "Down", ICON_NONE);
}
if (RNA_boolean_get(ptr, "relative")){
uiItemR(col, ptr, "rel_min_x", 0, "Left", ICON_NONE);
uiItemR(col, ptr, "rel_max_x", 0, "Right", ICON_NONE);
uiItemR(col, ptr, "rel_min_y", 0, "Up", ICON_NONE);
uiItemR(col, ptr, "rel_max_y", 0, "Down", ICON_NONE);
} else {
uiItemR(col, ptr, "min_x", 0, "Left", ICON_NONE);
uiItemR(col, ptr, "max_x", 0, "Right", ICON_NONE);
uiItemR(col, ptr, "min_y", 0, "Up", ICON_NONE);
uiItemR(col, ptr, "max_y", 0, "Down", ICON_NONE);
}
}
static void node_composit_buts_splitviewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)

@ -1035,7 +1035,7 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
MEM_freeN(nvm);
op->customdata= NULL;
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_NODE, NULL);
return OPERATOR_FINISHED;

@ -614,7 +614,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
}
}
}
/* make sequence selection a little bit more intuitive
for 3 strips: the last-strip should be sequence3 */
if (seq3 != NULL && seq2 != NULL) {

@ -993,7 +993,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
cpack(0x4040FF);
glRectf(x3, y3, x4, y4);
}
/* safety border */
if (ca && (ca->flag & CAM_SHOWTITLESAFE)) {
fac= 0.1;

@ -2565,10 +2565,10 @@ void VIEW3D_OT_cursor3d(wmOperatorType *ot)
ot->invoke= set_3dcursor_invoke;
ot->poll= ED_operator_view3d_active;
/* flags */
// ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna later */
}

@ -793,7 +793,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
/* transform the parent or the camera? */
if(fly->root_parent) {
Object *ob_update;
float view_mat[4][4];
float prev_view_imat[4][4];
float diff_mat[4][4];

@ -2234,7 +2234,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
int select;
select= (gesture_mode==GESTURE_MODAL_SELECT);
if( CTX_data_edit_object(C) || paint_facesel_test(obact) ||
(obact && (obact->mode & (OB_MODE_PARTICLE_EDIT|OB_MODE_POSE))) )
{

@ -3745,7 +3745,7 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
}
}
#endif
/* for extend we need to do some tricks */
if (t->mode == TFM_TIME_EXTEND) {

@ -2331,7 +2331,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
int x, y, radius, width, height, select;
float zoomx, zoomy, offset[2], ellipse[2];
int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
/* get operator properties */
select= (gesture_mode == GESTURE_MODAL_SELECT);
x= RNA_int_get(op->ptr, "x");

@ -1142,7 +1142,7 @@ static void p_chart_boundaries(PChart *chart, int *nboundaries, PEdge **outer)
(*nboundaries)++;
len = 0.0f;
be = e;
do {
be->flag |= PEDGE_DONE;

@ -629,7 +629,7 @@ static void uv_map_rotation_matrix(float result[][4], RegionView3D *rv3d, Object
rotside[1][0]= (float)sin(sideangle);
rotside[1][1]= (float)cos(sideangle);
rotside[2][2]= 1.0f;
upangle= (float)M_PI*upangledeg/180.0f;
rotup[1][1]= (float)cos(upangle)/radius;
rotup[1][2]= -(float)sin(upangle)/radius;

@ -793,7 +793,7 @@ static ListBase image_free_queue = {NULL, NULL};
static void gpu_queue_image_for_free(Image *ima)
{
Image *cpy = MEM_dupallocN(ima);
Image *cpy = MEM_dupallocN(ima);
BLI_lock_thread(LOCK_OPENGL);
BLI_addtail(&image_free_queue, cpy);

@ -119,8 +119,8 @@ void GPU_extensions_init(void)
glGetIntegerv(GL_RED_BITS, &r);
glGetIntegerv(GL_GREEN_BITS, &g);
glGetIntegerv(GL_BLUE_BITS, &b);
GG.colordepth = r+g+b; /* assumes same depth for RGB */
GG.colordepth = r+g+b; /* assumes same depth for RGB */
vendor = (const char*)glGetString(GL_VENDOR);
renderer = (const char*)glGetString(GL_RENDERER);
@ -141,7 +141,7 @@ void GPU_extensions_init(void)
else if(strstr(vendor, "Intel") ||
/* src/mesa/drivers/dri/intel/intel_context.c */
strstr(renderer, "Mesa DRI Intel") ||
strstr(renderer, "Mesa DRI Mobile Intel")) {
strstr(renderer, "Mesa DRI Mobile Intel")) {
GG.device = GPU_DEVICE_INTEL;
GG.driver = GPU_DRIVER_OFFICIAL;
}
@ -210,7 +210,7 @@ int GPU_non_power_of_two_support(void)
int GPU_color_depth(void)
{
return GG.colordepth;
return GG.colordepth;
}
int GPU_print_error(const char *str)
@ -1223,10 +1223,10 @@ void GPU_pixelbuffer_texture(GPUTexture *tex, GPUPixelBuffer *pb)
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, pb->bindcode[pb->current]);
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_EXT, pb->datasize, NULL,
GL_STREAM_DRAW_ARB);
pixels = glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, GL_WRITE_ONLY);
/*memcpy(pixels, _oImage.data(), pb->datasize);*/
if (!glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT)) {
fprintf(stderr, "Could not unmap opengl PBO\n");
break;

@ -185,7 +185,7 @@ static ImBuf * movie_fetchibuf(struct anim * anim, int position) {
if (anim->interlacing == DM_IMAGE_INTERLACED_EVEN) {
rect1 = ibuf->rect + (ibuf->x * ibuf->y) - 1;
rect2 = rect1 - ibuf->x;
for (size = ibuf->x * (ibuf->y - 1); size > 0; size--){
*rect1-- = *rect2--;
}

@ -74,7 +74,7 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1)
_p1 = (uchar *) ibuf1->rect;
dest=(uchar *) ibuf2->rect;
_p1f = ibuf1->rect_float;
destf= ibuf2->rect_float;
@ -600,7 +600,7 @@ static void enlarge_picture_float(
if ((int) y_src == src_height - 1) {
line2 = line1;
}
x_src = 0;
for (x_dst = 0; x_dst < dst_width; x_dst++) {
const float weight1x = (float)(1.0 - (x_src - (int) x_src));

@ -1065,7 +1065,7 @@ int make_structDNA(char *baseDirectory, FILE *file)
MEM_freeN(names);
MEM_freeN(types);
MEM_freeN(typelens);
MEM_freeN(alphalens);
MEM_freeN(alphalens);
MEM_freeN(structs);
if (debugSDNA > -1) printf("done.\n");

@ -497,18 +497,18 @@ static void rna_Actuator_Armature_update(Main *bmain, Scene *scene, PointerRNA *
/* note: the following set functions exists only to avoid id refcounting */
static void rna_Actuator_editobject_mesh_set(PointerRNA *ptr, PointerRNA value)
{
bActuator *act = (bActuator *)ptr->data;
bEditObjectActuator *eoa = (bEditObjectActuator *) act->data;
bActuator *act = (bActuator *)ptr->data;
bEditObjectActuator *eoa = (bEditObjectActuator *) act->data;
eoa->me = value.data;
eoa->me = value.data;
}
static void rna_Actuator_action_action_set(PointerRNA *ptr, PointerRNA value)
{
bActuator *act = (bActuator *)ptr->data;
bActionActuator *aa = (bActionActuator *) act->data;
bActuator *act = (bActuator *)ptr->data;
bActionActuator *aa = (bActionActuator *) act->data;
aa->act = value.data;
aa->act = value.data;
}
#else
@ -579,8 +579,8 @@ static void rna_def_action_actuator(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Action");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Action", "");
/* note: custom set function is ONLY to avoid rna setting a user for this. */
RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL, NULL);
/* note: custom set function is ONLY to avoid rna setting a user for this. */
RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL, NULL);
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);
@ -1811,8 +1811,8 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Action");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Action", "");
/* note: custom set function is ONLY to avoid rna setting a user for this. */
RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL, NULL);
/* note: custom set function is ONLY to avoid rna setting a user for this. */
RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL, NULL);
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);

@ -1329,7 +1329,7 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", 4);
RNA_def_property_ui_text(prop, "Limit Z", "Use minimum/maximum z limit");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "use_angular_limit_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", 8);
RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum x angular limit");
@ -1344,7 +1344,6 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", 32);
RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum z angular limit");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_clamp_to(BlenderRNA *brna)

@ -164,8 +164,8 @@ static void rna_DriverTarget_update_name(Main *bmain, Scene *scene, PointerRNA *
/* note: this function exists only to avoid id refcounting */
static void rna_DriverTarget_id_set(PointerRNA *ptr, PointerRNA value)
{
DriverTarget *dtar= (DriverTarget*)ptr->data;
dtar->id= value.data;
DriverTarget *dtar= (DriverTarget*)ptr->data;
dtar->id= value.data;
}
static StructRNA *rna_DriverTarget_id_typef(PointerRNA *ptr)
@ -1044,7 +1044,7 @@ static void rna_def_drivertarget(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "ID");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_editable_func(prop, "rna_DriverTarget_id_editable");
/* note: custom set function is ONLY to avoid rna setting a user for this. */
/* note: custom set function is ONLY to avoid rna setting a user for this. */
RNA_def_property_pointer_funcs(prop, NULL, "rna_DriverTarget_id_set", "rna_DriverTarget_id_typef", NULL);
RNA_def_property_ui_text(prop, "ID", "ID-block that the specific property used can be found from (id_type property must be set first)");
RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");

@ -101,7 +101,7 @@ EnumPropertyItem metaelem_type_items[] = {
#define OBTYPE_CU_CURVE {OB_CURVE, "CURVE", 0, "Curve", ""}
#define OBTYPE_CU_SURF {OB_SURF, "SURFACE", 0, "Surface", ""}
#define OBTYPE_CU_FONT {OB_FONT, "FONT", 0, "Font", ""}
EnumPropertyItem object_type_items[] = {
{OB_MESH, "MESH", 0, "Mesh", ""},
OBTYPE_CU_CURVE,

@ -820,7 +820,7 @@ static void rna_def_pointcache(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_EXTERNAL);
RNA_def_property_ui_text(prop, "External", "Read cache from an external location");
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
prop= RNA_def_property(srna, "use_library_path", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PTCACHE_IGNORE_LIBPATH);
RNA_def_property_ui_text(prop, "Library Path", "Use this files path when library linked into another file.");

@ -243,10 +243,10 @@ static void rna_Sensor_Armature_update(Main *bmain, Scene *scene, PointerRNA *pt
/* note: the following set functions exists only to avoid id refcounting */
static void rna_Sensor_touch_material_set(PointerRNA *ptr, PointerRNA value)
{
bSensor *sens = (bSensor *)ptr->data;
bTouchSensor *ts = (bTouchSensor *) sens->data;
bSensor *sens = (bSensor *)ptr->data;
bTouchSensor *ts = (bTouchSensor *) sens->data;
ts->ma = value.data;
ts->ma = value.data;
}
#else

@ -544,8 +544,8 @@ static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value)
/* note: this function exists only to avoid id refcounting */
static void rna_SpaceProperties_pin_id_set(PointerRNA *ptr, PointerRNA value)
{
SpaceButs *sbuts= (SpaceButs*)(ptr->data);
sbuts->pinid= value.data;
SpaceButs *sbuts= (SpaceButs*)(ptr->data);
sbuts->pinid= value.data;
}
static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr)
@ -1443,7 +1443,7 @@ static void rna_def_space_buttons(BlenderRNA *brna)
prop= RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "pinid");
RNA_def_property_struct_type(prop, "ID");
/* note: custom set function is ONLY to avoid rna setting a user for this. */
/* note: custom set function is ONLY to avoid rna setting a user for this. */
RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set", "rna_SpaceProperties_pin_id_typef", NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update");
@ -2380,7 +2380,7 @@ static void rna_def_space_node(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "zoom");
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_range(prop, 0.01f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
RNA_def_property_ui_text(prop, "Backdrop Zoom", "Backdrop zoom factor");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);

@ -1988,7 +1988,7 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_VIEWPORTNAME);
RNA_def_property_ui_text(prop, "Show View Name", "Show the name of the view's direction in each 3D View");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "show_splash", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_SPLASH_DISABLE);
RNA_def_property_ui_text(prop, "Show Splash", "Display splash screen on startup");

@ -1232,7 +1232,7 @@ static void rna_def_macro_operator(BlenderRNA *brna)
#ifdef WITH_PYTHON
RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister");
#endif
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);

@ -88,41 +88,41 @@ static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *i
static void do_chroma_key(bNode *node, float *out, float *in)
{
NodeChroma *c;
float x, z, alpha;
float theta, beta, angle, angle2;
float kfg;
float x, z, alpha;
float theta, beta, angle, angle2;
float kfg;
c=node->storage;
/* Algorithm from book "Video Demistified," does not include the spill reduction part */
/* Algorithm from book "Video Demistified," does not include the spill reduction part */
/* find theta, the angle that the color space should be rotated based on key*/
theta=atan2(c->key[2], c->key[1]);
theta=atan2(c->key[2], c->key[1]);
/*rotate the cb and cr into x/z space */
x=in[1]*cos(theta)+in[2]*sin(theta);
z=in[2]*cos(theta)-in[1]*sin(theta);
x=in[1]*cos(theta)+in[2]*sin(theta);
z=in[2]*cos(theta)-in[1]*sin(theta);
/*if within the acceptance angle */
angle=c->t1*M_PI/180.0; /* convert to radians */
/* if kfg is <0 then the pixel is outside of the key color */
kfg=x-(fabs(z)/tan(angle/2.0));
/*if within the acceptance angle */
angle=c->t1*M_PI/180.0; /* convert to radians */
out[0]=in[0];
out[1]=in[1];
out[2]=in[2];
/* if kfg is <0 then the pixel is outside of the key color */
kfg=x-(fabs(z)/tan(angle/2.0));
if(kfg>0.0) { /* found a pixel that is within key color */
alpha=(1.0-kfg)*(c->fstrength);
out[0]=in[0];
out[1]=in[1];
out[2]=in[2];
beta=atan2(z,x);
angle2=c->t2*M_PI/180.0;
if(kfg>0.0) { /* found a pixel that is within key color */
alpha=(1.0-kfg)*(c->fstrength);
/* if beta is within the cutoff angle */
if(fabs(beta)<(angle2/2.0)) {
alpha=0.0;
}
beta=atan2(z,x);
angle2=c->t2*M_PI/180.0;
/* if beta is within the cutoff angle */
if(fabs(beta)<(angle2/2.0)) {
alpha=0.0;
}
/* don't make something that was more transparent less transparent */
if (alpha<in[3]) {

@ -53,14 +53,14 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
CompBuf *stackbuf;
int x, y;
float *srcfp, *outfp;
rcti outputrect;
rcti outputrect;
if(node->custom2) {
ntxy->x1= cbuf->x* ntxy->fac_x1;
ntxy->x2= cbuf->x* ntxy->fac_x2;
ntxy->y1= cbuf->y* ntxy->fac_y1;
ntxy->y2= cbuf->y* ntxy->fac_y2;
}
if(node->custom2) {
ntxy->x1= cbuf->x* ntxy->fac_x1;
ntxy->x2= cbuf->x* ntxy->fac_x2;
ntxy->y1= cbuf->y* ntxy->fac_y1;
ntxy->y2= cbuf->y* ntxy->fac_y2;
}
/* check input image size */
if(cbuf->x <= ntxy->x1 + 1)

@ -102,15 +102,15 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
/* Only raise negative numbers by full integers */
if( in[0] >= 0 ) {
out[0]= pow(in[0], in2[0]);
} else {
float y_mod_1 = fmod(in2[0], 1);
} else {
float y_mod_1 = fmod(in2[0], 1);
/* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */
if (y_mod_1 > 0.999 || y_mod_1 < 0.001) {
out[0]= pow(in[0], floor(in2[0] + 0.5));
} else {
out[0] = 0.0;
}
}
if (y_mod_1 > 0.999 || y_mod_1 < 0.001) {
out[0]= pow(in[0], floor(in2[0] + 0.5));
} else {
out[0] = 0.0;
}
}
}
break;
case 11: /* Logarithm */

@ -49,80 +49,81 @@ static bNodeSocketType cmp_node_rotate_out[]= {
/* only supports RGBA nodes now */
static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
return;
if(in[0]->data) {
CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* note, this returns zero'd image */
float rad, u, v, s, c, centx, centy, miny, maxy, minx, maxx;
int x, y, yo, xo;
ImBuf *ibuf, *obuf;
ImBuf *ibuf, *obuf;
rad= (M_PI*in[1]->vec[0])/180.0f;
s= sin(rad);
c= cos(rad);
centx= cbuf->x/2;
centy= cbuf->y/2;
minx= -centx;
maxx= -centx + (float)cbuf->x;
miny= -centy;
maxy= -centy + (float)cbuf->y;
ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0);
if(ibuf && obuf){
ibuf->rect_float=cbuf->rect;
obuf->rect_float=stackbuf->rect;
ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0);
for(y=miny; y<maxy; y++) {
yo= y+(int)centy;
for(x=minx; x<maxx;x++) {
u=c*x + y*s + centx;
v=-s*x + c*y + centy;
xo= x+(int)centx;
if(ibuf && obuf){
ibuf->rect_float=cbuf->rect;
obuf->rect_float=stackbuf->rect;
switch(node->custom1) {
case 0:
neareast_interpolation(ibuf, obuf, u, v, xo, yo);
break ;
case 1:
bilinear_interpolation(ibuf, obuf, u, v, xo, yo);
break;
case 2:
bicubic_interpolation(ibuf, obuf, u, v, xo, yo);
}
for(y=miny; y<maxy; y++) {
yo= y+(int)centy;
for(x=minx; x<maxx;x++) {
u=c*x + y*s + centx;
v=-s*x + c*y + centy;
xo= x+(int)centx;
switch(node->custom1) {
case 0:
neareast_interpolation(ibuf, obuf, u, v, xo, yo);
break ;
case 1:
bilinear_interpolation(ibuf, obuf, u, v, xo, yo);
break;
case 2:
bicubic_interpolation(ibuf, obuf, u, v, xo, yo);
}
}
}
}
/* rotate offset vector too, but why negative rad, ehh?? Has to be replaced with [3][3] matrix once (ton) */
s= sin(-rad);
c= cos(-rad);
centx= (float)cbuf->xof; centy= (float)cbuf->yof;
stackbuf->xof= (int)( c*centx + s*centy);
stackbuf->yof= (int)(-s*centx + c*centy);
/* rotate offset vector too, but why negative rad, ehh?? Has to be replaced with [3][3] matrix once (ton) */
s= sin(-rad);
c= cos(-rad);
centx= (float)cbuf->xof; centy= (float)cbuf->yof;
stackbuf->xof= (int)( c*centx + s*centy);
stackbuf->yof= (int)(-s*centx + c*centy);
IMB_freeImBuf(ibuf);
IMB_freeImBuf(obuf);
}
/* pass on output and free */
out[0]->data= stackbuf;
if(cbuf!=in[0]->data)
if(cbuf!=in[0]->data) {
free_compbuf(cbuf);
}
}
}
static void node_composit_init_rotate(bNode *node)
{
node->custom1= 1; /* Bilinear Filter*/
node->custom1= 1; /* Bilinear Filter*/
}
void register_node_type_cmp_rotate(ListBase *lb)

@ -69,7 +69,7 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta
if(in[0]->data==NULL) {
float h, s, v;
rgb_to_hsv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &h, &s, &v);
rgb_to_hsv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &h, &s, &v);
out[0]->vec[0] = h;
out[1]->vec[0] = s;

@ -114,14 +114,14 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
/* Only raise negative numbers by full integers */
if( in0 >= 0 ) {
out[0]= pow(in0, in1);
} else {
float y_mod_1 = fmod(in1, 1);
} else {
float y_mod_1 = fmod(in1, 1);
if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
*out = pow(in0, floor(in1 + 0.5f));
} else {
*out = 0.0;
}
}
} else {
*out = 0.0;
}
}
}
break;
case 11: /* Logarithm */

@ -41,7 +41,7 @@
retrieve the color from the delegate.
comments: (ton)
This system needs recode, a node system should rely on the stack, and
callbacks for nodes only should evaluate own node, not recursively go
over other previous ones.

@ -293,7 +293,7 @@ static PyObject *Buffer_item(PyObject *self, int i)
size= BGL_typeSize(buf->type);
newbuf= (Buffer *) PyObject_NEW(Buffer, &BGL_bufferType);
Py_INCREF(self);
newbuf->parent= self;
@ -1641,7 +1641,7 @@ PyObject *BPyInit_bgl(void)
EXPP_ADDCONST(GL_TEXTURE_RESIDENT);
EXPP_ADDCONST(GL_TEXTURE_BINDING_1D);
EXPP_ADDCONST(GL_TEXTURE_BINDING_2D);
return submodule;
}

@ -76,12 +76,12 @@ static PyObject *bpy_script_paths(PyObject *UNUSED(self))
{
PyObject *ret= PyTuple_New(2);
char *path;
path= BLI_get_folder(BLENDER_USER_SCRIPTS, NULL);
PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
path= BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL);
PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:""));
return ret;
}

@ -255,7 +255,7 @@ float BPY_driver_exec(ChannelDriver *driver)
if(use_gil)
PyGILState_Release(gilstate);
if(finite(result)) {
return (float)result;
}

@ -668,8 +668,8 @@ static struct PyModuleDef bpy_proxy_def= {
};
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
PyObject_HEAD
/* Type-specific fields go here. */
PyObject *mod;
} dealloc_obj;

@ -38,68 +38,68 @@ static const char *traceback_filepath(PyTracebackObject *tb)
/* copied from pythonrun.c, 3.2.0 */
static int
parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
int *lineno, int *offset, const char **text)
int *lineno, int *offset, const char **text)
{
long hold;
PyObject *v;
long hold;
PyObject *v;
/* old style errors */
if (PyTuple_Check(err))
return PyArg_ParseTuple(err, "O(ziiz)", message, filename,
lineno, offset, text);
/* old style errors */
if (PyTuple_Check(err))
return PyArg_ParseTuple(err, "O(ziiz)", message, filename,
lineno, offset, text);
/* new style errors. `err' is an instance */
/* new style errors. `err' is an instance */
if (! (v = PyObject_GetAttrString(err, "msg")))
goto finally;
*message = v;
if (! (v = PyObject_GetAttrString(err, "msg")))
goto finally;
*message = v;
if (!(v = PyObject_GetAttrString(err, "filename")))
goto finally;
if (v == Py_None)
*filename = NULL;
else if (! (*filename = _PyUnicode_AsString(v)))
goto finally;
if (!(v = PyObject_GetAttrString(err, "filename")))
goto finally;
if (v == Py_None)
*filename = NULL;
else if (! (*filename = _PyUnicode_AsString(v)))
goto finally;
Py_DECREF(v);
if (!(v = PyObject_GetAttrString(err, "lineno")))
goto finally;
hold = PyLong_AsLong(v);
Py_DECREF(v);
v = NULL;
if (hold < 0 && PyErr_Occurred())
goto finally;
*lineno = (int)hold;
Py_DECREF(v);
if (!(v = PyObject_GetAttrString(err, "lineno")))
goto finally;
hold = PyLong_AsLong(v);
Py_DECREF(v);
v = NULL;
if (hold < 0 && PyErr_Occurred())
goto finally;
*lineno = (int)hold;
if (!(v = PyObject_GetAttrString(err, "offset")))
goto finally;
if (v == Py_None) {
*offset = -1;
Py_DECREF(v);
v = NULL;
if (!(v = PyObject_GetAttrString(err, "offset")))
goto finally;
if (v == Py_None) {
*offset = -1;
Py_DECREF(v);
v = NULL;
}
else {
hold = PyLong_AsLong(v);
Py_DECREF(v);
v = NULL;
if (hold < 0 && PyErr_Occurred())
goto finally;
*offset = (int)hold;
}
hold = PyLong_AsLong(v);
Py_DECREF(v);
v = NULL;
if (hold < 0 && PyErr_Occurred())
goto finally;
*offset = (int)hold;
}
if (!(v = PyObject_GetAttrString(err, "text")))
goto finally;
if (v == Py_None)
*text = NULL;
else if (!PyUnicode_Check(v) ||
!(*text = _PyUnicode_AsString(v)))
goto finally;
Py_DECREF(v);
return 1;
if (!(v = PyObject_GetAttrString(err, "text")))
goto finally;
if (v == Py_None)
*text = NULL;
else if (!PyUnicode_Check(v) ||
!(*text = _PyUnicode_AsString(v)))
goto finally;
Py_DECREF(v);
return 1;
finally:
Py_XDECREF(v);
return 0;
Py_XDECREF(v);
return 0;
}
/* end copied function! */
@ -122,7 +122,7 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
if(value) { /* should always be true */
PyObject *message;
const char *filename, *text;
const char *filename, *text;
if(parse_syntax_error(value, &message, &filename, lineno, offset, &text)) {
/* python adds a '/', prefix, so check for both */

@ -3726,7 +3726,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
VECCOPY(vec,ob->obmat[2]);
normalize_v3(vec);
InitSunSky(lar->sunsky, la->atm_turbidity, vec, la->horizon_brightness,
la->spread, la->sun_brightness, la->sun_size, la->backscattered_light,
la->skyblendfac, la->skyblendtype, la->sky_exposure, la->sky_colorspace);

@ -81,7 +81,7 @@ void addAlphaOverFloat(float *dest, float *source)
{
/* d = s + (1-alpha_s)d*/
float mul;
mul= 1.0 - source[3];
dest[0]= (mul*dest[0]) + source[0];
@ -131,7 +131,7 @@ void addalphaAddfacFloat(float *dest, float *source, char addfac)
else
#endif
dest[1]= c;
c= (m * dest[2]) + source[2];
#ifdef RE_FLOAT_COLOR_CLIPPING
if(c >= RE_FULL_COLOR_FLOAT) dest[2] = RE_FULL_COLOR_FLOAT;

@ -3198,7 +3198,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
if(la->type==LA_SPOT) {
tempvec[0]*= la->spottexfac;
tempvec[1]*= la->spottexfac;
/* project from 3d to 2d */
/* project from 3d to 2d */
tempvec[0] /= -tempvec[2];
tempvec[1] /= -tempvec[2];
}

@ -138,7 +138,7 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr)
/* depth >= 1 when ray-shading */
if(shi->depth==0 || shi->volume_depth > 0) {
if(R.r.mode & R_RAYTRACE) {
if(shi->ray_mirror!=0.0f || ((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) {
if(shi->ray_mirror!=0.0f || ((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) {
/* ray trace works on combined, but gives pass info */
ray_trace(shi, shr);
}

@ -142,13 +142,12 @@ void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_b
float spread,float sun_brightness, float sun_size, float back_scatter,
float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace)
{
float theta2;
float theta2;
float theta3;
float T;
float T2;
float chi;
sunsky->turbidity = turb;
sunsky->horizon_brightness = horizon_brightness;
@ -247,8 +246,8 @@ void GetSkyXYZRadiance(struct SunSky* sunsky, float theta, float phi, float colo
float gamma;
float x,y,Y,X,Z;
float hfade=1, nfade=1;
if (theta>(0.5*M_PI)) {
hfade = 1.0-(theta*M_1_PI-0.5)*2.0;
hfade = hfade*hfade*(3.0-2.0*hfade);
@ -320,7 +319,7 @@ void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3])
float fTauR, fTauA;
float m ;
float fAlpha;
int i;
float fLambda[3];
fLambda[0] = 0.65f;

@ -414,7 +414,7 @@ void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Material *ma)
SWAP(float *,sr,sr0);
SWAP(float *,sg,sg0);
SWAP(float *,sb,sb0);
/* main diffusion simulation */
ms_diffuse(sr0, sr, diff, n);
ms_diffuse(sg0, sg, diff, n);

@ -186,13 +186,13 @@ static void blender_esc(int sig)
#ifdef BUILD_DATE
static void strip_quotes(char *str)
{
if(str[0] == '"') {
int len= strlen(str) - 1;
memmove(str, str+1, len);
if(str[len-1] == '"') {
str[len-1]= '\0';
}
}
if(str[0] == '"') {
int len= strlen(str) - 1;
memmove(str, str+1, len);
if(str[len-1] == '"') {
str[len-1]= '\0';
}
}
}
#endif