View2D/TimeCode Drawing:

This commit introduces a few cleanups and tweaks to the way that timecodes (i.e. the timing indications used instead of frame numbers) get displayed.

1. Custom Spacing of TimeCodes/Gridlines
Made the minimum number of pixels between gridlines/timecode indications a user-preference, instead of being a hardcoded constant. This allows to set the spacing tighter/looser than the defaults, and is also used for the other changes.

2. Default timecode display style, (now named 'minimal') uses '+' as the delimeter for the sub-second frames. This hopefully makes it a bit clearer what those values represent, as opposed to the '!', which can sometimes look too much like a colon.

3. Added various timecode display styles as user-preference. - These include always displaying full SMPTE, to showing milliseconds instead of frams for sub-second times, and also an option to just show the times as seconds only.
- When changing the timecode style, the spacing setting is automatically modified so that the timecodes are spaced far apart enough so that they won't clash (under most circumstances). This automatic modification is only done if the spacing is too tight for the style being set.

4. Unified the code for generating timecode strings between the View2D scrollbar drawing and the current frame indicator drawing.
This commit is contained in:
2010-01-30 04:43:36 +00:00
parent d86a9da07c
commit e1fdf7fc58
8 changed files with 232 additions and 151 deletions

View File

@@ -236,7 +236,14 @@ class USERPREF_PT_interface(bpy.types.Panel):
col.prop(view, "auto_perspective") col.prop(view, "auto_perspective")
col.prop(view, "smooth_view") col.prop(view, "smooth_view")
col.prop(view, "rotation_angle") 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()
row.separator() row.separator()

View File

@@ -74,6 +74,125 @@
/* XXX */ /* XXX */
extern void ui_rasterpos_safe(float x, float y, float aspect); extern void ui_rasterpos_safe(float x, float y, float aspect);
/* *************************************************** */
/* TIME CODE FORMATTING */
/* 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)
{
if (timecodes) {
int hours=0, minutes=0, seconds=0, frames=0;
float raw_seconds= cfra;
char neg[2]= "";
/* get cframes */
if (cfra < 0) {
/* correction for negative cfraues */
sprintf(neg, "-");
cfra = -cfra;
}
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)cfra / 3600;
cfra= (float)fmod(cfra, 3600);
}
if (cfra >= 60) {
/* minutes */
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)cfra;
frames= (int)floor( ((cfra - seconds) * FPS) + 0.5f );
}
else {
/* seconds (with pixel offset rounding) */
seconds= (int)floor(cfra + 0.375f);
}
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));
}
}
/* *************************************************** */ /* *************************************************** */
/* CURRENT FRAME DRAWING */ /* CURRENT FRAME DRAWING */
@@ -81,65 +200,22 @@ extern void ui_rasterpos_safe(float x, float y, float aspect);
static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time) static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
{ {
float xscale, yscale, x, y; float xscale, yscale, x, y;
char str[32]; char str[32] = " t"; /* t is the character to start replacing from */
short slen; short slen;
/* because the frame number text is subject to the same scaling as the contents of the view */ /* because the frame number text is subject to the same scaling as the contents of the view */
UI_view2d_getscale(v2d, &xscale, &yscale); UI_view2d_getscale(v2d, &xscale, &yscale);
glScalef(1.0f/xscale, 1.0f, 1.0f); glScalef(1.0f/xscale, 1.0f, 1.0f);
if (time) { /* get timecode string
/* Timecode: * - padding on str-buf passed so that it doesn't sit on the frame indicator
* - In general, minutes and seconds should be shown, as most clips will be * - power = 0, gives 'standard' behaviour for time
* within this length. Hours will only be included if relevant. * but power = 1 is required for frames (to get integer frames)
* - Only show frames when zoomed in enough for them to be relevant */
* (using separator of '!' for frames). if (time)
* When showing frames, use slightly different display to avoid confusion with mm:ss format ANIM_timecode_string_from_frame(&str[4], scene, 0, time, FRA2TIME(cfra));
* TODO: factor into reusable function. else
* Meanwhile keep in sync: ANIM_timecode_string_from_frame(&str[4], scene, 1, time, cfra);
* source/blender/editors/animation/anim_draw.c
* source/blender/editors/interface/view2d.c
*/
float val= FRA2TIME(CFRA);
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);
}
{
/* 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 );
}
/* 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);
}
else
sprintf(str, " %d", CFRA);
slen= (short)UI_GetStringWidth(str) - 1; slen= (short)UI_GetStringWidth(str) - 1;
/* get starting coordinates for drawing */ /* get starting coordinates for drawing */

View File

@@ -409,6 +409,9 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, st
/* DRAWING API */ /* DRAWING API */
/* anim_draw.c */ /* 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 ---------------- */ /* ---------- Current Frame Drawing ---------------- */
/* flags for Current Frame Drawing */ /* flags for Current Frame Drawing */

View File

@@ -1377,6 +1377,9 @@ void init_userdef_do_versions(void)
U.scrcastfps = 10; U.scrcastfps = 10;
U.scrcastwait = 50; 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 */ /* funny name, but it is GE stuff, moves userdef stuff to engine */
// XXX space_set_commmandline_options(); // XXX space_set_commmandline_options();

View File

@@ -51,6 +51,7 @@
#include "BLF_api.h" #include "BLF_api.h"
#include "ED_anim_api.h"
#include "ED_screen.h" #include "ED_screen.h"
#include "UI_interface.h" #include "UI_interface.h"
@@ -1038,9 +1039,6 @@ void UI_view2d_view_restore(const bContext *C)
/* *********************************************************************** */ /* *********************************************************************** */
/* Gridlines */ /* Gridlines */
/* minimum pixels per gridstep */
#define MINGRIDSTEP 35
/* View2DGrid is typedef'd in UI_view2d.h */ /* View2DGrid is typedef'd in UI_view2d.h */
struct View2DGrid { struct View2DGrid {
float dx, dy; /* stepsize (in pixels) between gridlines */ 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; space= v2d->cur.xmax - v2d->cur.xmin;
pixels= (float)(v2d->mask.xmax - v2d->mask.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); step_to_grid(&grid->dx, &grid->powerx, xunits);
grid->dx *= seconddiv; 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; space= v2d->cur.ymax - v2d->cur.ymin;
pixels= (float)winy; pixels= (float)winy;
grid->dy= MINGRIDSTEP * space / pixels; grid->dy= U.v2d_min_gridsize * space / pixels;
step_to_grid(&grid->dy, &grid->powery, yunits); step_to_grid(&grid->dy, &grid->powery, yunits);
if (yclamp == V2D_GRID_CLAMP) { 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; vec2[1]= v2d->cur.ymax;
/* minor gridlines */ /* 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); UI_ThemeColor(TH_GRID);
for (a=0; a<step; a++) { 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; vec1[0]= grid->startx;
vec2[0]= v2d->cur.xmax; 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); UI_ThemeColor(TH_GRID);
for (a=0; a<=step; a++) { 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 */ /* get string to print */
if (unit == V2D_UNIT_SECONDS) { ANIM_timecode_string_from_frame(str, scene, power, (unit == V2D_UNIT_SECONDS), val);
/* 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));
}
/* get length of string, and adjust printing location to fit it into the horizontal scrollbar */ /* get length of string, and adjust printing location to fit it into the horizontal scrollbar */
len= strlen(str); len= strlen(str);
@@ -1753,7 +1686,6 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
val= grid->starty; val= grid->starty;
/* if vertical clamping (to whole numbers) is used (i.e. in Sequencer), apply correction */ /* 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) if (vs->yclamp == V2D_GRID_CLAMP)
fac += 0.5f * dfac; fac += 0.5f * dfac;

View File

@@ -491,11 +491,6 @@ static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar,
/* Curve ---------------- */ /* 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) */ /* 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) 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 * 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 /* 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? // 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; if (IS_EQ(samplefreq, 0)) samplefreq= 0.001f;

View File

@@ -291,7 +291,9 @@ typedef struct UserDef {
char sounddir[160]; char sounddir[160];
char anim_player[240]; // FILE_MAX length char anim_player[240]; // FILE_MAX length
int anim_player_preset; 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 versions;
short dbl_click_time; 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_HS 2
#define USER_CP_SQUARE_HV 3 #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 */ /* theme drawtypes */
#define TH_MINIMAL 0 #define TH_MINIMAL 0
#define TH_ROUNDSHADED 1 #define TH_ROUNDSHADED 1

View File

@@ -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) static PointerRNA rna_UserDef_view_get(PointerRNA *ptr)
{ {
return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesView, ptr->data); 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 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; PropertyRNA *prop;
StructRNA *srna; 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."); RNA_def_property_ui_text(prop, "Auto Depth", "Use the depth under the mouse to improve view pan/rotate/zoom functionality.");
/* view zoom */ /* view zoom */
prop= RNA_def_property(srna, "zoom_to_mouse", PROP_BOOLEAN, PROP_NONE); 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_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."); 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 */ /* view rotation */
prop= RNA_def_property(srna, "auto_perspective", PROP_BOOLEAN, PROP_NONE); prop= RNA_def_property(srna, "auto_perspective", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_AUTOPERSP); 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."); 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); 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_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_SELECTION);
RNA_def_property_ui_text(prop, "Rotate Around Selection", "Use selection as the pivot point."); RNA_def_property_ui_text(prop, "Rotate Around Selection", "Use selection as the pivot point.");
/* select with */
/* mini axis */
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, "show_mini_axis", PROP_BOOLEAN, PROP_NONE); 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_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."); 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"); RNA_def_property_update(prop, 0, "rna_userdef_update");
/* middle mouse button */ /* 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); 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_boolean_sdna(prop, NULL, "uiflag", USER_WHEELZOOMDIR);
RNA_def_property_ui_text(prop, "Wheel Invert Zoom", "Swap the Mouse Wheel zoom direction."); 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_range(prop, 4, 10);
RNA_def_property_ui_text(prop, "Object Origin Size", "Diameter in Pixels for Object/Lamp origin display."); 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"); 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) 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_NORMAL, "ADD_REPLACE_KEYS", 0, "Add/Replace", ""},
{AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""}, {AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}};
// XXX: we could just use the one that is defined in rna_curve.h
static EnumPropertyItem new_interpolation_types[] = { static EnumPropertyItem new_interpolation_types[] = {
{BEZT_IPO_CONST, "CONSTANT", 0, "Constant", ""}, {BEZT_IPO_CONST, "CONSTANT", 0, "Constant", ""},
{BEZT_IPO_LIN, "LINEAR", 0, "Linear", ""}, {BEZT_IPO_LIN, "LINEAR", 0, "Linear", ""},