[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20824] branches/soc-2009-aligorith/source /blender/editors: NLA SoC: Fixes for crashes when selecting keyframes in object channels in DopeSheet
Joshua Leung
aligorith at gmail.com
Fri Jun 12 04:49:21 CEST 2009
Revision: 20824
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20824
Author: aligorith
Date: 2009-06-12 04:49:21 +0200 (Fri, 12 Jun 2009)
Log Message:
-----------
NLA SoC: Fixes for crashes when selecting keyframes in object channels in DopeSheet
Modified Paths:
--------------
branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
branches/soc-2009-aligorith/source/blender/editors/animation/keyframes_edit.c
branches/soc-2009-aligorith/source/blender/editors/space_action/action_select.c
Modified: branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c 2009-06-12 02:29:38 UTC (rev 20823)
+++ branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c 2009-06-12 02:49:21 UTC (rev 20824)
@@ -1095,17 +1095,6 @@
ANIMDATA_FILTER_CASES(ob,
{ /* AnimData blocks - do nothing... */ },
{ /* nla */
-#if 0
- /* include nla-expand widget? */
- if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
- ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_OBJECT, (ID *)ob);
- if (ale) {
- BLI_addtail(anim_data, ale);
- items++;
- }
- }
-#endif
-
/* add NLA tracks */
items += animdata_filter_nla(anim_data, adt, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
},
@@ -1141,7 +1130,7 @@
items += animdata_filter_action(anim_data, adt->action, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
}
}
- )
+ );
}
@@ -1151,17 +1140,6 @@
ANIMDATA_FILTER_CASES(key,
{ /* AnimData blocks - do nothing... */ },
{ /* nla */
-#if 0
- /* include nla-expand widget? */
- if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
- ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_OBJECT, (ID *)ob);
- if (ale) {
- BLI_addtail(anim_data, ale);
- items++;
- }
- }
-#endif
-
/* add NLA tracks */
items += animdata_filter_nla(anim_data, adt, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
},
@@ -1195,7 +1173,7 @@
items += animdata_filter_shapekey(anim_data, key, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
}
}
- )
+ );
}
/* Materials? */
@@ -1280,17 +1258,6 @@
ANIMDATA_FILTER_CASES(sce,
{ /* AnimData blocks - do nothing... */ },
{ /* nla */
-#if 0
- /* include nla-expand widget? */
- if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
- ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_SCENE (ID *)sce);
- if (ale) {
- BLI_addtail(anim_data, ale);
- items++;
- }
- }
-#endif
-
/* add NLA tracks */
items += animdata_filter_nla(anim_data, adt, filter_mode, sce, ANIMTYPE_SCENE, (ID *)sce);
},
@@ -1334,17 +1301,6 @@
ANIMDATA_FILTER_CASES(wo,
{ /* AnimData blocks - do nothing... */ },
{ /* nla */
-#if 0
- /* include nla-expand widget? */
- if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
- ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_DSWOR (ID *)wo);
- if (ale) {
- BLI_addtail(anim_data, ale);
- items++;
- }
- }
-#endif
-
/* add NLA tracks */
items += animdata_filter_nla(anim_data, adt, filter_mode, wo, ANIMTYPE_DSWOR, (ID *)wo);
},
Modified: branches/soc-2009-aligorith/source/blender/editors/animation/keyframes_edit.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/animation/keyframes_edit.c 2009-06-12 02:29:38 UTC (rev 20823)
+++ branches/soc-2009-aligorith/source/blender/editors/animation/keyframes_edit.c 2009-06-12 02:49:21 UTC (rev 20824)
@@ -128,6 +128,10 @@
{
FCurve *fcu;
+ /* sanity check */
+ if (agrp == NULL)
+ return 0;
+
/* only iterate over the F-Curves that are in this group */
for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next) {
if (ANIM_fcurve_keys_bezier_loop(bed, fcu, bezt_ok, bezt_cb, fcu_cb))
@@ -142,6 +146,10 @@
{
FCurve *fcu;
+ /* sanity check */
+ if (act == NULL)
+ return 0;
+
/* just loop through all F-Curves */
for (fcu= act->curves.first; fcu; fcu= fcu->next) {
if (ANIM_fcurve_keys_bezier_loop(bed, fcu, bezt_ok, bezt_cb, fcu_cb))
@@ -154,6 +162,10 @@
/* This function is used to loop over the keyframe data of an AnimData block */
static short adt_keys_bezier_loop(BeztEditData *bed, AnimData *adt, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
{
+ /* sanity check */
+ if (adt == NULL)
+ return 0;
+
/* drivers or actions? */
if (filterflag & ADS_FILTER_ONLYDRIVERS) {
FCurve *fcu;
@@ -178,6 +190,10 @@
{
Key *key= ob_get_key(ob);
+ /* sanity check */
+ if (ob == NULL)
+ return 0;
+
/* firstly, Object's own AnimData */
if (ob->adt)
adt_keys_bezier_loop(bed, ob->adt, bezt_ok, bezt_cb, fcu_cb, filterflag);
@@ -194,8 +210,12 @@
/* This function is used to loop over the keyframe data in a Scene */
static short scene_keys_bezier_loop(BeztEditData *bed, Scene *sce, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
{
- World *wo= sce->world;
+ World *wo= (sce) ? sce->world : NULL;
+ /* sanity check */
+ if (sce == NULL)
+ return 0;
+
/* Scene's own animation */
if (sce->adt)
adt_keys_bezier_loop(bed, sce->adt, bezt_ok, bezt_cb, fcu_cb, filterflag);
@@ -231,7 +251,7 @@
return act_keys_bezier_loop(bed, (bAction *)ale->data, bezt_ok, bezt_cb, fcu_cb);
case ALE_OB: /* object */
- return ob_keys_bezier_loop(bed, (Object *)ale->data, bezt_ok, bezt_cb, fcu_cb, filterflag);
+ return ob_keys_bezier_loop(bed, (Object *)ale->key_data, bezt_ok, bezt_cb, fcu_cb, filterflag);
case ALE_SCE: /* scene */
return scene_keys_bezier_loop(bed, (Scene *)ale->data, bezt_ok, bezt_cb, fcu_cb, filterflag);
}
Modified: branches/soc-2009-aligorith/source/blender/editors/space_action/action_select.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_action/action_select.c 2009-06-12 02:29:38 UTC (rev 20823)
+++ branches/soc-2009-aligorith/source/blender/editors/space_action/action_select.c 2009-06-12 02:49:21 UTC (rev 20824)
@@ -858,17 +858,19 @@
ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
/* Highlight Action-Group or F-Curve? */
- if (ale->type == ANIMTYPE_GROUP) {
- bActionGroup *agrp= ale->data;
-
- agrp->flag |= AGRP_SELECTED;
- ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
- }
- else if (ale->type == ANIMTYPE_FCURVE) {
- FCurve *fcu= ale->data;
-
- fcu->flag |= FCURVE_SELECTED;
- ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
+ if (ale && ale->data) {
+ if (ale->type == ANIMTYPE_GROUP) {
+ bActionGroup *agrp= ale->data;
+
+ agrp->flag |= AGRP_SELECTED;
+ ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
+ }
+ else if (ale->type == ANIMTYPE_FCURVE) {
+ FCurve *fcu= ale->data;
+
+ fcu->flag |= FCURVE_SELECTED;
+ ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
+ }
}
}
else if (ac->datatype == ANIMCONT_GPENCIL) {
@@ -881,7 +883,7 @@
}
/* only select keyframes if we clicked on a valid channel and hit something */
- if (ale) {
+ if (ale && found) {
/* apply selection to keyframes */
if (/*gpl*/0) {
/* grease pencil */
More information about the Bf-blender-cvs
mailing list