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>2010-02-18 03:29:08 +0300
committerJoshua Leung <aligorith@gmail.com>2010-02-18 03:29:08 +0300
commit21a2350248fd526b898186ff7f1e2f5bc7457efd (patch)
treec329babd5fb61a903ccb389243d21bd7cbf7e9a0
parent65cac9ae1392f9eeb00cf2154e9c154e7104ce6b (diff)
Animation Playback Option (No negative frames) and Other Bugfixes:
* Added a user-preference setting which disallows setting the current frame number to a negative number. This setting only applies when setting the current frame by scrubbing the time cursor in a timeline view, or by typing a value into the current frame number field. * Made the minimum frame number for the start frame to be 0, which should make setting keyframes by a regular step size less confusing. Also changed the MINFRAME define to 0 for consistency. Hopefully this doesn't cause any problems with any output formats. * Fixed some missing channel selection cases in animation editors.
-rw-r--r--release/scripts/ui/space_userpref.py5
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c8
-rw-r--r--source/blender/editors/animation/anim_ops.c1
-rw-r--r--source/blender/editors/space_nla/nla_channels.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c8
-rw-r--r--source/blender/makesdna/DNA_scene_types.h4
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h8
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c1
-rw-r--r--source/blender/makesrna/intern/rna_scene.c13
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c23
10 files changed, 55 insertions, 20 deletions
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index ec52dd38f1f..4e6e5212fd0 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -338,6 +338,11 @@ class USERPREF_PT_edit(bpy.types.Panel):
#col.prop(edit, "grease_pencil_simplify_stroke", text="Simplify Stroke")
col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
col.prop(edit, "grease_pencil_smooth_stroke", text="Smooth Stroke")
+ col.separator()
+ col.separator()
+ col.separator()
+ col.label(text="Playback:")
+ col.prop(edit, "use_negative_frames")
row.separator()
row.separator()
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 8c9495ac61e..26dd0285a2f 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -261,6 +261,8 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
case ANIMTYPE_DSMBALL:
case ANIMTYPE_DSARM:
case ANIMTYPE_DSMESH:
+ case ANIMTYPE_DSNTREE:
+ case ANIMTYPE_DSTEX:
{
if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
sel= ACHANNEL_SETFLAG_CLEAR;
@@ -342,6 +344,8 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
case ANIMTYPE_DSMBALL:
case ANIMTYPE_DSARM:
case ANIMTYPE_DSMESH:
+ case ANIMTYPE_DSNTREE:
+ case ANIMTYPE_DSTEX:
{
/* need to verify that this data is valid for now */
if (ale->adt) {
@@ -1742,8 +1746,6 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh
if (adt) adt->flag |= ADT_UI_SELECTED;
}
- /* xxx should be ED_base_object_activate(), but we need context pointer for that... */
- //set_active_base(base);
if ((adt) && (adt->flag & ADT_UI_SELECTED))
adt->flag |= ADT_UI_ACTIVE;
@@ -1762,6 +1764,8 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh
case ANIMTYPE_DSMBALL:
case ANIMTYPE_DSARM:
case ANIMTYPE_DSMESH:
+ case ANIMTYPE_DSNTREE:
+ case ANIMTYPE_DSTEX:
{
/* sanity checking... */
if (ale->adt) {
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 090df504b83..4e310e27c5f 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -81,6 +81,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
/* set the new frame number */
CFRA= RNA_int_get(op->ptr, "frame");
+ FRAMENUMBER_MIN_CLAMP(CFRA);
/* do updates */
sound_seek_scene(C);
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index c508ef079b9..9708e12e738 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -173,8 +173,6 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
if (adt) adt->flag |= ADT_UI_SELECTED;
}
- /* xxx should be ED_base_object_activate(), but we need context pointer for that... */
- //set_active_base(base);
if ((adt) && (adt->flag & ADT_UI_SELECTED))
adt->flag |= ADT_UI_ACTIVE;
@@ -195,6 +193,8 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
case ANIMTYPE_DSPART:
case ANIMTYPE_DSMBALL:
case ANIMTYPE_DSARM:
+ case ANIMTYPE_DSMESH:
+ case ANIMTYPE_DSTEX:
{
/* sanity checking... */
if (ale->adt) {
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index e9b277d509a..59051c7a894 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -2000,12 +2000,6 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
fly->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
-
- /* we have to rely on events to give proper mousecoords after a warp_pointer */
-//XXX2.5 warp_pointer(cent_orig[0], cent_orig[1]);
- //fly->mval[0]= (fly->sa->winx)/2;
- //fly->mval[1]= (fly->sa->winy)/2;
-
fly->mval[0] = event->x - fly->ar->winrct.xmin;
fly->mval[1] = event->y - fly->ar->winrct.ymin;
@@ -2578,7 +2572,7 @@ static int fly_modal(bContext *C, wmOperator *op, wmEvent *event)
if(event->type==TIMER && event->customdata == fly->timer)
flyApply(fly);
- if(fly->redraw) {;
+ if(fly->redraw) {
ED_region_tag_redraw(CTX_wm_region(C));
}
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index ef6202c5faa..c408fd69f4f 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -982,8 +982,8 @@ typedef struct Scene {
#define MAXFRAME 300000
#define MAXFRAMEF 300000.0f
-#define MINFRAME 1
-#define MINFRAMEF 1.0f
+#define MINFRAME 0
+#define MINFRAMEF 0.0f
/* (minimum frame number for current-frame) */
#define MINAFRAME -300000
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 436b52c9b8d..a2d18ed5d0a 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -405,6 +405,14 @@ extern UserDef U; /* from blenkernel blender.c */
#define USER_DRAGIMMEDIATE (1 << 21)
#define USER_DONT_DOSCRIPTLINKS (1 << 22)
#define USER_FILENOUI (1 << 23)
+#define USER_NONEGFRAMES (1 << 24)
+
+/* helper macro for checking frame clamping */
+#define FRAMENUMBER_MIN_CLAMP(cfra) \
+ { \
+ if ((U.flag & USER_NONEGFRAMES) && (cfra < 0)) \
+ cfra = 0; \
+ }
/* viewzom */
#define USER_ZOOM_CONT 0
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 7d171bc4054..d8c5c796fa3 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1175,6 +1175,7 @@ static void def_cmp_output_file(StructRNA *srna)
RNA_def_property_ui_text(prop, "Quality", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+ // TODO: should these be limited to the extents of the each other so that no cross-over occurs?
prop = RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "sfra");
RNA_def_property_range(prop, MINFRAMEF, MAXFRAMEF);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index dbc33691afd..a76df31d31f 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -230,10 +230,20 @@ static void rna_Scene_layer_update(Main *bmain, Scene *unused, PointerRNA *ptr)
ED_view3d_scene_layers_update(bmain, scene);
}
+static void rna_Scene_current_frame_set(PointerRNA *ptr, int value)
+{
+ Scene *data= (Scene*)ptr->data;
+
+ /* if negative frames aren't allowed, then we can't use them */
+ FRAMENUMBER_MIN_CLAMP(value);
+ data->r.cfra= value;
+}
+
static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
{
Scene *data= (Scene*)ptr->data;
- CLAMP(value, 1, data->r.efra);
+ /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
+ CLAMP(value, MINFRAME, data->r.efra);
data->r.sfra= value;
}
@@ -2648,6 +2658,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_int_sdna(prop, NULL, "r.cfra");
RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+ RNA_def_property_int_funcs(prop, NULL, "rna_Scene_current_frame_set", NULL);
RNA_def_property_ui_text(prop, "Current Frame", "");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_frame_update");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 732cbfb0086..7cb7e69f047 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2011,7 +2011,8 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
prop= RNA_def_property(srna, "drag_immediately", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_DRAGIMMEDIATE);
RNA_def_property_ui_text(prop, "Drag Immediately", "Moving things with a mouse drag doesn't require a click to confirm (Best for tablet users)");
-
+
+ /* Undo */
prop= RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "undosteps");
RNA_def_property_range(prop, 0, 64);
@@ -2026,7 +2027,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_GLOBALUNDO);
RNA_def_property_ui_text(prop, "Global Undo", "Global undo works by keeping a full copy of the file itself in memory, so takes extra memory");
- /* snap to grid */
+ /* snapping */
prop= RNA_def_property(srna, "snap_translate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOGRABGRID);
RNA_def_property_ui_text(prop, "Enable Translation Snap", "Snap objects and sub-objects to grid units when moving");
@@ -2038,7 +2039,8 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
prop= RNA_def_property(srna, "snap_scale", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOSIZEGRID);
RNA_def_property_ui_text(prop, "Enable Scaling Snap", "Snap objects and sub-objects to grid units when scaling");
-
+
+ /* auto keyframing */
prop= RNA_def_property(srna, "use_auto_keying", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
RNA_def_property_ui_text(prop, "Auto Keying Enable", "Automatic keyframe insertion for Objects and Bones");
@@ -2056,6 +2058,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set", "Automatic keyframe insertion using active Keying Set");
+ /* keyframing settings */
prop= RNA_def_property(srna, "keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTNEEDED);
RNA_def_property_ui_text(prop, "Keyframe Insert Needed", "Keyframe insertion only when keyframe needed");
@@ -2073,6 +2076,12 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "ipo_new");
RNA_def_property_ui_text(prop, "New Interpolation Type", "");
+ /* frame numbers */
+ prop= RNA_def_property(srna, "use_negative_frames", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_NONEGFRAMES);
+ RNA_def_property_ui_text(prop, "Allow Negative Frames", "Current frame number can be manually set to a negative value");
+
+ /* grease pencil */
prop= RNA_def_property(srna, "grease_pencil_manhattan_distance", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "gp_manhattendist");
RNA_def_property_range(prop, 0, 100);
@@ -2095,7 +2104,8 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "gp_eraser");
RNA_def_property_range(prop, 0, 100);
RNA_def_property_ui_text(prop, "Grease Pencil Eraser Radius", "Radius of eraser 'brush'");
-
+
+ /* duplication linking */
prop= RNA_def_property(srna, "duplicate_mesh", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_MESH);
RNA_def_property_ui_text(prop, "Duplicate Mesh", "Causes mesh data to be duplicated with the object");
@@ -2131,11 +2141,12 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
prop= RNA_def_property(srna, "duplicate_texture", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_TEX);
RNA_def_property_ui_text(prop, "Duplicate Texture", "Causes texture data to be duplicated with the object");
-
+
+ // xxx
prop= RNA_def_property(srna, "duplicate_fcurve", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_IPO);
RNA_def_property_ui_text(prop, "Duplicate F-Curve", "Causes F-curve data to be duplicated with the object");
-
+ // xxx
prop= RNA_def_property(srna, "duplicate_action", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_ACT);
RNA_def_property_ui_text(prop, "Duplicate Action", "Causes actions to be duplicated with the object");