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:
authorJoshua Leung <aligorith@gmail.com>2009-01-05 12:54:39 +0300
committerJoshua Leung <aligorith@gmail.com>2009-01-05 12:54:39 +0300
commitdf20a12728626372de8a5eb127e57cb2cca40649 (patch)
tree1db0a794e8bd2bcdc899857715859ede024ca564 /source/blender/editors/animation/anim_deps.c
parent7de52578c044f20b166045eaf5e925c6714f6598 (diff)
2.5 - Animation Fixes + More Porting work in Action Editor
* Added crash fixes for loading old files with Actions/Armatures in them. Was caused by usage of some old globals still and the functions in question not performing NULL checks on the validity of the data they're given. * Added back reorganise action channels tools (shift/ctrl-shif pageup/down) for Action Editor. These are only available in 'Action Mode' only. * Tidied up Action Editor/Dopesheet tools code - removed various unused things, and also, added an API call in anim_deps.c to send the correct notifiers, since I anticipate that they're likely to require a few context checks which would be better to centralise than copy+paste everywhere. Note to Ton: could you have a look at this notifier stuff here? I'm not sure which ones I should be sending... * Also added a few assorted comments in various places
Diffstat (limited to 'source/blender/editors/animation/anim_deps.c')
-rw-r--r--source/blender/editors/animation/anim_deps.c66
1 files changed, 59 insertions, 7 deletions
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 336bc6f48ed..eaf4ef7ae12 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -56,6 +56,10 @@
#include "RNA_define.h"
#include "ED_anim_api.h"
+#include "ED_screen.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
/* ***************** depsgraph calls and anim updates ************* */
@@ -122,6 +126,53 @@ void ED_update_for_newframe(const bContext *C, int mute)
}
}
+/* **************************** animation tool notifiers ******************************** */
+
+/* Send notifiers on behalf of animation editing tools, based on various context info
+ * - data_changed: eAnimData_Changed
+ */
+void ANIM_animdata_send_notifiers (bContext *C, bAnimContext *ac, short data_changed)
+{
+ /* types of notifiers to send, depends on the editor context */
+ switch (ac->datatype) {
+ case ANIMCONT_DOPESHEET: /* dopesheet */
+ {
+ /* what action was taken */
+ switch (data_changed) {
+ case ANIM_CHANGED_KEYFRAMES_VALUES:
+ /* keyframe values changed, so transform may have changed */
+ // XXX what about other cases? maybe we need general ND_KEYFRAMES or ND_ANIMATION?
+ WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ break;
+ //case ANIM_CHANGED_KEYFRAMES_SELECT: // XXX what to do here?
+ // break;
+ case ANIM_CHANGED_CHANNELS:
+ // XXX err... check available datatypes in dopesheet first?
+ // FIXME: this currently doesn't work (to update own view)
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE|ND_OB_SELECT, ac->scene);
+ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE|ND_BONE_SELECT, NULL);
+ break;
+ }
+
+ // XXX for now, at least update own editor!
+ ED_area_tag_redraw(CTX_wm_area(C));
+ }
+ break;
+
+ case ANIMCONT_ACTION: /* action editor */
+ {
+ Object *obact= CTX_data_active_object(C);
+
+ // only update active object for now... more detail to come!
+ WM_event_add_notifier(C, NC_OBJECT, obact);
+ }
+ break;
+
+ default: /* some other data... just update area for now */
+ ED_area_tag_redraw(CTX_wm_area(C));
+ }
+}
+
/* **************************** pose <-> action syncing ******************************** */
/* Summary of what needs to be synced between poses and actions:
* 1) Flags
@@ -177,8 +228,9 @@ void ANIM_action_to_pose_sync (Object *ob)
* An object (usually 'active' Object) needs to be supplied, so that its Pose-Channels can be synced with
* the channels in its active Action.
*/
-void ANIM_pose_to_action_sync (Object *ob)
+void ANIM_pose_to_action_sync (Object *ob, ScrArea *sa)
{
+ SpaceAction *saction= (SpaceAction *)sa->spacedata.first;
bArmature *arm= (bArmature *)ob->data;
bAction *act= (bAction *)ob->action;
bActionChannel *achan;
@@ -197,12 +249,12 @@ void ANIM_pose_to_action_sync (Object *ob)
/* sync selection and visibility settings */
if (pchan && pchan->bone) {
/* visibility - if layer is hidden, or if bone itself is hidden */
- // XXX we may not want this happening though! (maybe we need some extra flags from context or so)
- // only if SACTION_NOHIDE==0, and saction->pin == 0, when in Action Editor mode
- if (!(pchan->bone->layer & arm->layer) || (pchan->bone->flag & BONE_HIDDEN_P))
- achan->flag |= ACHAN_HIDDEN;
- else
- achan->flag &= ~ACHAN_HIDDEN;
+ if (!(saction->flag & SACTION_NOHIDE) && !(saction->pin)) {
+ if (!(pchan->bone->layer & arm->layer) || (pchan->bone->flag & BONE_HIDDEN_P))
+ achan->flag |= ACHAN_HIDDEN;
+ else
+ achan->flag &= ~ACHAN_HIDDEN;
+ }
/* selection */
if (pchan->bone->flag & BONE_SELECTED)