diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-08 21:28:09 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-08 21:28:09 +0300 |
commit | 7e333010f3b76a467b88e80605df55b8f559bcda (patch) | |
tree | dc6e5509a808f4a08bcfdad3b5e03954d7038d41 /source/blender/editors/animation/anim_deps.c | |
parent | 445e4c9a8cbe3701ec784fa2f3aa16edc82c6971 (diff) |
Animation System: Handling Updates
* Added ANIM_list_elem_update and ANIM_id_update functions to call when
changing animation curves, which will then call the RNA property update
functions for those curves.
This is to replace just calling DAG_id_flush_update, that may not always
be the right thing to do, and doesn't send proper notifiers for redraw.
Still only used/usable when transforming in the graph editor, not sure
how this do this with NLA for example, .. needs to be improved.
* Added function wm_data_handle_update function to contain the object
update function, and also added scene animation update there. Actually
it should be doing all datablocks, this makes it work for sequencer.
Joshua, do you agree this is the right direction to go in? I can revert or
change the code if you think it should be done differently. Mainly wanted
to get this working well for sequencer now.
Diffstat (limited to 'source/blender/editors/animation/anim_deps.c')
-rw-r--r-- | source/blender/editors/animation/anim_deps.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 7a96c3b32a3..0e81dab380c 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -32,6 +32,7 @@ #include "MEM_guardedalloc.h" #include "DNA_action_types.h" +#include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -39,8 +40,10 @@ #include "BLI_blenlib.h" #include "BKE_action.h" +#include "BKE_animsys.h" #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_global.h" #include "BKE_main.h" #include "BKE_scene.h" #include "BKE_screen.h" @@ -55,6 +58,61 @@ #include "WM_api.h" #include "WM_types.h" +/* tags the given anim list element for refreshes (if applicable) + * due to Animation Editor editing */ +void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale) +{ + ID *id; + FCurve *fcu; + AnimData *adt; + + id= ale->id; + if(!id) + return; + + /* tag AnimData for refresh so that other views will update in realtime with these changes */ + adt= BKE_animdata_from_id(id); + if(adt) + adt->recalc |= ADT_RECALC_ANIM; + + /* update data */ + fcu= (ale->datatype == ALE_FCURVE)? ale->key_data: NULL; + + if(fcu && fcu->rna_path) { + /* if we have an fcurve, call the update for the property we + are editing, this is then expected to do the proper redraws + and depsgraph updates */ + PointerRNA id_ptr, ptr; + PropertyRNA *prop; + + RNA_id_pointer_create(id, &id_ptr); + + if(RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) + RNA_property_update_main(G.main, scene, &ptr, prop); + } + else { + /* in other case we do standard depsgaph update, ideally + we'd be calling property update functions here too ... */ + DAG_id_flush_update(id, OB_RECALC); // XXX or do we want something more restrictive? + } +} + +/* tags the given ID block for refreshes (if applicable) due to + * Animation Editor editing */ +void ANIM_id_update(Scene *scene, ID *id) +{ + if(id) { + AnimData *adt= BKE_animdata_from_id(id); + + /* tag AnimData for refresh so that other views will update in realtime with these changes */ + if (adt) + adt->recalc |= ADT_RECALC_ANIM; + + /* set recalc flags */ + DAG_id_flush_update(id, OB_RECALC); // XXX or do we want something more restrictive? + } +} + /* **************************** pose <-> action syncing ******************************** */ /* Summary of what needs to be synced between poses and actions: * 1) Flags |