Commit: d4ae4f59dbbdc8ab97327d3ac6041f34ca5fbb70
Author: Sergey Sharybin
Date: Thu Nov 6 11:25:39 2014 +0100
Branches: depsgraph_refactor
https://developer.blender.org/rBd4ae4f59dbbdc8ab97327d3ac6041f34ca5fbb70
Depsgraph: Make update for new frame closer to the master as well
===================================================================
M source/blender/blenkernel/intern/scene.c
===================================================================
diff --git a/source/blender/blenkernel/intern/scene.c
b/source/blender/blenkernel/intern/scene.c
index b68ca72..f4d6126 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1718,91 +1718,95 @@ void BKE_scene_update_for_newframe(EvaluationContext
*eval_ctx, Main *bmain, Sce
void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main
*bmain, Scene *sce, unsigned int lay, bool do_invisible_flush)
{
- if (DEG_get_eval_mode() == DEG_EVAL_MODE_OLD) {
- float ctime = BKE_scene_frame_get(sce);
- Scene *sce_iter;
+ float ctime = BKE_scene_frame_get(sce);
+ Scene *sce_iter;
#ifdef DETAILED_ANALYSIS_OUTPUT
- double start_time = PIL_check_seconds_timer();
+ double start_time = PIL_check_seconds_timer();
#endif
+ bool use_new_eval = DEG_get_eval_mode() == DEG_EVAL_MODE_NEW;
- /* keep this first */
- BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_PRE);
- BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_PRE);
-
- /* update animated image textures for particles, modifiers,
gpu, etc,
+ /* keep this first */
+ BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_PRE);
+ BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_PRE);
+
+ /* update animated image textures for particles, modifiers, gpu, etc,
* call this at the start so modifiers with textures don't lag 1 frame
*/
- BKE_image_update_frame(bmain, sce->r.cfra);
-
- /* rebuild rigid body worlds before doing the actual frame
update
+ BKE_image_update_frame(bmain, sce->r.cfra);
+
+ /* rebuild rigid body worlds before doing the actual frame update
* this needs to be done on start frame but animation playback usually
starts one frame later
* we need to do it here to avoid rebuilding the world on every
simulation change, which can be very expensive
*/
- scene_rebuild_rbw_recursive(sce, ctime);
-
- sound_set_cfra(sce->r.cfra);
-
- /* clear animation overrides */
- /* XXX TODO... */
-
- for (sce_iter = sce; sce_iter; sce_iter = sce_iter->set)
- DAG_scene_relations_update(bmain, sce_iter);
-
+ scene_rebuild_rbw_recursive(sce, ctime);
+
+ sound_set_cfra(sce->r.cfra);
+
+ /* clear animation overrides */
+ /* XXX TODO... */
+
+ for (sce_iter = sce; sce_iter; sce_iter = sce_iter->set)
+ DAG_scene_relations_update(bmain, sce_iter);
+
+ if (!use_new_eval) {
/* flush recalc flags to dependencies, if we were only changing
a frame
- * this would not be necessary, but if a user or a script has modified
- * some datablock before BKE_scene_update_tagged was called, we need
the flush */
+ * this would not be necessary, but if a user or a script has
modified
+ * some datablock before BKE_scene_update_tagged was called, we
need the flush */
DAG_ids_flush_tagged(bmain);
-
+
/* Following 2 functions are recursive
- * so don't call within 'scene_update_tagged_recursive' */
+ * so don't call within 'scene_update_tagged_recursive' */
DAG_scene_update_flags(bmain, sce, lay, true,
do_invisible_flush); // only stuff that moves or needs display still
-
- BKE_mask_evaluate_all_masks(bmain, ctime, true);
-
- /* All 'standard' (i.e. without any dependencies) animation is
handled here,
+ }
+
+ BKE_mask_evaluate_all_masks(bmain, ctime, true);
+
+ /* All 'standard' (i.e. without any dependencies) animation is handled
here,
* with an 'local' to 'macro' order of evaluation. This should ensure
that
* settings stored nestled within a hierarchy (i.e. settings in a
Texture block
* can be overridden by settings from Scene, which owns the Texture
through a hierarchy
* such as Scene->World->MTex/Texture) can still get correctly
overridden.
*/
- BKE_animsys_evaluate_all_animation(bmain, sce, ctime);
- /*...done with recursive funcs */
-
- /* clear "LIB_DOIT" flag from all materials, to prevent
infinite recursion problems later
+ BKE_animsys_evaluate_all_animation(bmain, sce, ctime);
+ /*...done with recursive funcs */
+
+ /* clear "LIB_DOIT" flag from all materials, to prevent infinite
recursion problems later
* when trying to find materials with drivers that need evaluating
[#32017]
*/
- BKE_main_id_tag_idcode(bmain, ID_MA, false);
- BKE_main_id_tag_idcode(bmain, ID_LA, false);
-
- /* run rigidbody sim */
- /* NOTE: current position is so that rigidbody sim affects
other objects, might change in the future */
- scene_do_rb_simulation_recursive(sce, ctime);
-
- /* BKE_object_handle_update() on all objects, groups and sets */
+ BKE_main_id_tag_idcode(bmain, ID_MA, false);
+ BKE_main_id_tag_idcode(bmain, ID_LA, false);
+
+ /* run rigidbody sim */
+ /* NOTE: current position is so that rigidbody sim affects other
objects, might change in the future */
+ scene_do_rb_simulation_recursive(sce, ctime);
+
+ /* BKE_object_handle_update() on all objects, groups and sets */
+ if (use_new_eval) {
+ DEG_evaluate_on_framechange(eval_ctx, sce->depsgraph, ctime);
+ }
+ else {
scene_update_tagged_recursive(eval_ctx, bmain, sce, sce);
- /* update sound system animation (TODO, move to depsgraph) */
- sound_update_scene(bmain, sce);
-
+ }
+
+ /* update sound system animation (TODO, move to depsgraph) */
+ sound_update_scene(bmain, sce);
+
+ if (!use_new_eval) {
scene_depsgraph_hack(eval_ctx, sce, sce);
-
- /* notify editors and python about recalc */
- BLI_callback_exec(bmain, &sce->id,
BLI_CB_EVT_SCENE_UPDATE_POST);
- BLI_callback_exec(bmain, &sce->id,
BLI_CB_EVT_FRAME_CHANGE_POST);
-
+ }
+
+ /* notify editors and python about recalc */
+ BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_POST);
+ BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_POST);
+
+ if (!use_new_eval) {
DAG_ids_check_recalc(bmain, sce, true);
-
/* clear recalc flags */
DAG_ids_clear_recalc(bmain);
-
+ }
+
#ifdef DETAILED_ANALYSIS_OUTPUT
- fprintf(stderr, "frame update start_time %f duration %f\n",
start_time, PIL_check_seconds_timer() - start_time);
+ fprintf(stderr, "frame update start_time %f duration %f\n", start_time,
PIL_check_seconds_timer() - start_time);
#endif
- }
- else {
- float ctime = BKE_scene_frame_get(sce);
- /* new depsgraph */
- BLI_assert(sce->depsgraph);
- DEG_evaluate_on_framechange(eval_ctx, sce->depsgraph, ctime);
- }
}
/* return default layer, also used to patch old files */
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs