svn merge ^/trunk/blender -r42670:42680

This commit is contained in:
Campbell Barton 2011-12-17 02:41:53 +00:00
commit 5c6ee6b523
58 changed files with 839 additions and 354 deletions

@ -446,6 +446,9 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
xml_read_enum(&mix->type, MixNode::type_enum, node, "type");
snode = mix;
}
else if(string_iequals(node.name(), "gamma")) {
snode = new GammaNode();
}
else if(string_iequals(node.name(), "combine_rgb")) {
snode = new CombineRGBNode();
}

@ -160,6 +160,10 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Node *
node = new InvertNode();
break;
}
case BL::ShaderNode::type_GAMMA: {
node = new GammaNode();
break;
}
case BL::ShaderNode::type_MIX_RGB: {
BL::ShaderNodeMixRGB b_mix_node(b_node);
MixNode *mix = new MixNode();

@ -59,6 +59,7 @@ set(SRC_SVM_HEADERS
svm/svm_convert.h
svm/svm_displace.h
svm/svm_fresnel.h
svm/svm_gamma.h
svm/svm_geometry.h
svm/svm_gradient.h
svm/svm_hsv.h

@ -19,6 +19,7 @@ set(SRC_OSL
node_emission.osl
node_environment_texture.osl
node_fresnel.osl
node_gamma.osl
node_geometry.osl
node_glass_bsdf.osl
node_glossy_bsdf.osl

@ -0,0 +1,33 @@
/*
* Copyright 2011, Blender Foundation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "stdosl.h"
shader node_gamma(
color ColorIn = color(0.8, 0.8, 0.8),
float Gamma = 1.0,
output ColorOut = color(0.8, 0.8, 0.8)
{
int i;
for (i=0;i<3;i++) {
if (ColorIn[i] > 0.0)
ColorIn[i] = powf(ColorIn[i], Gamma);
}
ColorOut = ColorIn;
}

@ -130,6 +130,7 @@ CCL_NAMESPACE_END
#include "svm_geometry.h"
#include "svm_hsv.h"
#include "svm_image.h"
#include "svm_gamma.h"
#include "svm_invert.h"
#include "svm_light_path.h"
#include "svm_magic.h"
@ -262,6 +263,9 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
case NODE_INVERT:
svm_node_invert(sd, stack, node.y, node.z, node.w);
break;
case NODE_GAMMA:
svm_node_gamma(sd, stack, node.y, node.z, node.w);
break;
case NODE_MIX:
svm_node_mix(kg, sd, stack, node.y, node.z, node.w, &offset);
break;

@ -0,0 +1,37 @@
/*
* Copyright 2011, Blender Foundation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
CCL_NAMESPACE_BEGIN
__device void svm_node_gamma(ShaderData *sd, float *stack, uint in_gamma, uint in_color, uint out_color)
{
float3 color = stack_load_float3(stack, in_color);
float gamma = stack_load_float(stack, in_gamma);
if (color.x > 0.0)
color.x = powf(color.x, gamma);
if (color.y > 0.0)
color.y = powf(color.y, gamma);
if (color.z > 0.0)
color.z = powf(color.z, gamma);
if (stack_valid(out_color))
stack_store_float3(stack, out_color, color);
}
CCL_NAMESPACE_END

@ -85,7 +85,8 @@ typedef enum NodeType {
NODE_HSV = 5200,
NODE_CAMERA = 5300,
NODE_INVERT = 5400,
NODE_NORMAL = 5500
NODE_NORMAL = 5500,
NODE_GAMMA = 5600
} NodeType;
typedef enum NodeAttributeType {

@ -1726,6 +1726,33 @@ void CombineRGBNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_combine_rgb");
}
/* Gamma */
GammaNode::GammaNode()
: ShaderNode("gamma")
{
add_input("Color", SHADER_SOCKET_COLOR);
add_input("Gamma", SHADER_SOCKET_FLOAT);
add_output("Color", SHADER_SOCKET_COLOR);
}
void GammaNode::compile(SVMCompiler& compiler)
{
ShaderInput *color_in = input("Color");
ShaderInput *gamma_in = input("Gamma");
ShaderOutput *color_out = output("Color");
compiler.stack_assign(color_in);
compiler.stack_assign(gamma_in);
compiler.stack_assign(color_out);
compiler.add_node(NODE_GAMMA, gamma_in->stack_offset, color_in->stack_offset, color_out->stack_offset);
}
void GammaNode::compile(OSLCompiler& compiler)
{
compiler.add(this, "node_gamma");
}
/* Separate RGB */
SeparateRGBNode::SeparateRGBNode()
: ShaderNode("separate_rgb")

@ -302,6 +302,11 @@ public:
SHADER_NODE_CLASS(CombineRGBNode)
};
class GammaNode : public ShaderNode {
public:
SHADER_NODE_CLASS(GammaNode)
};
class SeparateRGBNode : public ShaderNode {
public:
SHADER_NODE_CLASS(SeparateRGBNode)

@ -63,7 +63,8 @@ char *tcc_to_char (unsigned int tcc);
/* implemetation */
unsigned int GET_FCC (FILE *fp) {
unsigned int GET_FCC (FILE *fp)
{
unsigned char tmp[4];
tmp[0] = getc(fp);
@ -74,7 +75,8 @@ unsigned int GET_FCC (FILE *fp) {
return FCC (tmp);
}
unsigned int GET_TCC (FILE *fp) {
unsigned int GET_TCC (FILE *fp)
{
char tmp[5];
tmp[0] = getc(fp);
@ -85,7 +87,8 @@ unsigned int GET_TCC (FILE *fp) {
return FCC (tmp);
}
char *fcc_to_char (unsigned int fcc) {
char *fcc_to_char (unsigned int fcc)
{
DEBUG_FCC[0]= (fcc)&127;
DEBUG_FCC[1]= (fcc>>8)&127;
DEBUG_FCC[2]= (fcc>>16)&127;
@ -94,7 +97,8 @@ char *fcc_to_char (unsigned int fcc) {
return DEBUG_FCC;
}
char *tcc_to_char (unsigned int tcc) {
char *tcc_to_char (unsigned int tcc)
{
DEBUG_FCC[0]= (tcc)&127;
DEBUG_FCC[1]= (tcc>>8)&127;
DEBUG_FCC[2]= 0;
@ -103,7 +107,8 @@ char *tcc_to_char (unsigned int tcc) {
return DEBUG_FCC;
}
int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num) {
int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num)
{
int cur_stream;
if (movie == NULL)
@ -121,7 +126,8 @@ int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num) {
return -AVI_ERROR_FOUND;
}
static int fcc_get_stream (int fcc) {
static int fcc_get_stream (int fcc)
{
char fccs[4];
fccs[0] = fcc;
@ -132,7 +138,8 @@ static int fcc_get_stream (int fcc) {
return 10*(fccs[0]-'0') + (fccs[1]-'0');
}
static int fcc_is_data (int fcc) {
static int fcc_is_data (int fcc)
{
char fccs[4];
fccs[0] = fcc;
@ -148,7 +155,8 @@ static int fcc_is_data (int fcc) {
return 1;
}
AviError AVI_print_error (AviError in_error) {
AviError AVI_print_error (AviError in_error)
{
int error;
if ((int) in_error < 0)
@ -190,12 +198,14 @@ AviError AVI_print_error (AviError in_error) {
return in_error;
}
/*
void AVI_set_debug (int mode) {
void AVI_set_debug (int mode)
{
AVI_DEBUG= mode;
}
*/
/*
int AVI_is_avi (char *name) {
int AVI_is_avi (char *name)
{
FILE *fp;
int ret;
@ -216,7 +226,8 @@ int AVI_is_avi (char *name) {
}
*/
int AVI_is_avi (const char *name) {
int AVI_is_avi (const char *name)
{
int temp, fcca, j;
AviMovie movie= {NULL};
AviMainHeader header;
@ -407,7 +418,8 @@ int AVI_is_avi (const char *name) {
}
AviError AVI_open_movie (const char *name, AviMovie *movie) {
AviError AVI_open_movie (const char *name, AviMovie *movie)
{
int temp, fcca, size, j;
DEBUG_PRINT("opening movie\n");
@ -619,7 +631,11 @@ AviError AVI_open_movie (const char *name, AviMovie *movie) {
movie->entries[temp].Offset = GET_FCC (movie->fp);
movie->entries[temp].Size = GET_FCC (movie->fp);
if (AVI_DEBUG) printf ("Index entry %04d: ChunkId:%s Flags:%d Offset:%d Size:%d\n", temp, fcc_to_char(movie->entries[temp].ChunkId), movie->entries[temp].Flags, movie->entries[temp].Offset, movie->entries[temp].Size);
if (AVI_DEBUG) {
printf("Index entry %04d: ChunkId:%s Flags:%d Offset:%d Size:%d\n",
temp, fcc_to_char(movie->entries[temp].ChunkId), movie->entries[temp].Flags,
movie->entries[temp].Offset, movie->entries[temp].Size);
}
}
/* Some AVI's have offset entries in absolute coordinates
@ -637,7 +653,8 @@ AviError AVI_open_movie (const char *name, AviMovie *movie) {
return AVI_ERROR_NONE;
}
void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream) {
void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
{
int cur_frame=-1, temp, i=0, rewind=1;
void *buffer;
@ -681,7 +698,8 @@ void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
return buffer;
}
AviError AVI_close (AviMovie *movie) {
AviError AVI_close (AviMovie *movie)
{
int i;
fclose (movie->fp);
@ -703,7 +721,8 @@ AviError AVI_close (AviMovie *movie) {
return AVI_ERROR_NONE;
}
AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) {
AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
{
va_list ap;
AviList list;
AviChunk chunk;
@ -892,7 +911,8 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) {
return AVI_ERROR_NONE;
}
AviError AVI_write_frame (AviMovie *movie, int frame_num, ...) {
AviError AVI_write_frame (AviMovie *movie, int frame_num, ...)
{
AviList list;
AviChunk chunk;
AviIndexEntry *temp;
@ -999,7 +1019,8 @@ AviError AVI_write_frame (AviMovie *movie, int frame_num, ...) {
return AVI_ERROR_NONE;
}
AviError AVI_close_compress (AviMovie *movie) {
AviError AVI_close_compress (AviMovie *movie)
{
int temp, movi_size, i;
fseek (movie->fp, 0L, SEEK_END);

@ -40,7 +40,8 @@
#include "mjpeg.h"
#include "rgb32.h"
void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, int *size) {
void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, int *size)
{
if (from == to)
return buffer;
@ -82,7 +83,8 @@ void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat f
return buffer;
}
int avi_get_data_id (AviFormat format, int stream) {
int avi_get_data_id (AviFormat format, int stream)
{
char fcc[5];
if (avi_get_format_type (format) == FCC("vids"))
@ -95,7 +97,8 @@ int avi_get_data_id (AviFormat format, int stream) {
return FCC(fcc);
}
int avi_get_format_type (AviFormat format) {
int avi_get_format_type (AviFormat format)
{
switch (format) {
case AVI_FORMAT_RGB24:
case AVI_FORMAT_RGB32:
@ -109,7 +112,8 @@ int avi_get_format_type (AviFormat format) {
}
}
int avi_get_format_fcc (AviFormat format) {
int avi_get_format_fcc (AviFormat format)
{
switch (format) {
case AVI_FORMAT_RGB24:
case AVI_FORMAT_RGB32:
@ -125,7 +129,8 @@ int avi_get_format_fcc (AviFormat format) {
}
}
int avi_get_format_compression (AviFormat format) {
int avi_get_format_compression (AviFormat format)
{
switch (format) {
case AVI_FORMAT_RGB24:
case AVI_FORMAT_RGB32:

@ -43,7 +43,8 @@
#include "avi_intern.h"
#ifdef __BIG_ENDIAN__
static void invert (int *num) {
static void invert (int *num)
{
int new=0,i,j;
for (j=0; j < 4; j++) {
@ -55,7 +56,8 @@ static void invert (int *num) {
*num = new;
}
static void sinvert (short int *num) {
static void sinvert (short int *num)
{
short int new=0;
int i,j;
@ -68,20 +70,23 @@ static void sinvert (short int *num) {
*num = new;
}
static void Ichunk (AviChunk *chunk) {
static void Ichunk (AviChunk *chunk)
{
invert (&chunk->fcc);
invert (&chunk->size);
}
#endif
#ifdef __BIG_ENDIAN__
static void Ilist (AviList *list){
static void Ilist (AviList *list)
{
invert (&list->fcc);
invert (&list->size);
invert (&list->ids);
}
static void Imainh (AviMainHeader *mainh) {
static void Imainh (AviMainHeader *mainh)
{
invert (&mainh->fcc);
invert (&mainh->size);
invert (&mainh->MicroSecPerFrame);
@ -100,7 +105,8 @@ static void Imainh (AviMainHeader *mainh) {
invert (&mainh->Reserved[3]);
}
static void Istreamh (AviStreamHeader *streamh) {
static void Istreamh (AviStreamHeader *streamh)
{
invert (&streamh->fcc);
invert (&streamh->size);
invert (&streamh->Type);
@ -122,7 +128,8 @@ static void Istreamh (AviStreamHeader *streamh) {
sinvert (&streamh->bottom);
}
static void Ibitmaph (AviBitmapInfoHeader *bitmaph) {
static void Ibitmaph (AviBitmapInfoHeader *bitmaph)
{
invert (&bitmaph->fcc);
invert (&bitmaph->size);
invert (&bitmaph->Size);
@ -138,7 +145,8 @@ static void Ibitmaph (AviBitmapInfoHeader *bitmaph) {
invert (&bitmaph->ClrImportant);
}
static void Imjpegu (AviMJPEGUnknown *mjpgu) {
static void Imjpegu (AviMJPEGUnknown *mjpgu)
{
invert (&mjpgu->a);
invert (&mjpgu->b);
invert (&mjpgu->c);
@ -148,7 +156,8 @@ static void Imjpegu (AviMJPEGUnknown *mjpgu) {
invert (&mjpgu->g);
}
static void Iindexe (AviIndexEntry *indexe) {
static void Iindexe (AviIndexEntry *indexe)
{
invert (&indexe->ChunkId);
invert (&indexe->Flags);
invert (&indexe->Offset);
@ -156,7 +165,8 @@ static void Iindexe (AviIndexEntry *indexe) {
}
#endif /* __BIG_ENDIAN__ */
void awrite (AviMovie *movie, void *datain, int block, int size, FILE *fp, int type) {
void awrite (AviMovie *movie, void *datain, int block, int size, FILE *fp, int type)
{
#ifdef __BIG_ENDIAN__
void *data;

@ -50,7 +50,8 @@ static void jpegmemsrcmgr_build (j_decompress_ptr dinfo, unsigned char *buffer,
static int numbytes;
static void add_huff_table (j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) {
static void add_huff_table (j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
{
if (*htblptr == NULL)
*htblptr = jpeg_alloc_huff_table((j_common_ptr) dinfo);
@ -64,7 +65,8 @@ static void add_huff_table (j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const U
/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
/* IMPORTANT: these are only valid for 8-bit data precision! */
static void std_huff_tables (j_decompress_ptr dinfo) {
static void std_huff_tables (j_decompress_ptr dinfo)
{
static const UINT8 bits_dc_luminance[17] =
{ /* 0-base */
0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
@ -142,7 +144,8 @@ static void std_huff_tables (j_decompress_ptr dinfo) {
bits_ac_chrominance, val_ac_chrominance);
}
static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsigned int width, unsigned int height, int bufsize) {
static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsigned int width, unsigned int height, int bufsize)
{
int rowstride;
unsigned int y;
struct jpeg_decompress_struct dinfo;
@ -194,7 +197,8 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
return 1;
}
static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *inBuffer, int width, int height, int bufsize) {
static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *inBuffer, int width, int height, int bufsize)
{
int i, rowstride;
unsigned int y;
struct jpeg_compress_struct cinfo;
@ -255,7 +259,8 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *
jpeg_destroy_compress(&cinfo);
}
static void interlace(unsigned char *to, unsigned char *from, int width, int height) {
static void interlace(unsigned char *to, unsigned char *from, int width, int height)
{
int i, rowstride= width*3;
for (i=0; i<height; i++) {
@ -266,7 +271,8 @@ static void interlace(unsigned char *to, unsigned char *from, int width, int hei
}
}
static void deinterlace(int odd, unsigned char *to, unsigned char *from, int width, int height) {
static void deinterlace(int odd, unsigned char *to, unsigned char *from, int width, int height)
{
int i, rowstride= width*3;
for (i=0; i<height; i++) {
@ -277,7 +283,8 @@ static void deinterlace(int odd, unsigned char *to, unsigned char *from, int wid
}
}
static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, int width, int height, int bufsize) {
static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, int width, int height, int bufsize)
{
/* JPEG's are always multiples of 16, extra is cropped out AVI's */
if ((width&0xF) || (height&0xF)) {
int i, rrowstride, jrowstride;
@ -299,7 +306,8 @@ static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, in
}
}
static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned char *inbuf, int width, int height, int bufsize) {
static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned char *inbuf, int width, int height, int bufsize)
{
/* JPEG's are always multiples of 16, extra is ignored in AVI's */
if ((width&0xF) || (height&0xF)) {
int i, rrowstride, jrowstride;
@ -326,7 +334,8 @@ static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned
}
}
void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size) {
void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size)
{
int deint;
unsigned char *buf;
@ -349,7 +358,8 @@ void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buff
return buf;
}
void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size) {
void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size)
{
unsigned char *buf;
int bufsize= *size;
@ -380,22 +390,26 @@ void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer
/* Compression from memory */
static void jpegmemdestmgr_init_destination(j_compress_ptr cinfo) {
static void jpegmemdestmgr_init_destination(j_compress_ptr cinfo)
{
(void)cinfo; /* unused */
}
static boolean jpegmemdestmgr_empty_output_buffer(j_compress_ptr cinfo) {
static boolean jpegmemdestmgr_empty_output_buffer(j_compress_ptr cinfo)
{
(void)cinfo; /* unused */
return TRUE;
}
static void jpegmemdestmgr_term_destination(j_compress_ptr cinfo) {
static void jpegmemdestmgr_term_destination(j_compress_ptr cinfo)
{
numbytes-= cinfo->dest->free_in_buffer;
MEM_freeN(cinfo->dest);
}
static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, int bufsize) {
static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, int bufsize)
{
cinfo->dest= MEM_mallocN(sizeof(*(cinfo->dest)), "avi.jpegmemdestmgr_build");
cinfo->dest->init_destination= jpegmemdestmgr_init_destination;
@ -410,11 +424,13 @@ static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, in
/* Decompression from memory */
static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo) {
static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo)
{
(void)dinfo;
}
static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) {
static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo)
{
unsigned char *buf= (unsigned char*) dinfo->src->next_input_byte-2;
/* if we get called, must have run out of data */
@ -429,7 +445,8 @@ static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) {
return TRUE;
}
static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt) {
static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt)
{
if (dinfo->src->bytes_in_buffer<skipcnt)
skipcnt= dinfo->src->bytes_in_buffer;
@ -437,13 +454,15 @@ static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt)
dinfo->src->bytes_in_buffer-= skipcnt;
}
static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo) {
static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo)
{
numbytes-= dinfo->src->bytes_in_buffer;
MEM_freeN(dinfo->src);
}
static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, int bufsize) {
static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, int bufsize)
{
dinfo->src= MEM_mallocN(sizeof(*(dinfo->src)), "avi.jpegmemsrcmgr_build");
dinfo->src->init_source= jpegmemsrcmgr_init_source;

@ -43,7 +43,8 @@
/* avi_set_compress_options gets its own file... now don't WE feel important? */
AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) {
AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data)
{
int i;
int useconds;

@ -40,7 +40,8 @@
#include "MEM_guardedalloc.h"
#include "rgb32.h"
void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size) {
void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size)
{
int y, x, rowstridea, rowstrideb;
unsigned char *buf;
@ -65,7 +66,8 @@ void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buff
return buf;
}
void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size) {
void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size)
{
int i;
unsigned char *buf;
unsigned char *to, *from;

@ -521,6 +521,7 @@ struct ShadeResult;
#define SH_NODE_LAYER_WEIGHT 160
#define SH_NODE_VOLUME_TRANSPARENT 161
#define SH_NODE_VOLUME_ISOTROPIC 162
#define SH_NODE_GAMMA 163
/* custom defines options for Material node */
#define SH_NODE_MAT_DIFF 1

@ -1514,7 +1514,8 @@ BoidState *boid_new_state(BoidSettings *boids)
return state;
}
BoidState *boid_duplicate_state(BoidSettings *boids, BoidState *state) {
BoidState *boid_duplicate_state(BoidSettings *boids, BoidState *state)
{
BoidState *staten = MEM_dupallocN(state);
BLI_duplicatelist(&staten->rules, &state->rules);

@ -1508,10 +1508,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
int ok;
if(imtype == -1) {
/* use whatever existing image type is set by 'ibuf' */
}
else if(imtype== R_IMF_IMTYPE_IRIS) {
if(imtype== R_IMF_IMTYPE_IRIS) {
ibuf->ftype= IMAGIC;
}
#ifdef WITH_HDR
@ -2277,7 +2274,10 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
ibuf->x= rres.rectx;
ibuf->y= rres.recty;
if(ibuf->rect_float!=rectf || rect) /* ensure correct redraw */
/* free rect buffer if float buffer changes, so it can be recreated with
the updated result, and also in case we got byte buffer from sequencer,
so we don't keep reference to freed buffer */
if(ibuf->rect_float!=rectf || rect || !rectf)
imb_freerectImBuf(ibuf);
if(rect)

@ -1899,6 +1899,7 @@ static void registerShaderNodes(bNodeTreeType *ttype)
register_node_type_sh_output(ttype);
register_node_type_sh_material(ttype);
register_node_type_sh_camera(ttype);
register_node_type_sh_gamma(ttype);
register_node_type_sh_value(ttype);
register_node_type_sh_rgb(ttype);
register_node_type_sh_mix_rgb(ttype);

@ -1343,7 +1343,8 @@ typedef struct Ocean {
} Ocean;
float BKE_ocean_jminus_to_foam(float UNUSED(jminus), float UNUSED(coverage)) {
float BKE_ocean_jminus_to_foam(float UNUSED(jminus), float UNUSED(coverage))
{
return 0.0f;
}

@ -47,7 +47,8 @@ static SuggList suggestions = {NULL, NULL, NULL, NULL, NULL};
static char *documentation = NULL;
//static int doc_lines = 0;
static int txttl_cmp(const char *first, const char *second, int len) {
static int txttl_cmp(const char *first, const char *second, int len)
{
int cmp, i;
for (cmp=0, i=0; i<len; i++) {
if ( (cmp= toupper(first[i])-toupper(second[i])) ) {
@ -57,7 +58,8 @@ static int txttl_cmp(const char *first, const char *second, int len) {
return cmp;
}
static void txttl_free_suggest(void) {
static void txttl_free_suggest(void)
{
SuggItem *item, *prev;
for (item = suggestions.last; item; item=prev) {
prev = item->prev;
@ -69,7 +71,8 @@ static void txttl_free_suggest(void) {
suggestions.top = 0;
}
static void txttl_free_docs(void) {
static void txttl_free_docs(void)
{
if (documentation) {
MEM_freeN(documentation);
documentation = NULL;
@ -80,23 +83,27 @@ static void txttl_free_docs(void) {
/* General tool functions */
/**************************/
void free_texttools(void) {
void free_texttools(void)
{
txttl_free_suggest();
txttl_free_docs();
}
void texttool_text_set_active(Text *text) {
void texttool_text_set_active(Text *text)
{
if (activeToolText == text) return;
texttool_text_clear();
activeToolText = text;
}
void texttool_text_clear(void) {
void texttool_text_clear(void)
{
free_texttools();
activeToolText = NULL;
}
short texttool_text_is_active(Text *text) {
short texttool_text_is_active(Text *text)
{
return activeToolText==text ? 1 : 0;
}
@ -104,7 +111,8 @@ short texttool_text_is_active(Text *text) {
/* Suggestion list methods */
/***************************/
void texttool_suggest_add(const char *name, char type) {
void texttool_suggest_add(const char *name, char type)
{
SuggItem *newitem, *item;
int len, cmp;
@ -154,7 +162,8 @@ void texttool_suggest_add(const char *name, char type) {
suggestions.top= 0;
}
void texttool_suggest_prefix(const char *prefix) {
void texttool_suggest_prefix(const char *prefix)
{
SuggItem *match, *first, *last;
int cmp, len = strlen(prefix), top = 0;
@ -194,27 +203,33 @@ void texttool_suggest_prefix(const char *prefix) {
}
}
void texttool_suggest_clear(void) {
void texttool_suggest_clear(void)
{
txttl_free_suggest();
}
SuggItem *texttool_suggest_first(void) {
SuggItem *texttool_suggest_first(void)
{
return suggestions.firstmatch;
}
SuggItem *texttool_suggest_last(void) {
SuggItem *texttool_suggest_last(void)
{
return suggestions.lastmatch;
}
void texttool_suggest_select(SuggItem *sel) {
void texttool_suggest_select(SuggItem *sel)
{
suggestions.selected = sel;
}
SuggItem *texttool_suggest_selected(void) {
SuggItem *texttool_suggest_selected(void)
{
return suggestions.selected;
}
int *texttool_suggest_top(void) {
int *texttool_suggest_top(void)
{
return &suggestions.top;
}
@ -222,7 +237,8 @@ int *texttool_suggest_top(void) {
/* Documentation methods */
/*************************/
void texttool_docs_show(const char *docs) {
void texttool_docs_show(const char *docs)
{
int len;
if (!docs) return;
@ -246,10 +262,12 @@ void texttool_docs_show(const char *docs) {
documentation[len] = '\0';
}
char *texttool_docs_get(void) {
char *texttool_docs_get(void)
{
return documentation;
}
void texttool_docs_clear(void) {
void texttool_docs_clear(void)
{
txttl_free_docs();
}

@ -2851,7 +2851,8 @@ void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsign
/* Returns the first matching marker on the specified line between two points.
If the group or flags fields are non-zero the returned flag must be in the
specified group and have at least the specified flags set. */
TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags) {
TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags)
{
TextMarker *marker, *next;
int lineno= txt_get_span(text->lines.first, line);
@ -2918,7 +2919,8 @@ short txt_clear_markers(Text *text, int group, int flags)
/* Finds the marker at the specified line and cursor position with at least the
specified flags set in the given group (if non-zero). */
TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int flags) {
TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int flags)
{
TextMarker *marker;
int lineno= txt_get_span(text->lines.first, line);
@ -2936,7 +2938,8 @@ TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int
/* Finds the previous marker in the same group. If no other is found, the same
marker will be returned */
TextMarker *txt_prev_marker(Text *text, TextMarker *marker) {
TextMarker *txt_prev_marker(Text *text, TextMarker *marker)
{
TextMarker *tmp= marker;
while (tmp) {
if (tmp->prev) tmp= tmp->prev;
@ -2949,7 +2952,8 @@ TextMarker *txt_prev_marker(Text *text, TextMarker *marker) {
/* Finds the next marker in the same group. If no other is found, the same
marker will be returned */
TextMarker *txt_next_marker(Text *text, TextMarker *marker) {
TextMarker *txt_next_marker(Text *text, TextMarker *marker)
{
TextMarker *tmp= marker;
while (tmp) {
if (tmp->next) tmp= tmp->next;

@ -142,6 +142,16 @@ int BLI_ghashutil_strcmp (const void *a, const void *b);
unsigned int BLI_ghashutil_inthash (const void *ptr);
int BLI_ghashutil_intcmp (const void *a, const void *b);
typedef struct GHashPair {
const void *first;
int second;
} GHashPair;
GHashPair* BLI_ghashutil_pairalloc (const void *first, int second);
unsigned int BLI_ghashutil_pairhash (const void *ptr);
int BLI_ghashutil_paircmp (const void *a, const void *b);
void BLI_ghashutil_pairfree (void *ptr);
#ifdef __cplusplus
}
#endif

@ -94,7 +94,8 @@ void BLI_dynstr_append(DynStr *ds, const char *cstr)
ds->curlen+= cstrlen;
}
void BLI_dynstr_nappend(DynStr *ds, const char *cstr, int len) {
void BLI_dynstr_nappend(DynStr *ds, const char *cstr, int len)
{
DynStrElem *dse= malloc(sizeof(*dse));
int cstrlen= BLI_strnlen(cstr, len);
@ -225,7 +226,8 @@ int BLI_dynstr_get_len(DynStr *ds)
return ds->curlen;
}
char *BLI_dynstr_get_cstring(DynStr *ds) {
char *BLI_dynstr_get_cstring(DynStr *ds)
{
char *s, *rets= MEM_mallocN(ds->curlen+1, "dynstr_cstring");
DynStrElem *dse;
@ -241,7 +243,8 @@ char *BLI_dynstr_get_cstring(DynStr *ds) {
return rets;
}
void BLI_dynstr_free(DynStr *ds) {
void BLI_dynstr_free(DynStr *ds)
{
DynStrElem *dse;
for (dse= ds->elems; dse; ) {

@ -56,7 +56,8 @@ unsigned int hashsizes[]= {
/***/
GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) {
GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info)
{
GHash *gh= MEM_mallocN(sizeof(*gh), info);
gh->hashfp= hashfp;
gh->cmpfp= cmpfp;
@ -72,11 +73,13 @@ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) {
return gh;
}
int BLI_ghash_size(GHash *gh) {
int BLI_ghash_size(GHash *gh)
{
return gh->nentries;
}
void BLI_ghash_insert(GHash *gh, void *key, void *val) {
void BLI_ghash_insert(GHash *gh, void *key, void *val)
{
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
Entry *e= (Entry*) BLI_mempool_alloc(gh->entrypool);
@ -109,7 +112,8 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val) {
}
}
void *BLI_ghash_lookup(GHash *gh, const void *key) {
void *BLI_ghash_lookup(GHash *gh, const void *key)
{
if(gh) {
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
Entry *e;
@ -151,7 +155,8 @@ int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr
return 0;
}
int BLI_ghash_haskey(GHash *gh, void *key) {
int BLI_ghash_haskey(GHash *gh, void *key)
{
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
Entry *e;
@ -162,7 +167,8 @@ int BLI_ghash_haskey(GHash *gh, void *key) {
return 0;
}
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp) {
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
{
int i;
if (keyfreefp || valfreefp) {
@ -190,7 +196,8 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef
/***/
GHashIterator *BLI_ghashIterator_new(GHash *gh) {
GHashIterator *BLI_ghashIterator_new(GHash *gh)
{
GHashIterator *ghi= MEM_mallocN(sizeof(*ghi), "ghash iterator");
ghi->gh= gh;
ghi->curEntry= NULL;
@ -203,7 +210,8 @@ GHashIterator *BLI_ghashIterator_new(GHash *gh) {
}
return ghi;
}
void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) {
void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
{
ghi->gh= gh;
ghi->curEntry= NULL;
ghi->curBucket= -1;
@ -214,18 +222,22 @@ void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) {
ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
}
}
void BLI_ghashIterator_free(GHashIterator *ghi) {
void BLI_ghashIterator_free(GHashIterator *ghi)
{
MEM_freeN(ghi);
}
void *BLI_ghashIterator_getKey(GHashIterator *ghi) {
void *BLI_ghashIterator_getKey(GHashIterator *ghi)
{
return ghi->curEntry?ghi->curEntry->key:NULL;
}
void *BLI_ghashIterator_getValue(GHashIterator *ghi) {
void *BLI_ghashIterator_getValue(GHashIterator *ghi)
{
return ghi->curEntry?ghi->curEntry->val:NULL;
}
void BLI_ghashIterator_step(GHashIterator *ghi) {
void BLI_ghashIterator_step(GHashIterator *ghi)
{
if (ghi->curEntry) {
ghi->curEntry= ghi->curEntry->next;
while (!ghi->curEntry) {
@ -236,23 +248,27 @@ void BLI_ghashIterator_step(GHashIterator *ghi) {
}
}
}
int BLI_ghashIterator_isDone(GHashIterator *ghi) {
int BLI_ghashIterator_isDone(GHashIterator *ghi)
{
return !ghi->curEntry;
}
/***/
unsigned int BLI_ghashutil_ptrhash(const void *key) {
unsigned int BLI_ghashutil_ptrhash(const void *key)
{
return (unsigned int)(intptr_t)key;
}
int BLI_ghashutil_ptrcmp(const void *a, const void *b) {
int BLI_ghashutil_ptrcmp(const void *a, const void *b)
{
if (a==b)
return 0;
else
return (a<b)?-1:1;
}
unsigned int BLI_ghashutil_inthash(const void *ptr) {
unsigned int BLI_ghashutil_inthash(const void *ptr)
{
uintptr_t key = (uintptr_t)ptr;
key += ~(key << 16);
@ -265,14 +281,16 @@ unsigned int BLI_ghashutil_inthash(const void *ptr) {
return (unsigned int)(key & 0xffffffff);
}
int BLI_ghashutil_intcmp(const void *a, const void *b) {
int BLI_ghashutil_intcmp(const void *a, const void *b)
{
if (a==b)
return 0;
else
return (a<b)?-1:1;
}
unsigned int BLI_ghashutil_strhash(const void *ptr) {
unsigned int BLI_ghashutil_strhash(const void *ptr)
{
const char *s= ptr;
unsigned int i= 0;
unsigned char c;
@ -282,6 +300,39 @@ unsigned int BLI_ghashutil_strhash(const void *ptr) {
return i;
}
int BLI_ghashutil_strcmp(const void *a, const void *b) {
int BLI_ghashutil_strcmp(const void *a, const void *b)
{
return strcmp(a, b);
}
GHashPair *BLI_ghashutil_pairalloc(const void *first, int second)
{
GHashPair *pair = MEM_mallocN(sizeof(GHashPair), "GHashPair");
pair->first = first;
pair->second = second;
return pair;
}
unsigned int BLI_ghashutil_pairhash(const void *ptr)
{
const GHashPair *pair = ptr;
unsigned int hash = BLI_ghashutil_ptrhash(pair->first);
return hash ^ BLI_ghashutil_inthash(SET_INT_IN_POINTER(pair->second));
}
int BLI_ghashutil_paircmp(const void *a, const void *b)
{
const GHashPair *A = a;
const GHashPair *B = b;
int cmp = BLI_ghashutil_ptrcmp(A->first, B->first);
if(cmp == 0)
return BLI_ghashutil_intcmp(SET_INT_IN_POINTER(A->second), SET_INT_IN_POINTER(B->second));
return cmp;
}
void BLI_ghashutil_pairfree(void *ptr)
{
MEM_freeN((void*)ptr);
}

@ -35,7 +35,8 @@
#include "BLI_linklist.h"
#include "BLI_memarena.h"
int BLI_linklist_length(LinkNode *list) {
int BLI_linklist_length(LinkNode *list)
{
if (0) {
return list?(1+BLI_linklist_length(list->next)):0;
} else {
@ -70,7 +71,8 @@ LinkNode *BLI_linklist_find(LinkNode *list, int index)
return NULL;
}
void BLI_linklist_reverse(LinkNode **listp) {
void BLI_linklist_reverse(LinkNode **listp)
{
LinkNode *rhead= NULL, *cur= *listp;
while (cur) {
@ -85,7 +87,8 @@ void BLI_linklist_reverse(LinkNode **listp) {
*listp= rhead;
}
void BLI_linklist_prepend(LinkNode **listp, void *ptr) {
void BLI_linklist_prepend(LinkNode **listp, void *ptr)
{
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
nlink->link= ptr;
@ -93,7 +96,8 @@ void BLI_linklist_prepend(LinkNode **listp, void *ptr) {
*listp= nlink;
}
void BLI_linklist_append(LinkNode **listp, void *ptr) {
void BLI_linklist_append(LinkNode **listp, void *ptr)
{
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
LinkNode *node = *listp;
@ -110,7 +114,8 @@ void BLI_linklist_append(LinkNode **listp, void *ptr) {
}
}
void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma) {
void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma)
{
LinkNode *nlink= BLI_memarena_alloc(ma, sizeof(*nlink));
nlink->link= ptr;
@ -118,7 +123,8 @@ void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma) {
*listp= nlink;
}
void BLI_linklist_insert_after(LinkNode **listp, void *ptr) {
void BLI_linklist_insert_after(LinkNode **listp, void *ptr)
{
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
LinkNode *node = *listp;
@ -134,7 +140,8 @@ void BLI_linklist_insert_after(LinkNode **listp, void *ptr) {
}
}
void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc) {
void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc)
{
while (list) {
LinkNode *next= list->next;
@ -146,7 +153,8 @@ void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc) {
}
}
void BLI_linklist_apply(LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata) {
void BLI_linklist_apply(LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata)
{
for (; list; list= list->next)
applyfunc(list->link, userdata);
}

@ -48,7 +48,8 @@ struct MemArena {
LinkNode *bufs;
};
MemArena *BLI_memarena_new(int bufsize, const char *name) {
MemArena *BLI_memarena_new(int bufsize, const char *name)
{
MemArena *ma= MEM_callocN(sizeof(*ma), "memarena");
ma->bufsize= bufsize;
ma->align = 8;
@ -57,20 +58,24 @@ MemArena *BLI_memarena_new(int bufsize, const char *name) {
return ma;
}
void BLI_memarena_use_calloc(MemArena *ma) {
void BLI_memarena_use_calloc(MemArena *ma)
{
ma->use_calloc= 1;
}
void BLI_memarena_use_malloc(MemArena *ma) {
void BLI_memarena_use_malloc(MemArena *ma)
{
ma->use_calloc= 0;
}
void BLI_memarena_use_align(struct MemArena *ma, int align) {
void BLI_memarena_use_align(struct MemArena *ma, int align)
{
/* align should be a power of two */
ma->align = align;
}
void BLI_memarena_free(MemArena *ma) {
void BLI_memarena_free(MemArena *ma)
{
BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN);
MEM_freeN(ma);
}
@ -78,7 +83,8 @@ void BLI_memarena_free(MemArena *ma) {
/* amt must be power of two */
#define PADUP(num, amt) ((num+(amt-1))&~(amt-1))
void *BLI_memarena_alloc(MemArena *ma, int size) {
void *BLI_memarena_alloc(MemArena *ma, int size)
{
void *ptr;
/* ensure proper alignment by rounding

@ -42,7 +42,8 @@
/***/
EdgeHash *BLI_edgehash_new(void) {
EdgeHash *BLI_edgehash_new(void)
{
EdgeHash *eh= MEM_callocN(sizeof(*eh), "EdgeHash");
eh->cursize= 0;
eh->nentries= 0;
@ -54,11 +55,13 @@ EdgeHash *BLI_edgehash_new(void) {
return eh;
}
int BLI_edgehash_size(EdgeHash *eh) {
int BLI_edgehash_size(EdgeHash *eh)
{
return eh->nentries;
}
void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp) {
void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp)
{
int i;
for (i=0; i<eh->nbuckets; i++) {
@ -78,7 +81,8 @@ void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp) {
eh->nentries= 0;
}
void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP valfreefp) {
void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP valfreefp)
{
BLI_edgehash_clear(eh, valfreefp);
BLI_mempool_destroy(eh->epool);
@ -96,7 +100,8 @@ struct EdgeHashIterator {
EdgeEntry *curEntry;
};
EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) {
EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh)
{
EdgeHashIterator *ehi= MEM_mallocN(sizeof(*ehi), "eh iter");
ehi->eh= eh;
ehi->curEntry= NULL;
@ -109,26 +114,31 @@ EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) {
}
return ehi;
}
void BLI_edgehashIterator_free(EdgeHashIterator *ehi) {
void BLI_edgehashIterator_free(EdgeHashIterator *ehi)
{
MEM_freeN(ehi);
}
void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, int *v0_r, int *v1_r) {
void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, int *v0_r, int *v1_r)
{
if (ehi->curEntry) {
*v0_r = ehi->curEntry->v0;
*v1_r = ehi->curEntry->v1;
}
}
void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi) {
void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi)
{
return ehi->curEntry?ehi->curEntry->val:NULL;
}
void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val) {
void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val)
{
if(ehi->curEntry)
ehi->curEntry->val= val;
}
void BLI_edgehashIterator_step(EdgeHashIterator *ehi) {
void BLI_edgehashIterator_step(EdgeHashIterator *ehi)
{
if (ehi->curEntry) {
ehi->curEntry= ehi->curEntry->next;
while (!ehi->curEntry) {

@ -78,11 +78,13 @@ void rng_free(RNG* rng)
MEM_freeN(rng);
}
void rng_seed(RNG *rng, unsigned int seed) {
void rng_seed(RNG *rng, unsigned int seed)
{
rng->X= (((r_uint64) seed)<<16) | LOWSEED;
}
void rng_srandom(RNG *rng, unsigned int seed) {
void rng_srandom(RNG *rng, unsigned int seed)
{
rng_seed(rng, seed + hash[seed & 255]);
seed= rng_getInt(rng);
rng_seed(rng, seed + hash[seed & 255]);
@ -90,16 +92,19 @@ void rng_srandom(RNG *rng, unsigned int seed) {
rng_seed(rng, seed + hash[seed & 255]);
}
int rng_getInt(RNG *rng) {
int rng_getInt(RNG *rng)
{
rng->X= (MULTIPLIER*rng->X + ADDEND)&MASK;
return (int) (rng->X>>17);
}
double rng_getDouble(RNG *rng) {
double rng_getDouble(RNG *rng)
{
return (double) rng_getInt(rng)/0x80000000;
}
float rng_getFloat(RNG *rng) {
float rng_getFloat(RNG *rng)
{
return (float) rng_getInt(rng)/0x80000000;
}
@ -135,28 +140,34 @@ void rng_skip(RNG *rng, int n)
static RNG theBLI_rng = {0};
/* note, this one creates periodical patterns */
void BLI_srand(unsigned int seed) {
void BLI_srand(unsigned int seed)
{
rng_seed(&theBLI_rng, seed);
}
/* using hash table to create better seed */
void BLI_srandom(unsigned int seed) {
void BLI_srandom(unsigned int seed)
{
rng_srandom(&theBLI_rng, seed);
}
int BLI_rand(void) {
int BLI_rand(void)
{
return rng_getInt(&theBLI_rng);
}
double BLI_drand(void) {
double BLI_drand(void)
{
return rng_getDouble(&theBLI_rng);
}
float BLI_frand(void) {
float BLI_frand(void)
{
return rng_getFloat(&theBLI_rng);
}
void BLI_fillrand(void *addr, int len) {
void BLI_fillrand(void *addr, int len)
{
RNG rng;
unsigned char *p= addr;
@ -188,11 +199,13 @@ void BLI_thread_srandom(int thread, unsigned int seed)
rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
}
int BLI_thread_rand(int thread) {
int BLI_thread_rand(int thread)
{
return rng_getInt(&rng_tab[thread]);
}
float BLI_thread_frand(int thread) {
float BLI_thread_frand(int thread)
{
return rng_getFloat(&rng_tab[thread]);
}

@ -49,7 +49,8 @@
/* FILE_MAX */
int BLI_getInstallationDir( char * str ) {
int BLI_getInstallationDir( char * str )
{
char dir[FILE_MAXDIR];
int a;
@ -73,7 +74,8 @@ void RegisterBlendExtension_Fail(HKEY root)
TerminateProcess(GetCurrentProcess(),1);
}
void RegisterBlendExtension(void) {
void RegisterBlendExtension(void)
{
LONG lresult;
HKEY hkey = 0;
HKEY root = 0;
@ -167,7 +169,8 @@ void RegisterBlendExtension(void) {
TerminateProcess(GetCurrentProcess(),0);
}
DIR *opendir (const char *path) {
DIR *opendir (const char *path)
{
if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) {
DIR *newd= MEM_mallocN(sizeof(DIR), "opendir");
@ -185,7 +188,8 @@ DIR *opendir (const char *path) {
}
}
struct dirent *readdir(DIR *dp) {
struct dirent *readdir(DIR *dp)
{
if (dp->direntry.d_name) {
MEM_freeN(dp->direntry.d_name);
dp->direntry.d_name= NULL;
@ -208,7 +212,8 @@ struct dirent *readdir(DIR *dp) {
}
}
int closedir (DIR *dp) {
int closedir (DIR *dp)
{
if (dp->direntry.d_name) MEM_freeN(dp->direntry.d_name);
if (dp->handle!=INVALID_HANDLE_VALUE) FindClose(dp->handle);
@ -217,7 +222,8 @@ int closedir (DIR *dp) {
return 0;
}
void get_default_root(char* root) {
void get_default_root(char* root)
{
char str[MAX_PATH+1];
/* the default drive to resolve a directory without a specified drive

@ -389,17 +389,7 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
glEnable( GL_BLEND );
}
/* solid part */
uiDrawBox(GL_POLYGON, minx, miny, maxx, maxy, rad);
/* set antialias line */
glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
uiDrawBox(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
glDisable( GL_BLEND );
glDisable( GL_LINE_SMOOTH );
ui_draw_anti_roundbox(GL_POLYGON, minx, miny, maxx, maxy, rad);
}

@ -462,6 +462,7 @@ extern int ui_button_is_active(struct ARegion *ar);
/* interface_widgets.c */
void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3);
void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad);
void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
void ui_draw_search_back(struct uiStyle *style, uiBlock *block, rcti *rect);
int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol);

@ -200,7 +200,25 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
glDisableClientState(GL_VERTEX_ARRAY);
glDisable(GL_BLEND);
}
void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad)
{
float color[4];
int j;
glEnable(GL_BLEND);
glGetFloatv(GL_CURRENT_COLOR, color);
color[3] *= 0.125f;
glColor4fv(color);
for(j=0; j<8; j++) {
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
uiDrawBox(mode, minx, miny, maxx, maxy, rad);
glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
}
glDisable(GL_BLEND);
}
static void widget_init(uiWidgetBase *wtb)

@ -529,7 +529,8 @@ void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int compare(const void * a, const void * b){
static int compare(const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}

@ -47,9 +47,10 @@
#include "DNA_speaker_types.h"
#include "DNA_vfont_types.h"
#include "BLI_ghash.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "BKE_anim.h"
@ -1052,11 +1053,17 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
{
ListBase *lb;
DupliObject *dob;
GHash *dupli_gh= NULL, *parent_gh= NULL;
if(!(base->object->transflag & OB_DUPLI))
return;
lb= object_duplilist(scene, base->object);
if(use_hierarchy || use_base_parent) {
dupli_gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "make_object_duplilist_real dupli_gh");
parent_gh= BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "make_object_duplilist_real parent_gh");
}
for(dob= lb->first; dob; dob= dob->next) {
Base *basen;
@ -1085,6 +1092,11 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
copy_m4_m4(ob->obmat, dob->mat);
object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
if(dupli_gh)
BLI_ghash_insert(dupli_gh, dob, ob);
if(parent_gh)
BLI_ghash_insert(parent_gh, BLI_ghashutil_pairalloc(dob->ob, dob->index), ob);
}
if (use_hierarchy) {
@ -1093,12 +1105,17 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
Object *ob_src= dob->ob;
Object *ob_src_par= ob_src->parent;
Object *ob_dst= (Object *)ob_src->id.newid;
Object *ob_dst= BLI_ghash_lookup(dupli_gh, dob);
Object *ob_dst_par= NULL;
if (ob_src_par && ob_src_par->id.newid) {
/* the parent was also made real, parent newly real duplis */
Object *ob_dst_par= (Object *)ob_src_par->id.newid;
/* find parent that was also made real */
if(ob_src_par) {
GHashPair *pair = BLI_ghashutil_pairalloc(ob_src_par, dob->index);
ob_dst_par = BLI_ghash_lookup(parent_gh, pair);
BLI_ghashutil_pairfree(pair);
}
if (ob_dst_par) {
/* allow for all possible parent types */
ob_dst->partype= ob_src->partype;
BLI_strncpy(ob_dst->parsubstr, ob_src->parsubstr, sizeof(ob_dst->parsubstr));
@ -1132,8 +1149,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
* base object */
for(dob= lb->first; dob; dob= dob->next) {
/* original parents */
Object *ob_src= dob->ob;
Object *ob_dst= (Object *)ob_src->id.newid;
Object *ob_dst= BLI_ghash_lookup(dupli_gh, dob);
ob_dst->parent= base->object;
ob_dst->partype= PAROBJECT;
@ -1147,6 +1163,11 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
}
}
if(dupli_gh)
BLI_ghash_free(dupli_gh, NULL, NULL);
if(parent_gh)
BLI_ghash_free(parent_gh, BLI_ghashutil_pairfree, NULL);
copy_object_set_idnew(C, 0);
free_object_duplilist(lb);

@ -2605,8 +2605,8 @@ static int set_active_group_exec(bContext *C, wmOperator *op)
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
int nr= RNA_enum_get(op->ptr, "group");
BLI_assert(nr+1 >= 0);
ob->actdef= nr+1;
BLI_assert(ob->actdef >= 0);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob);
@ -2740,8 +2740,8 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
sort_map_update[0]= 0;
vgroup_remap_update_users(ob, sort_map_update);
BLI_assert(sort_map_update[ob->actdef] >= 0);
ob->actdef= sort_map_update[ob->actdef];
BLI_assert(ob->actdef >= 0);
MEM_freeN(sort_map_update);

@ -59,7 +59,8 @@
#include "physics_intern.h"
static int cache_break_test(void *UNUSED(cbd)) {
static int cache_break_test(void *UNUSED(cbd))
{
return G.afbreek==1;
}
static int ptcache_bake_all_poll(bContext *C)

@ -1103,8 +1103,8 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op)
ViewContext vc;
view3d_set_viewcontext(C, &vc);
BLI_assert(type + 1 >= 0);
vc.obact->actdef= type + 1;
BLI_assert(vc.obact->actdef >= 0);
DAG_id_tag_update(&vc.obact->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, vc.obact);
@ -1998,8 +1998,9 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
dg= ED_vgroup_add_name(ob, pchan->name); /* sets actdef */
}
else {
ob->actdef= 1 + BLI_findindex(&ob->defbase, dg);
BLI_assert(ob->actdef >= 0);
int actdef = 1 + BLI_findindex(&ob->defbase, dg);
BLI_assert(actdef >= 0);
ob->actdef= actdef;
}
}
}

@ -212,6 +212,104 @@ static void SOUND_OT_open_mono(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "mono", TRUE, "Mono", "Mixdown the sound to mono");
}
/* ******************************************************* */
static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op))
{
Sequence* seq;
Scene* scene = CTX_data_scene(C);
struct FCurve* fcu;
char driven;
SEQ_BEGIN(scene->ed, seq) {
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, &driven);
if(fcu || driven)
seq->flag |= SEQ_AUDIO_VOLUME_ANIMATED;
else
seq->flag &= ~SEQ_AUDIO_VOLUME_ANIMATED;
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pitch", 0, &driven);
if(fcu || driven)
seq->flag |= SEQ_AUDIO_PITCH_ANIMATED;
else
seq->flag &= ~SEQ_AUDIO_PITCH_ANIMATED;
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pan", 0, &driven);
if(fcu || driven)
seq->flag |= SEQ_AUDIO_PAN_ANIMATED;
else
seq->flag &= ~SEQ_AUDIO_PAN_ANIMATED;
}
SEQ_END
fcu = id_data_find_fcurve(&scene->id, scene, &RNA_Scene, "audio_volume", 0, &driven);
if(fcu || driven)
scene->audio.flag |= AUDIO_VOLUME_ANIMATED;
else
scene->audio.flag &= ~AUDIO_VOLUME_ANIMATED;
return OPERATOR_FINISHED;
}
static void SOUND_OT_update_animation_flags(wmOperatorType *ot)
{
/*
This operator is needed to set a correct state of the sound animation
System. Unfortunately there's no really correct place to call the exec
function, that's why I made it an operator that's only visible in the
search menu. Apart from that the bake animation operator calls it too.
*/
/* identifiers */
ot->name= "Update animation";
ot->description= "Update animation flags";
ot->idname= "SOUND_OT_update_animation_flags";
/* api callbacks */
ot->exec= sound_update_animation_flags_exec;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/* ******************************************************* */
static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
{
Main* bmain = CTX_data_main(C);
Scene* scene = CTX_data_scene(C);
int oldfra = scene->r.cfra;
int cfra;
sound_update_animation_flags_exec(C, NULL);
for(cfra = scene->r.sfra > 0 ? scene->r.sfra - 1 : 0; cfra <= scene->r.efra + 1; cfra++)
{
scene->r.cfra = cfra;
scene_update_for_newframe(bmain, scene, scene->lay);
}
scene->r.cfra = oldfra;
scene_update_for_newframe(bmain, scene, scene->lay);
return OPERATOR_FINISHED;
}
static void SOUND_OT_bake_animation(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Update animation cache";
ot->description= "Updates the audio animation cache so that it's up to date";
ot->idname= "SOUND_OT_bake_animation";
/* api callbacks */
ot->exec= sound_bake_animation_exec;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************** mixdown operator ********************/
static int sound_mixdown_exec(bContext *C, wmOperator *op)
@ -228,6 +326,8 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
AUD_Codec codec;
const char* result;
sound_bake_animation_exec(C, op);
RNA_string_get(op->ptr, "filepath", path);
bitrate = RNA_int_get(op->ptr, "bitrate") * 1000;
accuracy = RNA_int_get(op->ptr, "accuracy");
@ -613,104 +713,6 @@ static void SOUND_OT_unpack(wmOperatorType *ot)
RNA_def_string(ot->srna, "id", "", MAX_ID_NAME-2, "Sound Name", "Sound datablock name to unpack"); /* XXX, weark!, will fail with library, name collisions */
}
/* ******************************************************* */
static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op))
{
Sequence* seq;
Scene* scene = CTX_data_scene(C);
struct FCurve* fcu;
char driven;
SEQ_BEGIN(scene->ed, seq) {
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, &driven);
if(fcu || driven)
seq->flag |= SEQ_AUDIO_VOLUME_ANIMATED;
else
seq->flag &= ~SEQ_AUDIO_VOLUME_ANIMATED;
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pitch", 0, &driven);
if(fcu || driven)
seq->flag |= SEQ_AUDIO_PITCH_ANIMATED;
else
seq->flag &= ~SEQ_AUDIO_PITCH_ANIMATED;
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pan", 0, &driven);
if(fcu || driven)
seq->flag |= SEQ_AUDIO_PAN_ANIMATED;
else
seq->flag &= ~SEQ_AUDIO_PAN_ANIMATED;
}
SEQ_END
fcu = id_data_find_fcurve(&scene->id, scene, &RNA_Scene, "audio_volume", 0, &driven);
if(fcu || driven)
scene->audio.flag |= AUDIO_VOLUME_ANIMATED;
else
scene->audio.flag &= ~AUDIO_VOLUME_ANIMATED;
return OPERATOR_FINISHED;
}
static void SOUND_OT_update_animation_flags(wmOperatorType *ot)
{
/*
This operator is needed to set a correct state of the sound animation
System. Unfortunately there's no really correct place to call the exec
function, that's why I made it an operator that's only visible in the
search menu. Apart from that the bake animation operator calls it too.
*/
/* identifiers */
ot->name= "Update animation";
ot->description= "Update animation flags";
ot->idname= "SOUND_OT_update_animation_flags";
/* api callbacks */
ot->exec= sound_update_animation_flags_exec;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/* ******************************************************* */
static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
{
Main* bmain = CTX_data_main(C);
Scene* scene = CTX_data_scene(C);
int oldfra = scene->r.cfra;
int cfra;
sound_update_animation_flags_exec(C, NULL);
for(cfra = scene->r.sfra > 0 ? scene->r.sfra - 1 : 0; cfra <= scene->r.efra + 1; cfra++)
{
scene->r.cfra = cfra;
scene_update_for_newframe(bmain, scene, scene->lay);
}
scene->r.cfra = oldfra;
scene_update_for_newframe(bmain, scene, scene->lay);
return OPERATOR_FINISHED;
}
static void SOUND_OT_bake_animation(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Update animation cache";
ot->description= "Updates the audio animation cache so that it's up to date";
ot->idname= "SOUND_OT_bake_animation";
/* api callbacks */
ot->exec= sound_bake_animation_exec;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/* ******************************************************* */
void ED_operatortypes_sound(void)

@ -396,8 +396,8 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *
/* id in tselem is object */
ob= (Object *)tselem->id;
if(set) {
BLI_assert(te->index+1 >= 0);
ob->actdef= te->index+1;
BLI_assert(ob->actdef >= 0);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);

@ -380,7 +380,8 @@ static void viewRedrawPost(bContext *C, TransInfo *t)
/* ************************** TRANSFORMATIONS **************************** */
void BIF_selectOrientation(void) {
void BIF_selectOrientation(void)
{
#if 0 // TRANSFORM_FIX_ME
short val;
char *str_menu = BIF_menustringTransformOrientation("Orientation");
@ -2551,7 +2552,8 @@ void initResize(TransInfo *t)
t->num.increment = t->snap[1];
}
static void headerResize(TransInfo *t, float vec[3], char *str) {
static void headerResize(TransInfo *t, float vec[3], char *str)
{
char tvec[60];
char *spos= str;
if (hasNumInput(&t->num)) {
@ -2611,7 +2613,8 @@ static void TransMat3ToSize( float mat[][3], float smat[][3], float *size)
}
static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) {
static void ElementResize(TransInfo *t, TransData *td, float mat[3][3])
{
float tmat[3][3], smat[3][3], center[3];
float vec[3];
@ -2908,7 +2911,8 @@ void initRotation(TransInfo *t)
copy_v3_v3(t->axis_orig, t->axis);
}
static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around) {
static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around)
{
float vec[3], totmat[3][3], smat[3][3];
float eul[3], fmat[3][3], quat[4];
float *center = t->center;
@ -3348,7 +3352,8 @@ void initTranslation(TransInfo *t)
t->num.increment = t->snap[1];
}
static void headerTranslation(TransInfo *t, float vec[3], char *str) {
static void headerTranslation(TransInfo *t, float vec[3], char *str)
{
char *spos= str;
char tvec[60];
char distvec[20];
@ -3422,7 +3427,8 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
(void)spos;
}
static void applyTranslation(TransInfo *t, float vec[3]) {
static void applyTranslation(TransInfo *t, float vec[3])
{
TransData *td = t->data;
float tvec[3];
int i;
@ -4104,7 +4110,8 @@ void initBoneSize(TransInfo *t)
t->num.increment = t->snap[1];
}
static void headerBoneSize(TransInfo *t, float vec[3], char *str) {
static void headerBoneSize(TransInfo *t, float vec[3], char *str)
{
char tvec[60];
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
@ -5194,7 +5201,8 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str)
sprintf(str, "Sequence Slide: %s%s", &tvec[0], t->con.text);
}
static void applySeqSlide(TransInfo *t, float val[2]) {
static void applySeqSlide(TransInfo *t, float val[2])
{
TransData *td = t->data;
int i;
@ -5718,7 +5726,8 @@ void initTimeScale(TransInfo *t)
t->num.increment = t->snap[1];
}
static void headerTimeScale(TransInfo *t, char *str) {
static void headerTimeScale(TransInfo *t, char *str)
{
char tvec[60];
if (hasNumInput(&t->num))
@ -5729,7 +5738,8 @@ static void headerTimeScale(TransInfo *t, char *str) {
sprintf(str, "ScaleX: %s", &tvec[0]);
}
static void applyTimeScale(TransInfo *t) {
static void applyTimeScale(TransInfo *t)
{
Scene *scene = t->scene;
TransData *td = t->data;
TransData2D *td2d = t->data2d;

@ -138,7 +138,8 @@ void constraintNumInput(TransInfo *t, float vec[3])
}
}
static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) {
static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
{
int i = 0;
mul_m3_v3(t->con.imtx, vec);
@ -209,7 +210,8 @@ static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3])
}
}
static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) {
static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3])
{
float norm[3], vec[3], factor, angle;
float t_con_center[3];
@ -284,7 +286,8 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
}
}
static void planeProjection(TransInfo *t, float in[3], float out[3]) {
static void planeProjection(TransInfo *t, float in[3], float out[3])
{
float vec[3], factor, norm[3];
add_v3_v3v3(vec, in, t->con.center);
@ -547,7 +550,8 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3],
/*--------------------- INTERNAL SETUP CALLS ------------------*/
void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) {
void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[])
{
strncpy(t->con.text + 1, text, 48);
copy_m3_m3(t->con.mtx, space);
t->con.mode = mode;
@ -562,7 +566,8 @@ void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[])
t->redraw = 1;
}
void setLocalConstraint(TransInfo *t, int mode, const char text[]) {
void setLocalConstraint(TransInfo *t, int mode, const char text[])
{
if (t->flag & T_EDIT) {
float obmat[3][3];
copy_m3_m4(obmat, t->scene->obedit->obmat);
@ -596,7 +601,8 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[]) {
ftext is a format string passed to sprintf. It will add the name of
the orientation where %s is (logically).
*/
void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) {
void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[])
{
char text[40];
switch(orientation) {
@ -744,7 +750,8 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
}
}
static void drawObjectConstraint(TransInfo *t) {
static void drawObjectConstraint(TransInfo *t)
{
int i;
TransData * td = t->data;
@ -781,13 +788,15 @@ static void drawObjectConstraint(TransInfo *t) {
/*--------------------- START / STOP CONSTRAINTS ---------------------- */
void startConstraint(TransInfo *t) {
void startConstraint(TransInfo *t)
{
t->con.mode |= CON_APPLY;
*t->con.text = ' ';
t->num.idx_max = MIN2(getConstraintSpaceDimension(t) - 1, t->idx_max);
}
void stopConstraint(TransInfo *t) {
void stopConstraint(TransInfo *t)
{
t->con.mode &= ~(CON_APPLY|CON_SELECT);
*t->con.text = '\0';
t->num.idx_max = t->idx_max;
@ -836,7 +845,8 @@ void initSelectConstraint(TransInfo *t, float mtx[3][3])
t->con.applyRot = applyAxisConstraintRot;
}
void selectConstraint(TransInfo *t) {
void selectConstraint(TransInfo *t)
{
if (t->con.mode & CON_SELECT) {
setNearestAxis(t);
startConstraint(t);
@ -970,7 +980,8 @@ void setNearestAxis(TransInfo *t)
/*-------------- HELPER FUNCTIONS ----------------*/
char constraintModeToChar(TransInfo *t) {
char constraintModeToChar(TransInfo *t)
{
if ((t->con.mode & CON_APPLY)==0) {
return '\0';
}
@ -990,7 +1001,8 @@ char constraintModeToChar(TransInfo *t) {
}
int isLockConstraint(TransInfo *t) {
int isLockConstraint(TransInfo *t)
{
int mode = t->con.mode;
if ( (mode & (CON_AXIS0|CON_AXIS1)) == (CON_AXIS0|CON_AXIS1))

@ -122,7 +122,8 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list);
/* ************************** Functions *************************** */
static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp) {
static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp)
{
TransData *ihead = head;
TransData *itail = tail;
*temp = *head;
@ -169,7 +170,8 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra
}
}
void sort_trans_data_dist(TransInfo *t) {
void sort_trans_data_dist(TransInfo *t)
{
TransData temp;
TransData *start = t->data;
int i = 1;
@ -1334,7 +1336,8 @@ static void createTransMBallVerts(TransInfo *t)
/* ********************* curve/surface ********* */
static void calc_distanceCurveVerts(TransData *head, TransData *tail) {
static void calc_distanceCurveVerts(TransData *head, TransData *tail)
{
TransData *td, *td_near = NULL;
for (td = head; td<=tail; td++) {
if (td->flag & TD_SELECTED) {
@ -1379,7 +1382,8 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) {
}
/* Utility function for getting the handle data from bezier's */
static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt) {
static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt)
{
TransDataCurveHandleFlags *hdata;
td->flag |= TD_BEZTRIPLE;
hdata = td->hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");

@ -128,7 +128,8 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name
}
}
TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) {
TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite)
{
Base *base = CTX_data_active_base(C);
Object *ob;
float mat[3][3];
@ -151,7 +152,8 @@ TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports)
return addMatrixSpace(C, mat, name, overwrite);
}
TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite) {
TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite)
{
float mat[3][3];
float normal[3], plane[3];
@ -170,7 +172,8 @@ TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *na
return addMatrixSpace(C, mat, name, overwrite);
}
TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *name, int overwrite) {
TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *name, int overwrite)
{
float mat[3][3];
float normal[3], plane[3];
int type;
@ -268,7 +271,8 @@ int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3])
return 1;
}
TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], int overwrite) {
TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], int overwrite)
{
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
TransformOrientation *ts = NULL;
@ -295,7 +299,8 @@ TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[],
return ts;
}
void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) {
void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target)
{
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
TransformOrientation *ts;
int i;
@ -322,7 +327,8 @@ void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) {
}
}
void BIF_removeTransformOrientationIndex(bContext *C, int index) {
void BIF_removeTransformOrientationIndex(bContext *C, int index)
{
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
TransformOrientation *ts= BLI_findlink(transform_spaces, index);
@ -345,7 +351,8 @@ void BIF_removeTransformOrientationIndex(bContext *C, int index) {
}
}
void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) {
void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target)
{
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
View3D *v3d = CTX_wm_view3d(C);
TransformOrientation *ts;
@ -359,7 +366,8 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) {
}
}
void BIF_selectTransformOrientationValue(bContext *C, int orientation) {
void BIF_selectTransformOrientationValue(bContext *C, int orientation)
{
View3D *v3d = CTX_wm_view3d(C);
if(v3d) /* currently using generic poll */
v3d->twmode = orientation;
@ -408,7 +416,8 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C)
return item;
}
const char * BIF_menustringTransformOrientation(const bContext *C, const char *title) {
const char * BIF_menustringTransformOrientation(const bContext *C, const char *title)
{
const char* menu = IFACE_("%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3");
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
TransformOrientation *ts;
@ -430,7 +439,8 @@ const char * BIF_menustringTransformOrientation(const bContext *C, const char *t
return str_menu;
}
int BIF_countTransformOrientation(const bContext *C) {
int BIF_countTransformOrientation(const bContext *C)
{
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
TransformOrientation *ts;
int count = 0;
@ -442,7 +452,8 @@ int BIF_countTransformOrientation(const bContext *C) {
return count;
}
void applyTransformOrientation(const bContext *C, float mat[3][3], char *name) {
void applyTransformOrientation(const bContext *C, float mat[3][3], char *name)
{
TransformOrientation *ts;
View3D *v3d = CTX_wm_view3d(C);
int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);

@ -647,11 +647,13 @@ static char *code_generate_vertex(ListBase *nodes)
return code;
}
int GPU_bicubic_bump_support(void){
int GPU_bicubic_bump_support(void)
{
return GLEW_ARB_texture_gather && GLEW_ARB_texture_query_lod && GLEW_VERSION_3_0;
}
void GPU_code_generate_glsl_lib(void){
void GPU_code_generate_glsl_lib(void)
{
DynStr *ds;
/* only initialize the library once */

@ -110,7 +110,8 @@
#endif
#endif
int ismovie(const char *UNUSED(filepath)) {
int ismovie(const char *UNUSED(filepath))
{
return 0;
}
@ -126,7 +127,8 @@ static void free_anim_movie(struct anim *UNUSED(anim)) { ; }
# define PATHSEPERATOR '/'
#endif
static int an_stringdec(const char *string, char* head, char *tail, unsigned short *numlen) {
static int an_stringdec(const char *string, char* head, char *tail, unsigned short *numlen)
{
unsigned short len,nume,nums=0;
short i,found=FALSE;
@ -161,11 +163,13 @@ static int an_stringdec(const char *string, char* head, char *tail, unsigned sho
}
static void an_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic) {
static void an_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic)
{
BLI_stringenc(string, head, tail, numlen, pic);
}
static void free_anim_avi (struct anim *anim) {
static void free_anim_avi (struct anim *anim)
{
#if defined(_WIN32) && !defined(FREE_WINDOWS)
int i;
#endif
@ -206,7 +210,8 @@ static void free_anim_ffmpeg(struct anim * anim);
static void free_anim_redcode(struct anim * anim);
#endif
void IMB_free_anim(struct anim * anim) {
void IMB_free_anim(struct anim * anim)
{
if (anim == NULL) {
printf("free anim, anim == NULL\n");
return;
@ -229,14 +234,16 @@ void IMB_free_anim(struct anim * anim) {
MEM_freeN(anim);
}
void IMB_close_anim(struct anim * anim) {
void IMB_close_anim(struct anim * anim)
{
if (anim == NULL) return;
IMB_free_anim(anim);
}
struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex) {
struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex)
{
struct anim * anim;
anim = (struct anim*)MEM_callocN(sizeof(struct anim), "anim struct");
@ -249,7 +256,8 @@ struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex) {
}
static int startavi (struct anim *anim) {
static int startavi (struct anim *anim)
{
AviError avierror;
#if defined(_WIN32) && !defined(FREE_WINDOWS)
@ -355,7 +363,8 @@ static int startavi (struct anim *anim) {
return 0;
}
static ImBuf * avi_fetchibuf (struct anim *anim, int position) {
static ImBuf * avi_fetchibuf (struct anim *anim, int position)
{
ImBuf *ibuf = NULL;
int *tmp;
int y;
@ -405,7 +414,8 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) {
extern void do_init_ffmpeg(void);
static int startffmpeg(struct anim * anim) {
static int startffmpeg(struct anim * anim)
{
int i, videoStream;
AVCodec *pCodec;
@ -693,7 +703,6 @@ static void ffmpeg_postprocess(struct anim * anim)
int dstStride2[4] = { -dstStride[0], 0, 0, 0 };
uint8_t* dst2[4] = { dst[0] + (anim->y - 1)*dstStride[0],
0, 0, 0 };
int i;
sws_scale(anim->img_convert_ctx,
(const uint8_t * const *)input->data,
@ -1032,7 +1041,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
return anim->last_frame;
}
static void free_anim_ffmpeg(struct anim * anim) {
static void free_anim_ffmpeg(struct anim * anim)
{
if (anim == NULL) return;
if (anim->pCodecCtx) {
@ -1058,7 +1068,8 @@ static void free_anim_ffmpeg(struct anim * anim) {
#ifdef WITH_REDCODE
static int startredcode(struct anim * anim) {
static int startredcode(struct anim * anim)
{
anim->redcodeCtx = redcode_open(anim->name);
if (!anim->redcodeCtx) {
return -1;
@ -1068,7 +1079,8 @@ static int startredcode(struct anim * anim) {
return 0;
}
static ImBuf * redcode_fetchibuf(struct anim * anim, int position) {
static ImBuf * redcode_fetchibuf(struct anim * anim, int position)
{
struct ImBuf * ibuf;
struct redcode_frame * frame;
struct redcode_frame_raw * raw_frame;
@ -1099,7 +1111,8 @@ static ImBuf * redcode_fetchibuf(struct anim * anim, int position) {
return ibuf;
}
static void free_anim_redcode(struct anim * anim) {
static void free_anim_redcode(struct anim * anim)
{
if (anim->redcodeCtx) {
redcode_close(anim->redcodeCtx);
anim->redcodeCtx = 0;
@ -1113,7 +1126,8 @@ static void free_anim_redcode(struct anim * anim) {
/* Geen plaatje, probeer dan volgende animatie te openen */
/* gelukt, haal dan eerste plaatje van animatie */
static struct ImBuf * anim_getnew(struct anim * anim) {
static struct ImBuf * anim_getnew(struct anim * anim)
{
struct ImBuf *ibuf = NULL;
if (anim == NULL) return(NULL);
@ -1175,7 +1189,8 @@ static struct ImBuf * anim_getnew(struct anim * anim) {
return(ibuf);
}
struct ImBuf * IMB_anim_previewframe(struct anim * anim) {
struct ImBuf * IMB_anim_previewframe(struct anim * anim)
{
struct ImBuf * ibuf = NULL;
int position = 0;
@ -1282,7 +1297,8 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position,
/***/
int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc) {
int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc)
{
struct anim_index * idx;
if (tc == IMB_TC_NONE) {
return anim->duration;

@ -185,14 +185,16 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags)
}
/* Couple of helper functions for writing our data */
static int putIntLSB(unsigned int ui,FILE *ofile) {
static int putIntLSB(unsigned int ui,FILE *ofile)
{
putc((ui>>0)&0xFF,ofile);
putc((ui>>8)&0xFF,ofile);
putc((ui>>16)&0xFF,ofile);
return putc((ui>>24)&0xFF,ofile);
}
static int putShortLSB(unsigned short us,FILE *ofile) {
static int putShortLSB(unsigned short us,FILE *ofile)
{
putc((us>>0)&0xFF,ofile);
return putc((us>>8)&0xFF,ofile);
}

@ -70,21 +70,24 @@ int imb_is_a_jp2(unsigned char *buf)
/**
sample error callback expecting a FILE* client object
*/
static void error_callback(const char *msg, void *client_data) {
static void error_callback(const char *msg, void *client_data)
{
FILE *stream = (FILE*)client_data;
fprintf(stream, "[ERROR] %s", msg);
}
/**
sample warning callback expecting a FILE* client object
*/
static void warning_callback(const char *msg, void *client_data) {
static void warning_callback(const char *msg, void *client_data)
{
FILE *stream = (FILE*)client_data;
fprintf(stream, "[WARNING] %s", msg);
}
/**
sample debug callback expecting no client object
*/
static void info_callback(const char *msg, void *client_data) {
static void info_callback(const char *msg, void *client_data)
{
(void)client_data;
fprintf(stdout, "[INFO] %s", msg);
}
@ -305,7 +308,8 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
#define COMP_48_CS 520833 /*Maximum size per color component for 2K @ 48fps*/
static int initialise_4K_poc(opj_poc_t *POC, int numres){
static int initialise_4K_poc(opj_poc_t *POC, int numres)
{
POC[0].tile = 1;
POC[0].resno0 = 0;
POC[0].compno0 = 0;
@ -323,7 +327,8 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
return 2;
}
static void cinema_parameters(opj_cparameters_t *parameters){
static void cinema_parameters(opj_cparameters_t *parameters)
{
parameters->tile_size_on = false;
parameters->cp_tdx=1;
parameters->cp_tdy=1;
@ -356,7 +361,8 @@ static void cinema_parameters(opj_cparameters_t *parameters){
}
static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol)
{
int i;
float temp_rate;
@ -442,8 +448,8 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
}
static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) {
static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
{
unsigned char *rect;
float *rect_float;
@ -662,8 +668,8 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) {
/* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */
int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) {
int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags)
{
int quality = ibuf->ftype & 0xff;
int bSuccess;

@ -199,12 +199,14 @@ int IMB_ispic(const char *filename)
static int isavi (const char *name) {
static int isavi (const char *name)
{
return AVI_is_avi (name);
}
#ifdef WITH_QUICKTIME
static int isqtime (const char *name) {
static int isqtime (const char *name)
{
return anim_is_quicktime (name);
}
#endif
@ -240,7 +242,8 @@ void do_init_ffmpeg(void)
}
}
static int isffmpeg (const char *filename) {
static int isffmpeg (const char *filename)
{
AVFormatContext *pFormatCtx;
unsigned int i;
int videoStream;
@ -323,7 +326,8 @@ static int isredcode(const char * filename)
#endif
int imb_get_anim_type(const char * name) {
int imb_get_anim_type(const char * name)
{
int type;
struct stat st;
@ -364,7 +368,8 @@ int imb_get_anim_type(const char * name) {
return(0);
}
int IMB_isanim(const char *filename) {
int IMB_isanim(const char *filename)
{
int type;
if(U.uiflag & USER_FILTERFILEEXTS) {

@ -40,6 +40,7 @@ DefNode( ShaderNode, SH_NODE_VALTORGB, def_colorramp, "VALTO
DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
DefNode( ShaderNode, SH_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
DefNode( ShaderNode, SH_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" )
DefNode( ShaderNode, SH_NODE_GEOMETRY, def_sh_geometry, "GEOMETRY", Geometry, "Geometry", "" )
DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" )
DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curve", "" )

@ -113,6 +113,7 @@ set(SRC
shader/nodes/node_shader_common.c
shader/nodes/node_shader_curves.c
shader/nodes/node_shader_dynamic.c
shader/nodes/node_shader_gamma.c
shader/nodes/node_shader_geom.c
shader/nodes/node_shader_hueSatVal.c
shader/nodes/node_shader_invert.c

@ -54,6 +54,7 @@ void register_node_type_sh_valtorgb(struct bNodeTreeType *ttype);
void register_node_type_sh_rgbtobw(struct bNodeTreeType *ttype);
void register_node_type_sh_texture(struct bNodeTreeType *ttype);
void register_node_type_sh_normal(struct bNodeTreeType *ttype);
void register_node_type_sh_gamma(struct bNodeTreeType *ttype);
void register_node_type_sh_geom(struct bNodeTreeType *ttype);
void register_node_type_sh_mapping(struct bNodeTreeType *ttype);
void register_node_type_sh_curve_vec(struct bNodeTreeType *ttype);

@ -0,0 +1,63 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/nodes/composite/nodes/node_composite_gamma.c
* \ingroup cmpnodes
*/
#include "node_shader_util.h"
/* **************** Gamma Tools ******************** */
static bNodeSocketTemplate sh_node_gamma_in[]= {
{ SOCK_RGBA, 1, "Color", 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, "Gamma", 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED},
{ -1, 0, "" }
};
static bNodeSocketTemplate sh_node_gamma_out[]= {
{ SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
void register_node_type_sh_gamma(bNodeTreeType *ttype)
{
static bNodeType ntype;
node_type_base(ttype, &ntype, SH_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_compatibility(&ntype, NODE_NEW_SHADING);
node_type_socket_templates(&ntype, sh_node_gamma_in, sh_node_gamma_out);
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, NULL);
nodeRegisterType(ttype, &ntype);
}

@ -805,7 +805,8 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj
PyDoc_STRVAR(M_Geometry_intersect_point_quad_2d_doc,
".. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4)\n"
"\n"
" Takes 5 vectors (using only the x and y coordinates): one is the point and the next 4 define the quad, only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n"
" Takes 5 vectors (using only the x and y coordinates): one is the point and the next 4 define the quad, \n"
" only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n"
"\n"
" :arg pt: Point\n"
" :type pt: :class:`mathutils.Vector`\n"

@ -658,7 +658,7 @@ int append_qt(struct RenderData *rd, int frame, int *pixels, int rectx, int rect
}
else {
//Error getting audio packets
BKE_reportf(reports, RPT_ERROR, "Unable to get further audio packets from frame %i, error = 0x%x",qtexport->audioTotalExportedFrames,err);
BKE_reportf(reports, RPT_ERROR, "Unable to get further audio packets from frame %i, error = 0x%x",(int)qtexport->audioTotalExportedFrames,err);
break;
}
@ -779,7 +779,7 @@ void free_qtcomponentdata(void) {
void quicktime_verify_image_type(RenderData *rd)
{
if (rd->imtype == R_IMF_IMTYPE_QUICKTIME) {
if (rd->im_format.imtype == R_IMF_IMTYPE_QUICKTIME) {
if ((rd->qtcodecsettings.codecType<= 0) ||
(rd->qtcodecsettings.codecSpatialQuality <0) ||
(rd->qtcodecsettings.codecSpatialQuality > 100)) {

@ -689,7 +689,7 @@ static void check_renderbutton_framerate(RenderData *rd, ReportList *reports)
void quicktime_verify_image_type(RenderData *rd)
{
if (rd->imtype == R_IMF_IMTYPE_QUICKTIME) {
if (rd->im_format.imtype == R_IMF_IMTYPE_QUICKTIME) {
if ((rd->qtcodecsettings.codecType== 0) ||
(rd->qtcodecsettings.codecSpatialQuality <0) ||
(rd->qtcodecsettings.codecSpatialQuality > 100)) {

@ -1950,7 +1950,15 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *
initVideoTexture();
/* could be done a lot more nicely, but for now a quick way to get bge.* working */
PyRun_SimpleString("sys = __import__('sys');mod = sys.modules['bge'] = type(sys)('bge');mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes'), 'texture':__import__('VideoTexture')});");
PyRun_SimpleString("sys = __import__('sys');"
"mod = sys.modules['bge'] = type(sys)('bge');"
"mod.__dict__.update({'logic':__import__('GameLogic'), "
"'render':__import__('Rasterizer'), "
"'events':__import__('GameKeys'), "
"'constraints':__import__('PhysicsConstraints'), "
"'types':__import__('GameTypes'), "
"'texture':__import__('VideoTexture')});"
);
}
static struct PyModuleDef Rasterizer_module_def = {