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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-12-29 17:15:37 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-01-01 20:32:48 +0400
commitfe00175c35a301a68518c583a4fab163ac8f32a0 (patch)
tree284c8b5a7131571c5b62dde861c0baa968fa41cc /source/blender/blenkernel/intern/fcurve.c
parent5d701c6d25a1c5cea65b15cbcc88b4c745164cc2 (diff)
Fix crash happening in Cycles fcurve modifier
Summary: Crash was happening because of fcurve modifier stack used modifier's DNA to store temporary data. Now made it so storage for such a thing is being allocated locally per object update so multiple objects which shares the same animation wouldn't run into threading conflict anymore. This storage might be a part of EvaluationContext, but that'd mean passing this context all over in object_where_is which will clutter API for now without actual benefit for this. Optimization notes: storage is only being allocated if there're Cycles modifier in the stack, so there're no extra allocations happening in all other cases. To make code a bit less cluttered with this storage passing all over the place added extra callbacks to the FModifier storage which runs evaluation with the given storage. Reviewers: brecht, campbellbarton, aligorith CC: plasmasolutions Differential Revision: https://developer.blender.org/D147
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r--source/blender/blenkernel/intern/fcurve.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 32098c67ca7..04765a74b77 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2138,6 +2138,7 @@ static float fcurve_eval_samples(FCurve *fcu, FPoint *fpts, float evaltime)
*/
float evaluate_fcurve(FCurve *fcu, float evaltime)
{
+ FModifierStackStorage *storage;
float cvalue = 0.0f;
float devaltime;
@@ -2177,9 +2178,10 @@ float evaluate_fcurve(FCurve *fcu, float evaltime)
}
}
}
-
+
/* evaluate modifiers which modify time to evaluate the base curve at */
- devaltime = evaluate_time_fmodifiers(&fcu->modifiers, fcu, cvalue, evaltime);
+ storage = evaluate_fmodifiers_storage_new(&fcu->modifiers);
+ devaltime = evaluate_time_fmodifiers(storage, &fcu->modifiers, fcu, cvalue, evaltime);
/* evaluate curve-data
* - 'devaltime' instead of 'evaltime', as this is the time that the last time-modifying
@@ -2191,8 +2193,10 @@ float evaluate_fcurve(FCurve *fcu, float evaltime)
cvalue = fcurve_eval_samples(fcu, fcu->fpt, devaltime);
/* evaluate modifiers */
- evaluate_value_fmodifiers(&fcu->modifiers, fcu, &cvalue, evaltime);
-
+ evaluate_value_fmodifiers(storage, &fcu->modifiers, fcu, &cvalue, evaltime);
+
+ evaluate_fmodifiers_storage_free(storage);
+
/* if curve can only have integral values, perform truncation (i.e. drop the decimal part)
* here so that the curve can be sampled correctly
*/