diff options
author | Miika Hamalainen <blender@miikah.org> | 2011-06-27 12:11:05 +0400 |
---|---|---|
committer | Miika Hamalainen <blender@miikah.org> | 2011-06-27 12:11:05 +0400 |
commit | c896fcae7963fb35124ef3fefe0f12679228fa39 (patch) | |
tree | f4435bd39a36228a71c9142e4c26bacd482683f3 /source/blender/blenkernel | |
parent | cb12648656fc001e8c4c6d00df73e52d452f8787 (diff) | |
parent | 93bb6238e0c6b7ea008776f4e1c3958ef5382c09 (diff) |
Merge with trunk r37849
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_particle.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/bvhutils.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 19 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 144 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/writeffmpeg.c | 21 |
13 files changed, 174 insertions, 80 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 07f0885372a..7c11f9e964e 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -43,7 +43,7 @@ extern "C" { /* these lines are grep'd, watch out for our not-so-awesome regex * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ -#define BLENDER_VERSION 257 +#define BLENDER_VERSION 258 #define BLENDER_SUBVERSION 1 #define BLENDER_MINVERSION 250 @@ -51,9 +51,9 @@ extern "C" { /* used by packaging tools */ /* can be left blank, otherwise a,b,c... etc with no quotes */ -#define BLENDER_VERSION_CHAR b +#define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE beta +#define BLENDER_VERSION_CYCLE release struct ListBase; struct MemFile; diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index feeab98ad78..5b565223ece 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -147,7 +147,8 @@ typedef struct ParticleBillboardData struct Object *ob; float vec[3], vel[3]; float offset[2]; - float size, tilt, random, time; + float size[2]; + float tilt, random, time; int uv[3]; int lock, num; int totnum; diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 8b6bca3805e..99b1ff98808 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -43,8 +43,6 @@ set(INC ../nodes ../editors/include ../render/extern/include - ../../../intern/audaspace/intern - ../../../intern/ffmpeg ../../../intern/bsp/extern ../blenfont ../../../intern/decimation/extern ../../../intern/elbeem/extern @@ -238,6 +236,13 @@ set(SRC add_definitions(-DGLEW_STATIC) +if(WITH_AUDASPACE) + list(APPEND INC + ../../../intern/audaspace/intern + ) + add_definitions(-DWITH_AUDASPACE) +endif() + if(WITH_BULLET) list(APPEND INC ../../../extern/bullet2/src) add_definitions(-DUSE_BULLET) @@ -274,12 +279,13 @@ endif() if(WITH_CODEC_QUICKTIME) list(APPEND INC ../quicktime) - list(APPEND INC_SYS ${QUICKTIME_INC}) + list(APPEND INC_SYS ${QUICKTIME_INCLUDE_DIRS}) add_definitions(-DWITH_QUICKTIME) endif() if(WITH_CODEC_FFMPEG) - list(APPEND INC_SYS ${FFMPEG_INC}) + list(APPEND INC ../../../intern/ffmpeg) + list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS}) add_definitions(-DWITH_FFMPEG) endif() diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 1763866c000..0747d87a0ab 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -171,7 +171,12 @@ bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel * avs= &ob->avs; dst= &ob->mpath; } - + + /* avoid 0 size allocs */ + if(avs->path_sf >= avs->path_ef) { + return NULL; + } + /* if there is already a motionpath, just return that, * but provided it's settings are ok */ diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 0f545ad3ff9..8b4bbbd3c83 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -64,6 +64,7 @@ #include "BLI_dynstr.h" #include "BLI_path_util.h" #include "BLI_utildefines.h" +#include "BLI_callbacks.h" #include "IMB_imbuf.h" @@ -96,7 +97,7 @@ UserDef U; /* ListBase = {NULL, NULL}; */ short ENDIAN_ORDER; -static char versionstr[48]= ""; +char versionstr[48]= ""; /* ********** free ********** */ @@ -110,6 +111,9 @@ void free_blender(void) BKE_spacetypes_free(); /* after free main, it uses space callbacks */ IMB_exit(); + + BLI_cb_finalize(); + seq_stripelem_cache_destruct(); free_nodesystem(); @@ -129,9 +133,9 @@ void initglobals(void) ENDIAN_ORDER= (((char*)&ENDIAN_ORDER)[0])? L_ENDIAN: B_ENDIAN; if(BLENDER_SUBVERSION) - BLI_snprintf(versionstr, sizeof(versionstr), "www.blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION); + BLI_snprintf(versionstr, sizeof(versionstr), "blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION); else - BLI_snprintf(versionstr, sizeof(versionstr), "www.blender.org %d", BLENDER_VERSION); + BLI_snprintf(versionstr, sizeof(versionstr), "blender.org %d", BLENDER_VERSION); #ifdef _WIN32 // FULLSCREEN G.windowstate = G_WINDOWSTATE_USERDEF; diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index a4ceb62ab55..c497cd2813a 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -235,8 +235,6 @@ void make_local_brush(Brush *brush) if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) { if(scene->id.lib==NULL) { paint_brush_set(&scene->toolsettings->imapaint.paint, brushn); - brushn->id.us++; - brush->id.us--; } } } diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index fa6a8239282..91238f20337 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -719,7 +719,7 @@ void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data) if(!data->cached) BLI_bvhtree_free(data->tree); - memset( data, 0, sizeof(data) ); + memset( data, 0, sizeof(*data) ); } } diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 3a8a2ae9c09..64e374fe4c0 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -32,8 +32,10 @@ */ -#ifdef WITH_PYTHON -#include <Python.h> +#if 0 /* pynodes commented for now */ +# ifdef WITH_PYTHON +# include <Python.h> +# endif #endif #include "MEM_guardedalloc.h" diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 5be492d1108..d00eb6192da 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -85,8 +85,11 @@ Brush *paint_brush(Paint *p) void paint_brush_set(Paint *p, Brush *br) { - if(p) + if(p) { + id_us_min((ID *)p->brush); + id_us_plus((ID *)br); p->brush= br; + } } int paint_facesel_test(Object *ob) @@ -110,12 +113,17 @@ void paint_init(Paint *p, const char col[3]) p->flags |= PAINT_SHOW_BRUSH; } -void free_paint(Paint *UNUSED(paint)) +void free_paint(Paint *paint) { - /* nothing */ + id_us_min((ID *)paint->brush); } +/* called when copying scene settings, so even if 'src' and 'tar' are the same + * still do a id_us_plus(), rather then if we were copying betweem 2 existing + * scenes where a matching value should decrease the existing user count as + * with paint_brush_set() */ void copy_paint(Paint *src, Paint *tar) { tar->brush= src->brush; + id_us_plus((ID *)tar->brush); } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 2dcefb98012..5b7442fe5bc 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3543,6 +3543,8 @@ static void default_particle_settings(ParticleSettings *part) part->path_start = 0.0f; part->path_end = 1.0f; + part->bb_size[0] = part->bb_size[1] = 1.0f; + part->keyed_loops = 1; part->color_vec_max = 1.f; @@ -4514,8 +4516,8 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3] mul_v3_fl(tvec, -sin(bb->tilt * (float)M_PI)); VECADD(yvec, yvec, tvec); - mul_v3_fl(xvec, bb->size); - mul_v3_fl(yvec, bb->size); + mul_v3_fl(xvec, bb->size[0]); + mul_v3_fl(yvec, bb->size[1]); VECADDFAC(center, bb->vec, xvec, bb->offset[0]); VECADDFAC(center, center, yvec, bb->offset[1]); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b82ac69fc9e..265cc3eeb79 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -73,7 +73,10 @@ #include "BKE_context.h" #include "BKE_sound.h" -#include "AUD_C-API.h" + +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif #ifdef WIN32 #define snprintf _snprintf @@ -697,6 +700,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) } seq->strip->len = seq->len; case SEQ_SOUND: +#ifdef WITH_AUDASPACE if(!seq->sound) return; seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS); @@ -706,6 +710,9 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) seq->len = 0; } seq->strip->len = seq->len; +#else + return; +#endif break; case SEQ_SCENE: { @@ -3493,6 +3500,7 @@ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo return seq; } +#ifdef WITH_AUDASPACE Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) { Scene *scene= CTX_data_scene(C); /* only for sound */ @@ -3550,6 +3558,15 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo return seq; } +#else // WITH_AUDASPACE +Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) +{ + (void)C; + (void)seqbasep; + (void)seq_load; + return NULL; +} +#endif // WITH_AUDASPACE Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) { diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index e0e456a371e..f2e3537762f 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -21,7 +21,9 @@ #include "DNA_screen_types.h" #include "DNA_sound_types.h" -#include "AUD_C-API.h" +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif #include "BKE_utildefines.h" #include "BKE_global.h" @@ -36,6 +38,62 @@ static int force_device = -1; + +struct bSound* sound_new_file(struct Main *bmain, const char *filename) +{ + bSound* sound = NULL; + + char str[FILE_MAX]; + char *path; + + int len; + + strcpy(str, filename); + + path = /*bmain ? bmain->name :*/ G.main->name; + + BLI_path_abs(str, path); + + len = strlen(filename); + while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\') + len--; + + sound = alloc_libblock(&bmain->sound, ID_SO, filename+len); + BLI_strncpy(sound->name, filename, FILE_MAX); +// XXX unused currently sound->type = SOUND_TYPE_FILE; + + sound_load(bmain, sound); + + if(!sound->playback_handle) + { + free_libblock(&bmain->sound, sound); + sound = NULL; + } + + return sound; +} + +void sound_free(struct bSound* sound) +{ + if (sound->packedfile) + { + freePackedFile(sound->packedfile); + sound->packedfile = NULL; + } + +#ifdef WITH_AUDASPACE + if(sound->handle) + { + AUD_unload(sound->handle); + sound->handle = NULL; + sound->playback_handle = NULL; + } +#endif // WITH_AUDASPACE +} + + +#ifdef WITH_AUDASPACE + #ifdef WITH_JACK static void sound_sync_callback(void* data, int mode, float time) { @@ -123,40 +181,6 @@ void sound_exit(void) AUD_exit(); } -struct bSound* sound_new_file(struct Main *bmain, const char *filename) -{ - bSound* sound = NULL; - - char str[FILE_MAX]; - char *path; - - int len; - - strcpy(str, filename); - - path = /*bmain ? bmain->name :*/ G.main->name; - - BLI_path_abs(str, path); - - len = strlen(filename); - while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\') - len--; - - sound = alloc_libblock(&bmain->sound, ID_SO, filename+len); - BLI_strncpy(sound->name, filename, FILE_MAX); -// XXX unused currently sound->type = SOUND_TYPE_FILE; - - sound_load(bmain, sound); - - if(!sound->playback_handle) - { - free_libblock(&bmain->sound, sound); - sound = NULL; - } - - return sound; -} - // XXX unused currently #if 0 struct bSound* sound_new_buffer(struct bContext *C, struct bSound *source) @@ -301,22 +325,6 @@ void sound_load(struct Main *bmain, struct bSound* sound) } } -void sound_free(struct bSound* sound) -{ - if (sound->packedfile) - { - freePackedFile(sound->packedfile); - sound->packedfile = NULL; - } - - if(sound->handle) - { - AUD_unload(sound->handle); - sound->handle = NULL; - sound->playback_handle = NULL; - } -} - static float sound_get_volume(Scene* scene, Sequence* sequence, float time) { AnimData *adt= BKE_animdata_from_id(&scene->id); @@ -490,8 +498,9 @@ int sound_scene_playing(struct Scene *scene) int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end) { AUD_Sound* limiter = AUD_limitSound(sound->cache, start, end); - return AUD_readSound(limiter, buffer, length); + int ret= AUD_readSound(limiter, buffer, length); AUD_unload(limiter); + return ret; } int sound_get_channels(struct bSound* sound) @@ -502,3 +511,34 @@ int sound_get_channels(struct bSound* sound) return info.specs.channels; } + +#else // WITH_AUDASPACE + +#include "BLI_utildefines.h" + +int sound_define_from_str(const char *UNUSED(str)) { return -1;} +void sound_force_device(int UNUSED(device)) {} +void sound_init_once(void) {} +void sound_init(struct Main *UNUSED(bmain)) {} +void sound_exit(void) {} +void sound_cache(struct bSound* UNUSED(sound), int UNUSED(ignore)) { } +void sound_delete_cache(struct bSound* UNUSED(sound)) {} +void sound_load(struct Main *UNUSED(bmain), struct bSound* UNUSED(sound)) {} +void sound_create_scene(struct Scene *UNUSED(scene)) {} +void sound_destroy_scene(struct Scene *UNUSED(scene)) {} +void sound_mute_scene(struct Scene *UNUSED(scene), int UNUSED(muted)) {} +void* sound_scene_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; } +void* sound_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; } +void sound_remove_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle)) {} +void sound_mute_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle), char UNUSED(mute)) {} +void sound_move_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) {} +static void sound_start_play_scene(struct Scene *UNUSED(scene)) {} +void sound_play_scene(struct Scene *UNUSED(scene)) {} +void sound_stop_scene(struct Scene *UNUSED(scene)) {} +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 0; } +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/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index c729565533f..4db53999f10 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -49,7 +49,9 @@ #include "BLI_blenlib.h" -#include "AUD_C-API.h" /* must be before BKE_sound.h for define */ +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif #include "BKE_global.h" #include "BKE_idprop.h" @@ -89,7 +91,9 @@ static uint8_t* audio_output_buffer = 0; static int audio_outbuf_size = 0; static double audio_time = 0.0f; +#ifdef WITH_AUDASPACE static AUD_Device* audio_mixdown_device = 0; +#endif #define FFMPEG_AUTOSPLIT_SIZE 2000000000 @@ -103,6 +107,7 @@ static void delete_picture(AVFrame* f) } } +#ifdef WITH_AUDASPACE static int write_audio_frame(void) { AVCodecContext* c = NULL; @@ -145,6 +150,7 @@ static int write_audio_frame(void) } return 0; } +#endif // #ifdef WITH_AUDASPACE /* Allocate a temporary frame */ static AVFrame* alloc_picture(int pix_fmt, int width, int height) @@ -851,7 +857,7 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo ffmpeg_autosplit_count = 0; success = start_ffmpeg_impl(rd, rectx, recty, reports); - +#ifdef WITH_AUDASPACE if(audio_stream) { AVCodecContext* c = audio_stream->codec; @@ -861,12 +867,13 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo specs.rate = rd->ffcodecdata.audio_mixrate; audio_mixdown_device = sound_mixdown(scene, specs, rd->sfra, rd->ffcodecdata.audio_volume); } - +#endif return success; } void end_ffmpeg(void); +#ifdef WITH_AUDASPACE static void write_audio_frames(double to_pts) { int finished = 0; @@ -878,6 +885,7 @@ static void write_audio_frames(double to_pts) } } } +#endif int append_ffmpeg(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports) { @@ -905,8 +913,9 @@ int append_ffmpeg(RenderData *rd, int frame, int *pixels, int rectx, int recty, } } +#ifdef WITH_AUDASPACE write_audio_frames((frame - rd->sfra) / (((double)rd->frs_sec) / rd->frs_sec_base)); - +#endif return success; } @@ -920,12 +929,14 @@ void end_ffmpeg(void) write_audio_frames(); }*/ +#ifdef WITH_AUDASPACE if(audio_mixdown_device) { AUD_closeReadDevice(audio_mixdown_device); audio_mixdown_device = 0; } - +#endif + if (video_stream && video_stream->codec) { fprintf(stderr, "Flushing delayed frames...\n"); flush_ffmpeg (); |