[#26622] Blender crashes when calling transform operator

Add cancellation checks for time* transforms that only run in specific spaces.

Hide Transform Mode operator property (it shouldn't be modified after the operator is run), made default mode Translate, not the useless Dummy.
This commit is contained in:
2011-03-27 22:15:37 +00:00
parent 3c67374f50
commit 84befe2056
2 changed files with 24 additions and 6 deletions

View File

@@ -1650,11 +1650,6 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
break;
case TFM_EDGE_SLIDE:
initEdgeSlide(t);
if(t->state == TRANS_CANCEL)
{
postTrans(C, t);
return 0;
}
break;
case TFM_BONE_ROLL:
initBoneRoll(t);
@@ -1709,6 +1704,13 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
break;
}
if(t->state == TRANS_CANCEL)
{
postTrans(C, t);
return 0;
}
/* overwrite initial values if operator supplied a non-null vector */
if (RNA_property_is_set(op->ptr, "value"))
{
@@ -5515,6 +5517,11 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d,
void initTimeTranslate(TransInfo *t)
{
/* this tool is only really available in the Action Editor... */
if (t->spacetype != SPACE_ACTION) {
t->state = TRANS_CANCEL;
}
t->mode = TFM_TIME_TRANSLATE;
t->transform = TimeTranslate;
@@ -5663,8 +5670,11 @@ void initTimeSlide(TransInfo *t)
/* set flag for drawing stuff */
saction->flag |= SACTION_MOVING;
} else {
t->state = TRANS_CANCEL;
}
t->mode = TFM_TIME_SLIDE;
t->transform = TimeSlide;
t->flag |= T_FREE_CUSTOMDATA;
@@ -5789,6 +5799,11 @@ void initTimeScale(TransInfo *t)
{
int center[2];
/* this tool is only really available in the Action Editor... */
if (t->spacetype != SPACE_ACTION) {
t->state = TRANS_CANCEL;
}
t->mode = TFM_TIME_SCALE;
t->transform = TimeScale;

View File

@@ -755,6 +755,8 @@ void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
void TRANSFORM_OT_transform(struct wmOperatorType *ot)
{
PropertyRNA *prop;
static EnumPropertyItem transform_mode_types[] = {
{TFM_INIT, "INIT", 0, "Init", ""},
{TFM_DUMMY, "DUMMY", 0, "Dummy", ""},
@@ -800,7 +802,8 @@ void TRANSFORM_OT_transform(struct wmOperatorType *ot)
ot->cancel = transform_cancel;
ot->poll = ED_operator_areaactive;
RNA_def_enum(ot->srna, "mode", transform_mode_types, 0, "Mode", "");
prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
RNA_def_float_vector(ot->srna, "value", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX);