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>2015-03-28 13:22:02 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-03-31 16:18:05 +0300
commit08f7b20ebb5ab2746144663876d19086f7518939 (patch)
tree9b2253f530771c10d3ae022adb96e4e27e314a9b
parent4f57f156482e937fe922e9e0ec5d1a446b0463da (diff)
Bugfix: Fix for crash when trying to create new action in Shape Key DopeSheet mode
When the active object had no shapekey data, trying to create a new action from the Shape Keys mode of the DopeSheet would crash. The segfault here was a silly regression caused by my earlier Action Stashing work. However, the old (pre-Action Stashing) code here also wasn't that great either. While it didn't crash, it would still silently create a new action, even if that could not get assigned/used anywhere. To prevent both of these problems from happening again, I've added additional null checks, as well as beefing up the poll callback here to forbid keyframing
-rw-r--r--source/blender/editors/space_action/action_edit.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 76c955d8bca..95066b91725 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -93,11 +93,15 @@ static AnimData *actedit_animdata_from_context(bContext *C)
/* Get AnimData block to use */
if (saction->mode == SACTCONT_ACTION) {
/* Currently, "Action Editor" means object-level only... */
- adt = ob->adt;
+ if (ob) {
+ adt = ob->adt;
+ }
}
else if (saction->mode == SACTCONT_SHAPEKEY) {
Key *key = BKE_key_from_object(ob);
- adt = key->adt;
+ if (key) {
+ adt = key->adt;
+ }
}
return adt;
@@ -180,9 +184,19 @@ static int action_new_poll(bContext *C)
if (!(scene->flag & SCE_NLA_EDIT_ON)) {
if (ED_operator_action_active(C)) {
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
+ Object *ob = CTX_data_active_object(C);
/* For now, actions are only for the active object, and on object and shapekey levels... */
- return ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY);
+ if (saction->mode == SACTCONT_ACTION) {
+ /* XXX: This assumes that actions are assigned to the active object */
+ if (ob)
+ return true;
+ }
+ else if (saction->mode == SACTCONT_SHAPEKEY) {
+ Key *key = BKE_key_from_object(ob);
+ if (key)
+ return true;
+ }
}
else if (ED_operator_nla_active(C)) {
return true;