diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_sequence.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_sound.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 21 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequence.c | 47 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 10 |
10 files changed, 85 insertions, 28 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 6fe6a683130..dd5f391cc5c 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -280,7 +280,7 @@ void modifier_copyData(struct ModifierData *md, struct ModifierData *ta int modifier_dependsOnTime(struct ModifierData *md); int modifier_supportsMapping(struct ModifierData *md); int modifier_couldBeCage(struct ModifierData *md); -int modifier_isDeformer(struct ModifierData *md); +int modifier_isCorrectableDeformed(struct ModifierData *md); int modifier_sameTopology(ModifierData *md); int modifier_isEnabled(struct ModifierData *md, int required_mode); void modifier_setError(struct ModifierData *md, char *format, ...); @@ -303,7 +303,7 @@ int modifiers_isParticleEnabled(struct Object *ob); struct Object *modifiers_isDeformedByArmature(struct Object *ob); struct Object *modifiers_isDeformedByLattice(struct Object *ob); int modifiers_usesArmature(struct Object *ob, struct bArmature *arm); -int modifiers_isDeformed(struct Scene *scene, struct Object *ob); +int modifiers_isCorrectableDeformed(struct Scene *scene, struct Object *ob); void modifier_freeTemporaryData(struct ModifierData *md); int modifiers_indexInObject(struct Object *ob, struct ModifierData *md); diff --git a/source/blender/blenkernel/BKE_sequence.h b/source/blender/blenkernel/BKE_sequence.h index 2f7526d524c..acc0d8576a1 100644 --- a/source/blender/blenkernel/BKE_sequence.h +++ b/source/blender/blenkernel/BKE_sequence.h @@ -186,6 +186,7 @@ int shuffle_seq_time(ListBase * seqbasep); 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 clear_scene_in_allseqs(struct Scene *sce); diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index cbce4663d6f..64ce1983e7d 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -41,6 +41,8 @@ void sound_init(); void sound_exit(); +void sound_disable(); + struct bSound* sound_new_file(struct Main *main, char* filename); // XXX unused currently diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index c2921a17bef..a614404dc5e 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2513,7 +2513,7 @@ int editmesh_get_first_deform_matrices(Object *ob, EditMesh *em, float (**deform } for(; md && i <= cageIndex; md = md->next, i++) - if(editmesh_modifier_is_enabled(md, dm) && modifier_isDeformer(md)) + if(editmesh_modifier_is_enabled(md, dm) && modifier_isCorrectableDeformed(md)) numleft++; if(dm) diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 0623a5cbe5e..04fcd43b883 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -758,7 +758,12 @@ void fcurve_free_driver(FCurve *fcu) dtarn= dtar->next; driver_free_target(driver, dtar); } - + +#ifndef DISABLE_PYTHON + if(driver->expr_comp) + BPY_DECREF(driver->expr_comp); +#endif + /* free driver itself, then set F-Curve's point to this to NULL (as the curve may still be used) */ MEM_freeN(driver); fcu->driver= NULL; @@ -910,6 +915,7 @@ static float evaluate_driver (ChannelDriver *driver, float evaltime) // TODO: the flags for individual targets need to be used too for more fine-grained support... switch (driver->type) { case DRIVER_TYPE_AVERAGE: /* average values of driver targets */ + case DRIVER_TYPE_SUM: /* sum values of driver targets */ { /* check how many targets there are first (i.e. just one?) */ if (driver->targets.first == driver->targets.last) { @@ -921,19 +927,22 @@ static float evaluate_driver (ChannelDriver *driver, float evaltime) /* more than one target, so average the values of the targets */ int tot = 0; float value = 0.0f; - + /* loop through targets, adding (hopefully we don't get any overflow!) */ for (dtar= driver->targets.first; dtar; dtar=dtar->next) { - value += driver_get_target_value(driver, dtar); + value += driver_get_target_value(driver, dtar); tot++; } - + /* return the average of these */ - return (value / (float)tot); + if(driver->type == DRIVER_TYPE_AVERAGE) + return (value / (float)tot); + else + return value; + } } break; - case DRIVER_TYPE_PYTHON: /* expression */ { #ifndef DISABLE_PYTHON diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 3ab02a576d0..f35a0a96bb4 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -217,8 +217,8 @@ static int rem_from_group_internal(Group *group, Object *ob) int rem_from_group(Group *group, Object *object, Scene *scene, Base *base) { if(rem_from_group_internal(group, object)) { - - if(find_group(object, NULL) == NULL) { + /* object can be NULL */ + if(object && find_group(object, NULL) == NULL) { if(scene && base==NULL) base= object_in_scene(object, scene); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 4a3e0ded525..9390c7d67c4 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -9156,15 +9156,15 @@ Object *modifiers_isDeformedByArmature(Object *ob) } /* Takes an object and returns its first selected lattice, else just its -* armature -* This should work for multiple armatures per object +* lattice +* This should work for multiple lattics per object */ Object *modifiers_isDeformedByLattice(Object *ob) { ModifierData *md = modifiers_getVirtualModifierList(ob); LatticeModifierData *lmd= NULL; - /* return the first selected armature, this lets us use multiple armatures + /* return the first selected lattice, this lets us use multiple lattices */ for (; md; md=md->next) { if (md->type==eModifierType_Lattice) { @@ -9197,28 +9197,24 @@ int modifiers_usesArmature(Object *ob, bArmature *arm) return 0; } -int modifier_isDeformer(ModifierData *md) +int modifier_isCorrectableDeformed(ModifierData *md) { if (md->type==eModifierType_Armature) return 1; - if (md->type==eModifierType_Curve) - return 1; - if (md->type==eModifierType_Lattice) - return 1; if (md->type==eModifierType_ShapeKey) return 1; return 0; } -int modifiers_isDeformed(Scene *scene, Object *ob) +int modifiers_isCorrectableDeformed(Scene *scene, Object *ob) { ModifierData *md = modifiers_getVirtualModifierList(ob); for (; md; md=md->next) { if(ob->mode==OB_MODE_EDIT && (md->mode & eModifierMode_Editmode)==0); else - if(modifier_isDeformer(md)) + if(modifier_isCorrectableDeformed(md)) return 1; } return 0; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index eb7335307ad..47830453c2e 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -733,12 +733,12 @@ float dof_camera(Object *ob) if (cam->dof_ob) { /* too simple, better to return the distance on the view axis only * return len_v3v3(ob->obmat[3], cam->dof_ob->obmat[3]); */ - float mat[4][4], obmat[4][4]; + float mat[4][4], imat[4][4], obmat[4][4]; copy_m4_m4(obmat, ob->obmat); normalize_m4(obmat); - invert_m4_m4(ob->imat, obmat); - mul_m4_m4m4(mat, cam->dof_ob->obmat, ob->imat); + invert_m4_m4(imat, obmat); + mul_m4_m4m4(mat, cam->dof_ob->obmat, imat); return (float)fabs(mat[3][2]); } return cam->YF_dofdist; diff --git a/source/blender/blenkernel/intern/sequence.c b/source/blender/blenkernel/intern/sequence.c index 39b911d1c37..f11aca32da7 100644 --- a/source/blender/blenkernel/intern/sequence.c +++ b/source/blender/blenkernel/intern/sequence.c @@ -3477,16 +3477,55 @@ int shuffle_seq_time(ListBase * seqbasep) return offset? 0:1; } - -void seq_update_sound(struct Sequence *seq) +void seq_update_sound(Sequence *seq) { - if(seq->type == SEQ_SOUND) + if(seq->type == SEQ_SOUND && seq->sound_handle) { seq->sound_handle->startframe = seq->startdisp; seq->sound_handle->endframe = seq->enddisp; seq->sound_handle->frameskip = seq->startofs + seq->anim_startofs; - seq->sound_handle->mute = seq->flag & SEQ_MUTE ? 1 : 0; seq->sound_handle->changed = -1; + /* mute is set in seq_update_muting_recursive */ + } +} + +static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, int mute) +{ + Sequence *seq; + int seqmute; + + /* for sound we go over full meta tree to update muted state, + since sound is played outside of evaluating the imbufs, */ + for(seq=seqbasep->first; seq; seq=seq->next) { + seqmute= (mute || (seq->flag & SEQ_MUTE)); + + if(seq->type == SEQ_META) { + /* if this is the current meta sequence, unmute because + all sequences above this were set to mute */ + if(seq == metaseq) + seqmute= 0; + + seq_update_muting_recursive(&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; + } + } + } +} + +void seq_update_muting(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); + else + seq_update_muting_recursive(&ed->seqbase, NULL, 0); } } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index d8950c7dace..74c6afdc018 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -31,6 +31,13 @@ #include <config.h> #endif +static int sound_disabled = 0; + +void sound_disable() +{ + sound_disabled = 1; +} + void sound_init() { AUD_Specs specs; @@ -42,6 +49,9 @@ void sound_init() specs.format = U.audioformat; specs.rate = U.audiorate; + if (sound_disabled) + device = 0; + if(buffersize < 128) buffersize = AUD_DEFAULT_BUFFER_SIZE; |