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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-02-09 00:13:33 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-02-09 00:13:33 +0300
commited266e868cee7e922f028227ee22492d7e830253 (patch)
tree7eacd3765dbf381d8617f17e47c005165adc08ed /source/blender
parent4ec75badf8a0ed6bb2b00b26947792ddc629a164 (diff)
parent616af4fa52b4bdc3cbee3d6d1f17b5d1fb54a0b6 (diff)
Merged changes in the trunk up to revision 26719.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h1
-rw-r--r--source/blender/blenkernel/BKE_screen.h2
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h8
-rw-r--r--source/blender/blenkernel/BKE_sound.h27
-rw-r--r--source/blender/blenkernel/BKE_writeffmpeg.h2
-rw-r--r--source/blender/blenkernel/CMakeLists.txt4
-rw-r--r--source/blender/blenkernel/SConscript4
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c82
-rw-r--r--source/blender/blenkernel/intern/Makefile5
-rw-r--r--source/blender/blenkernel/intern/collision.c4
-rw-r--r--source/blender/blenkernel/intern/constraint.c27
-rw-r--r--source/blender/blenkernel/intern/exotic.c45
-rw-r--r--source/blender/blenkernel/intern/multires.c13
-rw-r--r--source/blender/blenkernel/intern/node.c2
-rw-r--r--source/blender/blenkernel/intern/pointcache.c105
-rw-r--r--source/blender/blenkernel/intern/scene.c9
-rw-r--r--source/blender/blenkernel/intern/screen.c16
-rw-r--r--source/blender/blenkernel/intern/sequencer.c90
-rw-r--r--source/blender/blenkernel/intern/softbody.c2
-rw-r--r--source/blender/blenkernel/intern/sound.c293
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c35
-rw-r--r--source/blender/blenkernel/intern/texture.c2
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c169
-rw-r--r--source/blender/blenlib/intern/BLI_args.c63
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c8
-rw-r--r--source/blender/blenlib/intern/bpath.c4
-rw-r--r--source/blender/blenlib/intern/noise.c10
-rw-r--r--source/blender/blenlib/intern/path_util.c4
-rw-r--r--source/blender/blenlib/intern/storage.c4
-rw-r--r--source/blender/blenloader/intern/readfile.c88
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c2
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c46
-rw-r--r--source/blender/editors/animation/anim_markers.c2
-rw-r--r--source/blender/editors/animation/anim_ops.c2
-rw-r--r--source/blender/editors/animation/keyframes_edit.c39
-rw-r--r--source/blender/editors/armature/editarmature.c22
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c2
-rw-r--r--source/blender/editors/armature/poseobject.c175
-rw-r--r--source/blender/editors/interface/interface.c12
-rw-r--r--source/blender/editors/interface/interface_handlers.c2
-rw-r--r--source/blender/editors/interface/interface_icons.c4
-rw-r--r--source/blender/editors/mesh/meshtools.c2
-rw-r--r--source/blender/editors/object/object_transform.c2
-rw-r--r--source/blender/editors/physics/physics_fluid.c20
-rw-r--r--source/blender/editors/screen/area.c2
-rw-r--r--source/blender/editors/screen/screen_ops.c14
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c2
-rw-r--r--source/blender/editors/sound/sound_ops.c4
-rw-r--r--source/blender/editors/space_action/action_edit.c2
-rw-r--r--source/blender/editors/space_action/action_select.c6
-rw-r--r--source/blender/editors/space_file/filelist.c2
-rw-r--r--source/blender/editors/space_graph/graph_edit.c4
-rw-r--r--source/blender/editors/space_graph/graph_ops.c2
-rw-r--r--source/blender/editors/space_graph/graph_select.c20
-rw-r--r--source/blender/editors/space_nla/nla_channels.c9
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c8
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c188
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c93
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h2
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c25
-rw-r--r--source/blender/editors/space_text/text_draw.c10
-rw-r--r--source/blender/editors/space_text/text_intern.h5
-rw-r--r--source/blender/editors/space_text/text_ops.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c18
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c4
-rw-r--r--source/blender/editors/transform/transform_conversions.c14
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c8
-rw-r--r--source/blender/imbuf/intern/iff.c6
-rw-r--r--source/blender/imbuf/intern/thumbs.c8
-rw-r--r--source/blender/makesdna/DNA_scene_types.h5
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h4
-rw-r--r--source/blender/makesdna/DNA_sound_types.h25
-rw-r--r--source/blender/makesdna/DNA_space_types.h4
-rw-r--r--source/blender/makesdna/DNA_text_types.h2
-rw-r--r--source/blender/makesrna/RNA_access.h4
-rw-r--r--source/blender/makesrna/intern/makesrna.c6
-rw-r--r--source/blender/makesrna/intern/rna_ID.c35
-rw-r--r--source/blender/makesrna/intern/rna_access.c39
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c9
-rw-r--r--source/blender/makesrna/intern/rna_color.c1
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c4
-rw-r--r--source/blender/makesrna/intern/rna_material.c2
-rw-r--r--source/blender/makesrna/intern/rna_scene.c48
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c24
-rw-r--r--source/blender/makesrna/intern/rna_ui.c4
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_output.c4
-rw-r--r--source/blender/nodes/intern/TEX_util.c41
-rw-r--r--source/blender/python/intern/bpy_interface.c4
-rw-r--r--source/blender/render/intern/include/shading.h2
-rw-r--r--source/blender/render/intern/raytrace/rayobject.cpp2
-rw-r--r--source/blender/render/intern/source/pipeline.c11
-rw-r--r--source/blender/render/intern/source/rendercore.c8
-rw-r--r--source/blender/render/intern/source/shadeoutput.c2
-rw-r--r--source/blender/render/intern/source/voxeldata.c50
-rw-r--r--source/blender/windowmanager/WM_types.h4
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c35
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c24
99 files changed, 1226 insertions, 1102 deletions
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 9839cde9a22..bdcfec84bdf 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -34,6 +34,7 @@ struct ChannelDriver;
struct DriverVar;
struct DriverTarget;
+struct bAction;
struct BezTriple;
struct StructRNA;
struct PointerRNA;
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 3a0cbd9d872..ebf4f09ffd4 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -234,6 +234,8 @@ struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *ar);
void BKE_area_region_free(struct SpaceType *st, struct ARegion *ar);
void BKE_screen_area_free(struct ScrArea *sa);
+struct ARegion *BKE_area_find_region_type(struct ScrArea *sa, int type);
+
/* screen */
void free_screen(struct bScreen *sc);
unsigned int BKE_screen_visible_layers(struct bScreen *screen, struct Scene *scene);
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 0c84d729d47..49afe201c92 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -150,8 +150,8 @@ struct ImBuf *give_ibuf_seq(struct Scene *scene, int rectx, int recty, int cfra,
struct ImBuf *give_ibuf_seq_threaded(struct Scene *scene, int rectx, int recty, int cfra, int chanshown, int render_size);
struct ImBuf *give_ibuf_seq_direct(struct Scene *scene, int rectx, int recty, int cfra, int render_size, struct Sequence *seq);
void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown, int render_size);
-void calc_sequence(struct Sequence *seq);
-void calc_sequence_disp(struct Sequence *seq);
+void calc_sequence(struct Scene *scene, struct Sequence *seq);
+void calc_sequence_disp(struct Scene *scene, struct Sequence *seq);
void new_tstripdata(struct Sequence *seq);
void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq);
void sort_seq(struct Scene *scene);
@@ -191,8 +191,8 @@ int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene);
int seqbase_isolated_sel_check(struct ListBase *seqbase);
void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage);
-void seq_update_sound(struct Sequence *seq);
-void seq_update_muting(struct Editing *ed);
+void seq_update_sound(struct Scene* scene, struct Sequence *seq);
+void seq_update_muting(struct Scene* scene, struct Editing *ed);
void seqbase_sound_reload(Scene *scene, ListBase *seqbase);
void clear_scene_in_allseqs(struct Scene *sce);
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index 82ef525ba91..1c9a7db03c3 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -36,6 +36,7 @@ struct bSound;
struct bContext;
struct ListBase;
struct Main;
+struct Sequence;
void sound_init();
@@ -63,20 +64,28 @@ void sound_load(struct Main *main, struct bSound* sound);
void sound_free(struct bSound* sound);
-void sound_unlink(struct bContext *C, struct bSound* sound);
+#ifdef AUD_CAPI
+AUD_Device* sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume);
+#endif
-struct SoundHandle* sound_new_handle(struct Scene *scene, struct bSound* sound, int startframe, int endframe, int frameskip);
+void sound_create_scene(struct Scene *scene);
-void sound_delete_handle(struct Scene *scene, struct SoundHandle *handle);
+void sound_destroy_scene(struct Scene *scene);
-void sound_update_playing(struct bContext *C);
+void* sound_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip);
-void sound_scrub(struct bContext *C);
+void sound_remove_scene_sound(struct Scene *scene, void* handle);
-#ifdef AUD_CAPI
-AUD_Device* sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, int end, float volume);
-#endif
+void sound_mute_scene_sound(struct Scene *scene, void* handle, char mute);
+
+void sound_move_scene_sound(struct Scene *scene, void* handle, int startframe, int endframe, int frameskip);
+
+void sound_play_scene(struct Scene *scene);
+
+void sound_stop_scene(struct Scene *scene);
+
+void sound_seek_scene(struct bContext *C);
-void sound_stop_all(struct bContext *C);
+int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length);
#endif
diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h
index 98c385ea2e1..20c5b2fd46f 100644
--- a/source/blender/blenkernel/BKE_writeffmpeg.h
+++ b/source/blender/blenkernel/BKE_writeffmpeg.h
@@ -45,6 +45,8 @@ extern "C" {
#define FFMPEG_FLV 8
#define FFMPEG_MKV 9
#define FFMPEG_OGG 10
+#define FFMPEG_WAV 11
+#define FFMPEG_MP3 12
#define FFMPEG_PRESET_NONE 0
#define FFMPEG_PRESET_DVD 1
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 69d43317013..ea30d4404be 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -73,6 +73,10 @@ ELSE(WITH_PYTHON)
ADD_DEFINITIONS(-DDISABLE_PYTHON)
ENDIF(WITH_PYTHON)
+IF(WITH_OPENMP)
+ ADD_DEFINITIONS(-DPARALLEL=1)
+ENDIF(WITH_OPENMP)
+
IF(NOT WITH_ELBEEM)
ADD_DEFINITIONS(-DDISABLE_ELBEEM)
ENDIF(NOT WITH_ELBEEM)
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index d8201c277f7..73f6a8393ed 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -55,6 +55,10 @@ if env['WITH_BF_QUICKTIME']:
if env['WITH_BF_BULLET']:
defs.append('USE_BULLET')
+if env['OURPLATFORM'] == 'darwin':
+ if env['WITH_BF_OPENMP']:
+ defs.append('PARALLEL=1')
+
if env['BF_NO_ELBEEM']:
defs.append('DISABLE_ELBEEM')
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 60e1015f190..eb316c64af4 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -6,6 +6,7 @@
#include "CCGSubSurf.h"
+#include "MEM_guardedalloc.h"
#include "BLO_sys_types.h" // for intptr_t support
#ifdef _MSC_VER
@@ -689,8 +690,8 @@ void ccgSubSurf_free(CCGSubSurf *ss) {
_ehash_free(ss->oldEMap, (EHEntryFreeFP) _edge_free, ss);
_ehash_free(ss->oldVMap, (EHEntryFreeFP) _vert_free, ss);
- CCGSUBSURF_free(ss, ss->tempVerts);
- CCGSUBSURF_free(ss, ss->tempEdges);
+ MEM_freeN(ss->tempVerts);
+ MEM_freeN(ss->tempEdges);
}
CCGSUBSURF_free(ss, ss->r);
@@ -815,8 +816,8 @@ CCGError ccgSubSurf_initFullSync(CCGSubSurf *ss) {
ss->numGrids = 0;
ss->lenTempArrays = 12;
- ss->tempVerts = CCGSUBSURF_alloc(ss, sizeof(*ss->tempVerts)*ss->lenTempArrays);
- ss->tempEdges = CCGSUBSURF_alloc(ss, sizeof(*ss->tempEdges)*ss->lenTempArrays);
+ ss->tempVerts = MEM_mallocN(sizeof(*ss->tempVerts)*ss->lenTempArrays, "CCGSubsurf tempVerts");
+ ss->tempEdges = MEM_mallocN(sizeof(*ss->tempEdges)*ss->lenTempArrays, "CCGSubsurf tempEdges");
ss->syncState = eSyncState_Vert;
@@ -1006,10 +1007,9 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
int j, k, topologyChanged = 0;
if (numVerts>ss->lenTempArrays) {
- int oldLen = ss->lenTempArrays;
ss->lenTempArrays = (numVerts<ss->lenTempArrays*2)?ss->lenTempArrays*2:numVerts;
- ss->tempVerts = CCGSUBSURF_realloc(ss, ss->tempVerts, sizeof(*ss->tempVerts)*ss->lenTempArrays, sizeof(*ss->tempVerts)*oldLen);
- ss->tempEdges = CCGSUBSURF_realloc(ss, ss->tempEdges, sizeof(*ss->tempEdges)*ss->lenTempArrays, sizeof(*ss->tempEdges)*oldLen);
+ ss->tempVerts = MEM_reallocN(ss->tempVerts, sizeof(*ss->tempVerts)*ss->lenTempArrays);
+ ss->tempEdges = MEM_reallocN(ss->tempEdges, sizeof(*ss->tempEdges)*ss->lenTempArrays);
}
if (ss->syncState==eSyncState_Partial) {
@@ -1124,8 +1124,8 @@ CCGError ccgSubSurf_processSync(CCGSubSurf *ss) {
_ehash_free(ss->oldFMap, (EHEntryFreeFP) _face_unlinkMarkAndFree, ss);
_ehash_free(ss->oldEMap, (EHEntryFreeFP) _edge_unlinkMarkAndFree, ss);
_ehash_free(ss->oldVMap, (EHEntryFreeFP) _vert_free, ss);
- CCGSUBSURF_free(ss, ss->tempEdges);
- CCGSUBSURF_free(ss, ss->tempVerts);
+ MEM_freeN(ss->tempEdges);
+ MEM_freeN(ss->tempVerts);
ss->lenTempArrays = 0;
@@ -1691,8 +1691,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
#pragma omp critical
{
- q = CCGSUBSURF_alloc(ss, ss->meshIFC.vertDataSize);
- r = CCGSUBSURF_alloc(ss, ss->meshIFC.vertDataSize);
+ q = MEM_mallocN(ss->meshIFC.vertDataSize, "CCGSubsurf q");
+ r = MEM_mallocN(ss->meshIFC.vertDataSize, "CCGSubsurf r");
}
#pragma omp for schedule(static)
@@ -1781,8 +1781,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
#pragma omp critical
{
- CCGSUBSURF_free(ss, q);
- CCGSUBSURF_free(ss, r);
+ MEM_freeN(q);
+ MEM_freeN(r);
}
}
@@ -1837,9 +1837,9 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
int curLvl, nextLvl;
void *q = ss->q, *r = ss->r;
- effectedV = CCGSUBSURF_alloc(ss, sizeof(*effectedV)*ss->vMap->numEntries);
- effectedE = CCGSUBSURF_alloc(ss, sizeof(*effectedE)*ss->eMap->numEntries);
- effectedF = CCGSUBSURF_alloc(ss, sizeof(*effectedF)*ss->fMap->numEntries);
+ effectedV = MEM_mallocN(sizeof(*effectedV)*ss->vMap->numEntries, "CCGSubsurf effectedV");
+ effectedE = MEM_mallocN(sizeof(*effectedE)*ss->eMap->numEntries, "CCGSubsurf effectedE");
+ effectedF = MEM_mallocN(sizeof(*effectedF)*ss->fMap->numEntries, "CCGSubsurf effectedF");
numEffectedV = numEffectedE = numEffectedF = 0;
for (i=0; i<ss->vMap->curSize; i++) {
CCGVert *v = (CCGVert*) ss->vMap->buckets[i];
@@ -2097,9 +2097,9 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
e->flags = 0;
}
- CCGSUBSURF_free(ss, effectedF);
- CCGSUBSURF_free(ss, effectedE);
- CCGSUBSURF_free(ss, effectedV);
+ MEM_freeN(effectedF);
+ MEM_freeN(effectedE);
+ MEM_freeN(effectedV);
}
static void ccgSubSurf__allFaces(CCGSubSurf *ss, CCGFace ***faces, int *numFaces, int *freeFaces)
@@ -2108,7 +2108,7 @@ static void ccgSubSurf__allFaces(CCGSubSurf *ss, CCGFace ***faces, int *numFaces
int i, num;
if(!*faces) {
- array = CCGSUBSURF_alloc(ss, sizeof(*array)*ss->fMap->numEntries);
+ array = MEM_mallocN(sizeof(*array)*ss->fMap->numEntries, "CCGSubsurf allFaces");
num = 0;
for (i=0; i<ss->fMap->curSize; i++) {
CCGFace *f = (CCGFace*) ss->fMap->buckets[i];
@@ -2131,8 +2131,8 @@ static void ccgSubSurf__effectedFaceNeighbours(CCGSubSurf *ss, CCGFace **faces,
CCGEdge **arrayE;
int numV, numE, i, j;
- arrayV = CCGSUBSURF_alloc(ss, sizeof(*arrayV)*ss->vMap->numEntries);
- arrayE = CCGSUBSURF_alloc(ss, sizeof(*arrayE)*ss->eMap->numEntries);
+ arrayV = MEM_mallocN(sizeof(*arrayV)*ss->vMap->numEntries, "CCGSubsurf arrayV");
+ arrayE = MEM_mallocN(sizeof(*arrayE)*ss->eMap->numEntries, "CCGSubsurf arrayV");
numV = numE = 0;
for (i=0; i<numFaces; i++) {
@@ -2210,7 +2210,7 @@ CCGError ccgSubSurf_updateFromFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF
}
}
- if(freeF) CCGSUBSURF_free(ss, effectedF);
+ if(freeF) MEM_freeN(effectedF);
return eCCGError_None;
}
@@ -2252,7 +2252,7 @@ CCGError ccgSubSurf_updateToFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF,
}
}
- if(freeF) CCGSUBSURF_free(ss, effectedF);
+ if(freeF) MEM_freeN(effectedF);
return eCCGError_None;
}
@@ -2297,9 +2297,8 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
VertDataZero(FACE_getCenterData(f));
for (S=0; S<f->numVerts; S++)
- if (FACE_getEdges(f)[S]->flags&Edge_eEffected)
- for (x=0; x<gridSize; x++)
- VertDataZero(FACE_getIECo(f, lvl, S, x));
+ for (x=0; x<gridSize; x++)
+ VertDataZero(FACE_getIECo(f, lvl, S, x));
for (S=0; S<f->numVerts; S++) {
int prevS = (S+f->numVerts-1)%f->numVerts;
@@ -2311,10 +2310,8 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
VertDataAdd(VERT_getCo(FACE_getVerts(f)[S], lvl), FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx));
for (x=1; x<gridSize-1; x++) {
- if (FACE_getEdges(f)[S]->flags&Edge_eEffected)
- VertDataAdd(FACE_getIECo(f, lvl, S, x), FACE_getIFCo(f, lvl, S, x, 0));
- if (FACE_getEdges(f)[prevS]->flags&Edge_eEffected)
- VertDataAdd(FACE_getIECo(f, lvl, prevS, x), FACE_getIFCo(f, lvl, S, 0, x));
+ VertDataAdd(FACE_getIECo(f, lvl, S, x), FACE_getIFCo(f, lvl, S, x, 0));
+ VertDataAdd(FACE_getIECo(f, lvl, prevS, x), FACE_getIFCo(f, lvl, S, 0, x));
}
for (x=0; x<gridSize-1; x++) {
@@ -2351,9 +2348,8 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
VertDataMulN(FACE_getCenterData(f), 1.0f/f->numVerts);
for (S=0; S<f->numVerts; S++)
- if (FACE_getEdges(f)[S]->flags&Edge_eEffected)
- for (x=1; x<gridSize-1; x++)
- VertDataMulN(FACE_getIECo(f, lvl, S, x), 0.5f);
+ for (x=1; x<gridSize-1; x++)
+ VertDataMulN(FACE_getIECo(f, lvl, S, x), 0.5f);
for (S=0; S<f->numVerts; S++) {
int prevS = (S+f->numVerts-1)%f->numVerts;
@@ -2386,9 +2382,9 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
for (i=0; i<numEffectedF; i++)
effectedF[i]->flags = 0;
- CCGSUBSURF_free(ss, effectedE);
- CCGSUBSURF_free(ss, effectedV);
- if(freeF) CCGSUBSURF_free(ss, effectedF);
+ MEM_freeN(effectedE);
+ MEM_freeN(effectedV);
+ if(freeF) MEM_freeN(effectedF);
return eCCGError_None;
}
@@ -2415,9 +2411,9 @@ CCGError ccgSubSurf_updateNormals(CCGSubSurf *ss, CCGFace **effectedF, int numEf
for (i=0; i<numEffectedF; i++)
effectedF[i]->flags = 0;
- CCGSUBSURF_free(ss, effectedE);
- CCGSUBSURF_free(ss, effectedV);
- if(freeF) CCGSUBSURF_free(ss, effectedF);
+ MEM_freeN(effectedE);
+ MEM_freeN(effectedV);
+ if(freeF) MEM_freeN(effectedF);
return eCCGError_None;
}
@@ -2449,9 +2445,9 @@ CCGError ccgSubSurf_updateLevels(CCGSubSurf *ss, int lvl, CCGFace **effectedF, i
for (i=0; i<numEffectedF; i++)
effectedF[i]->flags = 0;
- CCGSUBSURF_free(ss, effectedE);
- CCGSUBSURF_free(ss, effectedV);
- if(freeF) CCGSUBSURF_free(ss, effectedF);
+ MEM_freeN(effectedE);
+ MEM_freeN(effectedV);
+ if(freeF) MEM_freeN(effectedF);
return eCCGError_None;
}
diff --git a/source/blender/blenkernel/intern/Makefile b/source/blender/blenkernel/intern/Makefile
index 95c82d31890..70e1a785787 100644
--- a/source/blender/blenkernel/intern/Makefile
+++ b/source/blender/blenkernel/intern/Makefile
@@ -129,3 +129,8 @@ ifeq ($(WITH_QUICKTIME), true)
CPPFLAGS += -DWITH_QUICKTIME
endif
+ifeq ($(OS), darwin)
+ ifeq ($(WITH_BF_OPENMP), true)
+ CPPFLAGS += -DPARALLEL=1
+ endif
+endif
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 2ea54ac1f03..3348f7e94c7 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -313,6 +313,7 @@ gsl_poly_solve_quadratic (double a, double b, double c,
* See Bridson et al. "Robust Treatment of Collision, Contact and Friction for Cloth Animation"
* page 4, left column
*/
+#if 0
static int cloth_get_collision_time ( double a[3], double b[3], double c[3], double d[3], double e[3], double f[3], double solution[3] )
{
int num_sols = 0;
@@ -424,6 +425,7 @@ static int cloth_get_collision_time ( double a[3], double b[3], double c[3], dou
return num_sols;
}
+#endif
// w3 is not perfect
@@ -837,6 +839,7 @@ static int cloth_collision_response_moving( ClothModifierData *clmd, CollisionMo
}
#endif
+#if 0
static float projectPointOntoLine(float *p, float *a, float *b)
{
float ba[3], pa[3];
@@ -1067,7 +1070,6 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
return 0;
}
-#if 0
static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModifierData *collmd, CollPair *collpair )
{
EdgeCollPair edgecollpair;
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 18bf824f8d3..4f4c1959f34 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -2011,14 +2011,6 @@ static void actcon_new_data (void *cdata)
data->type = 20;
}
-/* only for setting the ID as extern */
-static void actcon_copy_data (bConstraint *con, bConstraint *srccon)
-{
- //bActionConstraint *src= srccon->data;
- bActionConstraint *dst= con->data;
- id_lib_extern((ID *)dst->act); /* would be better solved with something like modifiers_foreachIDLink */
-}
-
static void actcon_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bActionConstraint *data= con->data;
@@ -2170,7 +2162,7 @@ static bConstraintTypeInfo CTI_ACTION = {
NULL, /* free data */
actcon_relink, /* relink data */
actcon_id_looper, /* id looper */
- actcon_copy_data, /* copy data */
+ NULL, /* copy data */
actcon_new_data, /* new data */
actcon_get_tars, /* get constraint targets */
actcon_flush_tars, /* flush constraint targets */
@@ -4049,6 +4041,12 @@ void id_loop_constraints (ListBase *conlist, ConstraintIDFunc func, void *userda
/* ......... */
+static void con_extern_cb(bConstraint *con, ID **idpoin, void *userdata)
+{
+ if(idpoin && (*idpoin)->lib)
+ id_lib_extern(*idpoin);
+}
+
/* duplicate all of the constraints in a constraint stack */
void copy_constraints (ListBase *dst, const ListBase *src)
{
@@ -4067,8 +4065,15 @@ void copy_constraints (ListBase *dst, const ListBase *src)
id_us_plus((ID *)con->ipo);
/* only do specific constraints if required */
- if (cti && cti->copy_data)
- cti->copy_data(con, srccon);
+ if (cti) {
+ if (cti->copy_data) {
+ cti->copy_data(con, srccon);
+ }
+
+ if(cti->id_looper) {
+ cti->id_looper(con, con_extern_cb, NULL);
+ }
+ }
}
}
diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c
index 2a0759e6c36..050bf7c211f 100644
--- a/source/blender/blenkernel/intern/exotic.c
+++ b/source/blender/blenkernel/intern/exotic.c
@@ -37,6 +37,7 @@
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
+#include <errno.h>
#ifndef _WIN32
#include <unistd.h>
@@ -76,8 +77,8 @@
#include "BKE_object.h"
#include "BKE_material.h"
#include "BKE_exotic.h"
+#include "BKE_report.h"
-/* #include "BKE_error.h" */
#include "BKE_screen.h"
#include "BKE_displist.h"
#include "BKE_DerivedMesh.h"
@@ -205,18 +206,31 @@ static void read_stl_mesh_binary(Scene *scene, char *str)
unsigned int numfacets = 0, i, j, vertnum;
unsigned int maxmeshsize, nummesh, lastmeshsize;
unsigned int totvert, totface;
+ ReportList *reports= NULL; /* XXX */
fpSTL= fopen(str, "rb");
if(fpSTL==NULL) {
- //XXX error("Can't read file");
+ BKE_reportf(reports, RPT_ERROR, "Can't read file: %s.", strerror(errno));
return;
}
- fseek(fpSTL, 80, SEEK_SET);
- fread(&numfacets, 4*sizeof(char), 1, fpSTL);
+ if(fseek(fpSTL, 80, SEEK_SET) != 0) {
+ BKE_reportf(reports, RPT_ERROR, "Failed reading file: %s.", strerror(errno));
+ fclose(fpSTL);
+ return;
+ }
+
+ if(fread(&numfacets, 4*sizeof(char), 1, fpSTL) != 1) {
+ if(feof(fpSTL))
+ BKE_reportf(reports, RPT_ERROR, "Failed reading file: premature end of file.");
+ else
+ BKE_reportf(reports, RPT_ERROR, "Failed reading file: %s.", strerror(errno));
+ fclose(fpSTL);
+ return;
+ }
if (ENDIAN_ORDER==B_ENDIAN) {
- SWITCH_INT(numfacets);
- }
+ SWITCH_INT(numfacets);
+ }
maxmeshsize = MESH_MAX_VERTS/3;
@@ -318,13 +332,14 @@ static void read_stl_mesh_ascii(Scene *scene, char *str)
unsigned int numtenthousand, linenum;
unsigned int i, vertnum;
unsigned int totvert, totface;
+ ReportList *reports= NULL; /* XXX */
/* ASCII stl sucks ... we don't really know how many faces there
are until the file is done, so lets allocate faces 10000 at a time */
fpSTL= fopen(str, "r");
if(fpSTL==NULL) {
- //XXX error("Can't read file");
+ BKE_reportf(reports, RPT_ERROR, "Can't read file: %s.", strerror(errno));
return;
}
@@ -634,6 +649,7 @@ static void read_inventor(Scene *scene, char *str, struct ListBase *listb)
int file, filelen, count, lll, face, nr = 0;
int skipdata, ok, a, b, tot, first, colnr, coordtype, polytype, *idata;
struct DispList *dl;
+ ReportList *reports= NULL; /* XXX */
ivbase.first= ivbase.last= 0;
iv_curcol= 0;
@@ -641,7 +657,7 @@ static void read_inventor(Scene *scene, char *str, struct ListBase *listb)
file= open(str, O_BINARY|O_RDONLY);
if(file== -1) {
- //XXX error("Can't read file\n");
+ BKE_reportf(reports, RPT_ERROR, "Can't read file: %s.", strerror(errno));
return;
}
@@ -652,7 +668,11 @@ static void read_inventor(Scene *scene, char *str, struct ListBase *listb)
}
maindata= MEM_mallocN(filelen, "leesInventor");
- read(file, maindata, filelen);
+ if(read(file, maindata, filelen) < filelen) {
+ BKE_reportf(reports, RPT_ERROR, "Failed reading file: premature end of file.");
+ close(file);
+ return;
+ }
close(file);
iv_data_stack= MEM_mallocN(sizeof(float)*IV_MAXSTACK, "ivstack");
@@ -1895,6 +1915,7 @@ void write_stl(Scene *scene, char *str)
Base *base;
FILE *fpSTL;
int numfacets = 0;
+ ReportList *reports= NULL; /* XXX */
if(BLI_testextensie(str,".blend")) str[ strlen(str)-6]= 0;
if(BLI_testextensie(str,".ble")) str[ strlen(str)-4]= 0;
@@ -1908,7 +1929,7 @@ void write_stl(Scene *scene, char *str)
fpSTL= fopen(str, "wb");
if(fpSTL==NULL) {
- //XXX error("Can't write file");
+ BKE_reportf(reports, RPT_ERROR, "Can't open file: %s.", strerror(errno));
return;
}
strcpy(temp_dir, str);
@@ -3388,7 +3409,7 @@ static void dxf_read_polyline(Scene *scene, int noob) {
/* Blender vars */
Object *ob;
Mesh *me;
- float vert[3];
+ float vert[3] = {0};
MVert *mvert, *vtmp;
MFace *mface, *ftmp;
@@ -3613,7 +3634,7 @@ static void dxf_read_lwpolyline(Scene *scene, int noob) {
/* Blender vars */
Object *ob;
Mesh *me;
- float vert[3];
+ float vert[3] = {0};
MVert *mvert;
MFace *mface;
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 20f8d4852ce..e3b860ec041 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -96,16 +96,11 @@ static void multires_set_tot_level(Object *ob, MultiresModifierData *mmd, int lv
{
mmd->totlvl = lvl;
- if(ob->mode != OB_MODE_SCULPT) {
- mmd->lvl = MAX2(mmd->lvl, lvl);
- CLAMP(mmd->lvl, 0, mmd->totlvl);
- }
-
- mmd->sculptlvl = MAX2(mmd->sculptlvl, lvl);
- CLAMP(mmd->sculptlvl, 0, mmd->totlvl);
+ if(ob->mode != OB_MODE_SCULPT)
+ mmd->lvl = CLAMPIS(MAX2(mmd->lvl, lvl), 0, mmd->totlvl);
- mmd->renderlvl = MAX2(mmd->renderlvl, lvl);
- CLAMP(mmd->renderlvl, 0, mmd->totlvl);
+ mmd->sculptlvl = CLAMPIS(MAX2(mmd->sculptlvl, lvl), 0, mmd->totlvl);
+ mmd->renderlvl = CLAMPIS(MAX2(mmd->renderlvl, lvl), 0, mmd->totlvl);
}
static void multires_dm_mark_as_modified(DerivedMesh *dm)
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index ec3cf453c4b..285dc101497 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2872,7 +2872,7 @@ void ntreeCompositTagRender(Scene *curscene)
static int node_animation_properties(bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock;
- ListBase *lb;
+ const ListBase *lb;
Link *link;
PointerRNA ptr;
PropertyRNA *prop;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 9bdc700c313..71cea63b0bc 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -42,7 +42,13 @@
#include "DNA_smoke_types.h"
#include "BLI_blenlib.h"
+#include "BLI_threads.h"
+#include "PIL_time.h"
+
+#include "WM_api.h"
+
+#include "BKE_blender.h"
#include "BKE_cloth.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
@@ -58,8 +64,6 @@
#include "BKE_utildefines.h"
#include "BIK_api.h"
-#include "BLI_blenlib.h"
-
/* both in intern */
#include "smoke_API.h"
@@ -84,6 +88,13 @@
#include "BLI_winstuff.h"
#endif
+#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
+/* ************** libgomp (Apple gcc 4.2.1) TLS bug workaround *************** */
+#include <pthread.h>
+extern pthread_key_t gomp_tls_key;
+static void *thread_tls_data;
+#endif
+
#define PTCACHE_DATA_FROM(data, type, from) if(data[type]) { memcpy(data[type], from, ptcache_data_size[type]); }
#define PTCACHE_DATA_TO(data, type, index, to) if(data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); }
@@ -2247,6 +2258,32 @@ void BKE_ptcache_quick_cache_all(Scene *scene)
BKE_ptcache_make_cache(&baker);
}
+/* Simulation thread, no need for interlocks as data written in both threads
+ are only unitary integers (I/O assumed to be atomic for them) */
+typedef struct {
+ int break_operation;
+ int thread_ended;
+ int endframe;
+ int step;
+ int *cfra_ptr;
+ Scene *scene;
+} ptcache_make_cache_data;
+
+static void *ptcache_make_cache_thread(void *ptr) {
+ ptcache_make_cache_data *data = (ptcache_make_cache_data*)ptr;
+
+#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
+ // Workaround for Apple gcc 4.2.1 omp vs background thread bug
+ pthread_setspecific (gomp_tls_key, thread_tls_data);
+#endif
+
+ for(; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step)
+ scene_update_for_newframe(data->scene, data->scene->lay);
+
+ data->thread_ended = TRUE;
+ return NULL;
+}
+
/* if bake is not given run simulations to current frame */
void BKE_ptcache_make_cache(PTCacheBaker* baker)
{
@@ -2258,10 +2295,16 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
float frameleno = scene->r.framelen;
int cfrao = CFRA;
int startframe = MAXFRAME;
- int endframe = baker->anim_init ? scene->r.sfra : CFRA;
int bake = baker->bake;
int render = baker->render;
- int step = baker->quick_step;
+ ListBase threads;
+ ptcache_make_cache_data thread_data;
+ int progress, old_progress;
+
+ thread_data.endframe = baker->anim_init ? scene->r.sfra : CFRA;
+ thread_data.step = baker->quick_step;
+ thread_data.cfra_ptr = &CFRA;
+ thread_data.scene = baker->scene;
G.afbreek = 0;
@@ -2299,11 +2342,11 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
startframe = MAX2(cache->last_exact, cache->startframe);
if(bake) {
- endframe = cache->endframe;
+ thread_data.endframe = cache->endframe;
cache->flag |= PTCACHE_BAKING;
}
else {
- endframe = MIN2(endframe, cache->endframe);
+ thread_data.endframe = MIN2(thread_data.endframe, cache->endframe);
}
cache->flag &= ~PTCACHE_BAKED;
@@ -2335,7 +2378,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
cache->flag |= PTCACHE_BAKING;
if(bake)
- endframe = MAX2(endframe, cache->endframe);
+ thread_data.endframe = MAX2(thread_data.endframe, cache->endframe);
}
cache->flag &= ~PTCACHE_BAKED;
@@ -2345,30 +2388,45 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
BLI_freelistN(&pidlist);
}
- CFRA= startframe;
+ CFRA = startframe;
scene->r.framelen = 1.0;
-
- for(; CFRA <= endframe; CFRA+=step) {
- int prog;
+ thread_data.break_operation = FALSE;
+ thread_data.thread_ended = FALSE;
+ old_progress = -1;
+
+#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
+ // Workaround for Apple gcc 4.2.1 omp vs background thread bug
+ thread_tls_data = pthread_getspecific(gomp_tls_key);
+#endif
+ BLI_init_threads(&threads, ptcache_make_cache_thread, 1);
+ BLI_insert_thread(&threads, (void*)&thread_data);
+
+ while (thread_data.thread_ended == FALSE) {
if(bake)
- prog = (int)(100.0f * (float)(CFRA - startframe)/(float)(endframe-startframe));
+ progress = (int)(100.0f * (float)(CFRA - startframe)/(float)(thread_data.endframe-startframe));
else
- prog = CFRA;
+ progress = CFRA;
/* NOTE: baking should not redraw whole ui as this slows things down */
- if(baker->progressbar)
- baker->progressbar(baker->progresscontext, prog);
+ if ((baker->progressbar) && (progress != old_progress)) {
+ baker->progressbar(baker->progresscontext, progress);
+ old_progress = progress;
+ }
- scene_update_for_newframe(scene, scene->lay);
+ /* Delay to lessen CPU load from UI thread */
+ PIL_sleep_ms(200);
/* NOTE: breaking baking should leave calculated frames in cache, not clear it */
- if(baker->break_test && baker->break_test(baker->break_data))
- break;
+ if(blender_test_break() && !thread_data.break_operation) {
+ thread_data.break_operation = TRUE;
+ if (baker->progressend)
+ baker->progressend(baker->progresscontext);
+ WM_cursor_wait(1);
+ }
}
- if (baker->progressend)
- baker->progressend(baker->progresscontext);
+ BLI_end_threads(&threads);
/* clear baking flag */
if(pid) {
@@ -2391,7 +2449,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
cache = pid->cache;
- if(step > 1)
+ if(thread_data.step > 1)
cache->flag &= ~(PTCACHE_BAKING|PTCACHE_OUTDATED);
else
cache->flag &= ~(PTCACHE_BAKING|PTCACHE_REDO_NEEDED);
@@ -2413,6 +2471,11 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
if(bake) /* already on cfra unless baking */
scene_update_for_newframe(scene, scene->lay);
+ if (thread_data.break_operation)
+ WM_cursor_wait(0);
+ else if (baker->progressend)
+ baker->progressend(baker->progresscontext);
+
/* TODO: call redraw all windows somehow */
}
/* Helpers */
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 9a20943876e..9603863b60f 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -83,6 +83,7 @@
#include "BKE_sequencer.h"
#include "BKE_world.h"
#include "BKE_utildefines.h"
+#include "BKE_sound.h"
//XXX #include "BIF_previewrender.h"
//XXX #include "BIF_editseq.h"
@@ -235,6 +236,8 @@ Scene *copy_scene(Main *bmain, Scene *sce, int type)
}
}
+ sound_create_scene(scen);
+
return scen;
}
@@ -322,6 +325,8 @@ void free_scene(Scene *sce)
if(sce->stats)
MEM_freeN(sce->stats);
+
+ sound_destroy_scene(sce);
}
Scene *add_scene(char *name)
@@ -487,6 +492,8 @@ Scene *add_scene(char *name)
sce->gm.flag = GAME_DISPLAY_LISTS;
sce->gm.matmode = GAME_MAT_MULTITEX;
+ sound_create_scene(sce);
+
return sce;
}
@@ -726,7 +733,7 @@ Object *scene_find_camera_switch(Scene *scene)
Object *camera= NULL;
for (m= scene->markers.first; m; m= m->next) {
- if(m->camera && (m->frame <= cfra) && (m->frame > frame)) {
+ if(m->camera && (m->camera->restrictflag & OB_RESTRICT_RENDER)==0 && (m->frame <= cfra) && (m->frame > frame)) {
camera= m->camera;
frame= m->frame;
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 0dc6bf359f6..b8ac8d99128 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -336,3 +336,19 @@ unsigned int BKE_screen_visible_layers(bScreen *screen, Scene *scene)
return layer;
}
+/* ***************** Utilities ********************** */
+
+/* Find a region of the specified type from the given area */
+ARegion *BKE_area_find_region_type(ScrArea *sa, int type)
+{
+ if (sa) {
+ ARegion *ar;
+
+ for (ar=sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == type)
+ return ar;
+ }
+ }
+ return NULL;
+}
+
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 9fde0730011..8c119eb753b 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -233,8 +233,8 @@ void seq_free_sequence(Scene *scene, Sequence *seq)
if (ed->act_seq==seq)
ed->act_seq= NULL;
- if(seq->sound_handle)
- sound_delete_handle(scene, seq->sound_handle);
+ if(seq->scene_sound)
+ sound_remove_scene_sound(scene, seq->scene_sound);
}
MEM_freeN(seq);
@@ -484,7 +484,7 @@ void build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int *totseq,
}
-void calc_sequence_disp(Sequence *seq)
+void calc_sequence_disp(Scene *scene, Sequence *seq)
{
if(seq->startofs && seq->startstill) seq->startstill= 0;
if(seq->endofs && seq->endstill) seq->endstill= 0;
@@ -500,10 +500,10 @@ void calc_sequence_disp(Sequence *seq)
seq->handsize= (float)((seq->enddisp-seq->startdisp)/25);
}
- seq_update_sound(seq);
+ seq_update_sound(scene, seq);
}
-void calc_sequence(Sequence *seq)
+void calc_sequence(Scene *scene, Sequence *seq)
{
Sequence *seqm;
int min, max;
@@ -511,7 +511,7 @@ void calc_sequence(Sequence *seq)
/* check all metas recursively */
seqm= seq->seqbase.first;
while(seqm) {
- if(seqm->seqbase.first) calc_sequence(seqm);
+ if(seqm->seqbase.first) calc_sequence(scene, seqm);
seqm= seqm->next;
}
@@ -534,7 +534,7 @@ void calc_sequence(Sequence *seq)
seq->enddisp= MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp);
seq->len= seq->enddisp - seq->startdisp;
} else {
- calc_sequence_disp(seq);
+ calc_sequence_disp(scene, seq);
}
if(seq->strip && seq->len!=seq->strip->len) {
@@ -563,7 +563,7 @@ void calc_sequence(Sequence *seq)
}
}
}
- calc_sequence_disp(seq);
+ calc_sequence_disp(scene, seq);
}
}
@@ -614,7 +614,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq)
}
seq->strip->len = seq->len;
} else if (seq->type == SEQ_SOUND) {
- seq->len = AUD_getInfo(seq->sound->handle).length * FPS;
+ seq->len = AUD_getInfo(seq->sound->playback_handle).length * FPS;
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
@@ -653,7 +653,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq)
free_proxy_seq(seq);
- calc_sequence(seq);
+ calc_sequence(scene, seq);
}
void sort_seq(Scene *scene)
@@ -3189,7 +3189,7 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan
}
if(len_change)
- calc_sequence(seq);
+ calc_sequence(scene, seq);
}
return free_imbuf;
@@ -3239,23 +3239,6 @@ static void free_imbuf_seq_with_ipo(Scene *scene, struct Ipo *ipo)
}
#endif
-static int seq_sound_reload_cb(Sequence *seq, void *arg_pt)
-{
- if (seq->type==SEQ_SOUND && seq->sound) {
- Scene *scene= (Scene *)arg_pt;
- if(seq->sound_handle)
- sound_delete_handle(scene, seq->sound_handle);
-
- seq->sound_handle = sound_new_handle(scene, seq->sound, seq->start, seq->start + seq->strip->len, 0);
- return 0;
- }
- return 1; /* recurse meta's */
-}
-void seqbase_sound_reload(Scene *scene, ListBase *seqbase)
-{
- seqbase_recursive_apply(seqbase, seq_sound_reload_cb, (void *)scene);
-}
-
/* seq funcs's for transforming internally
notice the difference between start/end and left/right.
@@ -3463,7 +3446,7 @@ static void seq_translate(Scene *evil_scene, Sequence *seq, int delta)
}
}
- calc_sequence_disp(seq);
+ calc_sequence_disp(evil_scene, seq);
}
/* return 0 if there werent enough space */
@@ -3471,13 +3454,13 @@ int shuffle_seq(ListBase * seqbasep, Sequence *test, Scene *evil_scene)
{
int orig_machine= test->machine;
test->machine++;
- calc_sequence(test);
+ calc_sequence(evil_scene, test);
while( seq_test_overlap(seqbasep, test) ) {
if(test->machine >= MAXSEQ) {
break;
}
test->machine++;
- calc_sequence(test); // XXX - I dont think this is needed since were only moving vertically, Campbell.
+ calc_sequence(evil_scene, test); // XXX - I dont think this is needed since were only moving vertically, Campbell.
}
@@ -3497,7 +3480,7 @@ int shuffle_seq(ListBase * seqbasep, Sequence *test, Scene *evil_scene)
new_frame = new_frame + (test->start-test->startdisp); /* adjust by the startdisp */
seq_translate(evil_scene, test, new_frame - test->start);
- calc_sequence(test);
+ calc_sequence(evil_scene, test);
return 0;
} else {
return 1;
@@ -3526,7 +3509,7 @@ static int shuffle_seq_time_offset_test(ListBase * seqbasep, char dir)
return offset;
}
-static int shuffle_seq_time_offset(ListBase * seqbasep, char dir)
+static int shuffle_seq_time_offset(Scene* scene, ListBase * seqbasep, char dir)
{
int ofs= 0;
int tot_ofs= 0;
@@ -3545,7 +3528,7 @@ static int shuffle_seq_time_offset(ListBase * seqbasep, char dir)
for(seq= seqbasep->first; seq; seq= seq->next) {
if(seq->tmp)
- calc_sequence_disp(seq); /* corrects dummy startdisp/enddisp values */
+ calc_sequence_disp(scene, seq); /* corrects dummy startdisp/enddisp values */
}
return tot_ofs;
@@ -3557,8 +3540,8 @@ int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene)
Sequence *seq;
- int offset_l = shuffle_seq_time_offset(seqbasep, 'L');
- int offset_r = shuffle_seq_time_offset(seqbasep, 'R');
+ int offset_l = shuffle_seq_time_offset(evil_scene, seqbasep, 'L');
+ int offset_r = shuffle_seq_time_offset(evil_scene, seqbasep, 'R');
int offset = (-offset_l < offset_r) ? offset_l:offset_r;
if(offset) {
@@ -3573,19 +3556,16 @@ int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene)
return offset? 0:1;
}
-void seq_update_sound(Sequence *seq)
+void seq_update_sound(Scene* scene, Sequence *seq)
{
- if(seq->type == SEQ_SOUND && seq->sound_handle)
+ if(seq->scene_sound)
{
- seq->sound_handle->startframe = seq->startdisp;
- seq->sound_handle->endframe = seq->enddisp;
- seq->sound_handle->frameskip = seq->startofs + seq->anim_startofs;
- seq->sound_handle->changed = -1;
+ sound_move_scene_sound(scene, seq->scene_sound, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
/* mute is set in seq_update_muting_recursive */
}
}
-static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, int mute)
+static void seq_update_muting_recursive(Scene *scene, ListBase *seqbasep, Sequence *metaseq, int mute)
{
Sequence *seq;
int seqmute;
@@ -3601,27 +3581,26 @@ static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, i
if(seq == metaseq)
seqmute= 0;
- seq_update_muting_recursive(&seq->seqbase, metaseq, seqmute);
+ seq_update_muting_recursive(scene, &seq->seqbase, metaseq, seqmute);
}
else if(seq->type == SEQ_SOUND) {
- if(seq->sound_handle && seqmute != seq->sound_handle->mute) {
- seq->sound_handle->mute = seqmute;
- seq->sound_handle->changed = -1;
+ if(seq->scene_sound) {
+ sound_mute_scene_sound(scene, seq->scene_sound, seqmute);
}
}
}
}
-void seq_update_muting(Editing *ed)
+void seq_update_muting(Scene *scene, Editing *ed)
{
if(ed) {
/* mute all sounds up to current metastack list */
MetaStack *ms= ed->metastack.last;
if(ms)
- seq_update_muting_recursive(&ed->seqbase, ms->parseq, 1);
+ seq_update_muting_recursive(scene, &ed->seqbase, ms->parseq, 1);
else
- seq_update_muting_recursive(&ed->seqbase, NULL, 0);
+ seq_update_muting_recursive(scene, &ed->seqbase, NULL, 0);
}
}
@@ -3744,6 +3723,7 @@ Sequence *alloc_sequence(ListBase *lb, int cfra, int machine)
seq->machine= machine;
seq->mul= 1.0;
seq->blend_opacity = 100.0;
+ seq->volume = 1.0f;
return seq;
}
@@ -3793,13 +3773,13 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
sound = sound_new_file(CTX_data_main(C), seq_load->path);
- if (sound==NULL || sound->handle == NULL) {
+ if (sound==NULL || sound->playback_handle == NULL) {
//if(op)
// BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return NULL;
}
- info = AUD_getInfo(sound->handle);
+ info = AUD_getInfo(sound->playback_handle);
if (info.specs.channels == AUD_CHANNELS_INVALID) {
sound_delete(C, sound);
@@ -3824,9 +3804,9 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
BLI_split_dirfile_basic(seq_load->path, strip->dir, se->name);
- seq->sound_handle = sound_new_handle(scene, sound, seq_load->start_frame, seq_load->start_frame + strip->len, 0);
+ seq->scene_sound = sound_add_scene_sound(scene, seq, seq_load->start_frame, seq_load->start_frame + strip->len, 0);
- calc_sequence_disp(seq);
+ calc_sequence_disp(scene, seq);
/* last active name */
strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR-1);
@@ -3868,7 +3848,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
BLI_split_dirfile_basic(seq_load->path, strip->dir, se->name);
- calc_sequence_disp(seq);
+ calc_sequence_disp(scene, seq);
if(seq_load->flag & SEQ_LOAD_MOVIE_SOUND) {
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index a1e3dd6f963..abf76d0e998 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -2864,7 +2864,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
/* or heun ~ 2nd order runge-kutta steps, mode 1,2 */
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bp;
- float dx[3],dv[3],aabbmin[3],aabbmax[3],cm[3]={0.0f,0.0f,0.0f};
+ float dx[3]={0},dv[3],aabbmin[3],aabbmax[3],cm[3]={0.0f,0.0f,0.0f};
float timeovermass/*,freezeloc=0.00001f,freezeforce=0.00000000001f*/;
float maxerrpos= 0.0f,maxerrvel = 0.0f;
int a,fuzzy=0;
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 1be59529cc7..03fe1b8df7b 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -12,6 +12,7 @@
#include "BLI_blenlib.h"
#include "DNA_scene_types.h"
+#include "DNA_sequence_types.h"
#include "DNA_sound_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_screen_types.h"
@@ -26,6 +27,9 @@
#include "BKE_context.h"
#include "BKE_library.h"
#include "BKE_packedFile.h"
+#include "BKE_fcurve.h"
+
+#include "RNA_access.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -107,7 +111,7 @@ struct bSound* sound_new_file(struct Main *main, char* filename)
sound_load(main, sound);
- if(!sound->handle)
+ if(!sound->playback_handle)
{
free_libblock(&main->sound, sound);
sound = NULL;
@@ -133,7 +137,7 @@ struct bSound* sound_new_buffer(struct bContext *C, struct bSound *source)
sound_load(CTX_data_main(C), sound);
- if(!sound->handle)
+ if(!sound->playback_handle)
{
free_libblock(&CTX_data_main(C)->sound, sound);
sound = NULL;
@@ -159,7 +163,7 @@ struct bSound* sound_new_limiter(struct bContext *C, struct bSound *source, floa
sound_load(CTX_data_main(C), sound);
- if(!sound->handle)
+ if(!sound->playback_handle)
{
free_libblock(&CTX_data_main(C)->sound, sound);
sound = NULL;
@@ -175,8 +179,6 @@ void sound_delete(struct bContext *C, struct bSound* sound)
{
sound_free(sound);
- sound_unlink(C, sound);
-
free_libblock(&CTX_data_main(C)->sound, sound);
}
}
@@ -187,7 +189,7 @@ void sound_cache(struct bSound* sound, int ignore)
AUD_unload(sound->cache);
sound->cache = AUD_bufferSound(sound->handle);
- sound->changed++;
+ sound->playback_handle = sound->cache;
}
void sound_delete_cache(struct bSound* sound)
@@ -196,6 +198,7 @@ void sound_delete_cache(struct bSound* sound)
{
AUD_unload(sound->cache);
sound->cache = NULL;
+ sound->playback_handle = sound->handle;
}
}
@@ -207,6 +210,7 @@ void sound_load(struct Main *main, struct bSound* sound)
{
AUD_unload(sound->handle);
sound->handle = NULL;
+ sound->playback_handle = NULL;
}
// XXX unused currently
@@ -253,7 +257,10 @@ void sound_load(struct Main *main, struct bSound* sound)
break;
}
#endif
- sound->changed++;
+ if(sound->cache)
+ sound->playback_handle = sound->cache;
+ else
+ sound->playback_handle = sound->handle;
}
}
@@ -269,243 +276,115 @@ void sound_free(struct bSound* sound)
{
AUD_unload(sound->handle);
sound->handle = NULL;
+ sound->playback_handle = NULL;
}
}
-void sound_unlink(struct bContext *C, struct bSound* sound)
+static float sound_get_volume(Scene* scene, Sequence* sequence, float time)
{
- Scene *scene;
- SoundHandle *handle;
-
-// XXX unused currently
-#if 0
- bSound *snd;
- for(snd = CTX_data_main(C)->sound.first; snd; snd = snd->id.next)
- {
- if(snd->child_sound == sound)
- {
- snd->child_sound = NULL;
- if(snd->handle)
- {
- AUD_unload(sound->handle);
- snd->handle = NULL;
- }
-
- sound_unlink(C, snd);
- }
- }
-#endif
-
- for(scene = CTX_data_main(C)->scene.first; scene; scene = scene->id.next)
- {
- for(handle = scene->sound_handles.first; handle; handle = handle->next)
- {
- if(handle->source == sound)
- {
- handle->source = NULL;
- if(handle->handle)
- AUD_stop(handle->handle);
- }
- }
- }
+ struct FCurve* fcu = id_data_find_fcurve(&scene->id, sequence, &RNA_Sequence, "volume", 0);
+ if(fcu)
+ return evaluate_fcurve(fcu, time * FPS);
+ else
+ return sequence->volume;
}
-struct SoundHandle* sound_new_handle(struct Scene *scene, struct bSound* sound, int startframe, int endframe, int frameskip)
+AUD_Device* sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume)
{
- ListBase* handles = &scene->sound_handles;
+ AUD_Device* mixdown = AUD_openReadDevice(specs);
+
+ AUD_setDeviceVolume(mixdown, volume);
- SoundHandle* handle = MEM_callocN(sizeof(SoundHandle), "sound_handle");
- handle->source = sound;
- handle->startframe = startframe;
- handle->endframe = endframe;
- handle->frameskip = frameskip;
- handle->state = AUD_STATUS_INVALID;
- handle->volume = 1.0f;
+ AUD_playDevice(mixdown, scene->sound_scene, start / FPS);
- BLI_addtail(handles, handle);
+ return mixdown;
+}
- return handle;
+void sound_create_scene(struct Scene *scene)
+{
+ scene->sound_scene = AUD_createSequencer(scene, (AUD_volumeFunction)&sound_get_volume);
}
-void sound_delete_handle(struct Scene *scene, struct SoundHandle *handle)
+void sound_destroy_scene(struct Scene *scene)
{
- if(handle == NULL)
- return;
+ if(scene->sound_scene_handle)
+ AUD_stop(scene->sound_scene_handle);
+ if(scene->sound_scene)
+ AUD_destroySequencer(scene->sound_scene);
+}
- if(handle->handle)
- AUD_stop(handle->handle);
+void* sound_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip)
+{
+ return AUD_addSequencer(scene->sound_scene, &(sequence->sound->playback_handle), startframe / FPS, endframe / FPS, frameskip / FPS, sequence);
+}
- BLI_freelinkN(&scene->sound_handles, handle);
+void sound_remove_scene_sound(struct Scene *scene, void* handle)
+{
+ AUD_removeSequencer(scene->sound_scene, handle);
}
-void sound_stop_all(struct bContext *C)
+void sound_mute_scene_sound(struct Scene *scene, void* handle, char mute)
{
- SoundHandle *handle;
+ AUD_muteSequencer(scene->sound_scene, handle, mute);
+}
- for(handle = CTX_data_scene(C)->sound_handles.first; handle; handle = handle->next)
- {
- if(handle->state == AUD_STATUS_PLAYING)
- {
- AUD_pause(handle->handle);
- handle->state = AUD_STATUS_PAUSED;
- }
- }
+void sound_move_scene_sound(struct Scene *scene, void* handle, int startframe, int endframe, int frameskip)
+{
+ AUD_moveSequencer(scene->sound_scene, handle, startframe / FPS, endframe / FPS, frameskip / FPS);
}
-void sound_update_playing(struct bContext *C)
+void sound_start_play_scene(struct Scene *scene)
{
- SoundHandle *handle;
- Scene* scene = CTX_data_scene(C);
- int cfra = CFRA;
- float fps = FPS;
- int action;
+ AUD_Sound* sound;
+ sound = AUD_loopSound(scene->sound_scene);
+ scene->sound_scene_handle = AUD_play(sound, 1);
+ AUD_unload(sound);
+}
+void sound_play_scene(struct Scene *scene)
+{
AUD_lock();
- for(handle = scene->sound_handles.first; handle; handle = handle->next)
- {
- if(cfra < handle->startframe || cfra >= handle->endframe || handle->mute || (scene->audio.flag & AUDIO_MUTE))
- {
- if(handle->state == AUD_STATUS_PLAYING)
- {
- AUD_pause(handle->handle);
- handle->state = AUD_STATUS_PAUSED;
- }
- }
- else
- {
- action = 0;
-
- if(handle->changed != handle->source->changed)
- {
- handle->changed = handle->source->changed;
- action = 3;
- if(handle->state != AUD_STATUS_INVALID)
- {
- AUD_stop(handle->handle);
- handle->state = AUD_STATUS_INVALID;
- }
- }
- else
- {
- if(handle->state != AUD_STATUS_PLAYING)
- action = 3;
- else
- {
- handle->state = AUD_getStatus(handle->handle);
- if(handle->state != AUD_STATUS_PLAYING)
- action = 3;
- else
- {
- float diff = AUD_getPosition(handle->handle) * fps - cfra + handle->startframe;
- if(diff < 0.0)
- diff = -diff;
- if(diff > FPS/2.0)
- {
- action = 2;
- }
- }
- }
- }
-
- AUD_setSoundVolume(handle->handle, handle->volume);
-
- if(action & 1)
- {
- if(handle->state == AUD_STATUS_INVALID)
- {
- if(handle->source && handle->source->handle)
- {
- AUD_Sound* limiter = AUD_limitSound(handle->source->cache ? handle->source->cache : handle->source->handle, handle->frameskip / fps, (handle->frameskip + handle->endframe - handle->startframe)/fps);
- handle->handle = AUD_play(limiter, 1);
- AUD_unload(limiter);
- if(handle->handle)
- handle->state = AUD_STATUS_PLAYING;
- if(cfra == handle->startframe)
- action &= ~2;
- }
- }
- else
- if(AUD_resume(handle->handle))
- handle->state = AUD_STATUS_PLAYING;
- else
- handle->state = AUD_STATUS_INVALID;
- }
-
- if(action & 2)
- AUD_seek(handle->handle, (cfra - handle->startframe) / fps);
- }
- }
+ if(!scene->sound_scene_handle || AUD_getStatus(scene->sound_scene_handle) == AUD_STATUS_INVALID)
+ sound_start_play_scene(scene);
+
+ AUD_seek(scene->sound_scene_handle, CFRA / FPS);
+ AUD_setLoop(scene->sound_scene_handle, -1, -1);
+ AUD_resume(scene->sound_scene_handle);
AUD_unlock();
}
-void sound_scrub(struct bContext *C)
+void sound_stop_scene(struct Scene *scene)
{
- SoundHandle *handle;
- Scene* scene = CTX_data_scene(C);
- int cfra = CFRA;
- float fps = FPS;
-
- if(scene->audio.flag & AUDIO_SCRUB && !CTX_wm_screen(C)->animtimer)
- {
- AUD_lock();
-
- for(handle = scene->sound_handles.first; handle; handle = handle->next)
- {
- if(cfra >= handle->startframe && cfra < handle->endframe && !handle->mute)
- {
- if(handle->source && handle->source->handle)
- {
- int frameskip = handle->frameskip + cfra - handle->startframe;
- AUD_Sound* limiter = AUD_limitSound(handle->source->cache ? handle->source->cache : handle->source->handle, frameskip / fps, (frameskip + 1)/fps);
- AUD_play(limiter, 0);
- AUD_unload(limiter);
- }
- }
- }
-
- AUD_unlock();
- }
+ AUD_pause(scene->sound_scene_handle);
}
-AUD_Device* sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, int end, float volume)
+void sound_seek_scene(struct bContext *C)
{
- AUD_Device* mixdown = AUD_openReadDevice(specs);
- SoundHandle *handle;
- float fps = FPS;
- AUD_Sound *limiter, *delayer;
- int frameskip, s, e;
+ struct Scene *scene = CTX_data_scene(C);
- end++;
+ AUD_lock();
- AUD_setDeviceVolume(mixdown, volume);
+ if(!scene->sound_scene_handle || AUD_getStatus(scene->sound_scene_handle) == AUD_STATUS_INVALID)
+ {
+ sound_start_play_scene(scene);
+ AUD_pause(scene->sound_scene_handle);
+ }
- for(handle = scene->sound_handles.first; handle; handle = handle->next)
+ if(scene->audio.flag & AUDIO_SCRUB && !CTX_wm_screen(C)->animtimer)
{
- if(start < handle->endframe && end > handle->startframe && !handle->mute && handle->source && handle->source->handle)
- {
- frameskip = handle->frameskip;
- s = handle->startframe - start;
- e = handle->frameskip + AUD_MIN(handle->endframe, end) - handle->startframe;
-
- if(s < 0)
- {
- frameskip -= s;
- s = 0;
- }
-
- AUD_setSoundVolume(handle->handle, handle->volume);
-
- limiter = AUD_limitSound(handle->source->handle, frameskip / fps, e / fps);
- delayer = AUD_delaySound(limiter, s / fps);
-
- AUD_playDevice(mixdown, delayer);
-
- AUD_unload(delayer);
- AUD_unload(limiter);
- }
+ AUD_setLoop(scene->sound_scene_handle, -1, 1 / FPS);
+ AUD_seek(scene->sound_scene_handle, CFRA / FPS);
+ AUD_resume(scene->sound_scene_handle);
}
+ else
+ AUD_seek(scene->sound_scene_handle, CFRA / FPS);
- return mixdown;
+ AUD_unlock();
+}
+
+int sound_read_sound_buffer(bSound* sound, float* buffer, int length)
+{
+ return AUD_readSound(sound->cache, buffer, length);
}
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 2ad17b7d0b9..69f02bc6a80 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1220,6 +1220,21 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
glNormal3fv(no);
}
+static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
+{
+ if(ccgdm->pbvh) {
+ CCGFace **faces;
+ int totface;
+
+ BLI_pbvh_get_grid_updates(ccgdm->pbvh, 1, (void***)&faces, &totface);
+ if(totface) {
+ ccgSubSurf_updateFromFaces(ccgdm->ss, 0, faces, totface);
+ ccgSubSurf_updateNormals(ccgdm->ss, faces, totface);
+ MEM_freeN(faces);
+ }
+ }
+}
+
/* Only used by non-editmesh types */
static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast, int (*setMaterial)(int, void *attribs)) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
@@ -1229,20 +1244,12 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
char *faceFlags = ccgdm->faceFlags;
int step = (fast)? gridSize-1: 1;
- if(ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
- CCGFace **faces;
- int totface;
-
- BLI_pbvh_get_grid_updates(ccgdm->pbvh, 1, (void***)&faces, &totface);
- if(totface) {
- ccgSubSurf_updateFromFaces(ss, 0, faces, totface);
- ccgSubSurf_updateNormals(ss, faces, totface);
- MEM_freeN(faces);
- }
+ ccgdm_pbvh_update(ccgdm);
+ if(ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
if(dm->numFaceData) {
/* should be per face */
- if(!setMaterial(faceFlags[1], NULL))
+ if(!setMaterial(faceFlags[1]+1, NULL))
return;
glShadeModel((faceFlags[0] & ME_SMOOTH)? GL_SMOOTH: GL_FLAT);
@@ -1330,6 +1337,8 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, v
char *faceFlags = ccgdm->faceFlags;
int a, b, i, doDraw, numVerts, matnr, new_matnr, totface;
+ ccgdm_pbvh_update(ccgdm);
+
doDraw = 0;
numVerts = 0;
matnr = -1;
@@ -1484,6 +1493,8 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned ch
unsigned char *cp1, *cp2;
int useTwoSide=1;
+ ccgdm_pbvh_update(ccgdm);
+
cp1= col1;
if(col2) {
cp2= col2;
@@ -1554,6 +1565,8 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
int i, totface, flag, gridSize = ccgSubSurf_getGridSize(ss);
int gridFaces = gridSize - 1;
+ ccgdm_pbvh_update(ccgdm);
+
if(!mcol)
mcol = dm->getFaceDataArray(dm, CD_MCOL);
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 634d9e6ce0d..fce9ed75e93 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -860,8 +860,6 @@ void set_current_lamp_texture(Lamp *la, Tex *newtex)
bNode *give_current_material_texture_node(Material *ma)
{
- bNode *node;
-
if(ma && ma->use_nodes && ma->nodetree)
return nodeGetActiveID(ma->nodetree, ID_TE);
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 9c38f84aa26..d71836ab181 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -15,7 +15,6 @@
*
*/
-
#ifdef WITH_FFMPEG
#include <string.h>
#include <stdio.h>
@@ -78,11 +77,10 @@ extern void do_init_ffmpeg();
static int ffmpeg_type = 0;
static int ffmpeg_codec = CODEC_ID_MPEG4;
-static int ffmpeg_audio_codec = CODEC_ID_MP2;
+static int ffmpeg_audio_codec = CODEC_ID_NONE;
static int ffmpeg_video_bitrate = 1150;
static int ffmpeg_audio_bitrate = 128;
static int ffmpeg_gop_size = 12;
-static int ffmpeg_multiplex_audio = 1;
static int ffmpeg_autosplit = 0;
static int ffmpeg_autosplit_count = 0;
@@ -99,6 +97,7 @@ static uint8_t* audio_input_buffer = 0;
static int audio_input_frame_size = 0;
static uint8_t* audio_output_buffer = 0;
static int audio_outbuf_size = 0;
+static double audio_time = 0.0f;
static AUD_Device* audio_mixdown_device = 0;
@@ -133,27 +132,39 @@ static int write_audio_frame(void)
c = get_codec_from_stream(audio_stream);
- if(audio_mixdown_device)
- AUD_readDevice(audio_mixdown_device, audio_input_buffer, audio_input_frame_size);
-
av_init_packet(&pkt);
+ pkt.size = 0;
+
+ AUD_readDevice(audio_mixdown_device, audio_input_buffer, audio_input_frame_size);
+ audio_time += (double) audio_input_frame_size / (double) c->sample_rate;
pkt.size = avcodec_encode_audio(c, audio_output_buffer,
- audio_outbuf_size,
+ audio_outbuf_size,
(short*) audio_input_buffer);
+
+ if(pkt.size <= 0)
+ {
+ // XXX error("Error writing audio packet");
+ return -1;
+ }
+
pkt.data = audio_output_buffer;
+
+ if(c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE)
+ {
#ifdef FFMPEG_CODEC_TIME_BASE
- pkt.pts = av_rescale_q(c->coded_frame->pts,
- c->time_base, audio_stream->time_base);
+ pkt.pts = av_rescale_q(c->coded_frame->pts,
+ c->time_base, audio_stream->time_base);
#else
- pkt.pts = c->coded_frame->pts;
+ pkt.pts = c->coded_frame->pts;
#endif
- fprintf(stderr, "Audio Frame PTS: %d\n", (int)pkt.pts);
+ fprintf(stderr, "Audio Frame PTS: %d\n", (int)pkt.pts);
+ }
pkt.stream_index = audio_stream->index;
pkt.flags |= PKT_FLAG_KEY;
if (av_interleaved_write_frame(outfile, &pkt) != 0) {
- //XXX error("Error writing audio packet");
+ // XXX error("Error writing audio packet");
return -1;
}
return 0;
@@ -233,6 +244,14 @@ static const char** get_file_extensions(int format)
static const char * rv[] = { ".ogg", ".ogv", NULL };
return rv;
}
+ case FFMPEG_MP3: {
+ static const char * rv[] = { ".mp3", NULL };
+ return rv;
+ }
+ case FFMPEG_WAV: {
+ static const char * rv[] = { ".wav", NULL };
+ return rv;
+ }
default:
return NULL;
}
@@ -563,6 +582,7 @@ static AVStream* alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
c->sample_rate = rd->ffcodecdata.audio_mixrate;
c->bit_rate = ffmpeg_audio_bitrate*1000;
+ c->sample_fmt = SAMPLE_FMT_S16;
c->channels = 2;
codec = avcodec_find_encoder(c->codec_id);
if (!codec) {
@@ -577,40 +597,22 @@ static AVStream* alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
return NULL;
}
- /* FIXME: Should be user configurable */
- if (ffmpeg_type == FFMPEG_DV) {
- /* this is a hack around the poor ffmpeg dv multiplexer. */
- /* only fixes PAL for now
- (NTSC is a lot more complicated here...)! */
- audio_outbuf_size = 7680;
- } else {
- audio_outbuf_size = 10000;
- }
+ audio_outbuf_size = FF_MIN_BUFFER_SIZE;
+
audio_output_buffer = (uint8_t*)MEM_mallocN(
audio_outbuf_size, "FFMPEG audio encoder input buffer");
- /* ugly hack for PCM codecs */
-
- if (c->frame_size <= 1) {
- audio_input_frame_size = audio_outbuf_size / c->channels;
- switch(c->codec_id) {
- case CODEC_ID_PCM_S16LE:
- case CODEC_ID_PCM_S16BE:
- case CODEC_ID_PCM_U16LE:
- case CODEC_ID_PCM_U16BE:
- audio_input_frame_size >>= 1;
- break;
- default:
- break;
- }
- } else {
+ if((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD))
+ audio_input_frame_size = audio_outbuf_size * 8 / c->bits_per_coded_sample / c->channels;
+ else
audio_input_frame_size = c->frame_size;
- }
audio_input_buffer = (uint8_t*)MEM_mallocN(
- audio_input_frame_size * sizeof(short) * c->channels,
+ audio_input_frame_size * c->channels * sizeof(int16_t),
"FFMPEG audio encoder output buffer");
+ audio_time = 0.0f;
+
return st;
}
/* essential functions -- start, append, end */
@@ -629,8 +631,6 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
ffmpeg_video_bitrate = rd->ffcodecdata.video_bitrate;
ffmpeg_audio_bitrate = rd->ffcodecdata.audio_bitrate;
ffmpeg_gop_size = rd->ffcodecdata.gop_size;
- ffmpeg_multiplex_audio = rd->ffcodecdata.flags
- & FFMPEG_MULTIPLEX_AUDIO;
ffmpeg_autosplit = rd->ffcodecdata.flags
& FFMPEG_AUTOSPLIT_OUTPUT;
@@ -641,12 +641,11 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
fprintf(stderr, "Starting output to %s(ffmpeg)...\n"
" Using type=%d, codec=%d, audio_codec=%d,\n"
" video_bitrate=%d, audio_bitrate=%d,\n"
- " gop_size=%d, multiplex=%d, autosplit=%d\n"
+ " gop_size=%d, autosplit=%d\n"
" render width=%d, render height=%d\n",
name, ffmpeg_type, ffmpeg_codec, ffmpeg_audio_codec,
ffmpeg_video_bitrate, ffmpeg_audio_bitrate,
- ffmpeg_gop_size, ffmpeg_multiplex_audio,
- ffmpeg_autosplit, rectx, recty);
+ ffmpeg_gop_size, ffmpeg_autosplit, rectx, recty);
exts = get_file_extensions(ffmpeg_type);
if (!exts) {
@@ -667,7 +666,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
of->oformat = fmt;
of->packet_size= rd->ffcodecdata.mux_packet_size;
- if (ffmpeg_multiplex_audio) {
+ if (ffmpeg_audio_codec != CODEC_ID_NONE) {
of->mux_rate = rd->ffcodecdata.mux_rate;
} else {
of->mux_rate = 0;
@@ -676,6 +675,8 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
of->preload = (int)(0.5*AV_TIME_BASE);
of->max_delay = (int)(0.7*AV_TIME_BASE);
+ fmt->audio_codec = ffmpeg_audio_codec;
+
snprintf(of->filename, sizeof(of->filename), "%s", name);
/* set the codec to the user's selection */
switch(ffmpeg_type) {
@@ -703,6 +704,11 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
case FFMPEG_FLV:
fmt->video_codec = CODEC_ID_FLV1;
break;
+ case FFMPEG_MP3:
+ fmt->audio_codec = CODEC_ID_MP3;
+ case FFMPEG_WAV:
+ fmt->video_codec = CODEC_ID_NONE;
+ break;
case FFMPEG_MPEG4:
default:
fmt->video_codec = CODEC_ID_MPEG4;
@@ -723,30 +729,29 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
}
}
- fmt->audio_codec = ffmpeg_audio_codec;
-
if (ffmpeg_type == FFMPEG_DV) {
fmt->audio_codec = CODEC_ID_PCM_S16LE;
- if (ffmpeg_multiplex_audio && rd->ffcodecdata.audio_mixrate != 48000) {
+ if (ffmpeg_audio_codec != CODEC_ID_NONE && rd->ffcodecdata.audio_mixrate != 48000) {
BKE_report(reports, RPT_ERROR, "FFMPEG only supports 48khz / stereo audio for DV!");
return 0;
}
}
- video_stream = alloc_video_stream(rd, fmt->video_codec, of, rectx, recty);
- printf("alloc video stream %p\n", video_stream);
- if (!video_stream) {
- BKE_report(reports, RPT_ERROR, "Error initializing video stream.");
- return 0;
+ if (fmt->video_codec != CODEC_ID_NONE) {
+ video_stream = alloc_video_stream(rd, fmt->video_codec, of, rectx, recty);
+ printf("alloc video stream %p\n", video_stream);
+ if (!video_stream) {
+ BKE_report(reports, RPT_ERROR, "Error initializing video stream.");
+ return 0;
+ }
}
-
- if (ffmpeg_multiplex_audio) {
+
+ if (ffmpeg_audio_codec != CODEC_ID_NONE) {
audio_stream = alloc_audio_stream(rd, fmt->audio_codec, of);
if (!audio_stream) {
BKE_report(reports, RPT_ERROR, "Error initializing audio stream.");
return 0;
}
- //XXX audiostream_play(SFRA, 0, 1);
}
if (av_set_parameters(of, NULL) < 0) {
BKE_report(reports, RPT_ERROR, "Error setting output parameters.");
@@ -818,14 +823,14 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
success = start_ffmpeg_impl(rd, rectx, recty, reports);
- if(ffmpeg_multiplex_audio && audio_stream)
+ if(audio_stream)
{
AVCodecContext* c = get_codec_from_stream(audio_stream);
AUD_DeviceSpecs specs;
specs.channels = c->channels;
specs.format = AUD_FORMAT_S16;
specs.rate = rd->ffcodecdata.audio_mixrate;
- audio_mixdown_device = sound_mixdown(scene, specs, rd->sfra, rd->efra, rd->ffcodecdata.audio_volume);
+ audio_mixdown_device = sound_mixdown(scene, specs, rd->sfra, rd->ffcodecdata.audio_volume);
}
return success;
@@ -833,21 +838,13 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
void end_ffmpeg(void);
-static void write_audio_frames()
+static void write_audio_frames(double to_pts)
{
int finished = 0;
- while (ffmpeg_multiplex_audio && !finished) {
- double a_pts = ((double)audio_stream->pts.val
- * audio_stream->time_base.num
- / audio_stream->time_base.den);
- double v_pts = ((double)video_stream->pts.val
- * video_stream->time_base.num
- / video_stream->time_base.den);
-
- if (a_pts < v_pts) {
- write_audio_frame();
- } else {
+ while (audio_stream && !finished) {
+ if((audio_time >= to_pts) ||
+ (write_audio_frame())) {
finished = 1;
}
}
@@ -856,25 +853,31 @@ static void write_audio_frames()
int append_ffmpeg(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports)
{
AVFrame* avframe;
- int success;
+ int success = 1;
fprintf(stderr, "Writing frame %i, "
"render width=%d, render height=%d\n", frame,
rectx, recty);
- write_audio_frames();
+// why is this done before writing the video frame and again at end_ffmpeg?
+// write_audio_frames(frame / (((double)rd->frs_sec) / rd->frs_sec_base));
- avframe= generate_video_frame((unsigned char*) pixels, reports);
- success= (avframe && write_video_frame(rd, avframe, reports));
-
- if (ffmpeg_autosplit) {
- if (url_ftell(OUTFILE_PB) > FFMPEG_AUTOSPLIT_SIZE) {
- end_ffmpeg();
- ffmpeg_autosplit_count++;
- success &= start_ffmpeg_impl(rd, rectx, recty, reports);
+ if(video_stream)
+ {
+ avframe= generate_video_frame((unsigned char*) pixels, reports);
+ success= (avframe && write_video_frame(rd, avframe, reports));
+
+ if (ffmpeg_autosplit) {
+ if (url_ftell(OUTFILE_PB) > FFMPEG_AUTOSPLIT_SIZE) {
+ end_ffmpeg();
+ ffmpeg_autosplit_count++;
+ success &= start_ffmpeg_impl(rd, rectx, recty, reports);
+ }
}
}
+ write_audio_frames(frame / (((double)rd->frs_sec) / rd->frs_sec_base));
+
return success;
}
@@ -885,9 +888,9 @@ void end_ffmpeg(void)
fprintf(stderr, "Closing ffmpeg...\n");
- if (audio_stream && video_stream) {
+/* if (audio_stream) { SEE UPPER
write_audio_frames();
- }
+ }*/
if(audio_mixdown_device)
{
@@ -1259,8 +1262,8 @@ void ffmpeg_verify_image_type(RenderData *rd)
}
}
- if(audio && rd->ffcodecdata.audio_codec <= 0) {
- rd->ffcodecdata.audio_codec = CODEC_ID_MP2;
+ if(audio && rd->ffcodecdata.audio_codec < 0) {
+ rd->ffcodecdata.audio_codec = CODEC_ID_NONE;
rd->ffcodecdata.audio_bitrate = 128;
}
}
diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c
index b3ecb012282..0a7c016df7f 100644
--- a/source/blender/blenlib/intern/BLI_args.c
+++ b/source/blender/blenlib/intern/BLI_args.c
@@ -44,6 +44,7 @@ typedef struct bAKey {
} bAKey;
typedef struct bArgument {
+ bAKey *key;
BA_ArgCallback func;
void *data;
} bArgument;
@@ -55,7 +56,7 @@ struct bArgs {
int *passes;
};
-unsigned int case_strhash(void *ptr) {
+static unsigned int case_strhash(void *ptr) {
char *s= ptr;
unsigned int i= 0;
unsigned char c;
@@ -86,6 +87,17 @@ static int keycmp(void *a, void *b)
}
}
+static bArgument *lookUp(struct bArgs *ba, char *arg, int pass, int case_str)
+{
+ bAKey key;
+
+ key.case_str = case_str;
+ key.pass = pass;
+ key.arg = arg;
+
+ return BLI_ghash_lookup(ba->items, &key);
+}
+
bArgs *BLI_argsInit(int argc, char **argv)
{
bArgs *ba = MEM_callocN(sizeof(bArgs), "bArgs");
@@ -122,49 +134,52 @@ char **BLI_argsArgv(struct bArgs *ba)
return ba->argv;
}
-void BLI_argsAdd(struct bArgs *ba, char *arg, int pass, BA_ArgCallback cb, void *data)
+static void internalAdd(struct bArgs *ba, char *arg, int pass, int case_str, BA_ArgCallback cb, void *data)
{
- bArgument *a = MEM_callocN(sizeof(bArgument), "bArgument");
- bAKey *key = MEM_callocN(sizeof(bAKey), "bAKey");
+ bArgument *a;
+ bAKey *key;
+
+ a = lookUp(ba, arg, pass, case_str);
+
+ if (a) {
+ printf("WARNING: conflicting argument\n");
+ printf("\ttrying to add '%s' on pass %i, %scase sensitive\n", arg, pass, case_str == 1? "not ": "");
+ printf("\tconflict with '%s' on pass %i, %scase sensitive\n\n", a->key->arg, (int)a->key->pass, a->key->case_str == 1? "not ": "");
+ }
+
+ a = MEM_callocN(sizeof(bArgument), "bArgument");
+ key = MEM_callocN(sizeof(bAKey), "bAKey");
key->arg = arg;
key->pass = pass;
- key->case_str = 0;
+ key->case_str = case_str;
+ a->key = key;
a->func = cb;
a->data = data;
BLI_ghash_insert(ba->items, key, a);
}
-void BLI_argsAddCase(struct bArgs *ba, char *arg, int pass, BA_ArgCallback cb, void *data)
+void BLI_argsAdd(struct bArgs *ba, char *arg, int pass, BA_ArgCallback cb, void *data)
{
- bArgument *a = MEM_callocN(sizeof(bArgument), "bArgument");
- bAKey *key = MEM_callocN(sizeof(bAKey), "bAKey");
-
- key->arg = arg;
- key->pass = pass;
- key->case_str = 1;
-
- a->func = cb;
- a->data = data;
+ internalAdd(ba, arg, pass, 0, cb, data);
+}
- BLI_ghash_insert(ba->items, key, a);
+void BLI_argsAddCase(struct bArgs *ba, char *arg, int pass, BA_ArgCallback cb, void *data)
+{
+ internalAdd(ba, arg, pass, 1, cb, data);
}
void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *default_data)
{
- bAKey key;
int i = 0;
- key.case_str = -1; /* signal what side of the comparison it is */
- key.pass = pass;
-
for( i = 1; i < ba->argc; i++) { /* skip argv[0] */
- key.arg = ba->argv[i];
if (ba->passes[i] == 0) {
- bArgument *a = BLI_ghash_lookup(ba->items, &key);
+ /* -1 signal what side of the comparison it is */
+ bArgument *a = lookUp(ba, ba->argv[i], pass, -1);
BA_ArgCallback func = NULL;
void *data = NULL;
@@ -174,10 +189,6 @@ void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *
} else {
func = default_cb;
data = default_data;
-
- if (func) {
- printf("calling default on %s\n", ba->argv[i]);
- }
}
if (func) {
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index a91c24471bb..39f6e7a8aba 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -196,14 +196,14 @@ int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, int *max_
// http://ralphunden.net/content/tutorials/a-guide-to-introsort/
// and he derived it from the SUN STL
//////////////////////////////////////////////////////////////////////////////////////////////////////
-static int size_threshold = 16;
+//static int size_threshold = 16;
/*
* Common methods for all algorithms
*/
-static int floor_lg(int a)
+/*static int floor_lg(int a)
{
return (int)(floor(log(a)/log(2)));
-}
+}*/
/*
* Insertion sort algorithm
@@ -243,6 +243,7 @@ static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode * x, int axis)
/*
* Heapsort algorithm
*/
+#if 0
static void bvh_downheap(BVHNode **a, int i, int n, int lo, int axis)
{
BVHNode * d = a[lo+i-1];
@@ -274,6 +275,7 @@ static void bvh_heapsort(BVHNode **a, int lo, int hi, int axis)
bvh_downheap(a, 1,i-1,lo, axis);
}
}
+#endif
static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis) // returns Sortable
{
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index c3e7d1713db..670c70b86f2 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -486,8 +486,8 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo
BLI_bpathIterator_getPathExpanded(bpi, path_expanded);
if(reports) {
- if (name) BKE_reportf(reports, RPT_INFO, "%s \"%s\", \"%s\": %s", prefix, name, path_expanded, message);
- else BKE_reportf(reports, RPT_INFO, "%s \"%s\": %s", prefix, path_expanded, message);
+ if (name) BKE_reportf(reports, RPT_WARNING, "%s \"%s\", \"%s\": %s", prefix, name, path_expanded, message);
+ else BKE_reportf(reports, RPT_WARNING, "%s \"%s\": %s", prefix, path_expanded, message);
}
}
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 66e9a65dba5..53389950734 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -43,8 +43,8 @@
/* local */
static float noise3_perlin(float vec[3]);
-static float turbulence_perlin(float *point, float lofreq, float hifreq);
-static float turbulencep(float noisesize, float x, float y, float z, int nr);
+//static float turbulence_perlin(float *point, float lofreq, float hifreq);
+//static float turbulencep(float noisesize, float x, float y, float z, int nr);
#define HASHVEC(x,y,z) hashvectf+3*hash[ (hash[ (hash[(z) & 255]+(y)) & 255]+(x)) & 255]
@@ -976,6 +976,7 @@ static float noise3_perlin(float vec[3])
return 1.5 * lerp(sz, c, d); /* interpolate in z */
}
+#if 0
static float turbulence_perlin(float *point, float lofreq, float hifreq)
{
float freq, t, p[3];
@@ -993,6 +994,7 @@ static float turbulence_perlin(float *point, float lofreq, float hifreq)
}
return t - 0.3; /* readjust to make mean value = 0.0 */
}
+#endif
/* for use with BLI_gNoise/gTurbulence, returns signed noise */
static float orgPerlinNoise(float x, float y, float z)
@@ -1029,7 +1031,7 @@ float BLI_hnoisep(float noisesize, float x, float y, float z)
return noise3_perlin(vec);
}
-static float turbulencep(float noisesize, float x, float y, float z, int nr)
+/*static float turbulencep(float noisesize, float x, float y, float z, int nr)
{
float vec[3];
@@ -1038,7 +1040,7 @@ static float turbulencep(float noisesize, float x, float y, float z, int nr)
vec[2]= z/noisesize;
nr++;
return turbulence_perlin(vec, 1.0, (float)(1<<nr));
-}
+}*/
/******************/
/* VORONOI/WORLEY */
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index c3ce73df6c6..6baa7084b47 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -990,11 +990,11 @@ void BLI_setenv(const char *env, const char*val)
{
/* SGI or free windows */
#if (defined(__sgi) || ((defined(WIN32) || defined(WIN64)) && defined(FREE_WINDOWS)))
- char *envstr= malloc(sizeof(char) * (strlen(env) + strlen(val) + 2)); /* one for = another for \0 */
+ char *envstr= MEM_mallocN(sizeof(char) * (strlen(env) + strlen(val) + 2), "envstr"); /* one for = another for \0 */
sprintf(envstr, "%s=%s", env, val);
putenv(envstr);
- free(envstr);
+ MEM_freeN(envstr);
/* non-free windows */
#elif (defined(WIN32) || defined(WIN64)) /* not free windows */
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index ee7734fb14b..f7f032a72bb 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -487,7 +487,7 @@ LinkNode *BLI_read_file_as_lines(char *name)
size= ftell(fp);
fseek(fp, 0, SEEK_SET);
- buf= malloc(size);
+ buf= MEM_mallocN(size, "file_as_lines");
if (buf) {
int i, last= 0;
@@ -506,7 +506,7 @@ LinkNode *BLI_read_file_as_lines(char *name)
}
}
- free(buf);
+ MEM_freeN(buf);
}
fclose(fp);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 65fdd99c62e..38a58f3a398 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4138,14 +4138,14 @@ static void lib_link_scene(FileData *fd, Main *main)
if(seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo);
if(seq->scene) seq->scene= newlibadr(fd, sce->id.lib, seq->scene);
if(seq->sound) {
- seq->sound_handle= NULL;
+ seq->scene_sound = NULL;
if(seq->type == SEQ_HD_SOUND)
seq->type = SEQ_SOUND;
else
seq->sound= newlibadr(fd, sce->id.lib, seq->sound);
if (seq->sound) {
seq->sound->id.us++;
- seq->sound_handle= sound_new_handle(sce, seq->sound, seq->startdisp, seq->enddisp, seq->startofs);
+ seq->scene_sound = sound_add_scene_sound(sce, seq, seq->startdisp, seq->enddisp, seq->startofs);
}
}
seq->anim= 0;
@@ -4161,7 +4161,7 @@ static void lib_link_scene(FileData *fd, Main *main)
#endif
if(sce->ed)
- seq_update_muting(sce->ed);
+ seq_update_muting(sce, sce->ed);
if(sce->nodetree) {
lib_link_ntree(fd, &sce->id, sce->nodetree);
@@ -4218,7 +4218,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->obedit= NULL;
sce->stats= 0;
- memset(&sce->sound_handles, 0, sizeof(sce->sound_handles));
+ sound_create_scene(sce);
/* set users to one by default, not in lib-link, this will increase it for compo nodes */
sce->id.us= 1;
@@ -5205,6 +5205,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
static void direct_link_sound(FileData *fd, bSound *sound)
{
sound->handle = NULL;
+ sound->playback_handle = NULL;
sound->packedfile = direct_link_packedfile(fd, sound->packedfile);
sound->newpackedfile = direct_link_packedfile(fd, sound->newpackedfile);
@@ -5926,6 +5927,29 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb)
ar->v2d.flag = (V2D_PIXELOFS_X|V2D_PIXELOFS_Y);
}
+static void sequencer_init_preview_region(ARegion* ar)
+{
+ // XXX a bit ugly still, copied from space_sequencer
+ /* NOTE: if you change values here, also change them in space_sequencer.c, sequencer_new */
+ ar->regiontype= RGN_TYPE_PREVIEW;
+ ar->alignment= RGN_ALIGN_TOP;
+ ar->flag |= RGN_FLAG_HIDDEN;
+ ar->v2d.keepzoom= V2D_KEEPASPECT | V2D_KEEPZOOM;
+ ar->v2d.minzoom= 0.00001f;
+ ar->v2d.maxzoom= 100000.0f;
+ ar->v2d.tot.xmin= -960.0f; /* 1920 width centered */
+ ar->v2d.tot.ymin= -540.0f; /* 1080 height centered */
+ ar->v2d.tot.xmax= 960.0f;
+ ar->v2d.tot.ymax= 540.0f;
+ ar->v2d.min[0]= 0.0f;
+ ar->v2d.min[1]= 0.0f;
+ ar->v2d.max[0]= 12000.0f;
+ ar->v2d.max[1]= 12000.0f;
+ ar->v2d.cur= ar->v2d.tot;
+ ar->v2d.align= V2D_ALIGN_FREE; // (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
+ ar->v2d.keeptot= V2D_KEEPTOT_FREE;
+}
+
/* 2.50 patch */
static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
{
@@ -6006,9 +6030,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
}
ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer");
BLI_insertlinkbefore(lb, ar_main, ar);
- ar->regiontype= RGN_TYPE_PREVIEW;
- ar->alignment= RGN_ALIGN_TOP;
- ar->flag |= RGN_FLAG_HIDDEN;
+ sequencer_init_preview_region(ar);
break;
case SPACE_VIEW3D:
/* toolbar */
@@ -10305,7 +10327,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
break;
}
- if (ar) {
+ if (ar && (ar->regiontype == RGN_TYPE_PREVIEW)) {
SpaceType *st= BKE_spacetype_from_id(SPACE_SEQ);
BKE_area_region_free(st, ar);
BLI_freelinkN(regionbase, ar);
@@ -10350,9 +10372,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer");
BLI_insertlinkbefore(regionbase, ar_main, ar);
- ar->regiontype= RGN_TYPE_PREVIEW;
- ar->alignment= RGN_ALIGN_TOP;
- ar->flag |= RGN_FLAG_HIDDEN;
+ sequencer_init_preview_region(ar);
}
}
}
@@ -10459,7 +10479,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ma->vol.ms_intensity = 1.f;
}
}
-
}
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 13)) {
@@ -10552,6 +10571,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* put 2.50 compatibility code here until next subversion bump */
{
Scene *sce;
+ Sequence *seq;
/* initialize to sane default so toggling on border shows something */
for(sce = main->scene.first; sce; sce = sce->id.next) {
@@ -10562,7 +10582,48 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
sce->r.border.xmax= 1.0f;
sce->r.border.ymax= 1.0f;
}
+
+ if((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0)
+ sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE
+
+ SEQ_BEGIN(sce->ed, seq) {
+ seq->volume = 1.0f;
+ }
+ SEQ_END
}
+
+ /* sequencer changes */
+ {
+ bScreen *screen;
+ ScrArea *sa;
+ SpaceLink *sl;
+
+ for(screen= main->screen.first; screen; screen= screen->id.next) {
+ for(sa= screen->areabase.first; sa; sa= sa->next) {
+ for(sl= sa->spacedata.first; sl; sl= sl->next) {
+ if(sl->spacetype==SPACE_SEQ) {
+ ARegion *ar_preview;
+ ListBase *regionbase;
+
+ if (sl == sa->spacedata.first) {
+ regionbase = &sa->regionbase;
+ } else {
+ regionbase = &sl->regionbase;
+ }
+
+ ar_preview = (ARegion*)regionbase->first;
+ for (; ar_preview; ar_preview = ar_preview->next) {
+ if (ar_preview->regiontype == RGN_TYPE_PREVIEW)
+ break;
+ }
+ if (ar_preview && (ar_preview->regiontype == RGN_TYPE_PREVIEW)) {
+ sequencer_init_preview_region(ar_preview);
+ }
+ }
+ }
+ }
+ }
+ } /* sequencer changes */
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
@@ -10878,7 +10939,8 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
/* this is actually only needed on UI call? when ID was already read before, and another append
happens which invokes same ID... in that case the lookup table needs this entry */
oldnewmap_insert(fd->libmap, bhead->old, id, 1);
- if(G.f & G_DEBUG) printf("expand: already read %s\n", id->name);
+ // commented because this can print way too much
+ // if(G.f & G_DEBUG) printf("expand: already read %s\n", id->name);
}
}
}
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 8463fe5840e..84be7049f7b 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -2074,7 +2074,7 @@ static void dummy_olddraw_gpencil ()
case ANIMTYPE_GPDATABLOCK: /* gpencil datablock */
{
bGPdata *gpd = (bGPdata *)ale->data;
- ScrArea *sa = (ScrArea *)ale->owner;
+ ScrArea *sa = (ScrArea *)ale->owner; // XXX depreceated...
indent = 0;
group= 3;
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index f756c5b3158..fba6d56fcc6 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -71,6 +71,7 @@
#include "BKE_material.h"
#include "BKE_object.h"
#include "BKE_context.h"
+#include "BKE_global.h"
#include "BKE_utildefines.h"
#include "UI_interface.h"
@@ -436,18 +437,29 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA
/* if the level is 'less than' (i.e. more important) the level we're matching
* but also 'less than' the level just tried (i.e. only the 1st group above grouped F-Curves,
- * when toggling visibility of F-Curves, gets flushed), flush the new status...
+ * when toggling visibility of F-Curves, gets flushed, which should happen if we don't let prevLevel
+ * get updated below once the first 1st group is found)...
*/
- if (level < prevLevel)
+ if (level < prevLevel) {
+ /* flush the new status... */
ANIM_channel_setting_set(ac, ale, setting, on);
- /* however, if the level is 'greater than' (i.e. less important than the previous channel,
- * stop searching, since we've already reached the bottom of another hierarchy
- */
- else if (level > matchLevel)
- break;
-
- /* store this level as the 'old' level now */
- prevLevel= level;
+
+ /* store this level as the 'old' level now */
+ prevLevel= level;
+ }
+ /* if the level is 'greater than' (i.e. less important) than the previous level... */
+ else if (level > prevLevel) {
+ /* if previous level was a base-level (i.e. 0 offset / root of one hierarchy),
+ * stop here
+ */
+ if (prevLevel == 0)
+ break;
+ /* otherwise, this level weaves into another sibling hierarchy to the previous one just
+ * finished, so skip until we get to the parent of this level
+ */
+ else
+ continue;
+ }
}
}
@@ -1385,7 +1397,7 @@ void ANIM_OT_channels_expand (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_boolean(ot->srna, "all", 1, "All", "Expand all channels (not just selected ones)");
+ ot->prop= RNA_def_boolean(ot->srna, "all", 1, "All", "Expand all channels (not just selected ones)");
}
/* ********************** Collapse Channels Operator *********************** */
@@ -1427,7 +1439,7 @@ void ANIM_OT_channels_collapse (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_boolean(ot->srna, "all", 1, "All", "Collapse all channels (not just selected ones)");
+ ot->prop= RNA_def_boolean(ot->srna, "all", 1, "All", "Collapse all channels (not just selected ones)");
}
/* ********************** Select All Operator *********************** */
@@ -1467,7 +1479,7 @@ void ANIM_OT_channels_select_all_toggle (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+ ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
}
/* ******************** Borderselect Operator *********************** */
@@ -1594,7 +1606,8 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh
ale= BLI_findlink(&anim_data, channel_index);
if (ale == NULL) {
/* channel not found */
- printf("Error: animation channel (index = %d) not found in mouse_anim_channels() \n", channel_index);
+ if (G.f & G_DEBUG)
+ printf("Error: animation channel (index = %d) not found in mouse_anim_channels() \n", channel_index);
BLI_freelistN(&anim_data);
return 0;
@@ -1793,7 +1806,7 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh
case ANIMTYPE_GPLAYER:
{
#if 0 // XXX future of this is unclear
- bGPdata *gpd= (bGPdata *)ale->owner;
+ bGPdata *gpd= (bGPdata *)ale->owner; // xxx depreceated
bGPDlayer *gpl= (bGPDlayer *)ale->data;
if (x >= (ACHANNEL_NAMEWIDTH-16)) {
@@ -1818,7 +1831,8 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh
}
break;
default:
- printf("Error: Invalid channel type in mouse_anim_channels() \n");
+ if (G.f & G_DEBUG)
+ printf("Error: Invalid channel type in mouse_anim_channels() \n");
}
/* free channels */
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index d64787ba35b..38dcdd0c405 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -629,7 +629,7 @@ static void MARKER_OT_move(wmOperatorType *ot)
ot->poll= ED_operator_areaactive;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
/* rna storage */
RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 82a2b615681..8ac2bd5753a 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -83,7 +83,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
CFRA= RNA_int_get(op->ptr, "frame");
/* do updates */
- sound_scrub(C);
+ sound_seek_scene(C);
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
}
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index c1b2e474d52..718286b4ba4 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -89,52 +89,59 @@
*/
short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb)
{
- BezTriple *bezt;
+ BezTriple *bezt;
+ int i;
/* sanity check */
if (ELEM(NULL, fcu, fcu->bezt))
return 0;
/* set the F-Curve into the editdata so that it can be accessed */
- bed->fcu= fcu;
- bed->curIndex= 0;
+ if(bed) {
+ bed->fcu= fcu;
+ bed->curIndex= 0;
+ }
/* if function to apply to bezier curves is set, then loop through executing it on beztriples */
- if (bezt_cb) {
+ if (bezt_cb) {
/* if there's a validation func, include that check in the loop
* (this is should be more efficient than checking for it in every loop)
*/
if (bezt_ok) {
- for (bed->curIndex=0, bezt=fcu->bezt; bed->curIndex < fcu->totvert; bed->curIndex++, bezt++) {
+ for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
/* Only operate on this BezTriple if it fullfills the criteria of the validation func */
+ if(bed) bed->curIndex= i;
if (bezt_ok(bed, bezt)) {
/* Exit with return-code '1' if function returns positive
* This is useful if finding if some BezTriple satisfies a condition.
*/
- if (bezt_cb(bed, bezt)) return 1;
+ if (bezt_cb(bed, bezt)) return 1;
}
}
}
else {
- for (bed->curIndex=0, bezt=fcu->bezt; bed->curIndex < fcu->totvert; bed->curIndex++, bezt++) {
+ for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
/* Exit with return-code '1' if function returns positive
* This is useful if finding if some BezTriple satisfies a condition.
*/
- if (bezt_cb(bed, bezt)) return 1;
+ if(bed) bed->curIndex= i;
+ if (bezt_cb(bed, bezt)) return 1;
}
}
- }
+ }
/* unset the F-Curve from the editdata now that it's done */
- bed->fcu= NULL;
- bed->curIndex= 0;
-
- /* if fcu_cb (F-Curve post-editing callback) has been specified then execute it */
- if (fcu_cb)
- fcu_cb(fcu);
+ if(bed) {
+ bed->fcu= NULL;
+ bed->curIndex= 0;
+ }
+
+ /* if fcu_cb (F-Curve post-editing callback) has been specified then execute it */
+ if (fcu_cb)
+ fcu_cb(fcu);
/* done */
- return 0;
+ return 0;
}
/* -------------------------------- Further Abstracted (Not Exposed Directly) ----------------------------- */
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 496e9a0d4d7..9f82275390b 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -4982,7 +4982,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
}
else {
/* perform clamping using euler form (3-components) */
- float eul[3], oldeul[3], quat1[4];
+ float eul[3], oldeul[3], quat1[4] = {0};
if (pchan->rotmode == ROT_MODE_QUAT) {
QUATCOPY(quat1, pchan->quat);
@@ -5082,7 +5082,8 @@ static int pose_select_inverse_exec(bContext *C, wmOperator *op)
{
/* Set the flags */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) {
+ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
+ {
if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) {
pchan->bone->flag ^= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
}
@@ -5114,11 +5115,20 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op)
int action = RNA_enum_get(op->ptr, "action");
if (action == SEL_TOGGLE) {
- action = SEL_SELECT;
- /* Determine if there are any selected bones and therefore whether we are selecting or deselecting */
- // NOTE: we have to check for > 1 not > 0, since there is almost always an active bone that can't be cleared...
- if (CTX_DATA_COUNT(C, selected_pose_bones) > 1)
+ bPoseChannel *pchan= CTX_data_active_pose_bone(C);
+ int num_sel = CTX_DATA_COUNT(C, selected_pose_bones);
+
+ /* cases for deselect:
+ * 1) there's only one bone selected, and that is the active one
+ * 2) there's more than one bone selected
+ */
+ if ( ((num_sel == 1) && (pchan) && (pchan->bone->flag & BONE_SELECTED)) ||
+ (num_sel > 1) )
+ {
action = SEL_DESELECT;
+ }
+ else
+ action = SEL_SELECT;
}
/* Set the flags */
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index eee56070e91..75e7e9a3db8 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -1074,7 +1074,7 @@ int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Strok
DepthPeel *p1, *p2;
float *last_p = NULL;
float dist = FLT_MAX;
- float p[3];
+ float p[3] = {0};
float size = 0;
float mvalf[2];
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index e4fb378aff2..708ebe5c3ed 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -333,88 +333,43 @@ void POSE_OT_paths_clear (wmOperatorType *ot)
/* ******************* Select Constraint Target Operator ************* */
-// XXX this function is to be removed when the other stuff is recoded
-void pose_select_constraint_target(Scene *scene)
-{
- Object *obedit= scene->obedit; // XXX context
- Object *ob= OBACT;
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- bConstraint *con;
-
- /* paranoia checks */
- if (!ob && !ob->pose) return;
- if (ob==obedit || (ob->mode & OB_MODE_POSE)==0) return;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if (arm->layer & pchan->bone->layer) {
- if (pchan->bone->flag & BONE_SELECTED || pchan->bone == arm->act_bone) {
- for (con= pchan->constraints.first; con; con= con->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- ListBase targets = {NULL, NULL};
- bConstraintTarget *ct;
-
- if (cti && cti->get_constraint_targets) {
- cti->get_constraint_targets(con, &targets);
-
- for (ct= targets.first; ct; ct= ct->next) {
- if ((ct->tar == ob) && (ct->subtarget[0])) {
- bPoseChannel *pchanc= get_pose_channel(ob->pose, ct->subtarget);
- if((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE))
- pchanc->bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
- }
- }
-
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(con, &targets, 1);
- }
- }
- }
- }
- }
-
- BIF_undo_push("Select constraint target");
-
-}
-
static int pose_select_constraint_target_exec(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_active_object(C);
bArmature *arm= ob->data;
- bPoseChannel *pchan;
bConstraint *con;
int found= 0;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if (arm->layer & pchan->bone->layer) {
- if (pchan->bone->flag & BONE_SELECTED || pchan->bone == arm->act_bone) {
- for (con= pchan->constraints.first; con; con= con->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- ListBase targets = {NULL, NULL};
- bConstraintTarget *ct;
+ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
+ {
+ if ((pchan->bone->flag & BONE_SELECTED) || (pchan->bone == arm->act_bone)) {
+ for (con= pchan->constraints.first; con; con= con->next) {
+ bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+ ListBase targets = {NULL, NULL};
+ bConstraintTarget *ct;
+
+ if (cti && cti->get_constraint_targets) {
+ cti->get_constraint_targets(con, &targets);
- if (cti && cti->get_constraint_targets) {
- cti->get_constraint_targets(con, &targets);
-
- for (ct= targets.first; ct; ct= ct->next) {
- if ((ct->tar == ob) && (ct->subtarget[0])) {
- bPoseChannel *pchanc= get_pose_channel(ob->pose, ct->subtarget);
- if((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) {
- pchanc->bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
- found= 1;
- }
+ for (ct= targets.first; ct; ct= ct->next) {
+ if ((ct->tar == ob) && (ct->subtarget[0])) {
+ bPoseChannel *pchanc= get_pose_channel(ob->pose, ct->subtarget);
+ if((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) {
+ pchanc->bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
+ found= 1;
}
}
-
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(con, &targets, 1);
}
+
+ if (cti->flush_constraint_targets)
+ cti->flush_constraint_targets(con, &targets, 1);
}
}
}
}
+ CTX_DATA_END;
- if(!found)
+ if (!found)
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob);
@@ -442,24 +397,22 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_active_object(C);
bArmature *arm= ob->data;
- bPoseChannel *pchan;
Bone *curbone, *pabone, *chbone;
int direction = RNA_enum_get(op->ptr, "direction");
int add_to_sel = RNA_boolean_get(op->ptr, "extend");
int found= 0;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
+ {
curbone= pchan->bone;
- if ((arm->layer & curbone->layer) && (curbone->flag & BONE_UNSELECTABLE)==0) {
+ if ((curbone->flag & BONE_UNSELECTABLE)==0) {
if (curbone == arm->act_bone) {
if (direction == BONE_SELECT_PARENT) {
-
if (pchan->parent == NULL) continue;
else pabone= pchan->parent->bone;
if ((arm->layer & pabone->layer) && !(pabone->flag & BONE_HIDDEN_P)) {
-
if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
pabone->flag |= BONE_SELECTED;
arm->act_bone= pabone;
@@ -467,13 +420,12 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
found= 1;
break;
}
- } else { // BONE_SELECT_CHILD
-
+ }
+ else { /* direction == BONE_SELECT_CHILD */
if (pchan->child == NULL) continue;
else chbone = pchan->child->bone;
if ((arm->layer & chbone->layer) && !(chbone->flag & BONE_HIDDEN_P)) {
-
if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
chbone->flag |= BONE_SELECTED;
arm->act_bone= chbone;
@@ -485,6 +437,7 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
}
}
}
+ CTX_DATA_END;
if (found == 0)
return OPERATOR_CANCELLED;
@@ -521,11 +474,10 @@ void POSE_OT_select_hierarchy(wmOperatorType *ot)
/* ******************* select grouped operator ************* */
-static short pose_select_same_group (Object *ob, short extend)
+static short pose_select_same_group (bContext *C, Object *ob, short extend)
{
- bPose *pose= (ob)? ob->pose : NULL;
bArmature *arm= (ob)? ob->data : NULL;
- bPoseChannel *pchan;
+ bPose *pose= (ob)? ob->pose : NULL;
char *group_flags;
int numGroups = 0;
short changed=0, tagged=0;
@@ -545,25 +497,26 @@ static short pose_select_same_group (Object *ob, short extend)
*/
group_flags= MEM_callocN(numGroups+1, "pose_select_same_group");
- for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
- if (arm->layer & pchan->bone->layer) {
- /* keep track of group as group to use later? */
- if ((pchan->bone->flag & BONE_SELECTED) || (pchan->bone == arm->act_bone)) {
- group_flags[pchan->agrp_index] = 1;
- tagged= 1;
- }
-
- /* deselect all bones before selecting new ones? */
- if ((extend == 0) && (pchan->bone->flag & BONE_UNSELECTABLE)==0)
- pchan->bone->flag &= ~BONE_SELECTED;
+ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
+ {
+ /* keep track of group as group to use later? */
+ if ((pchan->bone->flag & BONE_SELECTED) || (pchan->bone == arm->act_bone)) {
+ group_flags[pchan->agrp_index] = 1;
+ tagged= 1;
}
+
+ /* deselect all bones before selecting new ones? */
+ if ((extend == 0) && (pchan->bone->flag & BONE_UNSELECTABLE)==0)
+ pchan->bone->flag &= ~BONE_SELECTED;
}
+ CTX_DATA_END;
/* small optimisation: only loop through bones a second time if there are any groups tagged */
if (tagged) {
/* only if group matches (and is not selected or current bone) */
- for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
- if ((arm->layer & pchan->bone->layer) && (pchan->bone->flag & BONE_UNSELECTABLE)==0) {
+ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
+ {
+ if ((pchan->bone->flag & BONE_UNSELECTABLE)==0) {
/* check if the group used by this bone is counted */
if (group_flags[pchan->agrp_index]) {
pchan->bone->flag |= BONE_SELECTED;
@@ -571,6 +524,7 @@ static short pose_select_same_group (Object *ob, short extend)
}
}
}
+ CTX_DATA_END;
}
/* free temp info */
@@ -579,11 +533,10 @@ static short pose_select_same_group (Object *ob, short extend)
return changed;
}
-static short pose_select_same_layer (Object *ob, short extend)
+static short pose_select_same_layer (bContext *C, Object *ob, short extend)
{
bPose *pose= (ob)? ob->pose : NULL;
bArmature *arm= (ob)? ob->data : NULL;
- bPoseChannel *pchan;
short changed= 0;
int layers= 0;
@@ -591,30 +544,30 @@ static short pose_select_same_layer (Object *ob, short extend)
return 0;
/* figure out what bones are selected */
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if (arm->layer & pchan->bone->layer) {
- /* keep track of layers to use later? */
- if ((pchan->bone->flag & BONE_SELECTED) || (pchan->bone == arm->act_bone))
- layers |= pchan->bone->layer;
-
- /* deselect all bones before selecting new ones? */
- if ((extend == 0) && (pchan->bone->flag & BONE_UNSELECTABLE)==0)
- pchan->bone->flag &= ~BONE_SELECTED;
- }
+ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
+ {
+ /* keep track of layers to use later? */
+ if ((pchan->bone->flag & BONE_SELECTED) || (pchan->bone == arm->act_bone))
+ layers |= pchan->bone->layer;
+
+ /* deselect all bones before selecting new ones? */
+ if ((extend == 0) && (pchan->bone->flag & BONE_UNSELECTABLE)==0)
+ pchan->bone->flag &= ~BONE_SELECTED;
}
+ CTX_DATA_END;
if (layers == 0)
return 0;
/* select bones that are on same layers as layers flag */
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if (arm->layer & pchan->bone->layer) {
- /* if bone is on a suitable layer, and the bone can have its selection changed, select it */
- if ((layers & pchan->bone->layer) && (pchan->bone->flag & BONE_UNSELECTABLE)==0) {
- pchan->bone->flag |= BONE_SELECTED;
- changed= 1;
- }
+ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
+ {
+ /* if bone is on a suitable layer, and the bone can have its selection changed, select it */
+ if ((layers & pchan->bone->layer) && (pchan->bone->flag & BONE_UNSELECTABLE)==0) {
+ pchan->bone->flag |= BONE_SELECTED;
+ changed= 1;
}
}
+ CTX_DATA_END;
return changed;
}
@@ -635,10 +588,10 @@ static int pose_select_grouped_exec (bContext *C, wmOperator *op)
*/
switch (RNA_enum_get(op->ptr, "type")) {
case 1: /* group */
- changed= pose_select_same_group(ob, extend);
+ changed= pose_select_same_group(C, ob, extend);
break;
default: /* layer */
- changed= pose_select_same_layer(ob, extend);
+ changed= pose_select_same_layer(C, ob, extend);
break;
}
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index cd9ebe6996f..c54b062c815 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1499,7 +1499,7 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
}
if(!buf) {
- BLI_strncpy(str, "", maxlen);
+ str[0] = '\0';
}
else if(buf && buf != str) {
/* string was too long, we have to truncate */
@@ -1511,12 +1511,12 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
/* ID pointer */
if(but->idpoin_idpp) { /* Can be NULL for ID properties by python */
ID *id= *(but->idpoin_idpp);
- if(id)
+ if(id) {
BLI_strncpy(str, id->name+2, maxlen);
+ return;
+ }
}
- else {
- str[0] = '\0';
- }
+ str[0] = '\0';
return;
}
else if(but->type == TEX) {
@@ -2067,7 +2067,7 @@ void ui_check_but(uiBut *but)
case HOTKEYEVT:
if (but->flag & UI_SELECT) {
- strncpy(but->drawstr, "", UI_MAX_DRAW_STR);
+ but->drawstr[0]= '\0';
if(but->modifier_key) {
char *str= but->drawstr;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index d3912e183c1..76a98479d55 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2084,7 +2084,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
/* pass on release as press for other keymaps XXX hack alert! */
if(event->type==LEFTMOUSE && event->val==KM_RELEASE) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
- event->val= KM_PRESS;
+ event->val= KM_CLICK;
return WM_UI_HANDLER_CONTINUE;
}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 6c4f5564fd7..7608014b150 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -573,8 +573,8 @@ static void init_iconfile_list(struct ListBase *list)
if(!BLI_getwdN(olddir))
restoredir = 0;
totfile = BLI_getdir(icondirstr, &dir);
- if (restoredir)
- chdir(olddir);
+ if (restoredir && !chdir(olddir))
+ ; /* fix warning about checking return value */
for(i=0; i<totfile; i++) {
if( (dir[i].type & S_IFREG) ) {
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 269fc278581..62af987c966 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -732,7 +732,7 @@ void sort_faces(Scene *scene, View3D *v3d)
if (event == 1) { /* sort on view axis */
mul_m4_v3(mat, vec);
face_sort_floats[i] = vec[2] * reverse;
- } else { /* distance from cursor*/
+ } else if(event == 2) { /* distance from cursor*/
face_sort_floats[i] = len_v3v3(cur, vec) * reverse; /* back to front */
}
}
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 15ed20c783e..82e72136daf 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -181,7 +181,7 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op)
}
else {
/* perform clamping using euler form (3-components) */
- float eul[3], oldeul[3], quat1[4];
+ float eul[3], oldeul[3], quat1[4] = {0};
if (ob->rotmode == ROT_MODE_QUAT) {
QUATCOPY(quat1, ob->quat);
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index eec971e777e..b1a3a3be28d 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -109,9 +109,9 @@ static void *thread_tls_data;
/* XXX */
/* from header info.c */
static int start_progress_bar(void) {return 0;};
-static void end_progress_bar(void) {};
+static void end_progress_bar(wmWindow *win) {WM_cursor_restore(win);};
static void waitcursor(int val) {};
-static int progress_bar(float done, char *busy_info) {return 0;}
+static int progress_bar(wmWindow *win, float done, char *busy_info) { WM_timecursor(win,done*100); return 0;}
static int pupmenu() {return 0;}
/* XXX */
@@ -1060,7 +1060,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *ob)
{
int done = 0;
float noFramesf = (float)noFrames;
- float percentdone = 0.0;
+ float percentdone = 0.0, oldpercentdone = -1.0;
int lastRedraw = -1;
g_break= 0;
@@ -1075,11 +1075,15 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *ob)
// lukep we add progress bar as an interim mesure
percentdone = globalBakeFrame / noFramesf;
- sprintf(busy_mess, "baking fluids %d / %d |||", globalBakeFrame, (int) noFramesf);
- progress_bar(percentdone, busy_mess );
+ if (percentdone != oldpercentdone) {
+ sprintf(busy_mess, "baking fluids %d / %d |||", globalBakeFrame, (int) noFramesf);
+ percentdone = percentdone < 0.0 ? 0.0:percentdone;
+ progress_bar(CTX_wm_window(C), percentdone, busy_mess );
+ oldpercentdone = percentdone;
+ }
- // longer delay to prevent frequent redrawing
- PIL_sleep_ms(2000);
+ //XXX no more need for longer delay to prevent frequent redrawing
+ PIL_sleep_ms(200);
BLI_lock_thread(LOCK_CUSTOM1);
if(globalBakeState != 0) done = 1; // 1=ok, <0=error/abort
@@ -1121,7 +1125,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *ob)
#endif
} // redraw
}
- end_progress_bar();
+ end_progress_bar(CTX_wm_window(C));
}
BLI_end_threads(&threads);
} // El'Beem API init, thread creation
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index f83af1d5167..9e7034b6475 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1390,6 +1390,8 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
// XXX quick hacks for files saved with 2.5 already (i.e. the builtin defaults file)
// scrollbars for button regions
ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+ ar->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
+ ar->v2d.scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
ar->v2d.keepzoom |= V2D_KEEPZOOM;
// correctly initialised User-Prefs?
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 259cb6d7c90..d747fc26aed 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1513,9 +1513,11 @@ static int frame_offset_exec(bContext *C, wmOperator *op)
int delta;
delta = RNA_int_get(op->ptr, "delta");
-
+
CTX_data_scene(C)->r.cfra += delta;
+ sound_seek_scene(C);
+
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C));
return OPERATOR_FINISHED;
@@ -2473,12 +2475,13 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event)
}
}
+ if(sad->flag & ANIMPLAY_FLAG_JUMPED)
+ sound_seek_scene(C);
+
/* since we follow drawflags, we can't send notifier but tag regions ourselves */
ED_update_for_newframe(C, 1);
- sound_update_playing(C);
-
for(sa= screen->areabase.first; sa; sa= sa->next) {
ARegion *ar;
for(ar= sa->regionbase.first; ar; ar= ar->next) {
@@ -2521,16 +2524,19 @@ static void SCREEN_OT_animation_step(wmOperatorType *ot)
static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event)
{
bScreen *screen= CTX_wm_screen(C);
+ struct Scene* scene = CTX_data_scene(C);
if(screen->animtimer) {
/* stop playback now */
ED_screen_animation_timer(C, 0, 0, 0);
- sound_stop_all(C);
+ sound_stop_scene(scene);
}
else {
ScrArea *sa= CTX_wm_area(C);
int mode= (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1;
int sync= -1;
+ if(mode == 1) // XXX only play audio forwards!?
+ sound_play_scene(scene);
if(RNA_property_is_set(op->ptr, "sync"))
sync= (RNA_boolean_get(op->ptr, "sync"));
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index c5dc6f74f58..81e2b1caea2 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -3578,7 +3578,7 @@ static void *do_projectpaint_thread(void *ph_v)
rctf bucket_bounds;
/* for smear only */
- float pos_ofs[2];
+ float pos_ofs[2] = {0};
float co[2];
float mask = 1.0f; /* airbrush wont use mask */
unsigned short mask_short;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 1914c40f817..129d10050a5 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1276,7 +1276,7 @@ static void do_flatten_clay_brush(Sculpt *sd, SculptSession *ss, PBVHNode **node
Brush *brush = paint_brush(&sd->paint);
float bstrength= ss->cache->bstrength;
float area_normal[3];
- float cntr[3], cntr2[3], bstr = 0;
+ float cntr[3], cntr2[3] = {0}, bstr = 0;
int n, flip = 0;
calc_area_normal(sd, ss, area_normal, nodes, totnode);
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 064baafbd95..7398017a267 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -74,12 +74,12 @@ static int open_exec(bContext *C, wmOperator *op)
sound = sound_new_file(CTX_data_main(C), path);
- if (sound==NULL || sound->handle == NULL) {
+ if (sound==NULL || sound->playback_handle == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
}
- info = AUD_getInfo(sound->handle);
+ info = AUD_getInfo(sound->playback_handle);
if (info.specs.channels == AUD_CHANNELS_INVALID) {
sound_delete(C, sound);
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 22f5989f3aa..d91f2788ecd 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -733,7 +733,7 @@ void ACTION_OT_clean (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
+ ot->prop= RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
}
/* ******************** Sample Keyframes Operator *********************** */
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 1939057b654..c22533f9d45 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -196,7 +196,7 @@ void ACTION_OT_select_all_toggle (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+ ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
}
/* ******************** Border Select Operator **************************** */
@@ -362,7 +362,7 @@ void ACTION_OT_select_border(wmOperatorType *ot)
/* rna */
WM_operator_properties_gesture_border(ot, FALSE);
- RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+ ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
}
/* ******************** Column Select Operator **************************** */
@@ -571,7 +571,7 @@ void ACTION_OT_select_column (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
+ ot->prop= RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
}
/* ******************** Select More/Less Operators *********************** */
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index dbe9417fd2a..556ab13654b 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -801,7 +801,7 @@ static void filelist_read_dir(struct FileList* filelist)
BLI_hide_dot_files(filelist->hide_dot);
filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist));
- chdir(wdir);
+ if(!chdir(wdir)) /* fix warning about not checking return value */;
filelist_setfiletypes(filelist, G.have_quicktime);
filelist_filter(filelist);
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index dca2b2f3b98..40e035759d1 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -924,7 +924,7 @@ void GRAPH_OT_clean (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
+ ot->prop= RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
}
/* ******************** Bake F-Curve Operator *********************** */
@@ -2013,7 +2013,7 @@ void GRAPH_OT_fmodifier_add (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* id-props */
- RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
+ ot->prop= RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
RNA_def_boolean(ot->srna, "only_active", 1, "Only Active", "Only add F-Modifier to active F-Curve.");
}
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 648a162890d..f8a12c566df 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -77,7 +77,7 @@ static void graphview_cursor_apply(bContext *C, wmOperator *op)
* NOTE: sync this part of the code with ANIM_OT_change_frame
*/
CFRA= RNA_int_get(op->ptr, "frame");
- sound_scrub(C);
+ sound_seek_scene(C);
/* set the cursor value */
sipo->cursorVal= RNA_float_get(op->ptr, "value");
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 872b688bea1..b2a38c295fa 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -199,7 +199,7 @@ void GRAPH_OT_select_all_toggle (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
/* props */
- RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+ ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
}
/* ******************** Border Select Operator **************************** */
@@ -361,7 +361,7 @@ void GRAPH_OT_select_border(wmOperatorType *ot)
/* rna */
WM_operator_properties_gesture_border(ot, FALSE);
- RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+ ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
}
/* ******************** Column Select Operator **************************** */
@@ -546,7 +546,7 @@ void GRAPH_OT_select_column (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
/* props */
- RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
+ ot->prop= RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
}
/* ******************** Select More/Less Operators *********************** */
@@ -687,7 +687,16 @@ enum {
NEAREST_HANDLE_KEY,
NEAREST_HANDLE_RIGHT
} eHandleIndex;
-
+
+/* check if its ok to select a handle */
+// XXX also need to check for int-values only?
+static int fcurve_handle_sel_check(SpaceIpo *sipo, BezTriple *bezt)
+{
+ if (sipo->flag & SIPO_NOHANDLES) return 0;
+ if ((sipo->flag & SIPO_SELVHANDLESONLY) && BEZSELECTED(bezt)==0) return 0;
+ return 1;
+}
+
/* Find the vertex (either handle (0/2) or the keyframe (1)) that is nearest to the mouse cursor (in area coordinates)
* Selected verts get a disadvantage, to make it easier to select handles behind.
* Returns eHandleIndex
@@ -751,8 +760,7 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc
}
/* handles - only do them if they're visible */
- // XXX also need to check for int-values only?
- if ((sipo->flag & SIPO_NOHANDLES)==0) {
+ if (fcurve_handle_sel_check(sipo, bezt1)) {
/* first handle only visible if previous segment had handles */
if ( (!prevbezt && (bezt1->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) )
{
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 1666a169f12..885521fe8c0 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -59,6 +59,7 @@
#include "BKE_animsys.h"
#include "BKE_nla.h"
#include "BKE_context.h"
+#include "BKE_global.h"
#include "BKE_screen.h"
#include "BKE_utildefines.h"
@@ -109,7 +110,8 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
ale= BLI_findlink(&anim_data, channel_index);
if (ale == NULL) {
/* channel not found */
- printf("Error: animation channel (index = %d) not found in mouse_anim_channels() \n", channel_index);
+ if (G.f & G_DEBUG)
+ printf("Error: animation channel (index = %d) not found in mouse_anim_channels() \n", channel_index);
BLI_freelistN(&anim_data);
return 0;
@@ -277,7 +279,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
break;
case ANIMTYPE_NLAACTION:
{
- AnimData *adt= BKE_animdata_from_id(ale->owner); /* this won't crash, right? */
+ AnimData *adt= BKE_animdata_from_id(ale->id);
if (x >= (v2d->cur.xmax-NLACHANNEL_BUTTON_WIDTH)) {
if (nlaedit_is_tweakmode_on(ac) == 0) {
@@ -298,7 +300,8 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
break;
default:
- printf("Error: Invalid channel type in mouse_nla_channels() \n");
+ if (G.f & G_DEBUG)
+ printf("Error: Invalid channel type in mouse_nla_channels() \n");
}
/* free channels */
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 359082c470a..566abaa18c3 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -215,7 +215,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
else
strcpy(seq->name+2, sce_seq->id.name+2);
- calc_sequence_disp(seq);
+ calc_sequence_disp(scene, seq);
sort_seq(scene);
if (RNA_boolean_get(op->ptr, "replace_sel")) {
@@ -303,7 +303,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
}
sort_seq(scene);
- seq_update_muting(ed);
+ seq_update_muting(scene, ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
@@ -428,7 +428,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
}
}
- calc_sequence_disp(seq);
+ calc_sequence_disp(scene, seq);
sort_seq(scene);
@@ -530,7 +530,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
- calc_sequence(seq);
+ calc_sequence(scene, seq);
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 37bb75a5efd..0955652c30f 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -49,7 +49,8 @@
#include "BKE_sequencer.h"
#include "BKE_scene.h"
#include "BKE_utildefines.h"
-
+#include "BKE_sound.h"
+
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -172,6 +173,38 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, char *col)
}
}
+static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2, float stepsize)
+{
+ /*
+ x1 is the starting x value to draw the wave,
+ x2 the end x value, same for y1 and y2
+ stepsize is width of a pixel.
+ */
+ if(seq->sound->cache)
+ {
+ int i;
+ int length = floor((x2-x1)/stepsize)+1;
+ float ymid = (y1+y2)/2;
+ float yscale = (y2-y1)/2;
+ float* samples = MEM_mallocN(length * sizeof(float) * 2, "seqwave_samples");
+ if(!samples)
+ return;
+ if(sound_read_sound_buffer(seq->sound, samples, length) != length)
+ {
+ MEM_freeN(samples);
+ return;
+ }
+ glBegin(GL_LINES);
+ for(i = 0; i < length; i++)
+ {
+ glVertex2f(x1+i*stepsize, ymid + samples[i * 2] * yscale);
+ glVertex2f(x1+i*stepsize, ymid + samples[i * 2 + 1] * yscale);
+ }
+ glEnd();
+ MEM_freeN(samples);
+ }
+}
+
static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
{
/* Note, this used to use WHILE_SEQ, but it messes up the seq->depth value, (needed by transform when doing overlap checks)
@@ -557,6 +590,9 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *
x1= seq->startdisp;
x2= seq->enddisp;
+ /* draw sound wave */
+ if(seq->type == SEQ_SOUND) drawseqwave(seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin)/ar->winx);
+
get_seq_color3ubv(scene, seq, col);
if (G.moving && (seq->flag & SELECT)) {
if(seq->flag & SEQ_OVERLAP) {
@@ -611,21 +647,18 @@ void set_special_seq_update(int val)
else special_seq_update= 0;
}
-// XXX todo: remove special offset code for image-buf calculations...
-void draw_image_seq(Scene *scene, ARegion *ar, SpaceSeq *sseq)
+void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq)
{
extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
struct ImBuf *ibuf;
- int x1, y1, rectx, recty;
+ struct View2D *v2d = &ar->v2d;
+ int rectx, recty;
int free_ibuf = 0;
static int recursive= 0;
- float zoom;
- float zoomx, zoomy;
float render_size = 0.0;
float proxy_size = 100.0;
-
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
+ GLuint texid;
+ GLuint last_texid;
render_size = sseq->render_size;
if (render_size == 0) {
@@ -637,14 +670,21 @@ void draw_image_seq(Scene *scene, ARegion *ar, SpaceSeq *sseq)
return;
}
- rectx= (render_size*scene->r.xsch)/100;
- recty= (render_size*scene->r.ysch)/100;
+ rectx= (render_size*(float)scene->r.xsch)/100.0f+0.5f;
+ recty= (render_size*(float)scene->r.ysch)/100.0f+0.5f;
+
+ /* XXX TODO: take color from theme */
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ UI_view2d_totRect_set(v2d, rectx, recty);
+ UI_view2d_curRect_validate(v2d);
/* BIG PROBLEM: the give_ibuf_seq() can call a rendering, which in turn calls redraws...
this shouldn't belong in a window drawing....
So: solve this once event based.
Now we check for recursion, space type and active area again (ton) */
-
+
if(recursive)
return;
else {
@@ -708,34 +748,37 @@ void draw_image_seq(Scene *scene, ARegion *ar, SpaceSeq *sseq)
IMB_rect_from_float(ibuf);
}
- /* needed for gla draw */
- glaDefine2DArea(&ar->winrct);
-
- zoom= SEQ_ZOOM_FAC(sseq->zoom);
- if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- zoom /= proxy_size / 100.0;
- zoomx = zoom * ((float)scene->r.xasp / (float)scene->r.yasp);
- zoomy = zoom;
- } else {
- zoomx = zoomy = zoom;
- }
+ /* setting up the view - actual drawing starts here */
+ UI_view2d_view_ortho(C, v2d);
- /* calc location */
- x1= (ar->winx-zoomx*ibuf->x)/2 + sseq->xof;
- y1= (ar->winy-zoomy*ibuf->y)/2 + sseq->yof;
-
- glPixelZoom(zoomx, zoomy);
-
- glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
-
- glPixelZoom(1.0, 1.0);
+ last_texid= glaGetOneInteger(GL_TEXTURE_2D);
+ glEnable(GL_TEXTURE_2D);
+ glGenTextures(1, (GLuint *)&texid);
+
+ glBindTexture(GL_TEXTURE_2D, texid);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
+ glBegin(GL_QUADS);
+ glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
+ glTexCoord2f(0.0f, 1.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
+ glTexCoord2f(1.0f, 1.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
+ glTexCoord2f(1.0f, 0.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
+ glEnd( );
+ glBindTexture(GL_TEXTURE_2D, last_texid);
+ glDisable(GL_TEXTURE_2D);
+ glDeleteTextures(1, &texid);
/* safety border */
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF &&
(sseq->flag & SEQ_DRAW_SAFE_MARGINS) != 0) {
float fac= 0.1;
- float x2 = x1 + ibuf->x * zoomx;
- float y2 = y1 + ibuf->y * zoomy;
+ float x1 = v2d->tot.xmin;
+ float y1 = v2d->tot.ymin;
+ float x2 = v2d->tot.xmax;
+ float y2 = v2d->tot.ymax;
float a= fac*(x2-x1);
x1+= a;
@@ -769,82 +812,9 @@ void draw_image_seq(Scene *scene, ARegion *ar, SpaceSeq *sseq)
// if (sseq->flag & SEQ_DRAW_GPENCIL)
// XXX draw_gpencil_2dview(sa, 0);
- /* ortho at pixel level sa */
-// XXX myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
-
-}
-
-// XXX part of wacko image-drawing system...
-void seq_reset_imageofs(SpaceSeq *sseq)
-{
- sseq->xof = sseq->yof = sseq->zoom = 0;
-}
-
-
-#if 0
-/* XXX - these should really be made to use View2D instead of so wacko private system - Aligorith */
-
-void seq_viewzoom(SpaceSeq *sseq, unsigned short event, int invert)
-{
-
- if(event==PAD1)
- sseq->zoom= 1.0;
- else if(event==PAD2)
- sseq->zoom= (invert)? 2.0: 0.5;
- else if(event==PAD4)
- sseq->zoom= (invert)? 4.0: 0.25;
- else if(event==PAD8)
- sseq->zoom= (invert)? 8.0: 0.125;
-
- /* ensure pixel exact locations for draw */
- sseq->xof= (int)sseq->xof;
- sseq->yof= (int)sseq->yof;
-}
-
-void seq_viewmove(Scene *scene, ARegion *ar, SpaceSeq *sseq)
-{
- short mval[2], mvalo[2];
- short rectx, recty, xmin, xmax, ymin, ymax, pad;
- int oldcursor;
- Window *win;
-
- sa = sseq->area;
- rectx= (scene->r.size*scene->r.xsch)/100;
- recty= (scene->r.size*scene->r.ysch)/100;
-
- pad = 10;
- xmin = -(ar->winx/2) - rectx/2 + pad;
- xmax = ar->winx/2 + rectx/2 - pad;
- ymin = -(ar->winy/2) - recty/2 + pad;
- ymax = ar->winy/2 + recty/2 - pad;
-
- getmouseco_sc(mvalo);
-
- oldcursor=get_cursor();
- win=winlay_get_active_window();
-
- SetBlenderCursor(BC_NSEW_SCROLLCURSOR);
-
- while(get_mbut()&(L_MOUSE|M_MOUSE)) {
-
- getmouseco_sc(mval);
-
- if(mvalo[0]!=mval[0] || mvalo[1]!=mval[1]) {
-
- sseq->xof -= (mvalo[0]-mval[0]);
- sseq->yof -= (mvalo[1]-mval[1]);
-
- /* prevent dragging image outside of the window and losing it! */
- CLAMP(sseq->xof, xmin, xmax);
- CLAMP(sseq->yof, ymin, ymax);
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- }
- }
+ /* ortho at pixel level */
+ UI_view2d_view_restore(C);
}
-#endif
void drawprefetchseqspace(Scene *scene, ARegion *ar, SpaceSeq *sseq)
{
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index bd1db4c29b6..11bdbcb5314 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -479,7 +479,7 @@ static void reload_sound_strip(Scene *scene, char *name)
seqact->strip= seq->strip;
seqact->len= seq->len;
- calc_sequence(seqact);
+ calc_sequence(scene, seqact);
seq->strip= 0;
seq_free_sequence(scene, seq);
@@ -519,7 +519,7 @@ static void reload_image_strip(Scene *scene, char *name)
seqact->strip= seq->strip;
seqact->len= seq->len;
- calc_sequence(seqact);
+ calc_sequence(scene, seqact);
seq->strip= 0;
seq_free_sequence(scene, seq);
@@ -857,8 +857,8 @@ static Sequence *dupli_seq(struct Scene *scene, Sequence *seq)
} else if(seq->type == SEQ_SOUND) {
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
- if(seq->sound_handle)
- seqn->sound_handle = sound_new_handle(scene, seqn->sound, seq->sound_handle->startframe, seq->sound_handle->endframe, seq->sound_handle->frameskip);
+ if(seq->scene_sound)
+ seqn->scene_sound = sound_add_scene_sound(scene, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
seqn->sound->id.us++;
} else if(seq->type == SEQ_IMAGE) {
@@ -983,7 +983,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
}
reload_sequence_new_file(scene, seq);
- calc_sequence(seq);
+ calc_sequence(scene, seq);
if (!skip_dup) {
/* Duplicate AFTER the first change */
@@ -1022,7 +1022,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
}
reload_sequence_new_file(scene, seqn);
- calc_sequence(seqn);
+ calc_sequence(scene, seqn);
}
return seqn;
}
@@ -1072,7 +1072,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
}
}
- calc_sequence(seq);
+ calc_sequence(scene, seq);
if (!skip_dup) {
/* Duplicate AFTER the first change */
@@ -1107,7 +1107,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
seqn->startstill = 0;
}
- calc_sequence(seqn);
+ calc_sequence(scene, seqn);
}
return seqn;
}
@@ -1161,7 +1161,7 @@ int insert_gap(Scene *scene, int gap, int cfra)
SEQP_BEGIN(ed, seq) {
if(seq->startdisp >= cfra) {
seq->start+= gap;
- calc_sequence(seq);
+ calc_sequence(scene, seq);
done= 1;
}
}
@@ -1336,7 +1336,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
}
seq_tx_handle_xlimits(seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL);
}
- calc_sequence(seq);
+ calc_sequence(scene, seq);
}
}
SEQ_END
@@ -1351,11 +1351,11 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
}
else if(seq->type & SEQ_EFFECT) {
if(seq->seq1 && (seq->seq1->flag & SELECT))
- calc_sequence(seq);
+ calc_sequence(scene, seq);
else if(seq->seq2 && (seq->seq2->flag & SELECT))
- calc_sequence(seq);
+ calc_sequence(scene, seq);
else if(seq->seq3 && (seq->seq3->flag & SELECT))
- calc_sequence(seq);
+ calc_sequence(scene, seq);
}
}
SEQ_END;
@@ -1425,7 +1425,7 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op)
}
}
- seq_update_muting(ed);
+ seq_update_muting(scene, ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
@@ -1476,7 +1476,7 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op)
}
}
- seq_update_muting(ed);
+ seq_update_muting(scene, ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
@@ -1623,8 +1623,6 @@ static int sequencer_refresh_all_exec(bContext *C, wmOperator *op)
free_imbuf_seq(scene, &ed->seqbase, FALSE);
- seqbase_sound_reload(scene, &ed->seqbase);
-
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
@@ -1840,7 +1838,7 @@ static int sequencer_delete_exec(bContext *C, wmOperator *op)
/* updates lengths etc */
seq= ed->seqbasep->first;
while(seq) {
- calc_sequence(seq);
+ calc_sequence(scene, seq);
seq= seq->next;
}
@@ -1848,7 +1846,7 @@ static int sequencer_delete_exec(bContext *C, wmOperator *op)
ms= ed->metastack.last;
while(ms) {
ms->parseq->strip->len= 0; /* force new alloc */
- calc_sequence(ms->parseq);
+ calc_sequence(scene, ms->parseq);
ms= ms->prev;
}
@@ -1923,7 +1921,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* new stripdata */
strip_new->stripdata= se_new= MEM_callocN(sizeof(StripElem)*1, "stripelem");
strncpy(se_new->name, se->name, FILE_MAXFILE-1);
- calc_sequence(seq_new);
+ calc_sequence(scene, seq_new);
seq_new->flag &= ~SEQ_OVERLAP;
if (seq_test_overlap(ed->seqbasep, seq_new)) {
shuffle_seq(ed->seqbasep, seq_new, scene);
@@ -2011,7 +2009,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op)
/* recalc all: the meta can have effects connected to it */
for(seq= ed->seqbasep->first; seq; seq= seq->next)
- calc_sequence(seq);
+ calc_sequence(scene, seq);
active_seq_set(scene, ms->parseq);
@@ -2022,7 +2020,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op)
}
- seq_update_muting(ed);
+ seq_update_muting(scene, ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
@@ -2081,7 +2079,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
seq= next;
}
seqm->machine= channel_max;
- calc_sequence(seqm);
+ calc_sequence(scene, seqm);
seqm->strip= MEM_callocN(sizeof(Strip), "metastrip");
seqm->strip->len= seqm->len;
@@ -2091,7 +2089,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
if( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene);
- seq_update_muting(ed);
+ seq_update_muting(scene, ed);
seqUniqueName(scene->ed->seqbasep, seqm);
@@ -2165,7 +2163,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *op)
SEQ_END;
sort_seq(scene);
- seq_update_muting(ed);
+ seq_update_muting(scene, ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
@@ -2225,14 +2223,20 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot)
/* view_all operator */
static int sequencer_view_all_preview_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- //bScreen *sc= CTX_wm_screen(C);
+ bScreen *sc= CTX_wm_screen(C);
ScrArea *area= CTX_wm_area(C);
+#if 0
ARegion *ar= CTX_wm_region(C);
SpaceSeq *sseq= area->spacedata.first;
- //View2D *v2d= UI_view2d_fromcontext(C);
-
+ Scene *scene= CTX_data_scene(C);
+#endif
+ View2D *v2d= UI_view2d_fromcontext(C);
+ v2d->cur= v2d->tot;
+ UI_view2d_curRect_validate(v2d);
+ UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
+
+#if 0
/* Like zooming on an image view */
float zoomX, zoomY;
int width, height, imgwidth, imgheight;
@@ -2261,6 +2265,7 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *op)
else {
sseq->zoom= 1.0f;
}
+#endif
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
@@ -2516,15 +2521,16 @@ void SEQUENCER_OT_previous_edit(wmOperatorType *ot)
/* properties */
}
-static void swap_sequence(Sequence* seqa, Sequence* seqb)
+static void swap_sequence(Scene* scene, Sequence* seqa, Sequence* seqb)
{
int gap = seqb->startdisp - seqa->enddisp;
seqb->start = seqa->start;
- calc_sequence(seqb);
+ calc_sequence(scene, seqb);
seqa->start = seqb->enddisp + gap;
- calc_sequence(seqa);
+ calc_sequence(scene, seqa);
}
+#if 0
static Sequence* sequence_find_parent(Scene* scene, Sequence* child)
{
Editing *ed= seq_give_editing(scene, FALSE);
@@ -2539,9 +2545,10 @@ static Sequence* sequence_find_parent(Scene* scene, Sequence* child)
break;
}
}
- return parent;
+ return parent;
}
+#endif
static int sequencer_swap_exec(bContext *C, wmOperator *op)
{
@@ -2566,17 +2573,17 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
switch (side) {
case SEQ_SIDE_LEFT:
- swap_sequence(seq, active_seq);
+ swap_sequence(scene, seq, active_seq);
break;
case SEQ_SIDE_RIGHT:
- swap_sequence(active_seq, seq);
+ swap_sequence(scene, active_seq, seq);
break;
}
// XXX - should be a generic function
for(iseq= scene->ed->seqbasep->first; iseq; iseq= iseq->next) {
if((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
- calc_sequence(iseq);
+ calc_sequence(scene, iseq);
}
}
@@ -2677,9 +2684,9 @@ static void seq_del_sound(Scene *scene, Sequence *seq)
seq_del_sound(scene, iseq);
}
}
- else if(seq->sound_handle) {
- sound_delete_handle(scene, seq->sound_handle);
- seq->sound_handle= NULL;
+ else if(seq->scene_sound) {
+ sound_remove_scene_sound(scene, seq->scene_sound);
+ seq->scene_sound = NULL;
}
}
@@ -2728,19 +2735,19 @@ void SEQUENCER_OT_copy(wmOperatorType *ot)
/* properties */
}
-static void seq_offset(Sequence *seq, int ofs)
+static void seq_offset(Scene *scene, Sequence *seq, int ofs)
{
if(seq->type == SEQ_META) {
Sequence *iseq;
for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
- seq_offset(iseq, ofs);
+ seq_offset(scene, iseq, ofs);
}
}
else {
seq->start += ofs;
}
- calc_sequence_disp(seq);
+ calc_sequence_disp(scene, seq);
}
static int sequencer_paste_exec(bContext *C, wmOperator *op)
@@ -2759,7 +2766,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op)
/* transform pasted strips before adding */
if(ofs) {
for(iseq= new.first; iseq; iseq= iseq->next) {
- seq_offset(iseq, ofs);
+ seq_offset(scene, iseq, ofs);
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index cf598bfb613..40e9a37f8b6 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -48,7 +48,7 @@ struct ARegion *sequencer_has_buttons_region(struct ScrArea *sa);
/* sequencer_draw.c */
void draw_timeline_seq(const struct bContext *C, struct ARegion *ar);
-void draw_image_seq(struct Scene *scene, struct ARegion *ar, struct SpaceSeq *sseq);
+void draw_image_seq(const struct bContext* C, struct Scene *scene,struct ARegion *ar, struct SpaceSeq *sseq);
void seq_reset_imageofs(struct SpaceSeq *sseq);
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index d2b13ac7912..99492272340 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -131,6 +131,7 @@ void ED_sequencer_update_view(bContext *C, int view)
if (ar_preview->flag & RGN_FLAG_HIDDEN) {
ar_preview->flag &= ~RGN_FLAG_HIDDEN;
ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
+ ar_preview->v2d.cur = ar_preview->v2d.tot;
}
ar_main->alignment= RGN_ALIGN_NONE;
ar_preview->alignment= RGN_ALIGN_NONE;
@@ -143,6 +144,7 @@ void ED_sequencer_update_view(bContext *C, int view)
if (ar_preview->flag & RGN_FLAG_HIDDEN) {
ar_preview->flag &= ~RGN_FLAG_HIDDEN;
ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
+ ar_preview->v2d.cur = ar_preview->v2d.tot;
}
ar_main->alignment= RGN_ALIGN_NONE;
ar_preview->alignment= RGN_ALIGN_TOP;
@@ -184,11 +186,28 @@ static SpaceLink *sequencer_new(const bContext *C)
ar->flag = RGN_FLAG_HIDDEN;
/* preview area */
+ /* NOTE: if you change values here, also change them in sequencer_init_preview_region */
ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer");
BLI_addtail(&sseq->regionbase, ar);
ar->regiontype= RGN_TYPE_PREVIEW;
ar->alignment= RGN_ALIGN_TOP;
ar->flag |= RGN_FLAG_HIDDEN;
+ /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+ ar->v2d.keepzoom= V2D_KEEPASPECT | V2D_KEEPZOOM;
+ ar->v2d.minzoom= 0.00001f;
+ ar->v2d.maxzoom= 100000.0f;
+ ar->v2d.tot.xmin= -960.0f; /* 1920 width centered */
+ ar->v2d.tot.ymin= -540.0f; /* 1080 height centered */
+ ar->v2d.tot.xmax= 960.0f;
+ ar->v2d.tot.ymax= 540.0f;
+ ar->v2d.min[0]= 0.0f;
+ ar->v2d.min[1]= 0.0f;
+ ar->v2d.max[0]= 12000.0f;
+ ar->v2d.max[1]= 12000.0f;
+ ar->v2d.cur= ar->v2d.tot;
+ ar->v2d.align= V2D_ALIGN_FREE;
+ ar->v2d.keeptot= V2D_KEEPTOT_FREE;
+
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for sequencer");
@@ -358,8 +377,8 @@ static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn)
static void sequencer_preview_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
-
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
+
+ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
keymap= WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
@@ -377,7 +396,7 @@ static void sequencer_preview_area_draw(const bContext *C, ARegion *ar)
/* XXX temp fix for wrong setting in sseq->mainb */
if (sseq->mainb == SEQ_DRAW_SEQUENCE) sseq->mainb = SEQ_DRAW_IMG_IMBUF;
- draw_image_seq(scene, ar, sseq);
+ draw_image_seq(C, scene, ar, sseq);
}
static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn)
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index b74e1f6cfb2..48e860ed88a 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -456,10 +456,11 @@ def wrap(line, view_width, wrap_chars):
int wrap_width(SpaceText *st, ARegion *ar)
{
+ int winx= ar->winx - TXT_SCROLL_WIDTH;
int x, max;
x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
- max= (ar->winx-x)/st->cwidth;
+ max= (winx-x)/st->cwidth;
return max>8 ? max : 8;
}
@@ -1209,7 +1210,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
TextLine *tmp;
rcti scroll;
char linenr[12];
- int i, x, y, linecount= 0;
+ int i, x, y, winx, linecount= 0;
/* if no text, nothing to do */
if(!text)
@@ -1252,6 +1253,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
x= TXT_OFFSET;
}
y= ar->winy-st->lheight;
+ winx= ar->winx - TXT_SCROLL_WIDTH;
/* draw cursor */
draw_cursor(st, ar);
@@ -1279,7 +1281,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
if(st->wordwrap) {
/* draw word wrapped text */
- int lines = text_draw_wrapped(st, tmp->line, x, y, ar->winx-x, tmp->format);
+ int lines = text_draw_wrapped(st, tmp->line, x, y, winx-x, tmp->format);
y -= lines*st->lheight;
}
else {
@@ -1325,6 +1327,8 @@ void text_update_cursor_moved(bContext *C)
for(ar=sa->regionbase.first; ar; ar= ar->next)
if(ar->regiontype==RGN_TYPE_WINDOW)
winx= ar->winx;
+
+ winx -= TXT_SCROLL_WIDTH;
if(!text || !text->curl) return;
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 5e3070c4718..59ca649dee8 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -58,6 +58,11 @@ void text_update_edited(struct Text *text);
void text_update_character_width(struct SpaceText *st);
void text_update_cursor_moved(struct bContext *C);
+ /* TXT_OFFSET used to be 35 when the scrollbar was on the left... */
+#define TXT_OFFSET 15
+#define TXT_SCROLL_WIDTH 20
+#define TXT_SCROLL_SPACE 2
+
#define TEXTXLOC (st->cwidth * st->linenrs_tot)
#define SUGG_LIST_SIZE 7
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 58d8e6b3363..d0a3fd3c1d9 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1882,7 +1882,8 @@ static int scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
return scroll_exec(C, op);
/* verify we are in the right zone */
- if(!(mval[0]>ar->winx-20 && mval[0]<ar->winx-2 && mval[1]>2 && mval[1]<ar->winy))
+ if(!(mval[0]>ar->winx-TXT_SCROLL_WIDTH && mval[0]<ar->winx-TXT_SCROLL_SPACE
+ && mval[1]>TXT_SCROLL_SPACE && mval[1]<ar->winy))
return OPERATOR_PASS_THROUGH;
tsc= MEM_callocN(sizeof(TextScroll), "TextScroll");
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index c33f8723231..e744252889a 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -738,7 +738,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d)
char *printable = NULL;
if (v3d->localvd) {
- printable = malloc(strlen(name) + strlen(" (Local)_")); /* '_' gives space for '\0' */
+ printable = MEM_mallocN(strlen(name) + strlen(" (Local)_"), "viewport_name"); /* '_' gives space for '\0' */
strcpy(printable, name);
strcat(printable, " (Local)");
} else {
@@ -751,7 +751,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d)
}
if (v3d->localvd) {
- free(printable);
+ MEM_freeN(printable);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index b5de24b9ae7..c44b7ec6b59 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -469,18 +469,24 @@ static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves
/* workaround: init mats first, EM_mask_init_backbuf_border can change
view matrix to pixel space, breaking edge select with backbuf. fixes bug #20936 */
- ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
+
+ /* [#21018] breaks zbuf select. run below. only if bbsel fails */
+ /* ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d) */
+
+ glLoadMatrixf(vc->rv3d->viewmat);
bbsel= EM_mask_init_backbuf_border(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
if(ts->selectmode & SCE_SELECT_VERTEX) {
if (bbsel) {
EM_backbuf_checkAndSelectVerts(vc->em, select);
} else {
+ ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, 1);
}
}
if(ts->selectmode & SCE_SELECT_EDGE) {
/* Does both bbsel and non-bbsel versions (need screen cos for both) */
+ ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
data.pass = 0;
mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, 0);
@@ -495,6 +501,7 @@ static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves
if (bbsel) {
EM_backbuf_checkAndSelectFaces(vc->em, select);
} else {
+ ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
mesh_foreachScreenFace(vc, do_lasso_select_mesh__doSelectFace, &data);
}
}
@@ -1397,13 +1404,19 @@ static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exte
/* workaround: init mats first, EM_mask_init_backbuf_border can change
view matrix to pixel space, breaking edge select with backbuf. fixes bug #20936 */
- ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
+ /*ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);*/ /* for foreach's screen/vert projection */
+
+ /* [#21018] breaks zbuf select. run below. only if bbsel fails */
+ /* ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d) */
+
+ glLoadMatrixf(vc->rv3d->viewmat);
bbsel= EM_init_backbuf_border(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
if(ts->selectmode & SCE_SELECT_VERTEX) {
if (bbsel) {
EM_backbuf_checkAndSelectVerts(vc->em, select);
} else {
+ ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, 1);
}
}
@@ -1423,6 +1436,7 @@ static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exte
if(bbsel) {
EM_backbuf_checkAndSelectFaces(vc->em, select);
} else {
+ ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
mesh_foreachScreenFace(vc, do_mesh_box_select__doSelectFace, &data);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index c5a713ea82a..27e8b850d52 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -2048,6 +2048,10 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
/*Done with correcting for the dist*/
}
+
+ /* center the mouse, probably the UI mafia are against this but without its quite annoying */
+ WM_cursor_warp(CTX_wm_window(C), fly->ar->winrct.xmin + fly->ar->winx/2, fly->ar->winrct.ymin + fly->ar->winy/2);
+
return 1;
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 15b812dc1f2..e93e9c42e10 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2369,10 +2369,10 @@ void flushTransSeq(TransInfo *t)
/* Calculate this strip and all nested strips
* children are ALWAYS transformed first
* so we dont need to do this in another loop. */
- calc_sequence(seq);
+ calc_sequence(t->scene, seq);
}
else {
- calc_sequence_disp(seq);
+ calc_sequence_disp(t->scene, seq);
}
}
seq_prev= seq;
@@ -2404,7 +2404,7 @@ void flushTransSeq(TransInfo *t)
while(seq) {
if (seq->type == SEQ_META && seq->flag & SELECT)
- calc_sequence(seq);
+ calc_sequence(t->scene, seq);
seq= seq->next;
}
}
@@ -4105,9 +4105,9 @@ static void freeSeqData(TransInfo *t)
for(seq= seqbasep->first; seq; seq= seq->next) {
/* We might want to build a list of effects that need to be updated during transform */
if(seq->type & SEQ_EFFECT) {
- if (seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(seq);
- else if (seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(seq);
- else if (seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(seq);
+ if (seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(t->scene, seq);
+ else if (seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(t->scene, seq);
+ else if (seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(t->scene, seq);
}
}
@@ -4118,7 +4118,7 @@ static void freeSeqData(TransInfo *t)
for(a=0; a<t->total; a++, td++) {
seq= ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev) && (seq->depth==0)) {
- calc_sequence_disp(seq);
+ calc_sequence_disp(t->scene, seq);
}
seq_prev= seq;
}
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 85ccef5cd7d..2de3c60f54c 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -1376,11 +1376,11 @@ static void p_polygon_kernel_center(float (*points)[2], int npoints, float *cent
if (nnewpoints*2 > size) {
size *= 2;
- free(oldpoints);
- oldpoints = malloc(sizeof(float)*2*size);
+ MEM_freeN(oldpoints);
+ oldpoints = MEM_mallocN(sizeof(float)*2*size, "oldpoints");
memcpy(oldpoints, newpoints, sizeof(float)*2*nnewpoints);
- free(newpoints);
- newpoints = malloc(sizeof(float)*2*size);
+ MEM_freeN(newpoints);
+ newpoints = MEM_mallocN(sizeof(float)*2*size, "newpoints");
}
else {
float (*sw_points)[2] = oldpoints;
diff --git a/source/blender/imbuf/intern/iff.c b/source/blender/imbuf/intern/iff.c
index 5fd823e78c1..db2e54a31b6 100644
--- a/source/blender/imbuf/intern/iff.c
+++ b/source/blender/imbuf/intern/iff.c
@@ -198,16 +198,16 @@ unsigned short imb_update_iff(int file, int code)
if (code == 0) return (TRUE);
filelen-=4;
- lseek(file,4L,1);
+ if(lseek(file,4L,1) == -1) return (FALSE);
while (filelen>0){ /* seek BODY */
- read(file, buf, 8);
+ if(read(file, buf, 8) != 8) return (FALSE);
filelen -= 8;
if (buf[0] == code) break;
skip = (BIG_LONG(buf[1]) + 1) & ~1;
filelen -= skip;
- lseek(file, skip, 1);
+ if(lseek(file, skip, 1) == -1) return (FALSE);
}
if (filelen <= 0) {
printf("update_iff: couldn't find chunk\n");
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 6053c5556f1..4e6230a0109 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -289,19 +289,19 @@ ImBuf* IMB_thumb_create(const char* dir, const char* file, ThumbSize size, Thumb
} else {
if (THB_SOURCE_IMAGE == source) {
BLI_getwdN(wdir);
- chdir(dir);
+ if(chdir(dir) != 0) return 0;
img = IMB_loadiffname(file, IB_rect | IB_imginfo);
if (img != NULL) {
stat(file, &info);
sprintf(mtime, "%ld", info.st_mtime);
sprintf(cwidth, "%d", img->x);
sprintf(cheight, "%d", img->y);
- chdir(wdir);
}
+ if(chdir(wdir) != 0) /* unlikely to happen, just silence warning */;
} else if (THB_SOURCE_MOVIE == source) {
struct anim * anim = NULL;
BLI_getwdN(wdir);
- chdir(dir);
+ if(chdir(dir) != 0) return 0;
anim = IMB_open_anim(file, IB_rect | IB_imginfo);
if (anim != NULL) {
img = IMB_anim_absolute(anim, 0);
@@ -315,7 +315,7 @@ ImBuf* IMB_thumb_create(const char* dir, const char* file, ThumbSize size, Thumb
}
stat(file, &info);
sprintf(mtime, "%ld", info.st_mtime);
- chdir(wdir);
+ if(chdir(wdir) != 0) /* unlikely to happen, just silence warning */;
}
if (!img) return 0;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 1f3ea1e0fc1..2586c4acb6c 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -763,7 +763,8 @@ typedef struct Scene {
ListBase markers;
ListBase transform_spaces;
- ListBase sound_handles;
+ void *sound_scene;
+ void *sound_scene_handle;
/* none of the dependancy graph vars is mean to be saved */
struct DagForest *theDag;
@@ -1089,7 +1090,7 @@ typedef struct Scene {
#define AUDIO_SYNC 2
#define AUDIO_SCRUB 4
-#define FFMPEG_MULTIPLEX_AUDIO 1
+#define FFMPEG_MULTIPLEX_AUDIO 1 /* deprecated, you can choose none as audiocodec now */
#define FFMPEG_AUTOSPLIT_OUTPUT 2
/* Paint.flags */
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 0b45d62e347..c93625e9c27 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -161,7 +161,9 @@ typedef struct Sequence {
ListBase seqbase; /* list of strips for metastrips */
struct bSound *sound; /* the linked "bSound" object */
- struct SoundHandle *sound_handle;
+ void *scene_sound;
+ float volume, pad;
+
float level, pan; /* level in dB (0=full), pan -1..1 */
int scenenr; /* for scene selection */
float strobe;
diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h
index 55b48e4aacd..c0b8657618d 100644
--- a/source/blender/makesdna/DNA_sound_types.h
+++ b/source/blender/makesdna/DNA_sound_types.h
@@ -41,21 +41,6 @@ struct Ipo;
struct PackedFile;
struct SpaceLink;
-// runtime only - no saving
-typedef struct SoundHandle {
- struct SoundHandle *next, *prev;
- struct bSound *source;
- void *handle;
- int state;
- int startframe;
- int endframe;
- int frameskip;
- int mute;
- int changed;
- float volume;
- float pad;
-} SoundHandle;
-
typedef struct Sound3D
{
float min_gain;
@@ -98,19 +83,21 @@ typedef struct bSound {
float max_gain;
float distance;
int flags;
+ int pad;
/** currently int type;
struct bSound *child_sound;*/
/**
- * Whether the sound has been changed and must be restarted if playing.
+ * The audaspace handle for cache.
*/
- int changed;
+ void *cache;
/**
- * The audaspace handle for cache.
+ * The audaspace handle that should actually be played back.
+ * Should be cache if cache != NULL; otherwise it's handle
*/
- void *cache;
+ void *playback_handle;
/** XXX unused currently // SOUND_TYPE_LIMITER
float start, end;*/
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index db31e4cd220..a0d7ab3bfc4 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -141,13 +141,13 @@ typedef struct SpaceSeq {
View2D v2d; /* deprecated, copied to region */
- float xof, yof; /* offset for drawing the image preview */
+ float xof, yof; /* deprecated: offset for drawing the image preview */
short mainb; /* weird name for the sequencer subtype (seq, image, luma... etc) */
short render_size;
short chanshown;
short zebra;
int flag;
- float zoom;
+ float zoom; /* deprecated, handled by View2D now */
int view; /* see SEQ_VIEW_* below */
int pad;
diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h
index 9a9daf56e8a..f37e8d01776 100644
--- a/source/blender/makesdna/DNA_text_types.h
+++ b/source/blender/makesdna/DNA_text_types.h
@@ -70,8 +70,6 @@ typedef struct Text {
double mtime;
} Text;
- /* TXT_OFFSET used to be 35 when the scrollbar was on the left... */
-#define TXT_OFFSET 15
#define TXT_TABSIZE 4
#define TXT_INIT_UNDO 1024
#define TXT_MAX_UNDO (TXT_INIT_UNDO*TXT_INIT_UNDO)
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 90ef29c45de..1baf11139c1 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -702,7 +702,9 @@ void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value);
char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen);
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value);
int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop);
-// TODO: get default strings...
+void RNA_property_string_get_default(PointerRNA *ptr, PropertyRNA *prop, char *value);
+char *RNA_property_string_get_default_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen);
+int RNA_property_string_default_length(PointerRNA *ptr, PropertyRNA *prop);
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop);
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value);
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 978ca0ba188..41be686048d 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -99,8 +99,10 @@ static int replace_if_different(char *tmpfile)
arr_new= MEM_mallocN(sizeof(char)*len_new, "rna_cmp_file_new");
arr_org= MEM_mallocN(sizeof(char)*len_org, "rna_cmp_file_org");
- fread(arr_new, sizeof(char), len_new, fp_new);
- fread(arr_org, sizeof(char), len_org, fp_org);
+ if(fread(arr_new, sizeof(char), len_new, fp_new) != len_new)
+ fprintf(stderr, "%s:%d, error reading file %s for comparison.\n", __FILE__, __LINE__, tmpfile);
+ if(fread(arr_org, sizeof(char), len_org, fp_org) != len_org)
+ fprintf(stderr, "%s:%d, error reading file %s for comparison.\n", __FILE__, __LINE__, orgfile);
fclose(fp_new);
fclose(fp_org);
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index ac354366c25..a32e12da2f6 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -246,40 +246,6 @@ ID *rna_ID_copy(ID *id)
return NULL;
}
-static int rna_IDPropertyGroup_name_length(PointerRNA *ptr)
-{
- IDProperty *group=(IDProperty*)ptr->id.data;
- IDProperty *idprop;
- idprop= IDP_GetPropertyFromGroup(group, "name");
-
- if(idprop && idprop->type == IDP_STRING)
- return strlen(idprop->data.pointer);
- else
- return 0;
-}
-
-static void rna_IDPropertyGroup_name_get(PointerRNA *ptr, char *str)
-{
- IDProperty *group=(IDProperty*)ptr->id.data;
- IDProperty *idprop;
- idprop= IDP_GetPropertyFromGroup(group, "name");
-
- if(idprop && idprop->type == IDP_STRING)
- strcpy(str, idprop->data.pointer);
- else
- str[0]= '\0';
-}
-
-void rna_IDPropertyGroup_name_set(PointerRNA *ptr, const char *value)
-{
- IDProperty *group=(IDProperty*)ptr->id.data;
- IDProperty *idprop;
- IDPropertyTemplate val = {0};
- val.str= (char *)value;
- idprop = IDP_New(IDP_STRING, val, "name");
- IDP_ReplaceInGroup(group, idprop);
-}
-
#else
static void rna_def_ID_properties(BlenderRNA *brna)
@@ -357,7 +323,6 @@ static void rna_def_ID_properties(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
//RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting.");
- RNA_def_property_string_funcs(prop, "rna_IDPropertyGroup_name_get", "rna_IDPropertyGroup_name_length", "rna_IDPropertyGroup_name_set");
RNA_def_struct_name_property(srna, prop);
}
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 9dd03ed7477..782031d12c6 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1775,6 +1775,36 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val
}
}
+void RNA_property_string_get_default(PointerRNA *ptr, PropertyRNA *prop, char *value)
+{
+ StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+ strcpy(value, sprop->defaultvalue);
+}
+
+char *RNA_property_string_get_default_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen)
+{
+ char *buf;
+ int length;
+
+ length= RNA_property_string_default_length(ptr, prop);
+
+ if(length+1 < fixedlen)
+ buf= fixedbuf;
+ else
+ buf= MEM_callocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
+
+ RNA_property_string_get_default(ptr, prop, buf);
+
+ return buf;
+}
+
+/* this is the length without \0 terminator */
+int RNA_property_string_default_length(PointerRNA *ptr, PropertyRNA *prop)
+{
+ StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+ return strlen(sprop->defaultvalue);
+}
+
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
{
EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
@@ -4316,8 +4346,15 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
return 1;
}
+ case PROP_STRING:
+ {
+ char *value= RNA_property_string_get_default_alloc(ptr, prop, NULL, 0);
+ RNA_property_string_set(ptr, prop, value);
+ MEM_freeN(value);
+ return 1;
+ }
+
//case PROP_POINTER:
- //case PROP_STRING:
default:
// FIXME: many of the other types such as strings and pointers need this implemented too!
return 0;
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index dd67f5604c0..346ecb1efa9 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -129,7 +129,6 @@ void rna_def_actuator(BlenderRNA *brna)
static void rna_def_object_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "ObjectActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Object Actuator", "Actuator to control the object movement.");
@@ -259,7 +258,6 @@ static void rna_def_camera_actuator(BlenderRNA *brna)
static void rna_def_sound_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "SoundActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Sound Actuator", "Actuator to ...");
@@ -271,7 +269,6 @@ static void rna_def_sound_actuator(BlenderRNA *brna)
static void rna_def_property_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "PropertyActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Property Actuator", "Actuator to ...");
@@ -283,7 +280,6 @@ static void rna_def_property_actuator(BlenderRNA *brna)
static void rna_def_constraint_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "ConstraintActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to ...");
@@ -295,7 +291,6 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
static void rna_def_edit_object_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "EditObjectActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator to ...");
@@ -527,7 +522,6 @@ static void rna_def_message_actuator(BlenderRNA *brna)
static void rna_def_action_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "ActionActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Action Actuator", "Actuator to ...");
@@ -696,7 +690,6 @@ static void rna_def_parent_actuator(BlenderRNA *brna)
static void rna_def_shape_action_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "ShapeActionActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Shape Action Actuator", "Actuator to ...");
@@ -708,7 +701,6 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna)
static void rna_def_state_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "StateActuator", "Actuator");
RNA_def_struct_ui_text(srna, "State Actuator", "Actuator to ...");
@@ -720,7 +712,6 @@ static void rna_def_state_actuator(BlenderRNA *brna)
static void rna_def_armature_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "ArmatureActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Armature Actuator", "Actuator to ...");
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index a9ef608cd6c..3ada3689d6c 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -232,7 +232,6 @@ static void rna_def_curvemapping(BlenderRNA *brna)
static void rna_def_histogram(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "Histogram", NULL);
RNA_def_struct_ui_text(srna, "Histogram", "Statistical view of the levels of color in an image");
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index c0ebc2abdf9..c1d274f6cca 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -307,12 +307,12 @@ static void rna_def_lamp_sky_settings(BlenderRNA *brna)
/* boolean */
- prop= RNA_def_property(srna, "sky", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", LA_SUN_EFFECT_SKY);
RNA_def_property_ui_text(prop, "Sky", "Apply sun effect on sky.");
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
- prop= RNA_def_property(srna, "atmosphere", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_atmosphere", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", LA_SUN_EFFECT_AP);
RNA_def_property_ui_text(prop, "Atmosphere", "Apply sun effect on atmosphere.");
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index ea750e94fba..b8c0c29c4ba 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -1599,7 +1599,7 @@ void RNA_def_material(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Z Offset", "Gives faces an artificial offset in the Z buffer for Z transparency.");
RNA_def_property_update(prop, 0, "rna_Material_update");
- prop= RNA_def_property(srna, "sky", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ENV);
RNA_def_property_ui_text(prop, "Sky", "Renders this material with zero alpha, with sky background in place (scanline only).");
RNA_def_property_update(prop, 0, "rna_Material_update");
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 352931294ae..94d18c48703 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -107,6 +107,7 @@ EnumPropertyItem snap_element_items[] = {
#include "BKE_depsgraph.h"
#include "BKE_image.h"
#include "BKE_mesh.h"
+#include "BKE_sound.h"
#include "BLI_threads.h"
#include "BLI_editVert.h"
@@ -287,10 +288,11 @@ static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
data->r.pefra= value;
}
-static void rna_Scene_frame_update(Main *bmain, Scene *unused, PointerRNA *ptr)
+static void rna_Scene_frame_update(bContext *C, PointerRNA *ptr)
{
//Scene *scene= ptr->id.data;
//ED_update_for_newframe(C);
+ sound_seek_scene(C);
}
static int rna_Scene_active_keying_set_editable(PointerRNA *ptr)
@@ -354,8 +356,17 @@ static int rna_SceneRenderData_threads_get(PointerRNA *ptr)
static int rna_SceneRenderData_save_buffers_get(PointerRNA *ptr)
{
RenderData *rd= (RenderData*)ptr->data;
+ if(rd->mode & R_BORDER)
+ return 0;
+ else
+ return (rd->scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) != 0;
+}
+
+static int rna_SceneRenderData_full_sample_get(PointerRNA *ptr)
+{
+ RenderData *rd= (RenderData*)ptr->data;
- return (rd->scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) != 0;
+ return (rd->scemode & R_FULL_SAMPLE) && !(rd->mode & R_BORDER);
}
static void rna_SceneRenderData_file_format_set(PointerRNA *ptr, int value)
@@ -1739,12 +1750,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
#ifdef WITH_FFMPEG
{R_H264, "H264", ICON_FILE_MOVIE, "H.264", ""},
{R_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", ""},
- // XXX broken
-#if 0
-#ifdef WITH_OGG
{R_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", ""},
-#endif
-#endif
{R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "FFMpeg", ""},
#endif
{R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", ""},
@@ -1795,16 +1801,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
{FFMPEG_DV, "DV", 0, "DV", ""},
{FFMPEG_H264, "H264", 0, "H.264", ""},
{FFMPEG_XVID, "XVID", 0, "Xvid", ""},
- // XXX broken
-#if 0
-#ifdef WITH_OGG
{FFMPEG_OGG, "OGG", 0, "Ogg", ""},
-#endif
-#endif
+ {FFMPEG_MKV, "MKV", 0, "Matroska", ""},
{FFMPEG_FLV, "FLASH", 0, "Flash", ""},
+ {FFMPEG_WAV, "WAV", 0, "Wav", ""},
+ {FFMPEG_MP3, "MP3", 0, "Mp3", ""},
{0, NULL, 0, NULL, NULL}};
-
+
static EnumPropertyItem ffmpeg_codec_items[] = {
+ {CODEC_ID_NONE, "NONE", 0, "None", ""},
{CODEC_ID_MPEG1VIDEO, "MPEG1", 0, "MPEG-1", ""},
{CODEC_ID_MPEG2VIDEO, "MPEG2", 0, "MPEG-2", ""},
{CODEC_ID_MPEG4, "MPEG4", 0, "MPEG-4(divx)", ""},
@@ -1812,18 +1817,19 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
{CODEC_ID_DVVIDEO, "DV", 0, "DV", ""},
{CODEC_ID_H264, "H264", 0, "H.264", ""},
{CODEC_ID_XVID, "XVID", 0, "Xvid", ""},
-#ifdef WITH_OGG
{CODEC_ID_THEORA, "THEORA", 0, "Theora", ""},
-#endif
{CODEC_ID_FLV1, "FLASH", 0, "Flash Video", ""},
+ {CODEC_ID_FFV1, "FFV1", 0, "FFmpeg video codec #1", ""},
{0, NULL, 0, NULL, NULL}};
-
+
static EnumPropertyItem ffmpeg_audio_codec_items[] = {
+ {CODEC_ID_NONE, "NONE", 0, "None", ""},
{CODEC_ID_MP2, "MP2", 0, "MP2", ""},
{CODEC_ID_MP3, "MP3", 0, "MP3", ""},
{CODEC_ID_AC3, "AC3", 0, "AC3", ""},
{CODEC_ID_AAC, "AAC", 0, "AAC", ""},
{CODEC_ID_VORBIS, "VORBIS", 0, "Vorbis", ""},
+ {CODEC_ID_FLAC, "FLAC", 0, "FLAC", ""},
{CODEC_ID_PCM_S16LE, "PCM", 0, "PCM", ""},
{0, NULL, 0, NULL, NULL}};
#endif
@@ -2056,7 +2062,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
/* FFMPEG Audio*/
-
prop= RNA_def_property(srna, "ffmpeg_audio_codec", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "ffcodecdata.audio_codec");
RNA_def_property_enum_items(prop, ffmpeg_audio_codec_items);
@@ -2069,11 +2074,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate(kb/s)");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "ffmpeg_multiplex_audio", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ffcodecdata.flags", FFMPEG_MULTIPLEX_AUDIO);
- RNA_def_property_ui_text(prop, "Multiplex Audio", "Interleave audio with the output video");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
prop= RNA_def_property(srna, "ffmpeg_audio_mixrate", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.audio_mixrate");
RNA_def_property_range(prop, 8000, 192000);
@@ -2253,7 +2253,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER);
- RNA_def_property_ui_text(prop, "Border", "Render a user-defined border region, within the frame size.");
+ RNA_def_property_ui_text(prop, "Border", "Render a user-defined border region, within the frame size. Note, this disables save_buffers and full_sample.");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop= RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE);
@@ -2346,6 +2346,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop= RNA_def_property(srna, "full_sample", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FULL_SAMPLE);
+ RNA_def_property_boolean_funcs(prop, "rna_SceneRenderData_full_sample_get", NULL);
RNA_def_property_ui_text(prop, "Full Sample","Save for every anti-aliasing sample the entire RenderLayer results. This solves anti-aliasing issues with compositing.");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
@@ -2704,6 +2705,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "r.cfra");
RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
RNA_def_property_ui_text(prop, "Current Frame", "");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_frame_update");
prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_TIME);
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 7ffaa4d478b..5927ca7a1be 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -93,7 +93,7 @@ static void rna_Sequence_frame_change_update(Scene *scene, Sequence *seq)
{
Editing *ed= seq_give_editing(scene, FALSE);
ListBase *seqbase= seq_seqbase(&ed->seqbase, seq);
- calc_sequence_disp(seq);
+ calc_sequence_disp(scene, seq);
if(seq_test_overlap(seqbase, seq)) {
shuffle_seq(seqbase, seq, scene); // XXX - BROKEN!, uses context seqbasep
@@ -351,14 +351,14 @@ static void rna_Sequence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
free_imbuf_seq(scene, &ed->seqbase, FALSE);
if(RNA_struct_is_a(ptr->type, &RNA_SoundSequence))
- seq_update_sound(ptr->data);
+ seq_update_sound(scene, ptr->data);
}
static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Editing *ed= seq_give_editing(scene, FALSE);
- seq_update_muting(ed);
+ seq_update_muting(scene, ed);
rna_Sequence_update(bmain, scene, ptr);
}
@@ -606,24 +606,28 @@ static void rna_def_sequence(BlenderRNA *brna)
prop= RNA_def_property(srna, "length", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "len");
RNA_def_property_range(prop, 1, MAXFRAME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip before the handles are applied");
RNA_def_property_int_funcs(prop, "rna_Sequence_length_get", "rna_Sequence_length_set",NULL);
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "start");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Start Frame", "");
RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_set",NULL); // overlap tests and calc_seq_disp
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "start_frame_final", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "startdisp");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Start Frame", "Start frame displayed in the sequence editor after offsets are applied, setting this is equivilent to moving the handle, not the actual start frame.");
RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_final_set", NULL); // overlap tests and calc_seq_disp
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "end_frame_final", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "enddisp");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "End Frame", "End frame displayed in the sequence editor after offsets are applied.");
RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_end_frame_final_set", NULL); // overlap tests and calc_seq_disp
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
@@ -949,6 +953,12 @@ static void rna_def_sound(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this sequence.");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
+ prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "volume");
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound");
+ RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
+
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "strip->stripdata->name");
RNA_def_property_ui_text(prop, "Filename", "");
@@ -961,14 +971,6 @@ static void rna_def_sound(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
rna_def_input(srna);
-
- RNA_def_struct_sdna_from(srna, "SoundHandle", "sound_handle");
-
- prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "volume");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound");
- RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
}
static void rna_def_effect(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 695eb76cb53..c5738b58614 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -522,10 +522,14 @@ static void rna_def_ui_layout(BlenderRNA *brna)
static EnumPropertyItem operator_context_items[] = {
{WM_OP_INVOKE_DEFAULT, "INVOKE_DEFAULT", 0, "Invoke Default", ""},
{WM_OP_INVOKE_REGION_WIN, "INVOKE_REGION_WIN", 0, "Invoke Region Window", ""},
+ {WM_OP_INVOKE_REGION_CHANNELS, "INVOKE_REGION_CHANNELS", 0, "Invoke Region Channels", ""},
+ {WM_OP_INVOKE_REGION_PREVIEW, "INVOKE_REGION_PREVIEW", 0, "Invoke Region Preview", ""},
{WM_OP_INVOKE_AREA, "INVOKE_AREA", 0, "Invoke Area", ""},
{WM_OP_INVOKE_SCREEN, "INVOKE_SCREEN", 0, "Invoke Screen", ""},
{WM_OP_EXEC_DEFAULT, "EXEC_DEFAULT", 0, "Exec Default", ""},
{WM_OP_EXEC_REGION_WIN, "EXEC_REGION_WIN", 0, "Exec Region Window", ""},
+ {WM_OP_EXEC_REGION_CHANNELS, "EXEC_REGION_CHANNELS", 0, "Exec Region Channels", ""},
+ {WM_OP_EXEC_REGION_PREVIEW, "EXEC_REGION_PREVIEW", 0, "Exec Region Preview", ""},
{WM_OP_EXEC_AREA, "EXEC_AREA", 0, "Exec Area", ""},
{WM_OP_EXEC_SCREEN, "EXEC_SCREEN", 0, "Exec Screen", ""},
{0, NULL, 0, NULL, NULL}};
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_output.c b/source/blender/nodes/intern/TEX_nodes/TEX_output.c
index ab8920e67ad..62b2c3ed757 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_output.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_output.c
@@ -144,7 +144,7 @@ static void unique_name(bNode *node)
new_len = 31;
}
- new_name = malloc(new_len + 1);
+ new_name = MEM_mallocN(new_len + 1, "new_name");
strcpy(new_name, name);
name = new_name;
}
@@ -153,7 +153,7 @@ static void unique_name(bNode *node)
if(new_name) {
strcpy(tno->name, new_name);
- free(new_name);
+ MEM_freeN(new_name);
}
}
diff --git a/source/blender/nodes/intern/TEX_util.c b/source/blender/nodes/intern/TEX_util.c
index 8b247688e8c..97426b7d782 100644
--- a/source/blender/nodes/intern/TEX_util.c
+++ b/source/blender/nodes/intern/TEX_util.c
@@ -189,44 +189,3 @@ void ntreeTexExecTree(
ntreeExecTree(nodes, &data, thread);
}
-char* ntreeTexOutputMenu(bNodeTree *ntree)
-{
- bNode *node;
- int len = 1;
- char *str;
- char ctrl[4];
- int index = 0;
-
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->type == TEX_NODE_OUTPUT) {
- len += strlen(
- ((TexNodeOutput*)node->storage)->name
- ) + strlen(" %xNNN|");
- index ++;
-
- if(node->custom1 > 999) {
- printf("Error: too many outputs");
- break;
- }
- }
-
- str = malloc(len * sizeof(char));
- *str = 0;
-
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->type == TEX_NODE_OUTPUT) {
- strcat(str, ((TexNodeOutput*)node->storage)->name);
- strcat(str, " %x");
-
- sprintf(ctrl, "%d", node->custom1);
- strcat(str, ctrl);
-
- if(--index)
- strcat(str, "|");
- else
- break;
- }
-
- return str;
-}
-
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 8437f4d376e..c02ddf34aab 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -455,11 +455,11 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc
fclose(fp);
- pystring= malloc(strlen(fn) + 32);
+ pystring= MEM_mallocN(strlen(fn) + 32, "pystring");
pystring[0]= '\0';
sprintf(pystring, "exec(open(r'%s').read())", fn);
py_result = PyRun_String( pystring, Py_file_input, py_dict, py_dict );
- free(pystring);
+ MEM_freeN(pystring);
#else
py_result = PyRun_File(fp, fn, Py_file_input, py_dict, py_dict);
fclose(fp);
diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h
index 95bccd2be1e..d6a18cf2cd8 100644
--- a/source/blender/render/intern/include/shading.h
+++ b/source/blender/render/intern/include/shading.h
@@ -86,8 +86,8 @@ void shade_lamp_loop(struct ShadeInput *shi, struct ShadeResult *shr);
void shade_color(struct ShadeInput *shi, ShadeResult *shr);
-void ambient_occlusion_to_diffuse(struct ShadeInput *shi, float *diff);
void ambient_occlusion(struct ShadeInput *shi);
+void environment_lighting_apply(struct ShadeInput *shi, struct ShadeResult *shr);
ListBase *get_lights(struct ShadeInput *shi);
float lamp_get_visibility(struct LampRen *lar, float *co, float *lv, float *dist);
diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp
index 869405e0fbc..ac386e776b4 100644
--- a/source/blender/render/intern/raytrace/rayobject.cpp
+++ b/source/blender/render/intern/raytrace/rayobject.cpp
@@ -180,7 +180,7 @@ static inline int rayface_check_cullface(RayFace *face, Isect *is)
/* this function shall only modify Isect if it detects an hit */
static int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *is)
{
- float co1[3],co2[3],co3[3],co4[3];
+ float co1[3],co2[3],co3[3],co4[3]={0};
float x0,x1,x2,t00,t01,t02,t10,t11,t12,t20,t21,t22,r0,r1,r2;
float m0, m1, m2, divdet, det1;
float labda, u, v;
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 5279d971d49..266c4505f25 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1231,6 +1231,13 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
#ifdef WITH_OPENEXR
if(re->r.scemode & R_FULL_SAMPLE)
re->r.scemode |= R_EXR_TILE_FILE; /* enable automatic */
+
+ /* Until use_border is made compatible with save_buffers/full_sample, render without the later instead of not rendering at all.*/
+ if(re->r.mode & R_BORDER)
+ {
+ re->r.scemode &= ~(R_EXR_TILE_FILE|R_FULL_SAMPLE);
+ }
+
#else
/* can't do this without openexr support */
re->r.scemode &= ~(R_EXR_TILE_FILE|R_FULL_SAMPLE);
@@ -2616,10 +2623,6 @@ static int is_rendering_allowed(Render *re)
re->error(re->erh, "No border area selected.");
return 0;
}
- if(re->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) {
- re->error(re->erh, "Border render and Buffer-save not supported yet");
- return 0;
- }
}
if(re->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) {
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index dec826faa65..958ed0c2fa5 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -2135,7 +2135,13 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int quad, int
if(bs->type==RE_BAKE_AO) {
ambient_occlusion(shi);
- VECCOPY(shr.combined, shi->ao)
+ if(R.r.bake_flag & R_BAKE_NORMALIZE) {
+ copy_v3_v3(shr.combined, shi->ao);
+ }
+ else {
+ zero_v3(shr.combined);
+ environment_lighting_apply(shi, &shr);
+ }
}
else {
if (bs->type==RE_BAKE_SHADOW) /* Why do shadows set the color anyhow?, ignore material color for baking */
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index eeb353eb66f..85b06837c92 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -1050,7 +1050,7 @@ static void ambient_occlusion_apply(ShadeInput *shi, ShadeResult *shr)
}
}
-static void environment_lighting_apply(ShadeInput *shi, ShadeResult *shr)
+void environment_lighting_apply(ShadeInput *shi, ShadeResult *shr)
{
float f= R.wrld.ao_env_energy*shi->amb;
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 1a220f6e9b1..f6da090f95b 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -57,29 +57,40 @@
#include "texture.h"
#include "voxeldata.h"
-void load_frame_blendervoxel(FILE *fp, float *F, int size, int frame, int offset)
+static int load_frame_blendervoxel(FILE *fp, float *F, int size, int frame, int offset)
{
- fseek(fp,frame*size*sizeof(float)+offset,0);
- fread(F,sizeof(float),size,fp);
+ if(fseek(fp,frame*size*sizeof(float)+offset,0) == -1)
+ return 0;
+ if(fread(F,sizeof(float),size,fp) != size)
+ return 0;
+
+ return 1;
}
-void load_frame_raw8(FILE *fp, float *F, int size, int frame)
+static int load_frame_raw8(FILE *fp, float *F, int size, int frame)
{
char *tmp;
int i;
tmp = (char *)MEM_mallocN(sizeof(char)*size, "temporary voxel file reading storage");
- fseek(fp,(frame-1)*size*sizeof(char),0);
- fread(tmp, sizeof(char), size, fp);
+ if(fseek(fp,(frame-1)*size*sizeof(char),0) == -1) {
+ MEM_freeN(tmp);
+ return 0;
+ }
+ if(fread(tmp, sizeof(char), size, fp) != size) {
+ MEM_freeN(tmp);
+ return 0;
+ }
for (i=0; i<size; i++) {
F[i] = (float)tmp[i] / 256.f;
}
MEM_freeN(tmp);
+ return 1;
}
-void load_frame_image_sequence(Render *re, VoxelData *vd, Tex *tex)
+static void load_frame_image_sequence(Render *re, VoxelData *vd, Tex *tex)
{
ImBuf *ibuf;
Image *ima = tex->ima;
@@ -133,26 +144,25 @@ void load_frame_image_sequence(Render *re, VoxelData *vd, Tex *tex)
}
}
-void write_voxeldata_header(struct VoxelDataHeader *h, FILE *fp)
-{
- fwrite(h,sizeof(struct VoxelDataHeader),1,fp);
-}
-
-void read_voxeldata_header(FILE *fp, struct VoxelData *vd)
+static int read_voxeldata_header(FILE *fp, struct VoxelData *vd)
{
VoxelDataHeader *h=(VoxelDataHeader *)MEM_mallocN(sizeof(VoxelDataHeader), "voxel data header");
rewind(fp);
- fread(h,sizeof(VoxelDataHeader),1,fp);
+ if(fread(h,sizeof(VoxelDataHeader),1,fp) != 1) {
+ MEM_freeN(h);
+ return 0;
+ }
vd->resol[0]=h->resolX;
vd->resol[1]=h->resolY;
vd->resol[2]=h->resolZ;
MEM_freeN(h);
+ return 1;
}
-void init_frame_smoke(Render *re, VoxelData *vd, Tex *tex)
+static void init_frame_smoke(Render *re, VoxelData *vd, Tex *tex)
{
Object *ob;
ModifierData *md;
@@ -224,7 +234,7 @@ void init_frame_smoke(Render *re, VoxelData *vd, Tex *tex)
}
}
-void cache_voxeldata(struct Render *re,Tex *tex)
+static void cache_voxeldata(struct Render *re,Tex *tex)
{
VoxelData *vd = tex->vd;
FILE *fp;
@@ -246,8 +256,12 @@ void cache_voxeldata(struct Render *re,Tex *tex)
fp = fopen(vd->source_path,"rb");
if (!fp) return;
- if (vd->file_format == TEX_VD_BLENDERVOXEL)
- read_voxeldata_header(fp, vd);
+ if (vd->file_format == TEX_VD_BLENDERVOXEL) {
+ if(!read_voxeldata_header(fp, vd)) {
+ fclose(fp);
+ return;
+ }
+ }
size = (vd->resol[0])*(vd->resol[1])*(vd->resol[2]);
vd->dataset = MEM_mapallocN(sizeof(float)*size, "voxel dataset");
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 3efa2b85174..7a08320cc19 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -58,11 +58,15 @@ enum {
/* if there's invoke, call it, otherwise exec */
WM_OP_INVOKE_DEFAULT,
WM_OP_INVOKE_REGION_WIN,
+ WM_OP_INVOKE_REGION_CHANNELS,
+ WM_OP_INVOKE_REGION_PREVIEW,
WM_OP_INVOKE_AREA,
WM_OP_INVOKE_SCREEN,
/* only call exec */
WM_OP_EXEC_DEFAULT,
WM_OP_EXEC_REGION_WIN,
+ WM_OP_EXEC_REGION_CHANNELS,
+ WM_OP_EXEC_REGION_PREVIEW,
WM_OP_EXEC_AREA,
WM_OP_EXEC_SCREEN
};
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 7e7dfe7a968..685e671c31a 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -48,6 +48,7 @@
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "BKE_utildefines.h"
#include "ED_fileselect.h"
@@ -656,17 +657,37 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, int contex
case WM_OP_EXEC_REGION_WIN:
case WM_OP_INVOKE_REGION_WIN:
+ case WM_OP_EXEC_REGION_CHANNELS:
+ case WM_OP_INVOKE_REGION_CHANNELS:
+ case WM_OP_EXEC_REGION_PREVIEW:
+ case WM_OP_INVOKE_REGION_PREVIEW:
{
- /* forces operator to go to the region window, for header menus
- but we stay in the same region if we are already in one */
+ /* forces operator to go to the region window/channels/preview, for header menus
+ * but we stay in the same region if we are already in one
+ */
ARegion *ar= CTX_wm_region(C);
ScrArea *area= CTX_wm_area(C);
+ int type = RGN_TYPE_WINDOW;
- if(!(ar && ar->regiontype == RGN_TYPE_WINDOW) && area) {
- ARegion *ar1= area->regionbase.first;
- for(; ar1; ar1= ar1->next)
- if(ar1->regiontype==RGN_TYPE_WINDOW)
- break;
+ switch (context) {
+ case WM_OP_EXEC_REGION_CHANNELS:
+ case WM_OP_INVOKE_REGION_CHANNELS:
+ type = RGN_TYPE_CHANNELS;
+
+ case WM_OP_EXEC_REGION_PREVIEW:
+ case WM_OP_INVOKE_REGION_PREVIEW:
+ type = RGN_TYPE_PREVIEW;
+ break;
+
+ case WM_OP_EXEC_REGION_WIN:
+ case WM_OP_INVOKE_REGION_WIN:
+ default:
+ type = RGN_TYPE_WINDOW;
+ break;
+ }
+
+ if(!(ar && ar->regiontype == type) && area) {
+ ARegion *ar1= BKE_area_find_region_type(area, type);
if(ar1)
CTX_wm_region_set(C, ar1);
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 9b0f6823522..e0d4cf13efd 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -43,6 +43,7 @@
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_main.h"
+#include "BKE_screen.h"
#include "BKE_utildefines.h"
#include "RNA_access.h"
@@ -475,16 +476,27 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C, const char *op
if(found==NULL) {
if(ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
if(sa) {
- if(!(ar && ar->regiontype == RGN_TYPE_WINDOW)) {
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_WINDOW)
- break;
- }
-
+ if (!(ar && ar->regiontype == RGN_TYPE_WINDOW))
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+
if(ar)
found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r);
}
}
+ else if(ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) {
+ if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS))
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
+
+ if(ar)
+ found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r);
+ }
+ else if(ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) {
+ if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW))
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
+
+ if(ar)
+ found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r);
+ }
else {
if(ar)
found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r);