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>2009-07-07 10:56:29 +0400
committerJoshua Leung <aligorith@gmail.com>2009-07-07 10:56:29 +0400
commit761241fcbbeb254cd78aca5f8bb62330ce9369ac (patch)
tree232414e27d3a0ec06d97bdb7ef49508ac9cf27ca /source/blender
parentdd42ad590ed4a620b0c70eb844d0cf341014b290 (diff)
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?
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/animation/anim_ops.c8
-rw-r--r--source/blender/editors/space_action/action_select.c2
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c2
-rw-r--r--source/blender/editors/space_graph/graph_select.c2
-rw-r--r--source/blender/editors/space_nla/nla_select.c2
-rw-r--r--source/blender/editors/space_time/time_header.c5
-rw-r--r--source/blender/makesdna/DNA_scene_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c4
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c8
-rw-r--r--source/blender/makesrna/intern/rna_nla.c4
-rw-r--r--source/blender/makesrna/intern/rna_object.c2
-rw-r--r--source/blender/makesrna/intern/rna_particle.c10
-rw-r--r--source/blender/makesrna/intern/rna_scene.c2
13 files changed, 32 insertions, 23 deletions
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index e899cc1d520..10691c558bf 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -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 ****************************/
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index d45e32dd3bb..5b87c04b311 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -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 {
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 7c622f172a2..99cc85d9a52 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -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 */
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 11af86ca83b..c855222df02 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -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 {
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index ca186dcf702..895d0dbf88a 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -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 {
diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c
index 29f31671670..da99849e594 100644
--- a/source/blender/editors/space_time/time_header.c
+++ b/source/blender/editors/space_time/time_header.c
@@ -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);
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 3549cdbe75f..6355e02a5e0 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -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))
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 5c4b6a95524..2a5df8f1488 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -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");
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 48bfdf70171..69d5c203abf 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -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");
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index dae1a611757..b0149d29e69 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -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;
}
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index ca2c9d072fb..b33c5e480b5 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -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");
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index d60a215b498..ba331efada1 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -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");
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 5f03b7167f4..2ad4a20f9a0 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -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");