Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-09-01 04:56:21 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-01 04:56:21 +0400
commitfb3f7d95664dd71a545061ddf8d75726ff423c10 (patch)
tree49fa13b4c511d05070ad7f359f2b646ba33dbb09 /source/blender
parent9bc92b21468f1d0fee77e7aac34145f3f0345dfc (diff)
parent22676a434efdb99e38535b2f4a2623ea670ebf4d (diff)
svn merge -r39792:39829 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenfont/intern/blf.c30
-rw-r--r--source/blender/blenfont/intern/blf_font.c9
-rw-r--r--source/blender/blenkernel/BKE_sound.h2
-rw-r--r--source/blender/blenkernel/intern/collision.c2
-rw-r--r--source/blender/blenkernel/intern/particle_system.c11
-rw-r--r--source/blender/blenkernel/intern/pointcache.c20
-rw-r--r--source/blender/blenkernel/intern/report.c6
-rw-r--r--source/blender/blenkernel/intern/sequencer.c13
-rw-r--r--source/blender/blenkernel/intern/sound.c10
-rw-r--r--source/blender/blenkernel/intern/unit.c11
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c6
-rw-r--r--source/blender/blenlib/BLI_callbacks.h1
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c8
-rw-r--r--source/blender/blenlib/intern/BLI_kdtree.c4
-rw-r--r--source/blender/blenlib/intern/graph.c2
-rw-r--r--source/blender/blenlib/intern/math_matrix.c2
-rw-r--r--source/blender/blenlib/intern/storage.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/blenpluginapi/iff.h2
-rw-r--r--source/blender/collada/AnimationExporter.h2
-rw-r--r--source/blender/collada/ArmatureImporter.cpp5
-rw-r--r--source/blender/collada/ExtraHandler.cpp2
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c2
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c2
-rw-r--r--source/blender/editors/animation/anim_filter.c2
-rw-r--r--source/blender/editors/armature/poseSlide.c6
-rw-r--r--source/blender/editors/armature/poseobject.c4
-rw-r--r--source/blender/editors/object/object_add.c4
-rw-r--r--source/blender/editors/object/object_select.c2
-rw-r--r--source/blender/editors/physics/physics_fluid.c18
-rw-r--r--source/blender/editors/space_console/space_console.c4
-rw-r--r--source/blender/editors/space_graph/graph_draw.c2
-rw-r--r--source/blender/editors/space_image/image_ops.c24
-rw-r--r--source/blender/editors/space_logic/logic_window.c2
-rw-r--r--source/blender/editors/space_nla/nla_draw.c14
-rw-r--r--source/blender/editors/space_nla/nla_edit.c12
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c33
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c2
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c111
-rw-r--r--source/blender/imbuf/CMakeLists.txt4
-rw-r--r--source/blender/imbuf/IMB_imbuf.h2
-rw-r--r--source/blender/imbuf/intern/indexer_dv.c5
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp15
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_multi.h4
-rw-r--r--source/blender/imbuf/intern/rectop.c10
-rw-r--r--source/blender/imbuf/intern/writeimage.c1
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c5
-rw-r--r--source/blender/python/intern/bpy_intern_string.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c2
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h4
-rw-r--r--source/blender/render/intern/source/pipeline.c42
52 files changed, 239 insertions, 255 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index c0e62b1c0c7..fc812d652b3 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -369,28 +369,28 @@ void BLF_position(int fontid, float x, float y, float z)
za= 1.0f;
}
- remainder= x - floor(x);
- if (remainder > 0.4 && remainder < 0.6) {
- if (remainder < 0.5)
- x -= 0.1 * xa;
+ remainder= x - floorf(x);
+ if (remainder > 0.4f && remainder < 0.6f) {
+ if (remainder < 0.5f)
+ x -= 0.1f * xa;
else
- x += 0.1 * xa;
+ x += 0.1f * xa;
}
- remainder= y - floor(y);
- if (remainder > 0.4 && remainder < 0.6) {
- if (remainder < 0.5)
- y -= 0.1 * ya;
+ remainder= y - floorf(y);
+ if (remainder > 0.4f && remainder < 0.6f) {
+ if (remainder < 0.5f)
+ y -= 0.1f * ya;
else
- y += 0.1 * ya;
+ y += 0.1f * ya;
}
- remainder= z - floor(z);
- if (remainder > 0.4 && remainder < 0.6) {
- if (remainder < 0.5)
- z -= 0.1 * za;
+ remainder= z - floorf(z);
+ if (remainder > 0.4f && remainder < 0.6f) {
+ if (remainder < 0.5f)
+ z -= 0.1f * za;
else
- z += 0.1 * za;
+ z += 0.1f * za;
}
font->pos[0]= x;
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 708b3708ab7..fb6505fe935 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -213,7 +213,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
{
unsigned char *cbuf;
unsigned int c;
- unsigned char b_col_char[3];
+ unsigned char b_col_char[4];
GlyphBLF *g, *g_prev;
FT_Vector delta;
FT_UInt glyph_index;
@@ -232,6 +232,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
b_col_char[0]= font->b_col[0] * 255;
b_col_char[1]= font->b_col[1] * 255;
b_col_char[2]= font->b_col[2] * 255;
+ b_col_char[3]= font->b_col[3] * 255;
while (str[i]) {
int pen_y;
@@ -296,16 +297,19 @@ void blf_font_buffer(FontBLF *font, const char *str)
a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
if(a > 0.0f) {
+ float alphatest;
fbuf= font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
if (a >= 1.0f) {
fbuf[0]= font->b_col[0];
fbuf[1]= font->b_col[1];
fbuf[2]= font->b_col[2];
+ fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]))) < 1.0f ? alphatest : 1.0f;
}
else {
fbuf[0]= (font->b_col[0]*a) + (fbuf[0] * (1-a));
fbuf[1]= (font->b_col[1]*a) + (fbuf[1] * (1-a));
fbuf[2]= (font->b_col[2]*a) + (fbuf[2] * (1-a));
+ fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]*a))) < 1.0f ? alphatest : 1.0f;
}
}
}
@@ -324,16 +328,19 @@ void blf_font_buffer(FontBLF *font, const char *str)
a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
if(a > 0.0f) {
+ int alphatest;
cbuf= font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
if (a >= 1.0f) {
cbuf[0]= b_col_char[0];
cbuf[1]= b_col_char[1];
cbuf[2]= b_col_char[2];
+ cbuf[3]= (alphatest= ((int)cbuf[3] + (int)b_col_char[3])) < 255 ? alphatest : 255;
}
else {
cbuf[0]= (b_col_char[0]*a) + (cbuf[0] * (1-a));
cbuf[1]= (b_col_char[1]*a) + (cbuf[1] * (1-a));
cbuf[2]= (b_col_char[2]*a) + (cbuf[2] * (1-a));
+ cbuf[3]= (alphatest= ((int)cbuf[3] + (int)((font->b_col[3]*a)*255.0f))) < 255 ? alphatest : 255;
}
}
}
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index e1b6ff02bc4..fac5bf1cfd2 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -134,8 +134,6 @@ void sound_free_waveform(struct bSound* sound);
void sound_read_waveform(struct bSound* sound);
-int sound_get_channels(struct bSound* sound);
-
void sound_update_scene(struct Scene* scene);
void* sound_get_factory(void* sound);
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 1fec977851e..04c5caf138a 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -1092,7 +1092,7 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
VECADDMUL(cloth1->verts[collpair->ap1].impulse, pimpulse, w1*2.0);
VECADDMUL(cloth1->verts[collpair->ap2].impulse, pimpulse, w2*2.0);
- VECADDMUL(cloth1->verts[collpair->ap3].impulse, pimpulse, w3*2.0);;
+ VECADDMUL(cloth1->verts[collpair->ap3].impulse, pimpulse, w3*2.0);
cloth1->verts[collpair->ap1].impulse_count++;
cloth1->verts[collpair->ap2].impulse_count++;
cloth1->verts[collpair->ap3].impulse_count++;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 62f269d775e..8bb783abb80 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -68,6 +68,7 @@
#include "BLI_listbase.h"
#include "BLI_threads.h"
#include "BLI_storage.h" /* For _LARGEFILE64_SOURCE; zlib needs this on some systems */
+#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLI_edgehash.h"
@@ -104,12 +105,6 @@
#include <zlib.h>
#include <string.h>
-#ifdef WIN32
-#ifndef snprintf
-#define snprintf _snprintf
-#endif
-#endif
-
#endif // DISABLE_ELBEEM
/************************************************/
@@ -3876,7 +3871,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
gzf = gzopen(filename, "rb");
if (!gzf) {
- snprintf(debugStrBuffer,256,"readFsPartData::error - Unable to open file for reading '%s' \n", filename);
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"readFsPartData::error - Unable to open file for reading '%s' \n", filename);
// XXX bad level call elbeemDebugOut(debugStrBuffer);
return;
}
@@ -3937,7 +3932,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
gzclose( gzf );
totpart = psys->totpart = activeParts;
- snprintf(debugStrBuffer,256,"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d \n", psys->totpart,activeParts,fileParts,readMask);
+ BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d \n", psys->totpart,activeParts,fileParts,readMask);
// bad level call
// XXX elbeemDebugOut(debugStrBuffer);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 0f0afe30392..a56010a5ccf 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -917,14 +917,14 @@ static int ptcache_path(PTCacheID *pid, char *filename)
if (i > 6)
file[i-6] = '\0';
- snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */
+ BLI_snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */
BLI_path_abs(filename, blendfilename);
return BLI_add_slash(filename); /* new strlen() */
}
/* use the temp path. this is weak but better then not using point cache at all */
/* btempdir is assumed to exist and ALWAYS has a trailing slash */
- snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid()));
+ BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid()));
return BLI_add_slash(filename); /* new strlen() */
}
@@ -948,7 +948,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
idname = (pid->ob->id.name+2);
/* convert chars to hex so they are always a valid filename */
while('\0' != *idname) {
- snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++));
+ BLI_snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++));
newname+=2;
len += 2;
}
@@ -967,12 +967,12 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
if(pid->cache->flag & PTCACHE_EXTERNAL) {
if(pid->cache->index >= 0)
- snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
+ BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
else
- snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */
+ BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */
}
else {
- snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
+ BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
}
len += 16;
}
@@ -2002,7 +2002,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
if (dir==NULL)
return;
- snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
+ BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
@@ -2204,7 +2204,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
if (dir==NULL)
return;
- snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
+ BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
@@ -2904,7 +2904,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to)
return;
}
- snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
+ BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
/* put new name into cache */
strcpy(pid->cache->name, to);
@@ -2960,7 +2960,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
return;
if(cache->index >= 0)
- snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index);
+ BLI_snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index);
else
strcpy(ext, PTCACHE_EXT);
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index f84d98a31b4..4926edaeec2 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -44,12 +44,6 @@
#include <stdio.h>
#include <string.h>
-#ifdef _WIN32
-#ifndef vsnprintf
-#define vsnprintf _vsnprintf
-#endif
-#endif
-
static const char *report_type_str(int type)
{
switch(type) {
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 40e02d65323..9ef30bdd49b 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -78,11 +78,6 @@
# include "AUD_C-API.h"
#endif
-#ifdef WIN32
-#define snprintf _snprintf
-#endif
-
-
static ImBuf* seq_render_strip_stack(
SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
@@ -1193,7 +1188,7 @@ static void seq_open_anim_file(Sequence * seq)
static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, char * name)
{
int frameno;
- char dir[FILE_MAXDIR];
+ char dir[PROXY_MAXFILE];
int render_size = context.preview_render_size;
if (!seq->strip->proxy) {
@@ -1211,7 +1206,7 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra,
if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) {
strcpy(dir, seq->strip->proxy->dir);
} else if (seq->type == SEQ_IMAGE) {
- snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir);
+ BLI_snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir);
} else {
return FALSE;
}
@@ -1232,14 +1227,14 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra,
/* generate a separate proxy directory for each preview size */
if (seq->type == SEQ_IMAGE) {
- snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir,
+ BLI_snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir,
context.preview_render_size,
give_stripelem(seq, cfra)->name);
frameno = 1;
} else {
frameno = (int) give_stripelem_index(seq, cfra)
+ seq->anim_startofs;
- snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir,
+ BLI_snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir,
context.preview_render_size);
}
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 985fef974d3..cdb509ab8e1 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -641,15 +641,6 @@ void sound_read_waveform(struct bSound* sound)
}
}
-int sound_get_channels(struct bSound* sound)
-{
- AUD_SoundInfo info;
-
- info = AUD_getInfo(sound->playback_handle);
-
- return info.specs.channels;
-}
-
void sound_update_scene(struct Scene* scene)
{
Object* ob;
@@ -769,6 +760,5 @@ void sound_seek_scene(struct bContext *UNUSED(C)) {}
float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; }
int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; }
int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
-int sound_get_channels(struct bSound* UNUSED(sound)) { return 1; }
#endif // WITH_AUDASPACE
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index a9792bc44fa..72fe1c19884 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -34,6 +34,7 @@
#include "BKE_unit.h"
#include "BLI_math.h"
+#include "BLI_string.h"
#include "BLI_winstuff.h"
@@ -344,7 +345,7 @@ static int unit_as_string(char *str, int len_max, double value, int prec, bUnitC
/* Convert to a string */
{
- len= snprintf(str, len_max, "%.*lf", prec, value_conv);
+ len= BLI_snprintf(str, len_max, "%.*lf", prec, value_conv);
if(len >= len_max)
len= len_max;
@@ -495,7 +496,7 @@ static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pr
len_name = strlen(replace_str);
len_move= (len - (found_ofs+len_name)) + 1; /* 1+ to copy the string terminator */
- len_num= snprintf(str_tmp, TEMP_STR_SIZE, "*%lg"SEP_STR, unit->scalar/scale_pref); /* # removed later */
+ len_num= BLI_snprintf(str_tmp, TEMP_STR_SIZE, "*%lg"SEP_STR, unit->scalar/scale_pref); /* # removed later */
if(len_num > len_max)
len_num= len_max;
@@ -629,12 +630,12 @@ int bUnit_ReplaceString(char *str, int len_max, char *str_prev, double scale_pre
/* add the unit prefix and re-run, use brackets incase there was an expression given */
- if(snprintf(str_tmp, sizeof(str_tmp), "(%s)%s", str, unit->name) < sizeof(str_tmp)) {
+ if(BLI_snprintf(str_tmp, sizeof(str_tmp), "(%s)%s", str, unit->name) < sizeof(str_tmp)) {
strncpy(str, str_tmp, len_max);
return bUnit_ReplaceString(str, len_max, NULL, scale_pref, system, type);
}
else {
- /* snprintf would not fit into str_tmp, cant do much in this case
+ /* BLI_snprintf would not fit into str_tmp, cant do much in this case
* check for this because otherwise bUnit_ReplaceString could call its self forever */
return 0;
}
@@ -705,7 +706,7 @@ void bUnit_ToUnitAltName(char *str, int len_max, char *orig_str, int system, int
/* print the alt_name */
if(unit->name_alt)
- len_name= snprintf(str, len_max, "%s", unit->name_alt);
+ len_name= BLI_snprintf(str, len_max, "%s", unit->name_alt);
else
len_name= 0;
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 24e0fe95a1f..13875ff19f7 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -39,10 +39,6 @@
#include <libswscale/swscale.h>
#include <libavcodec/opt.h>
-#if defined(WIN32) && (!(defined snprintf))
-#define snprintf _snprintf
-#endif
-
#include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
@@ -652,7 +648,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
fmt->audio_codec = ffmpeg_audio_codec;
- snprintf(of->filename, sizeof(of->filename), "%s", name);
+ BLI_snprintf(of->filename, sizeof(of->filename), "%s", name);
/* set the codec to the user's selection */
switch(ffmpeg_type) {
case FFMPEG_AVI:
diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h
index fc5c5a80131..5c3180ba9c5 100644
--- a/source/blender/blenlib/BLI_callbacks.h
+++ b/source/blender/blenlib/BLI_callbacks.h
@@ -42,6 +42,7 @@ struct ID;
typedef enum {
BLI_CB_EVT_RENDER_PRE,
BLI_CB_EVT_RENDER_POST,
+ BLI_CB_EVT_RENDER_STATS,
BLI_CB_EVT_LOAD_PRE,
BLI_CB_EVT_LOAD_POST,
BLI_CB_EVT_SAVE_PRE,
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 527692348e7..dcbe043f0d0 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -1494,7 +1494,7 @@ static float fast_ray_nearest_hit(const BVHRayCastData *data, const BVHNode *nod
float t2z = (bv[data->index[5]] - data->ray.origin[2]) * data->idot_axis[2];
if(t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return FLT_MAX;
- if(t2x < 0.0 || t2y < 0.0 || t2z < 0.0) return FLT_MAX;
+ if(t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return FLT_MAX;
if(t1x > data->hit.dist || t1y > data->hit.dist || t1z > data->hit.dist) return FLT_MAX;
dist = t1x;
@@ -1599,11 +1599,11 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, float
data.ray_dot_axis[i] = INPR( data.ray.direction, KDOP_AXES[i]);
data.idot_axis[i] = 1.0f / data.ray_dot_axis[i];
- if(fabs(data.ray_dot_axis[i]) < FLT_EPSILON)
+ if(fabsf(data.ray_dot_axis[i]) < FLT_EPSILON)
{
data.ray_dot_axis[i] = 0.0;
}
- data.index[2*i] = data.idot_axis[i] < 0.0 ? 1 : 0;
+ data.index[2*i] = data.idot_axis[i] < 0.0f ? 1 : 0;
data.index[2*i+1] = 1 - data.index[2*i];
data.index[2*i] += 2*i;
data.index[2*i+1] += 2*i;
@@ -1654,7 +1654,7 @@ float BLI_bvhtree_bb_raycast(float *bv, float *light_start, float *light_end, fl
dist = ray_nearest_hit(&data, bv);
- if(dist > 0.0)
+ if(dist > 0.0f)
{
VECADDFAC(pos, light_start, data.ray.direction, dist);
}
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c
index 713bfde3417..c885e8c8a9c 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -187,7 +187,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *
cur_dist = node->co[node->d] - co[node->d];
- if(cur_dist<0.0){
+ if(cur_dist<0.0f){
cur_dist= -cur_dist*cur_dist;
if(-cur_dist<min_dist){
@@ -294,7 +294,7 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree
cur_dist = node->co[node->d] - co[node->d];
- if(cur_dist<0.0){
+ if(cur_dist<0.0f){
cur_dist= -cur_dist*cur_dist;
if(found<n || -cur_dist<nearest[found-1].dist){
diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c
index 51e639d1c75..2e26f4bd9c9 100644
--- a/source/blender/blenlib/intern/graph.c
+++ b/source/blender/blenlib/intern/graph.c
@@ -714,7 +714,7 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo
int dispatch = 0;
int last = i - 1;
- if (fabs(ring[first].arc->length - ring[i].arc->length) > limit)
+ if (fabsf(ring[first].arc->length - ring[i].arc->length) > limit)
{
dispatch = 1;
}
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 5edf6e28d4c..3c79a77707a 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -820,7 +820,7 @@ void normalize_m4_m4(float rmat[][4], float mat[][4])
len= normalize_v3_v3(rmat[1], mat[1]);
if(len!=0.0f) rmat[1][3]= mat[1][3] / len;
len= normalize_v3_v3(rmat[2], mat[2]);
- if(len!=0.0f) rmat[2][3]= mat[2][3] / len;;
+ if(len!=0.0f) rmat[2][3]= mat[2][3] / len;
}
void adjoint_m3_m3(float m1[][3], float m[][3])
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 41eedef8835..67e27063fd0 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -338,7 +338,7 @@ void BLI_adddirstrings(void)
if ( pwuser ) {
BLI_strncpy(file->owner, pwuser->pw_name, sizeof(file->owner));
} else {
- snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid);
+ BLI_snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid);
}
}
#endif
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 3eafa79a19a..54b3bca1111 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -10147,7 +10147,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
!(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR))
{
- snprintf(seq->strip->proxy->dir,
+ BLI_snprintf(seq->strip->proxy->dir,
FILE_MAXDIR, "%s/BL_proxy",
seq->strip->dir);
}
diff --git a/source/blender/blenpluginapi/iff.h b/source/blender/blenpluginapi/iff.h
index 77cdf889ea5..d29853f7d15 100644
--- a/source/blender/blenpluginapi/iff.h
+++ b/source/blender/blenpluginapi/iff.h
@@ -115,7 +115,7 @@ LIBIMPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf,
LIBIMPORT void IMB_rectfill(struct ImBuf *drect, const float col[4]);
LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
-LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2);
+LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
LIBIMPORT void IMB_rectfill_alpha(struct ImBuf *drect, const float value);
#endif /* IFF_H */
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index 267ad4be887..d277dad8e8c 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -160,4 +160,4 @@ protected:
char* extract_transform_name(char *rna_path);
std::string getObjectBoneName ( Object *ob,const FCurve * fcu);
-}; \ No newline at end of file
+};
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 1e7879b352f..2ec8ae540d2 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -310,9 +310,10 @@ void ArmatureImporter::fix_leaf_bones( )
LeafBone& leaf = *it;
// pointing up
- float vec[3] = {0.0f, 0.0f, 1.0f};
+ float vec[3] = {0.0f, 0.0f, 0.1f};
- //mul_v3_fl(vec, leaf_bone_length);
+ // if parent: take parent length and direction
+ if(leaf.bone->parent) sub_v3_v3v3(vec, leaf.bone->parent->tail, leaf.bone->parent->head);
copy_v3_v3(leaf.bone->tail, leaf.bone->head);
add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
diff --git a/source/blender/collada/ExtraHandler.cpp b/source/blender/collada/ExtraHandler.cpp
index a60ef8b2ea5..820665ad757 100644
--- a/source/blender/collada/ExtraHandler.cpp
+++ b/source/blender/collada/ExtraHandler.cpp
@@ -56,7 +56,7 @@ bool ExtraHandler::textData(const char* text, size_t textLength)
{
char buf[1024];
- if(currentElement.length() == 0) return false;
+ if(currentElement.length() == 0 || currentExtraTags == 0) return false;
BLI_snprintf(buf, textLength+1, "%s", text);
currentExtraTags->addTag(currentElement, std::string(buf));
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 806af4c0ef5..bdc654ff25a 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -1273,7 +1273,7 @@ static int acf_dstex_icon(bAnimListElem *UNUSED(ale))
/* offset for texture expanders */
// FIXME: soon to be obsolete?
-static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *ale)
+static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
{
return 14; // XXX: simply include this in indention instead?
}
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index c9d6f9a6420..d58d51c8e08 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -2018,7 +2018,7 @@ static void rename_anim_channels (bAnimContext *ac, int channel_index)
ED_region_tag_redraw(ac->ar);
}
-static int animchannels_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+static int animchannels_rename_invoke (bContext *C, wmOperator *UNUSED(op), wmEvent *evt)
{
bAnimContext ac;
ARegion *ar;
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 0472731dd6d..8010a41ccb3 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -990,7 +990,7 @@ static size_t animfilter_fcurves (ListBase *anim_data, bDopeSheet *ads, FCurve *
return items;
}
-static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *act, bActionGroup *agrp, int filter_mode, ID *owner_id)
+static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *UNUSED(act), bActionGroup *agrp, int filter_mode, ID *owner_id)
{
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index 3c15ff52a30..b0ff60455cf 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -520,7 +520,7 @@ static void pose_slide_reset (tPoseSlideOp *pso)
/* ------------------------------------ */
/* draw percentage indicator in header */
-static void pose_slide_draw_status (bContext *C, tPoseSlideOp *pso)
+static void pose_slide_draw_status (tPoseSlideOp *pso)
{
char statusStr[32];
char mode[32];
@@ -615,7 +615,7 @@ static int pose_slide_invoke_common (bContext *C, wmOperator *op, tPoseSlideOp *
WM_cursor_modal(win, BC_EW_SCROLLCURSOR);
/* header print */
- pose_slide_draw_status(C, pso);
+ pose_slide_draw_status(pso);
/* add a modal handler for this operator */
WM_event_add_modal_handler(C, op);
@@ -672,7 +672,7 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt)
RNA_float_set(op->ptr, "percentage", pso->percentage);
/* update percentage indicator in header */
- pose_slide_draw_status(C, pso);
+ pose_slide_draw_status(pso);
/* reset transforms (to avoid accumulation errors) */
pose_slide_reset(pso);
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index d2f32837d6d..3911be02fe7 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -1611,7 +1611,7 @@ static int compare_agroup(const void *sgrp_a_ptr, const void *sgrp_b_ptr)
return strcmp(sgrp_a->agrp->name, sgrp_b->agrp->name);
}
-static int group_sort_exec(bContext *C, wmOperator *op)
+static int group_sort_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
bPose *pose= (ob) ? ob->pose : NULL;
@@ -2275,7 +2275,7 @@ void POSE_OT_quaternions_flip (wmOperatorType *ot)
/* ********************************************** */
/* Clear User Transforms */
-static int pose_clear_user_transforms_exec (bContext *C, wmOperator *op)
+static int pose_clear_user_transforms_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 838523599c5..45888b1486b 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -277,8 +277,10 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
RNA_boolean_set(op->ptr, "view_align", view_align);
}
- if (view_align)
+ if (view_align) {
ED_object_rotation_from_view(C, rot);
+ RNA_float_set_array(op->ptr, "rotation", rot);
+ }
else
RNA_float_get_array(op->ptr, "rotation", rot);
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index b3c4ffc0ac9..cb1fc7541d0 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -600,7 +600,7 @@ static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob))
*/
for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
/* if id matches, select then stop looping (match found) */
- if (ksp->id == base->object) {
+ if (ksp->id == (ID *)base->object) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
break;
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 37309f1e07c..bd53de20871 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -41,12 +41,6 @@
#include <string.h>
#include <sys/stat.h>
-#ifdef WIN32 /* Windos */
-#ifndef snprintf
-#define snprintf _snprintf
-#endif
-#endif
-
#include "MEM_guardedalloc.h"
/* types */
@@ -155,8 +149,8 @@ static int fluid_is_animated_mesh(FluidsimSettings *fss)
#if 0
/* helper function */
void fluidsimGetGeometryObjFilename(Object *ob, char *dst) { //, char *srcname) {
- //snprintf(dst,FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name);
- snprintf(dst,FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name);
+ //BLI_snprintf(dst,FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name);
+ BLI_snprintf(dst,FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name);
}
#endif
@@ -888,7 +882,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain)
if(getenv(strEnvName)) {
int dlevel = atoi(getenv(strEnvName));
elbeemSetDebugLevel(dlevel);
- snprintf(debugStrBuffer,256,"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName);
+ BLI_snprintf(debugStrBuffer,256,"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName);
elbeemDebugOut(debugStrBuffer);
}
@@ -925,7 +919,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain)
/* rough check of settings... */
if(domainSettings->previewresxyz > domainSettings->resolutionxyz) {
- snprintf(debugStrBuffer,256,"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz);
+ BLI_snprintf(debugStrBuffer,256,"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz);
elbeemDebugOut(debugStrBuffer);
domainSettings->previewresxyz = domainSettings->resolutionxyz;
}
@@ -945,7 +939,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain)
} else {
gridlevels = domainSettings->maxRefine;
}
- snprintf(debugStrBuffer,256,"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels );
+ BLI_snprintf(debugStrBuffer,256,"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels );
elbeemDebugOut(debugStrBuffer);
@@ -997,7 +991,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain)
/* ******** init domain object's matrix ******** */
copy_m4_m4(domainMat, fsDomain->obmat);
if(!invert_m4_m4(invDomMat, domainMat)) {
- snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n");
+ BLI_snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n");
elbeemDebugOut(debugStrBuffer);
BKE_report(reports, RPT_ERROR, "Invalid object matrix.");
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 52c5100900d..c8fa049f5eb 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -169,7 +169,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
BLI_strescape(id_esc, id->name+2, sizeof(id_esc));
- snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc);
+ BLI_snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc);
/* copy drag path to properties */
RNA_string_set(drop->ptr, "text", text);
@@ -186,7 +186,7 @@ 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);
+ BLI_snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path);
RNA_string_set(drop->ptr, "text", pathname);
}
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index d65297e068d..dc5e71f0406 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -706,7 +706,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
if (fcu->driver)
resol= 32;
else
- resol= (int)(5.0*len_v2v2(bezt->vec[1], prevbezt->vec[1]));
+ resol= (int)(5.0f*len_v2v2(bezt->vec[1], prevbezt->vec[1]));
if (resol < 2) {
/* only draw one */
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index d58b78ff6a7..68f9e4d033e 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -960,20 +960,19 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
if(ibuf) {
Image *ima= sima->image;
- RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
simopts->planes= ibuf->depth;
- /* cant save multilayer sequence, ima->rr isn't valid for a specific frame */
- if(rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER))
- simopts->imtype= R_MULTILAYER;
- else if(ima->type==IMA_TYPE_R_RESULT)
+ if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
simopts->imtype= scene->r.imtype;
- else if (ima->source == IMA_SRC_GENERATED)
+ simopts->planes= scene->r.planes;
+ }
+ else if (ima->source == IMA_SRC_GENERATED) {
simopts->imtype= R_PNG;
- else
+ }
+ else {
simopts->imtype= BKE_ftype_to_imtype(ibuf->ftype);
-
+ }
simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
simopts->quality= ibuf->ftype & 0xff;
@@ -1000,8 +999,6 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
}
BLI_path_abs(simopts->filepath, G.main->name);
}
- /* cleanup */
- BKE_image_release_renderresult(scene, ima);
}
ED_space_image_release_buffer(sima, lock);
@@ -1016,7 +1013,10 @@ static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op
// if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX
if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality");
- if (RNA_property_is_set(op->ptr, "filepath")) RNA_string_get(op->ptr, "filepath", simopts->filepath);
+ if (RNA_property_is_set(op->ptr, "filepath")) {
+ RNA_string_get(op->ptr, "filepath", simopts->filepath);
+ BLI_path_abs(simopts->filepath, G.main->name);
+ }
}
static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op)
@@ -1069,7 +1069,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
Scene *scene= CTX_data_scene(C);
RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
if(rr) {
- RE_WriteRenderResult(rr, simopts->filepath, simopts->quality);
+ RE_WriteRenderResult(op->reports, rr, simopts->filepath, simopts->quality);
ok= TRUE;
}
else {
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 882d89fcd33..920e93cc0fc 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -3677,7 +3677,7 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
{
Object *ob = (Object *)ptr->id.data;
PointerRNA settings_ptr;
- uiLayout *row, *subrow, *col;;
+ uiLayout *row, *subrow, *col;
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 0583f328371..0c9c7877ddc 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -468,10 +468,10 @@ static void nla_draw_strip_text (AnimData *adt, NlaTrack *nlt, NlaStrip *strip,
/* just print the name and the range */
if (strip->flag & NLASTRIP_FLAG_TEMP_META) {
- sprintf(str, "%d) Temp-Meta", index);
+ BLI_snprintf(str, sizeof(str), "%d) Temp-Meta", index);
}
else {
- sprintf(str, strip->name);
+ BLI_strncpy(str, strip->name, sizeof(str));
}
/* set text color - if colors (see above) are light, draw black text, otherwise draw white */
@@ -514,7 +514,7 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
{
const float ytol = 1.0f; /* small offset to vertical positioning of text, for legibility */
const char col[4] = {220, 220, 220, 255}; /* light grey */
- char str[16] = "";
+ char str[32] = "";
/* Always draw times above the strip, whereas sequencer drew below + above.
@@ -524,11 +524,11 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
* while also preserving some accuracy, since we do use floats
*/
/* start frame */
- sprintf(str, "%.1f", strip->start);
+ BLI_snprintf(str, sizeof(str), "%.1f", strip->start);
UI_view2d_text_cache_add(v2d, strip->start-1.0f, ymaxc+ytol, str, col);
/* end frame */
- sprintf(str, "%.1f", strip->end);
+ BLI_snprintf(str, sizeof(str), "%.1f", strip->end);
UI_view2d_text_cache_add(v2d, strip->end, ymaxc+ytol, str, col);
}
@@ -730,9 +730,9 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
special = ICON_ACTION;
if (act)
- sprintf(name, "%s", act->id.name+2);
+ BLI_snprintf(name, sizeof(name), "%s", act->id.name+2);
else
- sprintf(name, "<No Action>");
+ BLI_strncpy(name, "<No Action>", sizeof(name));
// draw manually still
doDraw= 1;
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 0f87be0f807..08026e8a1d2 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -533,7 +533,7 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
if ELEM(0, (s1->flag & NLASTRIP_FLAG_SELECT), (s2->flag & NLASTRIP_FLAG_SELECT))
continue;
/* check if there's space between the two */
- if (IS_EQ(s1->end, s2->start))
+ if (IS_EQF(s1->end, s2->start))
continue;
/* make sure neither one is a transition
* - although this is impossible to create with the standard tools,
@@ -613,7 +613,7 @@ void NLA_OT_transition_add (wmOperatorType *ot)
/* ******************** Add Sound Clip Operator ***************************** */
/* Add a new sound clip */
-static int nlaedit_add_sound_exec (bContext *C, wmOperator *op)
+static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1013,14 +1013,14 @@ static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip
/* strip extents */
len= strip->end - strip->start;
- if (IS_EQ(len, 0.0f))
+ if (IS_EQF(len, 0.0f))
return;
else
splitframe= strip->start + (len / 2.0f);
/* action range */
len= strip->actend - strip->actstart;
- if (IS_EQ(len, 0.0f))
+ if (IS_EQF(len, 0.0f))
splitaframe= strip->actend;
else
splitaframe= strip->actstart + (len / 2.0f);
@@ -1858,10 +1858,10 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op)
strip->start= (float)CFRA;
break;
case NLAEDIT_SNAP_NEAREST_FRAME: /* to nearest frame */
- strip->start= (float)(floor(start+0.5));
+ strip->start= floorf(start+0.5f);
break;
case NLAEDIT_SNAP_NEAREST_SECOND: /* to nearest second */
- strip->start= ((float)floor(start/secf + 0.5f) * secf);
+ strip->start= floorf(start/secf + 0.5f) * secf;
break;
case NLAEDIT_SNAP_NEAREST_MARKER: /* to nearest marker */
strip->start= (float)ED_markers_find_nearest_marker_time(ac.markers, start);
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 4525ea9c8d9..3ae158bd275 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -822,7 +822,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l
/* ------------------------------------------ */
-static void actionset_id_cb(TreeElement *te, TreeStoreElem *tselem, TreeStoreElem *tsep, ID *actId)
+static void actionset_id_cb(TreeElement *UNUSED(te), TreeStoreElem *tselem, TreeStoreElem *tsep, ID *actId)
{
bAction *act = (bAction *)actId;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index fbb3aac43fe..2b994a2d0d2 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1496,7 +1496,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
}
/* flag similar to draw_object() */
-static void drawspeaker(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int flag)
+static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D *UNUSED(rv3d), Object *UNUSED(ob), int UNUSED(flag))
{
//Speaker *spk = ob->data;
@@ -1505,34 +1505,29 @@ static void drawspeaker(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
glEnable(GL_BLEND);
- for(j = 0; j < 3; j++)
- {
- vec[2] = .25f * j -.125f;
+ for(j = 0; j < 3; j++) {
+ vec[2] = 0.25f * j -0.125f;
glBegin(GL_LINE_LOOP);
- for(i = 0; i < 16; i++)
- {
- vec[0] = cos(M_PI * i / 8.0f) * (j == 0 ? .5f : .25f);
- vec[1] = sin(M_PI * i / 8.0f) * (j == 0 ? .5f : .25f);
+ for(i = 0; i < 16; i++) {
+ vec[0] = cosf(M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f);
+ vec[1] = sinf(M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f);
glVertex3fv(vec);
}
glEnd();
}
- for(j = 0; j < 4; j++)
- {
- vec[0] = (((j + 1) % 2) * (j - 1)) * .5f;
- vec[1] = ((j % 2) * (j - 2)) * .5f;
+ for(j = 0; j < 4; j++) {
+ vec[0] = (((j + 1) % 2) * (j - 1)) * 0.5f;
+ vec[1] = ((j % 2) * (j - 2)) * 0.5f;
glBegin(GL_LINE_STRIP);
- for(i = 0; i < 3; i++)
- {
- if(i == 1)
- {
- vec[0] *= .5f;
- vec[1] *= .5f;
+ for(i = 0; i < 3; i++) {
+ if(i == 1) {
+ vec[0] *= 0.5f;
+ vec[1] *= 0.5f;
}
- vec[2] = .25f * i -.125f;
+ vec[2] = 0.25f * i -0.125f;
glVertex3fv(vec);
}
glEnd();
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index e9ed5dac3de..19e8d42db2d 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -3475,7 +3475,7 @@ void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist)
copy_m3_m4(nmat, mat);
normalize_m3(nmat);
- mul_m3_v3(nmat, vec);;
+ mul_m3_v3(nmat, vec);
sub_v3_v3(ofs, vec);
}
}
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 77498835d57..360f3dbf63f 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -59,15 +59,6 @@
#include <string.h>
#include <stdarg.h>
-#ifdef _WIN32
-#ifndef vsnprintf
-#define vsnprintf _vsnprintf
-#endif
-#ifndef snprintf
-#define snprintf _snprintf
-#endif
-#endif
-
extern char datatoc_gpu_shader_material_glsl[];
extern char datatoc_gpu_shader_vertex_glsl[];
@@ -168,24 +159,6 @@ struct GPUPass {
struct GPUShader *shader;
};
-/* Strings utility */
-
-static void BLI_dynstr_printf(DynStr *dynstr, const char *format, ...)
-{
- va_list args;
- int retval;
- char str[2048];
-
- va_start(args, format);
- retval = vsnprintf(str, sizeof(str), format, args);
- va_end(args);
-
- if (retval >= sizeof(str))
- fprintf(stderr, "BLI_dynstr_printf: limit exceeded\n");
- else
- BLI_dynstr_append(dynstr, str);
-}
-
/* GLSL code parsing for finding function definitions.
* These are stored in a hash for lookup when creating a material. */
@@ -318,7 +291,7 @@ static char *gpu_generate_function_prototyps(GHash *hash)
name = BLI_ghashIterator_getValue(ghi);
function = BLI_ghashIterator_getValue(ghi);
- BLI_dynstr_printf(ds, "void %s(", name);
+ BLI_dynstr_appendf(ds, "void %s(", name);
for(a=0; a<function->totparam; a++) {
if(function->paramqual[a] == FUNCTION_QUAL_OUT)
BLI_dynstr_append(ds, "out ");
@@ -334,7 +307,7 @@ static char *gpu_generate_function_prototyps(GHash *hash)
else
BLI_dynstr_append(ds, GPU_DATATYPE_STR[function->paramtype[a]]);
- //BLI_dynstr_printf(ds, " param%d", a);
+ //BLI_dynstr_appendf(ds, " param%d", a);
if(a != function->totparam-1)
BLI_dynstr_append(ds, ", ");
@@ -390,42 +363,42 @@ static void codegen_convert_datatype(DynStr *ds, int from, int to, const char *t
{
char name[1024];
- snprintf(name, sizeof(name), "%s%d", tmp, id);
+ BLI_snprintf(name, sizeof(name), "%s%d", tmp, id);
if (from == to) {
BLI_dynstr_append(ds, name);
}
else if (to == GPU_FLOAT) {
if (from == GPU_VEC4)
- BLI_dynstr_printf(ds, "dot(%s.rgb, vec3(0.35, 0.45, 0.2))", name);
+ BLI_dynstr_appendf(ds, "dot(%s.rgb, vec3(0.35, 0.45, 0.2))", name);
else if (from == GPU_VEC3)
- BLI_dynstr_printf(ds, "dot(%s, vec3(0.33))", name);
+ BLI_dynstr_appendf(ds, "dot(%s, vec3(0.33))", name);
else if (from == GPU_VEC2)
- BLI_dynstr_printf(ds, "%s.r", name);
+ BLI_dynstr_appendf(ds, "%s.r", name);
}
else if (to == GPU_VEC2) {
if (from == GPU_VEC4)
- BLI_dynstr_printf(ds, "vec2(dot(%s.rgb, vec3(0.35, 0.45, 0.2)), %s.a)", name, name);
+ BLI_dynstr_appendf(ds, "vec2(dot(%s.rgb, vec3(0.35, 0.45, 0.2)), %s.a)", name, name);
else if (from == GPU_VEC3)
- BLI_dynstr_printf(ds, "vec2(dot(%s.rgb, vec3(0.33)), 1.0)", name);
+ BLI_dynstr_appendf(ds, "vec2(dot(%s.rgb, vec3(0.33)), 1.0)", name);
else if (from == GPU_FLOAT)
- BLI_dynstr_printf(ds, "vec2(%s, 1.0)", name);
+ BLI_dynstr_appendf(ds, "vec2(%s, 1.0)", name);
}
else if (to == GPU_VEC3) {
if (from == GPU_VEC4)
- BLI_dynstr_printf(ds, "%s.rgb", name);
+ BLI_dynstr_appendf(ds, "%s.rgb", name);
else if (from == GPU_VEC2)
- BLI_dynstr_printf(ds, "vec3(%s.r, %s.r, %s.r)", name, name, name);
+ BLI_dynstr_appendf(ds, "vec3(%s.r, %s.r, %s.r)", name, name, name);
else if (from == GPU_FLOAT)
- BLI_dynstr_printf(ds, "vec3(%s, %s, %s)", name, name, name);
+ BLI_dynstr_appendf(ds, "vec3(%s, %s, %s)", name, name, name);
}
else {
if (from == GPU_VEC3)
- BLI_dynstr_printf(ds, "vec4(%s, 1.0)", name);
+ BLI_dynstr_appendf(ds, "vec4(%s, 1.0)", name);
else if (from == GPU_VEC2)
- BLI_dynstr_printf(ds, "vec4(%s.r, %s.r, %s.r, %s.g)", name, name, name, name);
+ BLI_dynstr_appendf(ds, "vec4(%s.r, %s.r, %s.r, %s.g)", name, name, name, name);
else if (from == GPU_FLOAT)
- BLI_dynstr_printf(ds, "vec4(%s, %s, %s, 1.0)", name, name, name);
+ BLI_dynstr_appendf(ds, "vec4(%s, %s, %s, 1.0)", name, name, name);
}
}
@@ -433,10 +406,10 @@ static void codegen_print_datatype(DynStr *ds, int type, float *data)
{
int i;
- BLI_dynstr_printf(ds, "%s(", GPU_DATATYPE_STR[type]);
+ BLI_dynstr_appendf(ds, "%s(", GPU_DATATYPE_STR[type]);
for(i=0; i<type; i++) {
- BLI_dynstr_printf(ds, "%f", data[i]);
+ BLI_dynstr_appendf(ds, "%f", data[i]);
if(i == type-1)
BLI_dynstr_append(ds, ")");
else
@@ -568,7 +541,7 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes)
if ((input->source == GPU_SOURCE_TEX) || (input->source == GPU_SOURCE_TEX_PIXEL)) {
/* create exactly one sampler for each texture */
if (codegen_input_has_texture(input) && input->bindtex)
- BLI_dynstr_printf(ds, "uniform %s samp%d;\n",
+ BLI_dynstr_appendf(ds, "uniform %s samp%d;\n",
(input->textype == GPU_TEX1D)? "sampler1D":
(input->textype == GPU_TEX2D)? "sampler2D": "sampler2DShadow",
input->texid);
@@ -580,11 +553,11 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes)
name = GPU_builtin_name(input->builtin);
if(gpu_str_prefix(name, "unf")) {
- BLI_dynstr_printf(ds, "uniform %s %s;\n",
+ BLI_dynstr_appendf(ds, "uniform %s %s;\n",
GPU_DATATYPE_STR[input->type], name);
}
else {
- BLI_dynstr_printf(ds, "varying %s %s;\n",
+ BLI_dynstr_appendf(ds, "varying %s %s;\n",
GPU_DATATYPE_STR[input->type], name);
}
}
@@ -592,19 +565,19 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes)
else if (input->source == GPU_SOURCE_VEC_UNIFORM) {
if(input->dynamicvec) {
/* only create uniforms for dynamic vectors */
- BLI_dynstr_printf(ds, "uniform %s unf%d;\n",
+ BLI_dynstr_appendf(ds, "uniform %s unf%d;\n",
GPU_DATATYPE_STR[input->type], input->id);
}
else {
/* for others use const so the compiler can do folding */
- BLI_dynstr_printf(ds, "const %s cons%d = ",
+ BLI_dynstr_appendf(ds, "const %s cons%d = ",
GPU_DATATYPE_STR[input->type], input->id);
codegen_print_datatype(ds, input->type, input->vec);
BLI_dynstr_append(ds, ";\n");
}
}
else if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
- BLI_dynstr_printf(ds, "varying %s var%d;\n",
+ BLI_dynstr_appendf(ds, "varying %s var%d;\n",
GPU_DATATYPE_STR[input->type], input->attribid);
}
}
@@ -624,8 +597,8 @@ static void codegen_declare_tmps(DynStr *ds, ListBase *nodes)
for (input=node->inputs.first; input; input=input->next) {
if (input->source == GPU_SOURCE_TEX_PIXEL) {
if (codegen_input_has_texture(input) && input->definetex) {
- BLI_dynstr_printf(ds, "\tvec4 tex%d = texture2D(", input->texid);
- BLI_dynstr_printf(ds, "samp%d, gl_TexCoord[%d].st);\n",
+ BLI_dynstr_appendf(ds, "\tvec4 tex%d = texture2D(", input->texid);
+ BLI_dynstr_appendf(ds, "samp%d, gl_TexCoord[%d].st);\n",
input->texid, input->texid);
}
}
@@ -633,7 +606,7 @@ static void codegen_declare_tmps(DynStr *ds, ListBase *nodes)
/* declare temporary variables for node output storage */
for (output=node->outputs.first; output; output=output->next)
- BLI_dynstr_printf(ds, "\t%s tmp%d;\n",
+ BLI_dynstr_appendf(ds, "\t%s tmp%d;\n",
GPU_DATATYPE_STR[output->type], output->id);
}
@@ -647,13 +620,13 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final
GPUOutput *output;
for (node=nodes->first; node; node=node->next) {
- BLI_dynstr_printf(ds, "\t%s(", node->name);
+ BLI_dynstr_appendf(ds, "\t%s(", node->name);
for (input=node->inputs.first; input; input=input->next) {
if (input->source == GPU_SOURCE_TEX) {
- BLI_dynstr_printf(ds, "samp%d", input->texid);
+ BLI_dynstr_appendf(ds, "samp%d", input->texid);
if (input->link)
- BLI_dynstr_printf(ds, ", gl_TexCoord[%d].st", input->texid);
+ BLI_dynstr_appendf(ds, ", gl_TexCoord[%d].st", input->texid);
}
else if (input->source == GPU_SOURCE_TEX_PIXEL) {
if (input->link && input->link->output)
@@ -664,21 +637,21 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final
"tex", input->texid);
}
else if(input->source == GPU_SOURCE_BUILTIN)
- BLI_dynstr_printf(ds, "%s", GPU_builtin_name(input->builtin));
+ BLI_dynstr_appendf(ds, "%s", GPU_builtin_name(input->builtin));
else if(input->source == GPU_SOURCE_VEC_UNIFORM) {
if(input->dynamicvec)
- BLI_dynstr_printf(ds, "unf%d", input->id);
+ BLI_dynstr_appendf(ds, "unf%d", input->id);
else
- BLI_dynstr_printf(ds, "cons%d", input->id);
+ BLI_dynstr_appendf(ds, "cons%d", input->id);
}
else if (input->source == GPU_SOURCE_ATTRIB)
- BLI_dynstr_printf(ds, "var%d", input->attribid);
+ BLI_dynstr_appendf(ds, "var%d", input->attribid);
BLI_dynstr_append(ds, ", ");
}
for (output=node->outputs.first; output; output=output->next) {
- BLI_dynstr_printf(ds, "tmp%d", output->id);
+ BLI_dynstr_appendf(ds, "tmp%d", output->id);
if (output->next)
BLI_dynstr_append(ds, ", ");
}
@@ -702,7 +675,7 @@ static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const ch
codegen_print_uniforms_functions(ds, nodes);
//if(G.f & G_DEBUG)
- // BLI_dynstr_printf(ds, "/* %s */\n", name);
+ // BLI_dynstr_appendf(ds, "/* %s */\n", name);
BLI_dynstr_append(ds, "void main(void)\n");
BLI_dynstr_append(ds, "{\n");
@@ -731,9 +704,9 @@ static char *code_generate_vertex(ListBase *nodes)
for (node=nodes->first; node; node=node->next) {
for (input=node->inputs.first; input; input=input->next) {
if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
- BLI_dynstr_printf(ds, "attribute %s att%d;\n",
+ BLI_dynstr_appendf(ds, "attribute %s att%d;\n",
GPU_DATATYPE_STR[input->type], input->attribid);
- BLI_dynstr_printf(ds, "varying %s var%d;\n",
+ BLI_dynstr_appendf(ds, "varying %s var%d;\n",
GPU_DATATYPE_STR[input->type], input->attribid);
}
}
@@ -747,11 +720,11 @@ static char *code_generate_vertex(ListBase *nodes)
if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
if(input->attribtype == CD_TANGENT) /* silly exception */
{
- BLI_dynstr_printf(ds, "\tvar%d.xyz = normalize((gl_ModelViewMatrix * vec4(att%d.xyz, 0)).xyz);\n", input->attribid, input->attribid);
- BLI_dynstr_printf(ds, "\tvar%d.w = att%d.w;\n", input->attribid, input->attribid);
+ BLI_dynstr_appendf(ds, "\tvar%d.xyz = normalize((gl_ModelViewMatrix * vec4(att%d.xyz, 0)).xyz);\n", input->attribid, input->attribid);
+ BLI_dynstr_appendf(ds, "\tvar%d.w = att%d.w;\n", input->attribid, input->attribid);
}
else
- BLI_dynstr_printf(ds, "\tvar%d = att%d;\n", input->attribid, input->attribid);
+ BLI_dynstr_appendf(ds, "\tvar%d = att%d;\n", input->attribid, input->attribid);
}
BLI_dynstr_append(ds, "}\n\n");
@@ -799,9 +772,9 @@ static void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes)
continue;
if (input->ima || input->tex)
- snprintf(input->shadername, sizeof(input->shadername), "samp%d", input->texid);
+ BLI_snprintf(input->shadername, sizeof(input->shadername), "samp%d", input->texid);
else
- snprintf(input->shadername, sizeof(input->shadername), "unf%d", input->id);
+ BLI_snprintf(input->shadername, sizeof(input->shadername), "unf%d", input->id);
/* pass non-dynamic uniforms to opengl */
extract = 0;
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index ff13be20d4e..1547d2ee9ce 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -55,6 +55,8 @@ set(SRC
intern/filetype.c
intern/filter.c
intern/imageprocess.c
+ intern/indexer.c
+ intern/indexer_dv.c
intern/iris.c
intern/jp2.c
intern/jpeg.c
@@ -73,7 +75,6 @@ set(SRC
intern/tiff.c
intern/util.c
intern/writeimage.c
- intern/indexer.c
IMB_imbuf.h
IMB_imbuf_types.h
@@ -82,6 +83,7 @@ set(SRC
intern/IMB_anim.h
intern/IMB_filetype.h
intern/IMB_filter.h
+ intern/IMB_indexer.h
intern/IMB_metadata.h
intern/cineon/cin_debug_stuff.h
intern/cineon/cineonfile.h
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index 1fbe8e01fd4..2c926f2d94b 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -499,7 +499,7 @@ void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, i
void IMB_rectfill_alpha(struct ImBuf *ibuf, const float value);
/* this should not be here, really, we needed it for operating on render data, IMB_rectfill_area calls it */
-void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2);
+void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
/* defined in metadata.c */
int IMB_metadata_change_field(struct ImBuf *img, const char *key, const char *field);
diff --git a/source/blender/imbuf/intern/indexer_dv.c b/source/blender/imbuf/intern/indexer_dv.c
index 0961af10f69..2def0d042b7 100644
--- a/source/blender/imbuf/intern/indexer_dv.c
+++ b/source/blender/imbuf/intern/indexer_dv.c
@@ -26,6 +26,7 @@
#include "IMB_indexer.h"
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
#include <time.h>
typedef struct indexer_dv_bitstream {
@@ -279,7 +280,7 @@ static void fill_gap(indexer_dv_context * This, int isPAL)
}
static void proc_frame(indexer_dv_context * This,
- unsigned char* framebuffer, int isPAL)
+ unsigned char* UNUSED(framebuffer), int isPAL)
{
struct tm recDate;
time_t t;
@@ -329,7 +330,7 @@ static void proc_frame(indexer_dv_context * This,
static void indexer_dv_proc_frame(anim_index_builder * idx,
unsigned char * buffer,
- int data_size,
+ int UNUSED(data_size),
struct anim_index_entry * entry)
{
int isPAL;
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 7b528ed9624..88f6508d356 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -487,7 +487,7 @@ void IMB_exr_add_channel(void *handle, const char *layname, const char *passname
}
/* only used for writing temp. render results (not image files) */
-void IMB_exr_begin_write(void *handle, const char *filename, int width, int height, int compress)
+int IMB_exr_begin_write(void *handle, const char *filename, int width, int height, int compress)
{
ExrHandle *data= (ExrHandle *)handle;
Header header (width, height);
@@ -504,8 +504,17 @@ void IMB_exr_begin_write(void *handle, const char *filename, int width, int heig
/* header.lineOrder() = DECREASING_Y; this crashes in windows for file read! */
header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.55.1 and newer"));
-
- data->ofile = new OutputFile(filename, header);
+
+ /* avoid crash/abort when we dont have permission to write here */
+ try {
+ data->ofile = new OutputFile(filename, header);
+ }
+ catch (const std::exception &exc) {
+ std::cerr << "IMB_exr_begin_write: ERROR: " << exc.what() << std::endl;
+ data->ofile = NULL;
+ }
+
+ return (data->ofile != NULL);
}
void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley)
diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h
index 3d95bb7c306..58c5e0f2a3e 100644
--- a/source/blender/imbuf/intern/openexr/openexr_multi.h
+++ b/source/blender/imbuf/intern/openexr/openexr_multi.h
@@ -50,7 +50,7 @@ void * IMB_exr_get_handle (void);
void IMB_exr_add_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect);
int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height);
-void IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress);
+int IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress);
void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley);
void IMB_exr_set_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect);
@@ -75,7 +75,7 @@ void * IMB_exr_get_handle (void) {return NULL;}
void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;}
-void IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; }
+int IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; return 0;}
void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; }
void IMB_exr_set_channel (void *handle, char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index 844478e03cb..db2ae3a5114 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -482,7 +482,7 @@ void IMB_rectfill(struct ImBuf *drect, const float col[4])
}
-void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2)
+void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2)
{
int i, j;
float a; /* alpha */
@@ -509,6 +509,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
unsigned char *pixel;
unsigned char chr=0, chg=0, chb=0;
float fr=0, fg=0, fb=0;
+
+ const int alphaint= FTOCHAR(a);
if (a == 1.0f) {
chr = FTOCHAR(col[0]);
@@ -527,10 +529,13 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
pixel[0] = chr;
pixel[1] = chg;
pixel[2] = chb;
+ pixel[3] = 255;
} else {
+ int alphatest;
pixel[0] = (char)((fr + ((float)pixel[0]*aich))*255.0f);
pixel[1] = (char)((fg + ((float)pixel[1]*aich))*255.0f);
pixel[2] = (char)((fb + ((float)pixel[2]*aich))*255.0f);
+ pixel[3] = (char)((alphatest= ((int)pixel[3] + alphaint)) < 255 ? alphatest : 255);
}
}
}
@@ -546,10 +551,13 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
pixel[0] = col[0];
pixel[1] = col[1];
pixel[2] = col[2];
+ pixel[3] = 1.0f;
} else {
+ float alphatest;
pixel[0] = (col[0]*a) + (pixel[0]*ai);
pixel[1] = (col[1]*a) + (pixel[1]*ai);
pixel[2] = (col[2]*a) + (pixel[2]*ai);
+ pixel[3] = (alphatest= (pixel[3] + a)) < 1.0f ? alphatest : 1.0f;
}
}
}
diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c
index cd660e11f26..b933e6d93ee 100644
--- a/source/blender/imbuf/intern/writeimage.c
+++ b/source/blender/imbuf/intern/writeimage.c
@@ -55,7 +55,6 @@ short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags)
if(ibuf->rect==NULL && ibuf->rect_float)
IMB_rect_from_float(ibuf);
}
- /* TODO. have const char for image write funcs */
return type->save(ibuf, name, flags);
}
}
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index 77ba6031da5..eeb2adb3cf2 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -42,9 +42,10 @@ static PyTypeObject BlenderAppCbType;
static PyStructSequence_Field app_cb_info_fields[]= {
{(char *)"render_pre", NULL},
{(char *)"render_post", NULL},
- {(char *)"load_pre", NULL},
+ {(char *)"render_stats", NULL},
+ {(char *)"load_pre", NULL},
{(char *)"load_post", NULL},
- {(char *)"save_pre", NULL},
+ {(char *)"save_pre", NULL},
{(char *)"save_post", NULL},
{NULL}
};
diff --git a/source/blender/python/intern/bpy_intern_string.c b/source/blender/python/intern/bpy_intern_string.c
index 6fc861b2a0d..7c80653496f 100644
--- a/source/blender/python/intern/bpy_intern_string.c
+++ b/source/blender/python/intern/bpy_intern_string.c
@@ -40,7 +40,7 @@ PyObject *bpy_intern_str___slots__;
void bpy_intern_string_init(void)
{
bpy_intern_str_register= PyUnicode_FromString("register");
- bpy_intern_str_unregister= PyUnicode_FromString("unregister");;
+ bpy_intern_str_unregister= PyUnicode_FromString("unregister");
bpy_intern_str_bl_rna= PyUnicode_FromString("bl_rna");
bpy_intern_str_order= PyUnicode_FromString("order");
bpy_intern_str_attr= PyUnicode_FromString("attr");
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 4abcbc684e2..e1c38a82142 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1251,7 +1251,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
#if 0 // gives python decoding errors while generating docs :(
char error_str[256];
- snprintf(error_str, sizeof(error_str), "RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop));
+ BLI_snprintf(error_str, sizeof(error_str), "RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop));
PyErr_Warn(PyExc_RuntimeWarning, error_str);
#endif
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index 0736bed4faf..97ffcd95473 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -227,8 +227,8 @@ void RE_SetReports(struct Render *re, struct ReportList *reports);
/* main preview render call */
void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene);
-void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode);
-void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress);
+int RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode);
+int RE_WriteRenderResult(struct ReportList *reports, RenderResult *rr, const char *filename, int compress);
struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty);
extern const float default_envmap_layout[];
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 0d5f8c77f6b..24c55332bff 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -173,6 +173,9 @@ static void stats_background(void *UNUSED(arg), RenderStats *rs)
else
fprintf(stdout, "Sce: %s Ve:%d Fa:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->totlamp);
}
+
+ BLI_exec_cb(rs, (ID *)rs, BLI_CB_EVT_RENDER_STATS);
+
fputc('\n', stdout);
fflush(stdout);
}
@@ -824,11 +827,12 @@ static char *make_pass_name(RenderPass *rpass, int chan)
/* filename already made absolute */
/* called from within UI, saves both rendered result as a file-read result */
-void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress)
+int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *filename, int compress)
{
RenderLayer *rl;
RenderPass *rpass;
void *exrhandle= IMB_exr_get_handle();
+ int success;
BLI_make_existing_file(filename);
@@ -864,11 +868,20 @@ void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress)
}
}
}
-
- IMB_exr_begin_write(exrhandle, filename, rr->rectx, rr->recty, compress);
-
- IMB_exr_write_channels(exrhandle);
+
+ /* when the filename has no permissions, this can fail */
+ if(IMB_exr_begin_write(exrhandle, filename, rr->rectx, rr->recty, compress)) {
+ IMB_exr_write_channels(exrhandle);
+ success= TRUE;
+ }
+ else {
+ /* TODO, get the error from openexr's exception */
+ BKE_report(reports, RPT_ERROR, "Error Writing Render Result, see console");
+ success= FALSE;
+ }
IMB_exr_close(exrhandle);
+
+ return success;
}
/* callbacks for RE_MultilayerConvert */
@@ -992,9 +1005,10 @@ static int read_render_result_from_file(const char *filename, RenderResult *rr)
}
/* only for temp buffer files, makes exact copy of render result */
-static void read_render_result(Render *re, int sample)
+static int read_render_result(Render *re, int sample)
{
char str[FILE_MAX];
+ int success;
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
@@ -1004,10 +1018,18 @@ static void read_render_result(Render *re, int sample)
render_unique_exr_name(re, str, sample);
printf("read exr tmp file: %s\n", str);
- if(!read_render_result_from_file(str, re->result))
+ if(read_render_result_from_file(str, re->result)) {
+ success= TRUE;
+ }
+ else {
printf("cannot read: %s\n", str);
+ success= FALSE;
+
+ }
BLI_rw_mutex_unlock(&re->resultmutex);
+
+ return success;
}
/* *************************************************** */
@@ -2981,7 +3003,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, c
if(re->r.imtype==R_MULTILAYER) {
if(re->result) {
- RE_WriteRenderResult(re->result, name, scene->r.quality);
+ RE_WriteRenderResult(re->reports, re->result, name, scene->r.quality);
printf("Saved: %s", name);
}
}
@@ -3198,7 +3220,7 @@ void RE_PreviewRender(Render *re, Main *bmain, Scene *sce)
/* note; repeated win/disprect calc... solve that nicer, also in compo */
/* only the temp file! */
-void RE_ReadRenderResult(Scene *scene, Scene *scenode)
+int RE_ReadRenderResult(Scene *scene, Scene *scenode)
{
Render *re;
int winx, winy;
@@ -3232,7 +3254,7 @@ void RE_ReadRenderResult(Scene *scene, Scene *scenode)
RE_InitState(re, NULL, &scene->r, NULL, winx, winy, &disprect);
re->scene= scene;
- read_render_result(re, 0);
+ return read_render_result(re, 0);
}
void RE_set_max_threads(int threads)