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:
authorLukas Tönne <lukas.toenne@gmail.com>2015-05-27 16:22:57 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-05-27 16:22:57 +0300
commit96e878b6cc717d44b1b27ea56a83589acb321c0e (patch)
tree09fa0684045c67d73266211035f11cf593199524 /source/blender/blenkernel/intern
parent62fd4395ac594dd02a61982d2bf92839d9810f1b (diff)
parent2aa75bb1061d9c7327f219396efd01aea1bdedae (diff)
Merge branch 'alembic' into gooseberry
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/cache_library.c69
-rw-r--r--source/blender/blenkernel/intern/object_dupli.c13
2 files changed, 28 insertions, 54 deletions
diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index 2188023cd48..46cc2aa40d9 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -89,8 +89,6 @@ CacheLibrary *BKE_cache_library_add(Main *bmain, const char *name)
cachelib->source_mode = CACHE_LIBRARY_SOURCE_SCENE;
cachelib->display_mode = CACHE_LIBRARY_DISPLAY_MODIFIERS;
cachelib->display_flag = CACHE_LIBRARY_DISPLAY_MOTION | CACHE_LIBRARY_DISPLAY_CHILDREN;
- cachelib->render_flag = CACHE_LIBRARY_RENDER_MOTION | CACHE_LIBRARY_RENDER_CHILDREN;
- cachelib->eval_mode = CACHE_LIBRARY_EVAL_REALTIME | CACHE_LIBRARY_EVAL_RENDER;
/* cache everything by default */
cachelib->data_types = CACHE_TYPE_ALL;
@@ -376,24 +374,11 @@ static struct PTCReaderArchive *find_active_cache(Scene *scene, CacheLibrary *ca
return archive;
}
-void BKE_cache_library_get_read_flags(CacheLibrary *cachelib, eCacheLibrary_EvalMode eval_mode, bool for_display,
- bool *read_strands_motion, bool *read_strands_children)
+void BKE_cache_library_get_read_flags(CacheLibrary *cachelib, bool use_render, bool for_display, bool *read_strands_motion, bool *read_strands_children)
{
- if (for_display) {
- switch (eval_mode) {
- case CACHE_LIBRARY_EVAL_REALTIME:
- *read_strands_motion = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_MOTION;
- *read_strands_children = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_CHILDREN;
- break;
- case CACHE_LIBRARY_EVAL_RENDER:
- *read_strands_motion = cachelib->render_flag & CACHE_LIBRARY_RENDER_MOTION;
- *read_strands_children = cachelib->render_flag & CACHE_LIBRARY_RENDER_CHILDREN;
- break;
- default:
- *read_strands_motion = false;
- *read_strands_children = false;
- break;
- }
+ if (!use_render && for_display) {
+ *read_strands_motion = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_MOTION;
+ *read_strands_children = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_CHILDREN;
}
else {
*read_strands_motion = true;
@@ -402,7 +387,7 @@ void BKE_cache_library_get_read_flags(CacheLibrary *cachelib, eCacheLibrary_Eval
}
bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
- Scene *scene, Group *dupgroup, float frame, eCacheLibrary_EvalMode eval_mode, bool for_display)
+ Scene *scene, Group *dupgroup, float frame, bool use_render, bool for_display)
{
bool read_strands_motion, read_strands_children, read_simdebug = G.debug & G_DEBUG_SIMDATA;
struct PTCReaderArchive *archive;
@@ -415,16 +400,14 @@ bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
if (!dupgroup || !cachelib)
return false;
- if (!(cachelib->eval_mode & eval_mode))
- return false;
archive = find_active_cache(scene, cachelib);
if (!archive)
return false;
- PTC_reader_archive_use_render(archive, eval_mode == CACHE_LIBRARY_EVAL_RENDER);
+ PTC_reader_archive_use_render(archive, use_render);
- BKE_cache_library_get_read_flags(cachelib, eval_mode, for_display, &read_strands_motion, &read_strands_children);
+ BKE_cache_library_get_read_flags(cachelib, use_render, for_display, &read_strands_motion, &read_strands_children);
// TODO duplicache reader should only overwrite data that is not sequentially generated by modifiers (simulations) ...
reader = PTC_reader_duplicache(dupgroup->id.name, dupgroup, dupcache,
read_strands_motion, read_strands_children, read_simdebug);
@@ -439,7 +422,7 @@ bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
}
bool BKE_cache_read_dupli_object(CacheLibrary *cachelib, DupliObjectData *data,
- Scene *scene, Object *ob, float frame, eCacheLibrary_EvalMode eval_mode, bool for_display)
+ Scene *scene, Object *ob, float frame, bool use_render, bool for_display)
{
bool read_strands_motion, read_strands_children;
struct PTCReaderArchive *archive;
@@ -448,16 +431,14 @@ bool BKE_cache_read_dupli_object(CacheLibrary *cachelib, DupliObjectData *data,
if (!data || !ob || !cachelib)
return false;
- if (!(cachelib->eval_mode & eval_mode))
- return false;
archive = find_active_cache(scene, cachelib);
if (!archive)
return false;
- PTC_reader_archive_use_render(archive, eval_mode == CACHE_LIBRARY_EVAL_RENDER);
+ PTC_reader_archive_use_render(archive, use_render);
- BKE_cache_library_get_read_flags(cachelib, eval_mode, for_display, &read_strands_motion, &read_strands_children);
+ BKE_cache_library_get_read_flags(cachelib, use_render, for_display, &read_strands_motion, &read_strands_children);
reader = PTC_reader_duplicache_object(ob->id.name, ob, data, read_strands_motion, read_strands_children);
PTC_reader_init(reader, archive);
@@ -470,16 +451,12 @@ bool BKE_cache_read_dupli_object(CacheLibrary *cachelib, DupliObjectData *data,
}
-void BKE_cache_library_dag_recalc_tag(EvaluationContext *eval_ctx, Main *bmain)
+void BKE_cache_library_dag_recalc_tag(EvaluationContext *UNUSED(eval_ctx), Main *bmain)
{
CacheLibrary *cachelib;
- eCacheLibrary_EvalMode eval_mode = (eval_ctx->mode == DAG_EVAL_RENDER) ? CACHE_LIBRARY_EVAL_RENDER : CACHE_LIBRARY_EVAL_REALTIME;
-
for (cachelib = bmain->cache_library.first; cachelib; cachelib = cachelib->id.next) {
- if (cachelib->eval_mode & eval_mode) {
- if (has_active_cache(cachelib))
- DAG_id_tag_update(&cachelib->id, OB_RECALC_DATA | OB_RECALC_TIME);
- }
+ if (has_active_cache(cachelib))
+ DAG_id_tag_update(&cachelib->id, OB_RECALC_DATA | OB_RECALC_TIME);
}
}
@@ -596,7 +573,7 @@ void BKE_cache_modifier_foreachIDLink(struct CacheLibrary *cachelib, struct Cach
}
void BKE_cache_process_dupli_cache(CacheLibrary *cachelib, CacheProcessData *data,
- Scene *scene, Group *dupgroup, float frame_prev, float frame, eCacheLibrary_EvalMode eval_mode)
+ Scene *scene, Group *dupgroup, float frame_prev, float frame)
{
CacheProcessContext ctx;
CacheModifier *md;
@@ -610,7 +587,7 @@ void BKE_cache_process_dupli_cache(CacheLibrary *cachelib, CacheProcessData *dat
CacheModifierTypeInfo *mti = cache_modifier_type_get(md->type);
if (mti->process)
- mti->process(md, &ctx, data, frame, frame_prev, eval_mode);
+ mti->process(md, &ctx, data, frame, frame_prev);
}
}
@@ -1138,7 +1115,7 @@ static void hairsim_foreach_id_link(HairSimCacheModifier *hsmd, CacheLibrary *ca
walk(userdata, cachelib, &hsmd->modifier, (ID **)(&hsmd->sim_params.effector_weights->group));
}
-static void hairsim_process(HairSimCacheModifier *hsmd, CacheProcessContext *ctx, CacheProcessData *data, int frame, int frame_prev, eCacheLibrary_EvalMode UNUSED(eval_mode))
+static void hairsim_process(HairSimCacheModifier *hsmd, CacheProcessContext *ctx, CacheProcessData *data, int frame, int frame_prev)
{
#define MAX_CACHE_EFFECTORS 64
@@ -1441,7 +1418,7 @@ static void shrinkwrap_apply(ShrinkWrapCacheModifier *smd, ShrinkWrapCacheData *
}
}
-static void shrinkwrap_process(ShrinkWrapCacheModifier *smd, CacheProcessContext *UNUSED(ctx), CacheProcessData *data, int UNUSED(frame), int UNUSED(frame_prev), eCacheLibrary_EvalMode UNUSED(eval_mode))
+static void shrinkwrap_process(ShrinkWrapCacheModifier *smd, CacheProcessContext *UNUSED(ctx), CacheProcessData *data, int UNUSED(frame), int UNUSED(frame_prev))
{
Object *ob = smd->object;
DupliObject *dob;
@@ -1522,7 +1499,7 @@ static void strandskey_foreach_id_link(StrandsKeyCacheModifier *skmd, CacheLibra
walk(userdata, cachelib, &skmd->modifier, (ID **)(&skmd->object));
}
-static void strandskey_process(StrandsKeyCacheModifier *skmd, CacheProcessContext *UNUSED(ctx), CacheProcessData *data, int UNUSED(frame), int UNUSED(frame_prev), eCacheLibrary_EvalMode UNUSED(eval_mode))
+static void strandskey_process(StrandsKeyCacheModifier *skmd, CacheProcessContext *UNUSED(ctx), CacheProcessData *data, int UNUSED(frame), int UNUSED(frame_prev))
{
const bool use_motion = skmd->flag & eStrandsKeyCacheModifier_Flag_UseMotionState;
Object *ob = skmd->object;
@@ -1900,10 +1877,10 @@ static bool haircut_find_first_strand_cut(HaircutCacheModifier *hmd, HaircutCach
return false;
}
-static void haircut_apply(HaircutCacheModifier *hmd, CacheProcessContext *ctx, eCacheLibrary_EvalMode eval_mode, HaircutCacheData *data, Strands *parents, StrandsChildren *strands)
+static void haircut_apply(HaircutCacheModifier *hmd, CacheProcessContext *UNUSED(ctx), HaircutCacheData *data, Strands *parents, StrandsChildren *strands)
{
StrandChildIterator it_strand;
- bool do_strands_motion, do_strands_children;
+ bool do_strands_motion = true;
/* Note: the child data here is not yet deformed by parents, so the intersections won't be correct.
* We deform each strand individually on-the-fly to avoid duplicating memory.
@@ -1912,8 +1889,6 @@ static void haircut_apply(HaircutCacheModifier *hmd, CacheProcessContext *ctx, e
int maxlen = BKE_strands_children_max_length(strands);
float (*strand_deform)[3] = (float (*)[3])MEM_mallocN(sizeof(float) * 3 * maxlen, "child strand buffer");
- BKE_cache_library_get_read_flags(ctx->cachelib, eval_mode, true, &do_strands_motion, &do_strands_children);
-
for (BKE_strand_child_iter_init(&it_strand, strands); BKE_strand_child_iter_valid(&it_strand); BKE_strand_child_iter_next(&it_strand)) {
float cutoff = -1.0f;
@@ -1929,7 +1904,7 @@ static void haircut_apply(HaircutCacheModifier *hmd, CacheProcessContext *ctx, e
MEM_freeN(strand_deform);
}
-static void haircut_process(HaircutCacheModifier *hmd, CacheProcessContext *ctx, CacheProcessData *data, int UNUSED(frame), int UNUSED(frame_prev), eCacheLibrary_EvalMode eval_mode)
+static void haircut_process(HaircutCacheModifier *hmd, CacheProcessContext *ctx, CacheProcessData *data, int UNUSED(frame), int UNUSED(frame_prev))
{
const bool dupli_target = hmd->flag & eHaircutCacheModifier_Flag_InternalTarget;
Object *ob = hmd->object;
@@ -1974,7 +1949,7 @@ static void haircut_process(HaircutCacheModifier *hmd, CacheProcessContext *ctx,
haircut_data_get_instances(&haircut, hmd->target, mat, NULL);
}
- haircut_apply(hmd, ctx, eval_mode, &haircut, parents, strands);
+ haircut_apply(hmd, ctx, &haircut, parents, strands);
haircut_data_free(&haircut);
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 988761094b9..06cc649f52e 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1732,7 +1732,7 @@ void BKE_dupli_cache_from_group(Scene *scene, Group *group, CacheLibrary *cachel
/* ------------------------------------------------------------------------- */
-static void object_dupli_cache_apply_modifiers(Object *ob, Scene *scene, eCacheLibrary_EvalMode eval_mode)
+static void object_dupli_cache_apply_modifiers(Object *ob, Scene *scene)
{
CacheLibrary *cachelib = ob->cache_library;
int frame = scene->r.cfra;
@@ -1742,13 +1742,12 @@ static void object_dupli_cache_apply_modifiers(Object *ob, Scene *scene, eCacheL
copy_m4_m4(process_data.mat, ob->obmat);
process_data.dupcache = ob->dup_cache;
- BKE_cache_process_dupli_cache(cachelib, &process_data, scene, ob->dup_group, (float)frame, (float)frame, eval_mode);
+ BKE_cache_process_dupli_cache(cachelib, &process_data, scene, ob->dup_group, (float)frame, (float)frame);
}
void BKE_object_dupli_cache_update(Scene *scene, Object *ob, EvaluationContext *eval_ctx, float frame)
{
- const eCacheLibrary_EvalMode eval_mode = eval_ctx->mode == DAG_EVAL_RENDER ? CACHE_LIBRARY_EVAL_RENDER : CACHE_LIBRARY_EVAL_REALTIME;
-
+ bool use_render = (eval_ctx->mode == DAG_EVAL_RENDER);
bool is_dupligroup = (ob->transflag & OB_DUPLIGROUP) && ob->dup_group;
bool is_cached = ob->cache_library && (ob->cache_library->source_mode == CACHE_LIBRARY_SOURCE_CACHE || ob->cache_library->display_mode == CACHE_LIBRARY_DISPLAY_RESULT);
bool do_modifiers = ob->cache_library && ob->cache_library->display_mode == CACHE_LIBRARY_DISPLAY_MODIFIERS;
@@ -1774,13 +1773,13 @@ void BKE_object_dupli_cache_update(Scene *scene, Object *ob, EvaluationContext *
if (!(ob->cache_library->flag & CACHE_LIBRARY_BAKING)) {
bool do_strands_motion, do_strands_children;
- BKE_cache_library_get_read_flags(ob->cache_library, eval_mode, true, &do_strands_motion, &do_strands_children);
+ BKE_cache_library_get_read_flags(ob->cache_library, use_render, true, &do_strands_motion, &do_strands_children);
/* TODO at this point we could apply animation offset */
- BKE_cache_read_dupli_cache(ob->cache_library, ob->dup_cache, scene, ob->dup_group, frame, eval_mode, true);
+ BKE_cache_read_dupli_cache(ob->cache_library, ob->dup_cache, scene, ob->dup_group, frame, use_render, true);
if (do_modifiers) {
- object_dupli_cache_apply_modifiers(ob, scene, eval_mode);
+ object_dupli_cache_apply_modifiers(ob, scene);
}
/* Deform child strands to follow parent motion.