Update Handling: moved wm_data_handle_update from windowmanager to
scene_update_tagged in blenkernel, code fits better there.
This commit is contained in:
@@ -74,6 +74,7 @@ void scene_select_base(struct Scene *sce, struct Base *selbase);
|
||||
/* checks for cycle, returns 1 if it's all OK */
|
||||
int scene_check_setscene(struct Scene *sce);
|
||||
|
||||
void scene_update_tagged(struct Scene *sce);
|
||||
void scene_update_for_newframe(struct Scene *sce, unsigned int lay);
|
||||
|
||||
void scene_add_render_layer(struct Scene *sce);
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_sequence.h"
|
||||
#include "BKE_world.h"
|
||||
@@ -772,7 +773,7 @@ float frame_to_float (Scene *scene, int cfra) /* see also bsystem_time in objec
|
||||
return ctime;
|
||||
}
|
||||
|
||||
static void scene_update(Scene *sce, unsigned int lay)
|
||||
static void scene_update_newframe(Scene *sce, unsigned int lay)
|
||||
{
|
||||
Base *base;
|
||||
Object *ob;
|
||||
@@ -804,6 +805,40 @@ static void scene_update(Scene *sce, unsigned int lay)
|
||||
}
|
||||
}
|
||||
|
||||
/* this is called in main loop, doing tagged updates before redraw */
|
||||
void scene_update_tagged(Scene *scene)
|
||||
{
|
||||
Scene *sce;
|
||||
Base *base;
|
||||
float ctime = frame_to_float(scene, scene->r.cfra);
|
||||
|
||||
/* update all objects: drivers, matrices, displists, etc. flags set
|
||||
by depgraph or manual, no layer check here, gets correct flushed */
|
||||
|
||||
/* sets first, we allow per definition current scene to have
|
||||
dependencies on sets, but not the other way around. */
|
||||
if(scene->set) {
|
||||
for(SETLOOPER(scene->set, base))
|
||||
object_handle_update(scene, base->object);
|
||||
}
|
||||
|
||||
for(base= scene->base.first; base; base= base->next) {
|
||||
object_handle_update(scene, base->object);
|
||||
}
|
||||
|
||||
/* recalc scene animation data here (for sequencer) */
|
||||
{
|
||||
AnimData *adt= BKE_animdata_from_id(&scene->id);
|
||||
|
||||
if(adt && (adt->recalc & ADT_RECALC_ANIM))
|
||||
BKE_animsys_evaluate_animdata(&scene->id, adt, ctime, 0);
|
||||
}
|
||||
|
||||
BKE_ptcache_quick_cache_all(scene);
|
||||
|
||||
/* in the future this should handle updates for all datablocks, not
|
||||
only objects and scenes. - brecht */
|
||||
}
|
||||
|
||||
/* applies changes right away, does all sets too */
|
||||
void scene_update_for_newframe(Scene *sce, unsigned int lay)
|
||||
@@ -815,9 +850,9 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay)
|
||||
|
||||
/* sets first, we allow per definition current scene to have dependencies on sets */
|
||||
for(sce= sce->set; sce; sce= sce->set)
|
||||
scene_update(sce, lay);
|
||||
scene_update_newframe(sce, lay);
|
||||
|
||||
scene_update(scene, lay);
|
||||
scene_update_newframe(scene, lay);
|
||||
}
|
||||
|
||||
/* return default layer, also used to patch old files */
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
@@ -42,17 +41,14 @@
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_blender.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_idprop.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_pointcache.h"
|
||||
|
||||
#include "ED_fileselect.h"
|
||||
#include "ED_info.h"
|
||||
@@ -149,40 +145,6 @@ static wmNotifier *wm_notifier_next(wmWindowManager *wm)
|
||||
return note;
|
||||
}
|
||||
|
||||
static void wm_data_handle_update(Scene *scene)
|
||||
{
|
||||
Scene *sce;
|
||||
Base *base;
|
||||
|
||||
/* XXX make lock in future, or separated derivedmesh users in scene */
|
||||
if(G.rendering)
|
||||
return;
|
||||
|
||||
/* update all objects, drivers, matrices, displists, etc. Flags set by depgraph or manual,
|
||||
no layer check here, gets correct flushed */
|
||||
/* sets first, we allow per definition current scene to have dependencies on sets */
|
||||
if(scene->set) {
|
||||
for(SETLOOPER(scene->set, base))
|
||||
object_handle_update(scene, base->object);
|
||||
}
|
||||
|
||||
for(base= scene->base.first; base; base= base->next) {
|
||||
object_handle_update(scene, base->object);
|
||||
}
|
||||
|
||||
/* recalc scene animation data here (for sequencer). actually
|
||||
this should be doing all datablocks including e.g. materials,
|
||||
but for now this solves some update issues - brecht. */
|
||||
{
|
||||
AnimData *adt= BKE_animdata_from_id(&scene->id);
|
||||
|
||||
if(adt && (adt->recalc & ADT_RECALC_ANIM))
|
||||
BKE_animsys_evaluate_animdata(&scene->id, adt, scene->r.cfra, 0);
|
||||
}
|
||||
|
||||
BKE_ptcache_quick_cache_all(scene);
|
||||
}
|
||||
|
||||
/* called in mainloop */
|
||||
void wm_event_do_notifiers(bContext *C)
|
||||
{
|
||||
@@ -296,7 +258,10 @@ void wm_event_do_notifiers(bContext *C)
|
||||
}
|
||||
}
|
||||
|
||||
wm_data_handle_update(win->screen->scene);
|
||||
/* XXX make lock in future, or separated derivedmesh users in scene */
|
||||
if(!G.rendering)
|
||||
/* depsgraph & animation: update tagged datablocks */
|
||||
scene_update_tagged(win->screen->scene);
|
||||
}
|
||||
|
||||
CTX_wm_window_set(C, NULL);
|
||||
|
||||
Reference in New Issue
Block a user