diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-10-02 03:32:57 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-10-02 03:32:57 +0400 |
commit | b26ef33b8ed68ba3b5a5a78a3f23fcade4035f31 (patch) | |
tree | dd88daaab4ad1768e6060e6f787741959cfc3c04 /source/blender/editors/space_action/action_edit.c | |
parent | bc942eceacb638735dc4f4f68252c4c207147a70 (diff) |
Fix #19311: adding/opening datablocks did not always make the right
one active. Now there's a function to get the pointer + property from
the UI, just like for the animation operators.
Also two fixes for fileselect events, regions are now preserved so that
context is restored to the old region, and the cancel callback is called
when the operator is cancelled.
Diffstat (limited to 'source/blender/editors/space_action/action_edit.c')
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 865d072d938..0bcf4b037cb 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -86,6 +86,8 @@ #include "WM_api.h" #include "WM_types.h" +#include "UI_interface.h" + #include "action_intern.h" /* ************************************************************************** */ @@ -96,14 +98,25 @@ static int act_new_exec(bContext *C, wmOperator *op) { bAction *action; + PointerRNA ptr, idptr; + PropertyRNA *prop; // XXX need to restore behaviour to copy old actions... action= add_empty_action("Action"); - /* combined with RNA property, this will assign & increase user, - so decrease here to compensate for that */ - action->id.us--; - + /* hook into UI */ + uiIDContextProperty(C, &ptr, &prop); + + if(prop) { + /* when creating new ID blocks, use is already 1, but RNA + * pointer se also increases user, so this compensates it */ + action->id.us--; + + RNA_id_pointer_create(&action->id, &idptr); + RNA_property_pointer_set(&ptr, prop, idptr); + RNA_property_update(C, &ptr, prop); + } + /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); |