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:
-rw-r--r--release/scripts/ui/space_userpref.py9
-rw-r--r--source/blender/editors/animation/anim_draw.c162
-rw-r--r--source/blender/editors/include/ED_anim_api.h3
-rw-r--r--source/blender/editors/interface/resources.c3
-rw-r--r--source/blender/editors/interface/view2d.c80
-rw-r--r--source/blender/editors/space_graph/graph_draw.c9
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h19
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c78
8 files changed, 222 insertions, 141 deletions
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index 1a85d8e999c..42b6b1d1a54 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -236,7 +236,14 @@ class USERPREF_PT_interface(bpy.types.Panel):
col.prop(view, "auto_perspective")
col.prop(view, "smooth_view")
col.prop(view, "rotation_angle")
-
+
+ col.separator()
+ col.separator()
+
+ col.label(text="2D Viewports:")
+ col.prop(view, "view2d_grid_minimum_spacing", text="Minimum Grid Spacing")
+ col.prop(view, "timecode_style")
+
row.separator()
row.separator()
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index decf507ae1f..2b7bccd6059 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -75,71 +75,147 @@
extern void ui_rasterpos_safe(float x, float y, float aspect);
/* *************************************************** */
-/* CURRENT FRAME DRAWING */
+/* TIME CODE FORMATTING */
-/* Draw current frame number in a little green box beside the current frame indicator */
-static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
+/* Generate timecode/frame number string and store in the supplied string
+ * - buffer: must be at least 13 chars long
+ * - power: special setting for View2D grid drawing,
+ * used to specify how detailed we need to be
+ * - timecodes: boolean specifying whether timecodes or
+ * frame numbers get drawn
+ * - cfra: time in frames or seconds, consistent with the values shown by timecodes
+ */
+// TODO: have this in kernel instead under scene?
+void ANIM_timecode_string_from_frame (char *str, Scene *scene, int power, short timecodes, float cfra)
{
- float xscale, yscale, x, y;
- char str[32];
- short slen;
-
- /* because the frame number text is subject to the same scaling as the contents of the view */
- UI_view2d_getscale(v2d, &xscale, &yscale);
- glScalef(1.0f/xscale, 1.0f, 1.0f);
-
- if (time) {
- /* Timecode:
- * - In general, minutes and seconds should be shown, as most clips will be
- * within this length. Hours will only be included if relevant.
- * - Only show frames when zoomed in enough for them to be relevant
- * (using separator of '!' for frames).
- * When showing frames, use slightly different display to avoid confusion with mm:ss format
- * TODO: factor into reusable function.
- * Meanwhile keep in sync:
- * source/blender/editors/animation/anim_draw.c
- * source/blender/editors/interface/view2d.c
- */
- float val= FRA2TIME(CFRA);
+ if (timecodes) {
int hours=0, minutes=0, seconds=0, frames=0;
+ float raw_seconds= cfra;
char neg[2]= "";
- /* get values */
- if (val < 0) {
- /* correction for negative values */
+ /* get cframes */
+ if (cfra < 0) {
+ /* correction for negative cfraues */
sprintf(neg, "-");
- val = -val;
+ cfra = -cfra;
}
- if (val >= 3600) {
+ if (cfra >= 3600) {
/* hours */
/* XXX should we only display a single digit for hours since clips are
* VERY UNLIKELY to be more than 1-2 hours max? However, that would
* go against conventions...
*/
- hours= (int)val / 3600;
- val= (float)fmod(val, 3600);
+ hours= (int)cfra / 3600;
+ cfra= (float)fmod(cfra, 3600);
}
- if (val >= 60) {
+ if (cfra >= 60) {
/* minutes */
- minutes= (int)val / 60;
- val= (float)fmod(val, 60);
+ minutes= (int)cfra / 60;
+ cfra= (float)fmod(cfra, 60);
}
- {
+ if (power <= 0) {
/* seconds + frames
* Frames are derived from 'fraction' of second. We need to perform some additional rounding
* to cope with 'half' frames, etc., which should be fine in most cases
*/
- seconds= (int)val;
- frames= (int)floor( ((val - seconds) * FPS) + 0.5f );
+ seconds= (int)cfra;
+ frames= (int)floor( ((cfra - seconds) * FPS) + 0.5f );
+ }
+ else {
+ /* seconds (with pixel offset rounding) */
+ seconds= (int)floor(cfra + 0.375f);
}
- /* print timecode to temp string buffer */
- if (hours) sprintf(str, " %s%02d:%02d:%02d!%02d", neg, hours, minutes, seconds, frames);
- else if (minutes) sprintf(str, " %s%02d:%02d!%02d", neg, minutes, seconds, frames);
- else sprintf(str, " %s%d!%02d", neg, seconds, frames);
+ switch (U.timecode_style) {
+ case USER_TIMECODE_MINIMAL:
+ {
+ /* - In general, minutes and seconds should be shown, as most clips will be
+ * within this length. Hours will only be included if relevant.
+ * - Only show frames when zoomed in enough for them to be relevant
+ * (using separator of '+' for frames).
+ * When showing frames, use slightly different display to avoid confusion with mm:ss format
+ */
+ if (power <= 0) {
+ /* include "frames" in display */
+ if (hours) sprintf(str, "%s%02d:%02d:%02d+%02d", neg, hours, minutes, seconds, frames);
+ else if (minutes) sprintf(str, "%s%02d:%02d+%02d", neg, minutes, seconds, frames);
+ else sprintf(str, "%s%d+%02d", neg, seconds, frames);
+ }
+ else {
+ /* don't include 'frames' in display */
+ if (hours) sprintf(str, "%s%02d:%02d:%02d", neg, hours, minutes, seconds);
+ else sprintf(str, "%s%02d:%02d", neg, minutes, seconds);
+ }
+ }
+ break;
+
+ case USER_TIMECODE_SMPTE_MSF:
+ {
+ /* reduced SMPTE format that always shows minutes, seconds, frames. Hours only shown as needed. */
+ if (hours) sprintf(str, "%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
+ else sprintf(str, "%s%02d:%02d:%02d", neg, minutes, seconds, frames);
+ }
+ break;
+
+ case USER_TIMECODE_MILLISECONDS:
+ {
+ /* reduced SMPTE. Instead of frames, milliseconds are shown */
+ int ms_dp= (power <= 0) ? (1 - power) : 1; /* precision of decimal part */
+ int s_pad= ms_dp+3; /* to get 2 digit whole-number part for seconds display (i.e. 3 is for 2 digits + radix, on top of full length) */
+
+ if (hours) sprintf(str, "%s%02d:%02d:%0*.*f", neg, hours, minutes, s_pad, ms_dp, cfra);
+ else sprintf(str, "%s%02d:%0*.*f", neg, minutes, s_pad, ms_dp, cfra);
+ }
+ break;
+
+ case USER_TIMECODE_SECONDS_ONLY:
+ {
+ /* only show the original seconds display */
+ /* round to whole numbers if power is >= 1 (i.e. scale is coarse) */
+ if (power <= 0) sprintf(str, "%.*f", 1-power, raw_seconds);
+ else sprintf(str, "%d", (int)floor(raw_seconds + 0.375f));
+ }
+ break;
+
+ case USER_TIMECODE_SMPTE_FULL:
+ default:
+ {
+ /* full SMPTE format */
+ sprintf(str, "%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
+ }
+ break;
+ }
+ }
+ else {
+ /* round to whole numbers if power is >= 1 (i.e. scale is coarse) */
+ if (power <= 0) sprintf(str, "%.*f", 1-power, cfra);
+ else sprintf(str, "%d", (int)floor(cfra + 0.375f));
}
- else
- sprintf(str, " %d", CFRA);
+}
+
+/* *************************************************** */
+/* CURRENT FRAME DRAWING */
+
+/* Draw current frame number in a little green box beside the current frame indicator */
+static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
+{
+ float xscale, yscale, x, y;
+ char str[32] = " t"; /* t is the character to start replacing from */
+ short slen;
+
+ /* because the frame number text is subject to the same scaling as the contents of the view */
+ UI_view2d_getscale(v2d, &xscale, &yscale);
+ glScalef(1.0f/xscale, 1.0f, 1.0f);
+
+ /* get timecode string
+ * - padding on str-buf passed so that it doesn't sit on the frame indicator
+ * - power = 0, gives 'standard' behaviour for time
+ * but power = 1 is required for frames (to get integer frames)
+ */
+ if (time)
+ ANIM_timecode_string_from_frame(&str[4], scene, 0, time, FRA2TIME(cfra));
+ else
+ ANIM_timecode_string_from_frame(&str[4], scene, 1, time, cfra);
slen= (short)UI_GetStringWidth(str) - 1;
/* get starting coordinates for drawing */
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 1b1b31ff704..47eeb476c4d 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -409,6 +409,9 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, st
/* DRAWING API */
/* anim_draw.c */
+/* Get string representing the given frame number as an appropriately represented frame or timecode */
+void ANIM_timecode_string_from_frame(char *str, struct Scene *scene, int power, short timecodes, float cfra);
+
/* ---------- Current Frame Drawing ---------------- */
/* flags for Current Frame Drawing */
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 8fa925a9c54..9468eb7a0c6 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1377,6 +1377,9 @@ void init_userdef_do_versions(void)
U.scrcastfps = 10;
U.scrcastwait = 50;
}
+ if (U.v2d_min_gridsize == 0) {
+ U.v2d_min_gridsize= 35;
+ }
/* funny name, but it is GE stuff, moves userdef stuff to engine */
// XXX space_set_commmandline_options();
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index b14dc5a03b6..7aabc147139 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -51,6 +51,7 @@
#include "BLF_api.h"
+#include "ED_anim_api.h"
#include "ED_screen.h"
#include "UI_interface.h"
@@ -1038,9 +1039,6 @@ void UI_view2d_view_restore(const bContext *C)
/* *********************************************************************** */
/* Gridlines */
-/* minimum pixels per gridstep */
-#define MINGRIDSTEP 35
-
/* View2DGrid is typedef'd in UI_view2d.h */
struct View2DGrid {
float dx, dy; /* stepsize (in pixels) between gridlines */
@@ -1131,7 +1129,7 @@ View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, sh
space= v2d->cur.xmax - v2d->cur.xmin;
pixels= (float)(v2d->mask.xmax - v2d->mask.xmin);
- grid->dx= (MINGRIDSTEP * space) / (seconddiv * pixels);
+ grid->dx= (U.v2d_min_gridsize * space) / (seconddiv * pixels);
step_to_grid(&grid->dx, &grid->powerx, xunits);
grid->dx *= seconddiv;
@@ -1147,7 +1145,7 @@ View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, sh
space= v2d->cur.ymax - v2d->cur.ymin;
pixels= (float)winy;
- grid->dy= MINGRIDSTEP * space / pixels;
+ grid->dy= U.v2d_min_gridsize * space / pixels;
step_to_grid(&grid->dy, &grid->powery, yunits);
if (yclamp == V2D_GRID_CLAMP) {
@@ -1192,7 +1190,7 @@ void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int f
vec2[1]= v2d->cur.ymax;
/* minor gridlines */
- step= (v2d->mask.xmax - v2d->mask.xmin + 1) / MINGRIDSTEP;
+ step= (v2d->mask.xmax - v2d->mask.xmin + 1) / U.v2d_min_gridsize;
UI_ThemeColor(TH_GRID);
for (a=0; a<step; a++) {
@@ -1226,7 +1224,7 @@ void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int f
vec1[0]= grid->startx;
vec2[0]= v2d->cur.xmax;
- step= (v2d->mask.ymax - v2d->mask.ymin + 1) / MINGRIDSTEP;
+ step= (v2d->mask.ymax - v2d->mask.ymin + 1) / U.v2d_min_gridsize;
UI_ThemeColor(TH_GRID);
for (a=0; a<=step; a++) {
@@ -1491,72 +1489,7 @@ static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, f
}
/* get string to print */
- if (unit == V2D_UNIT_SECONDS) {
- /* Timecode:
- * - In general, minutes and seconds should be shown, as most clips will be
- * within this length. Hours will only be included if relevant.
- * - Only show frames when zoomed in enough for them to be relevant
- * (using separator of '!' for frames).
- * When showing frames, use slightly different display to avoid confusion with mm:ss format
- * TODO: factor into reusable function.
- * Meanwhile keep in sync:
- * source/blender/editors/animation/anim_draw.c
- * source/blender/editors/interface/view2d.c
- */
- int hours=0, minutes=0, seconds=0, frames=0;
- char neg[2]= "";
-
- /* get values */
- if (val < 0) {
- /* correction for negative values */
- sprintf(neg, "-");
- val = -val;
- }
- if (val >= 3600) {
- /* hours */
- /* XXX should we only display a single digit for hours since clips are
- * VERY UNLIKELY to be more than 1-2 hours max? However, that would
- * go against conventions...
- */
- hours= (int)val / 3600;
- val= (float)fmod(val, 3600);
- }
- if (val >= 60) {
- /* minutes */
- minutes= (int)val / 60;
- val= (float)fmod(val, 60);
- }
- if (power <= 0) {
- /* seconds + frames
- * Frames are derived from 'fraction' of second. We need to perform some additional rounding
- * to cope with 'half' frames, etc., which should be fine in most cases
- */
- seconds= (int)val;
- frames= (int)floor( ((val - seconds) * FPS) + 0.5f );
- }
- else {
- /* seconds (with pixel offset) */
- seconds= (int)floor(val + 0.375f);
- }
-
- /* print timecode to temp string buffer */
- if (power <= 0) {
- /* include "frames" in display */
- if (hours) sprintf(str, "%s%02d:%02d:%02d!%02d", neg, hours, minutes, seconds, frames);
- else if (minutes) sprintf(str, "%s%02d:%02d!%02d", neg, minutes, seconds, frames);
- else sprintf(str, "%s%d!%02d", neg, seconds, frames);
- }
- else {
- /* don't include 'frames' in display */
- if (hours) sprintf(str, "%s%02d:%02d:%02d", neg, hours, minutes, seconds);
- else sprintf(str, "%s%02d:%02d", neg, minutes, seconds);
- }
- }
- else {
- /* round to whole numbers if power is >= 1 (i.e. scale is coarse) */
- if (power <= 0) sprintf(str, "%.*f", 1-power, val);
- else sprintf(str, "%d", (int)floor(val + 0.375f));
- }
+ ANIM_timecode_string_from_frame(str, scene, power, (unit == V2D_UNIT_SECONDS), val);
/* get length of string, and adjust printing location to fit it into the horizontal scrollbar */
len= strlen(str);
@@ -1753,7 +1686,6 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
val= grid->starty;
/* if vertical clamping (to whole numbers) is used (i.e. in Sequencer), apply correction */
- // XXX only relevant to Sequencer, so need to review this when we port that code
if (vs->yclamp == V2D_GRID_CLAMP)
fac += 0.5f * dfac;
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index b52fc1b9e6a..8642c2d15c5 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -491,11 +491,6 @@ static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar,
/* Curve ---------------- */
-/* minimum pixels per gridstep
- * XXX: defined in view2d.c - must keep these in sync or relocate to View2D header!
- */
-#define MINGRIDSTEP 35
-
/* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */
static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DGrid *grid)
{
@@ -523,10 +518,10 @@ static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, SpaceIpo *
* loop (i.e. too close to FLT_EPSILON), fall back to default of 0.001
*/
/* grid->dx is the first float in View2DGrid struct, so just cast to float pointer, and use it
- * It represents the number of 'frames' between gridlines, but we divide by MINGRIDSTEP to get pixels-steps
+ * It represents the number of 'frames' between gridlines, but we divide by U.v2d_min_gridsize to get pixels-steps
*/
// TODO: perhaps we should have 1.0 frames as upper limit so that curves don't get too distorted?
- samplefreq= *((float *)grid) / MINGRIDSTEP;
+ samplefreq= *((float *)grid) / U.v2d_min_gridsize;
if (IS_EQ(samplefreq, 0)) samplefreq= 0.001f;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 55eba879865..40de15ac012 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -291,7 +291,9 @@ typedef struct UserDef {
char sounddir[160];
char anim_player[240]; // FILE_MAX length
int anim_player_preset;
- int pad;
+
+ short v2d_min_gridsize; /* minimum spacing between gridlines in View2D grids */
+ short timecode_style; /* style of timecode display */
short versions;
short dbl_click_time;
@@ -496,6 +498,21 @@ extern UserDef U; /* from blenkernel blender.c */
#define USER_CP_SQUARE_HS 2
#define USER_CP_SQUARE_HV 3
+/* timecode display styles */
+ /* as little info as is necessary to show relevant info
+ * with '+' to denote the frames
+ * i.e. HH:MM:SS+FF, MM:SS+FF, SS+FF, or MM:SS
+ */
+#define USER_TIMECODE_MINIMAL 0
+ /* reduced SMPTE - (HH:)MM:SS:FF */
+#define USER_TIMECODE_SMPTE_MSF 1
+ /* full SMPTE - HH:MM:SS:FF */
+#define USER_TIMECODE_SMPTE_FULL 2
+ /* milliseconds for sub-frames - HH:MM:SS.sss */
+#define USER_TIMECODE_MILLISECONDS 3
+ /* seconds only */
+#define USER_TIMECODE_SECONDS_ONLY 4
+
/* theme drawtypes */
#define TH_MINIMAL 0
#define TH_ROUNDSHADED 1
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 22ab36d5b2a..d14dfd08d48 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -107,6 +107,40 @@ static void rna_userdef_autokeymode_set(PointerRNA *ptr,int value)
}
}
+static void rna_userdef_timecode_style_set(PointerRNA *ptr, int value)
+{
+ UserDef *userdef = (UserDef*)ptr->data;
+ int required_size = userdef->v2d_min_gridsize;
+
+ /* set the timecode style */
+ userdef->timecode_style= value;
+
+ /* adjust the v2d gridsize if needed so that timecodes don't overlap
+ * NOTE: most of these have been hand-picked to avoid overlaps while still keeping
+ * things from getting too blown out
+ */
+ switch (value) {
+ case USER_TIMECODE_MINIMAL:
+ case USER_TIMECODE_SECONDS_ONLY:
+ /* 35 is great most of the time, but not that great for full-blown */
+ required_size= 35;
+ break;
+ case USER_TIMECODE_SMPTE_MSF:
+ required_size= 50;
+ break;
+ case USER_TIMECODE_SMPTE_FULL:
+ /* the granddaddy! */
+ required_size= 65;
+ break;
+ case USER_TIMECODE_MILLISECONDS:
+ required_size= 45;
+ break;
+ }
+
+ if (U.v2d_min_gridsize < required_size)
+ U.v2d_min_gridsize= required_size;
+}
+
static PointerRNA rna_UserDef_view_get(PointerRNA *ptr)
{
return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesView, ptr->data);
@@ -1682,6 +1716,14 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna)
static void rna_def_userdef_view(BlenderRNA *brna)
{
+ static EnumPropertyItem timecode_styles[] = {
+ {USER_TIMECODE_MINIMAL, "MINIMAL", 0, "Minimal Info", "Most compact representation. Uses '+' as separator for sub-second frame numbers, with left and right truncation of the timecode as necessary."},
+ {USER_TIMECODE_SMPTE_FULL, "SMPTE", 0, "SMPTE (Full)", "Full SMPTE timecode. Format is HH:MM:SS:FF."},
+ {USER_TIMECODE_SMPTE_MSF, "SMPTE_COMPACT", 0, "SMPTE (Compact)", "SMPTE timecode showing minutes, seconds, and frames only. Hours are also shown if necessary, but not by default."},
+ {USER_TIMECODE_MILLISECONDS, "MILLISECONDS", 0, "Compact with Milliseconds", "Similar to SMPTE (Compact), except that instead of frames, milliseconds are shown instead."},
+ {USER_TIMECODE_SECONDS_ONLY, "SECONDS_ONLY", 0, "Only Seconds", "Direct conversion of frame numbers to seconds."},
+ {0, NULL, 0, NULL, NULL}};
+
PropertyRNA *prop;
StructRNA *srna;
@@ -1769,13 +1811,11 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Auto Depth", "Use the depth under the mouse to improve view pan/rotate/zoom functionality.");
/* view zoom */
-
prop= RNA_def_property(srna, "zoom_to_mouse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_TO_MOUSEPOS);
RNA_def_property_ui_text(prop, "Zoom To Mouse Position", "Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center.");
/* view rotation */
-
prop= RNA_def_property(srna, "auto_perspective", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_AUTOPERSP);
RNA_def_property_ui_text(prop, "Auto Perspective", "Automatically switch between orthographic and perspective when changing from top/front/side views.");
@@ -1783,17 +1823,8 @@ static void rna_def_userdef_view(BlenderRNA *brna)
prop= RNA_def_property(srna, "rotate_around_selection", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_SELECTION);
RNA_def_property_ui_text(prop, "Rotate Around Selection", "Use selection as the pivot point.");
-
- /* select with */
-
-
-
-
- prop= RNA_def_property(srna, "use_middle_mouse_paste", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MMB_PASTE);
- RNA_def_property_ui_text(prop, "Middle Mouse Paste", "In text window, paste with middle mouse button instead of panning.");
-
+ /* mini axis */
prop= RNA_def_property(srna, "show_mini_axis", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_ROTVIEWICON);
RNA_def_property_ui_text(prop, "Show Mini Axis", "Show a small rotating 3D axis in the bottom left corner of the 3D View.");
@@ -1812,9 +1843,10 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_userdef_update");
/* middle mouse button */
+ prop= RNA_def_property(srna, "use_middle_mouse_paste", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MMB_PASTE);
+ RNA_def_property_ui_text(prop, "Middle Mouse Paste", "In text window, paste with middle mouse button instead of panning.");
-
-
prop= RNA_def_property(srna, "wheel_invert_zoom", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_WHEELZOOMDIR);
RNA_def_property_ui_text(prop, "Wheel Invert Zoom", "Swap the Mouse Wheel zoom direction.");
@@ -1862,6 +1894,21 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_range(prop, 4, 10);
RNA_def_property_ui_text(prop, "Object Origin Size", "Diameter in Pixels for Object/Lamp origin display.");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* View2D Grid Displays */
+ prop= RNA_def_property(srna, "view2d_grid_minimum_spacing", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "v2d_min_gridsize");
+ RNA_def_property_range(prop, 1, 500); // XXX: perhaps the lower range should only go down to 5?
+ RNA_def_property_ui_text(prop, "2D View Minimum Grid Spacing", "Minimum number of pixels between each gridline in 2D Viewports");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ // TODO: add a setter for this, so that we can bump up the minimum size as necessary...
+ prop= RNA_def_property(srna, "timecode_style", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, timecode_styles);
+ RNA_def_property_enum_sdna(prop, NULL, "timecode_style");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_timecode_style_set", NULL);
+ RNA_def_property_ui_text(prop, "TimeCode Style", "Format of Time Codes displayed when not displaying timing in terms of frames.");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
}
static void rna_def_userdef_edit(BlenderRNA *brna)
@@ -1873,7 +1920,8 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
{AUTOKEY_MODE_NORMAL, "ADD_REPLACE_KEYS", 0, "Add/Replace", ""},
{AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""},
{0, NULL, 0, NULL, NULL}};
-
+
+ // XXX: we could just use the one that is defined in rna_curve.h
static EnumPropertyItem new_interpolation_types[] = {
{BEZT_IPO_CONST, "CONSTANT", 0, "Constant", ""},
{BEZT_IPO_LIN, "LINEAR", 0, "Linear", ""},