NLA SoC: Current Frame can now be negative
This commit is quite experimental, and might have to be reverted, but in quite a few places, the cleanups from this commit were already necessary. * I've left most of the image-handling functions alone, since I'm not sure how well they cope with negative indices. * Start/End frames cannot be negative for now... any specific reasons why they should be negative?
This commit is contained in:
@@ -83,10 +83,12 @@ static void change_frame_apply(bContext *C, wmOperator *op)
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
int cfra;
|
||||
|
||||
/* get frame, and clamp to MINFRAME */
|
||||
/* get frame, and clamp to MINAFRAME
|
||||
* - not MINFRAME, since it's useful to be able to key a few-frames back
|
||||
*/
|
||||
cfra= RNA_int_get(op->ptr, "frame");
|
||||
|
||||
if (cfra < MINFRAME) cfra= MINFRAME;
|
||||
if (cfra < MINAFRAME) cfra= MINAFRAME;
|
||||
CFRA= cfra;
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
|
||||
@@ -209,7 +211,7 @@ void ANIM_OT_change_frame(wmOperatorType *ot)
|
||||
ot->modal= change_frame_modal;
|
||||
|
||||
/* rna */
|
||||
RNA_def_int(ot->srna, "frame", 0, 1, MAXFRAME, "Frame", "", 1, MAXFRAME);
|
||||
RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
|
||||
}
|
||||
|
||||
/* ****************** set preview range operator ****************************/
|
||||
|
||||
@@ -642,7 +642,7 @@ static void actkeys_mselect_leftright (bAnimContext *ac, short leftright, short
|
||||
|
||||
memset(&bed, 0, sizeof(BeztEditFunc));
|
||||
if (leftright == ACTKEYS_LRSEL_LEFT) {
|
||||
bed.f1 = -MAXFRAMEF;
|
||||
bed.f1 = MINAFRAMEF;
|
||||
bed.f2 = (float)(CFRA + FRAME_CLICK_THRESH);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -193,7 +193,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
xco+=XIC;
|
||||
uiDefButI(block, NUM, B_NEWFRAME, "", (xco+20),yco,60,YIC, &(CTX_data_scene(C)->r.cfra), 1.0, MAXFRAMEF, 0, 0, "Displays Current Frame of animation. Click to change.");
|
||||
uiDefButI(block, NUM, B_NEWFRAME, "", (xco+20),yco,60,YIC, &(CTX_data_scene(C)->r.cfra), MINAFRAMEF, MAXFRAMEF, 0, 0, "Displays Current Frame of animation. Click to change.");
|
||||
xco+= 80;
|
||||
|
||||
/* always as last */
|
||||
|
||||
@@ -763,7 +763,7 @@ static void graphkeys_mselect_leftright (bAnimContext *ac, short leftright, shor
|
||||
|
||||
memset(&bed, 0, sizeof(BeztEditFunc));
|
||||
if (leftright == GRAPHKEYS_LRSEL_LEFT) {
|
||||
bed.f1 = -MAXFRAMEF;
|
||||
bed.f1 = MINAFRAMEF;
|
||||
bed.f2 = (float)(CFRA + 0.1f);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -501,7 +501,7 @@ static void nlaedit_mselect_leftright (bContext *C, bAnimContext *ac, short left
|
||||
|
||||
/* get range, and get the right flag-setting mode */
|
||||
if (leftright == NLAEDIT_LRSEL_LEFT) {
|
||||
xmin = -MAXFRAMEF;
|
||||
xmin = MINAFRAMEF;
|
||||
xmax = (float)(CFRA + FRAME_CLICK_THRESH);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -536,9 +536,12 @@ void time_header_buttons(const bContext *C, ARegion *ar)
|
||||
|
||||
xco += (short)(4.5 * XIC + 16);
|
||||
|
||||
/* MINAFRAMEF not MINFRAMEF, since MINAFRAMEF allows to set current frame negative
|
||||
* to facilitate easier keyframing in some situations
|
||||
*/
|
||||
uiDefButI(block, NUM, B_NEWFRAME, "",
|
||||
xco,yco, (int)3.5*XIC,YIC,
|
||||
&(scene->r.cfra), MINFRAMEF, MAXFRAMEF, 0, 0,
|
||||
&(scene->r.cfra), MINAFRAMEF, MAXFRAMEF, 0, 0,
|
||||
"Displays Current Frame of animation");
|
||||
|
||||
xco += (short)(3.5 * XIC + 16);
|
||||
|
||||
@@ -772,6 +772,10 @@ typedef struct Scene {
|
||||
#define MINFRAME 1
|
||||
#define MINFRAMEF 1.0f
|
||||
|
||||
/* (minimum frame number for current-frame) */
|
||||
#define MINAFRAME -300000
|
||||
#define MINAFRAMEF -300000.0f
|
||||
|
||||
/* depricate this! */
|
||||
#define TESTBASE(v3d, base) ( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0) )
|
||||
#define TESTBASELIB(v3d, base) ( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
|
||||
|
||||
@@ -729,13 +729,13 @@ static void rna_def_constraint_action(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "start");
|
||||
RNA_def_property_range(prop, MINFRAME, MAXFRAME);
|
||||
RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
|
||||
RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use.");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
|
||||
|
||||
prop= RNA_def_property(srna, "end_frame", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "end");
|
||||
RNA_def_property_range(prop, MINFRAME, MAXFRAME);
|
||||
RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
|
||||
RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use.");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
|
||||
|
||||
|
||||
@@ -506,7 +506,7 @@ static void rna_def_modifier_build(BlenderRNA *brna)
|
||||
RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
|
||||
|
||||
prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 1, MAXFRAMEF);
|
||||
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
|
||||
RNA_def_property_ui_text(prop, "Start", "Specify the start frame of the effect.");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
@@ -660,18 +660,18 @@ static void rna_def_modifier_wave(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "timeoffs");
|
||||
RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
|
||||
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
|
||||
RNA_def_property_ui_text(prop, "Time Offset", "Either the starting frame (for positive speed) or ending frame (for negative speed.)");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
|
||||
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
|
||||
RNA_def_property_ui_text(prop, "Lifetime", "");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "damping_time", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "damp");
|
||||
RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
|
||||
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
|
||||
RNA_def_property_ui_text(prop, "Damping Time", "");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value)
|
||||
}
|
||||
}
|
||||
else {
|
||||
CLAMP(value, -MAXFRAME, data->end);
|
||||
CLAMP(value, MINAFRAME, data->end);
|
||||
}
|
||||
data->start= value;
|
||||
}
|
||||
@@ -185,7 +185,7 @@ static void rna_NlaStrip_blend_out_set(PointerRNA *ptr, float value)
|
||||
static void rna_NlaStrip_action_start_frame_set(PointerRNA *ptr, float value)
|
||||
{
|
||||
NlaStrip *data= (NlaStrip*)ptr->data;
|
||||
CLAMP(value, -MAXFRAME, data->actend);
|
||||
CLAMP(value, MINAFRAME, data->actend);
|
||||
data->actstart= value;
|
||||
}
|
||||
|
||||
|
||||
@@ -1154,7 +1154,7 @@ static void rna_def_object(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "sf");
|
||||
RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
|
||||
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
|
||||
RNA_def_property_ui_text(prop, "Time Offset", "Animation offset in frames for IPO's and dupligroup instances.");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
|
||||
|
||||
|
||||
@@ -161,8 +161,8 @@ static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
|
||||
|
||||
if(settings->type==PART_REACTOR && value < 1.0)
|
||||
value = 1.0;
|
||||
else if (value < -30000.0f) //TODO: replace 30000 with MAXFRAMEF when available in 2.5
|
||||
value = -30000.0f;
|
||||
else if (value < MINAFRAMEF)
|
||||
value = MINAFRAMEF;
|
||||
|
||||
settings->sta = value;
|
||||
}
|
||||
@@ -1066,19 +1066,19 @@ static void rna_def_particle_settings(BlenderRNA *brna)
|
||||
/* general values */
|
||||
prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "sta");//optional if prop names are the same
|
||||
RNA_def_property_range(prop, -30000.0f, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
|
||||
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
|
||||
RNA_def_property_ui_text(prop, "Start", "Frame # to start emitting particles.");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
|
||||
|
||||
prop= RNA_def_property(srna, "end", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, -30000.0f, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
|
||||
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL);
|
||||
RNA_def_property_ui_text(prop, "End", "Frame # to stop emitting particles.");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
|
||||
|
||||
prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 1.0f, 30000.0f);
|
||||
RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
|
||||
RNA_def_property_ui_text(prop, "Lifetime", "Specify the life span of the particles");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
|
||||
|
||||
|
||||
@@ -960,7 +960,7 @@ void RNA_def_scene(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "current_frame", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "r.cfra");
|
||||
RNA_def_property_range(prop, MINFRAME, MAXFRAME);
|
||||
RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
|
||||
RNA_def_property_ui_text(prop, "Current Frame", "");
|
||||
RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_frame_update");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user