Added the new Timeline Window, copied from Tuhopuu, coded by Matt Ebb.
Main change is that it's an own Space type now, not part of the Audio window... the audio window should restrict to own options. This way functionality is nicely separated. Since it's the first time I added a new space (since long!) I've made an extensive tutorial as well. You can find that here: http://www.blender3d.org/cms/Adding_new_Space_Window.557.0.html Notes for using timewindow; - Add time markers with MKey - CTRL+M gives option to name Marker - Markers cannot be moved yet... - Pageup-Pagedown keys moves current frame to next-prev Marker - Xkey removes Markers - If an object has Ipos or an Action, it draws key lines - CTRL+Pageup-Pagedown moves current frame to next-prev Key - Press S or E to set start/end frame for playback Notes about the implementation in Tuhopuu: - Add new Marker now selects new, deselects others - Selecting Marker didn't work like elsewhere in Blender, on click it should deselect all, except the indicated Marker. Not when holding SHIFT of course - Not exported functions are static now - Removed unused defines (MARKER_NONE NEXT_AVAIL) - Drawing order was confusing, doing too many matrix calls - Removed not needed scrollbar, added new function to draw time values. (Has advantage the MMB scroll works not confusing on a scrollbar) - Added proper support for 'frame mapping' - The string button (name Marker) had a bug (checked str[64] while str was only 64 long) - String button itself didn't allow "OK on enter" - Made frame buttons in header larger, the arrows overlapped - Removed support for negative frame values, that won't work so simple!
This commit is contained in:
@@ -179,6 +179,8 @@ typedef struct Global {
|
||||
#define G_DRAW_FACEAREA (1 << 23)
|
||||
#define G_DRAW_EDGEANG (1 << 24)
|
||||
|
||||
#define G_RECORDKEYS (1 << 25)
|
||||
|
||||
/* G.fileflags */
|
||||
|
||||
#define G_AUTOPACK_BIT 0
|
||||
|
||||
@@ -2042,6 +2042,36 @@ void make_cfra_list(Ipo *ipo, ListBase *elems)
|
||||
icu= icu->next;
|
||||
}
|
||||
}
|
||||
else if(ipo->blocktype==ID_AC) {
|
||||
icu= ipo->curve.first;
|
||||
while(icu) {
|
||||
if(icu->flag & IPO_VISIBLE) {
|
||||
switch(icu->adrcode) {
|
||||
case AC_LOC_X:
|
||||
case AC_LOC_Y:
|
||||
case AC_LOC_Z:
|
||||
case AC_SIZE_X:
|
||||
case AC_SIZE_Y:
|
||||
case AC_SIZE_Z:
|
||||
case AC_QUAT_W:
|
||||
case AC_QUAT_X:
|
||||
case AC_QUAT_Y:
|
||||
case AC_QUAT_Z:
|
||||
bezt= icu->bezt;
|
||||
if(bezt) {
|
||||
a= icu->totvert;
|
||||
while(a--) {
|
||||
add_to_cfra_elem(elems, bezt);
|
||||
bezt++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
icu= icu->next;
|
||||
}
|
||||
}
|
||||
|
||||
if(ipo->showkey==0) {
|
||||
/* deselect all keys */
|
||||
ce= elems->first;
|
||||
|
||||
@@ -147,6 +147,9 @@ void free_scene(Scene *sce)
|
||||
MEM_freeN(sce->r.qtcodecdata);
|
||||
sce->r.qtcodecdata = NULL;
|
||||
}
|
||||
|
||||
BLI_freelistN(&sce->markers);
|
||||
|
||||
if (sce->theDag) {
|
||||
free_forest(sce->theDag);
|
||||
MEM_freeN(sce->theDag);
|
||||
|
||||
@@ -2476,17 +2476,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
|
||||
|
||||
sce->radio= newdataadr(fd, sce->radio);
|
||||
|
||||
sce->r.avicodecdata = newdataadr(fd, sce->r.avicodecdata);
|
||||
if (sce->r.avicodecdata) {
|
||||
sce->r.avicodecdata->lpFormat = newdataadr(fd, sce->r.avicodecdata->lpFormat);
|
||||
sce->r.avicodecdata->lpParms = newdataadr(fd, sce->r.avicodecdata->lpParms);
|
||||
}
|
||||
|
||||
sce->r.qtcodecdata = newdataadr(fd, sce->r.qtcodecdata);
|
||||
if (sce->r.qtcodecdata) {
|
||||
sce->r.qtcodecdata->cdParms = newdataadr(fd, sce->r.qtcodecdata->cdParms);
|
||||
}
|
||||
|
||||
if(sce->ed) {
|
||||
ed= sce->ed= newdataadr(fd, sce->ed);
|
||||
|
||||
@@ -2598,6 +2587,19 @@ static void direct_link_scene(FileData *fd, Scene *sce)
|
||||
}
|
||||
|
||||
direct_link_scriptlink(fd, &sce->scriptlink);
|
||||
|
||||
sce->r.avicodecdata = newdataadr(fd, sce->r.avicodecdata);
|
||||
if (sce->r.avicodecdata) {
|
||||
sce->r.avicodecdata->lpFormat = newdataadr(fd, sce->r.avicodecdata->lpFormat);
|
||||
sce->r.avicodecdata->lpParms = newdataadr(fd, sce->r.avicodecdata->lpParms);
|
||||
}
|
||||
|
||||
sce->r.qtcodecdata = newdataadr(fd, sce->r.qtcodecdata);
|
||||
if (sce->r.qtcodecdata) {
|
||||
sce->r.qtcodecdata->cdParms = newdataadr(fd, sce->r.qtcodecdata->cdParms);
|
||||
}
|
||||
|
||||
link_list(fd, &(sce->markers));
|
||||
}
|
||||
|
||||
/* ************ READ SCREEN ***************** */
|
||||
|
||||
@@ -1082,6 +1082,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
|
||||
Sequence *seq;
|
||||
MetaStack *ms;
|
||||
Strip *strip;
|
||||
TimeMarker *marker;
|
||||
|
||||
sce= scebase->first;
|
||||
while(sce) {
|
||||
@@ -1156,6 +1157,13 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
|
||||
if (sce->r.qtcodecdata->cdParms) writedata(wd, DATA, sce->r.qtcodecdata->cdSize, sce->r.qtcodecdata->cdParms);
|
||||
}
|
||||
|
||||
/* writing dynamic list of TimeMarkers to the blend file */
|
||||
marker= sce->markers.first;
|
||||
while(marker){
|
||||
writestruct(wd, DATA, "TimeMarker", 1, marker);
|
||||
marker= marker->next;
|
||||
}
|
||||
|
||||
sce= sce->id.next;
|
||||
}
|
||||
/* flush helps the compression for undo-save */
|
||||
@@ -1271,6 +1279,9 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
|
||||
else if(sl->spacetype==SPACE_NLA){
|
||||
writestruct(wd, DATA, "SpaceNla", 1, sl);
|
||||
}
|
||||
else if(sl->spacetype==SPACE_TIME){
|
||||
writestruct(wd, DATA, "SpaceTime", 1, sl);
|
||||
}
|
||||
sl= sl->next;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,13 +49,13 @@ typedef enum {
|
||||
ICON_ACTION,
|
||||
ICON_NLA,
|
||||
ICON_SCRIPTWIN,
|
||||
ICON_VIEWMOVE,
|
||||
ICON_HOME,
|
||||
ICON_CLIPUV_DEHLT,
|
||||
ICON_CLIPUV_HLT,
|
||||
ICON_SOME_WACKY_VERTS_AND_LINES,
|
||||
ICON_A_WACKY_VERT_AND_SOME_LINES,
|
||||
ICON_VPAINT_COL,
|
||||
ICON_TIME,
|
||||
ICON_SPACE1,
|
||||
ICON_SPACE2,
|
||||
ICON_SPACE3,
|
||||
ICON_SPACE4,
|
||||
ICON_SPACE5,
|
||||
ICON_SPACE6,
|
||||
|
||||
ICON_ORTHO,
|
||||
ICON_PERSP,
|
||||
@@ -66,7 +66,7 @@ typedef enum {
|
||||
ICON_SOLID,
|
||||
ICON_SMOOTH,
|
||||
ICON_POTATO,
|
||||
ICON_BLANK2,
|
||||
ICON_MARKER_HLT,
|
||||
ICON_NORMALVIEW,
|
||||
ICON_LOCALVIEW,
|
||||
ICON_UNUSEDVIEW,
|
||||
@@ -96,14 +96,13 @@ typedef enum {
|
||||
ICON_ROTATECOLLECTION,
|
||||
ICON_ROTATECENTER,
|
||||
ICON_ALIGN,
|
||||
ICON_BLANK8,
|
||||
ICON_BLANK9,
|
||||
ICON_BLANK10,
|
||||
ICON_BLANK11,
|
||||
ICON_REC,
|
||||
ICON_PLAY,
|
||||
ICON_FF,
|
||||
ICON_REW,
|
||||
ICON_PYTHON,
|
||||
|
||||
|
||||
|
||||
ICON_DOTSUP,
|
||||
ICON_DOTSDOWN,
|
||||
ICON_MENU_PANEL,
|
||||
@@ -113,8 +112,8 @@ typedef enum {
|
||||
ICON_DRAW_UVFACES,
|
||||
ICON_STICKY_UVS,
|
||||
ICON_STICKY2_UVS,
|
||||
ICON_BLANK17,
|
||||
ICON_BLANK18,
|
||||
ICON_PREV_KEYFRAME,
|
||||
ICON_NEXT_KEYFRAME,
|
||||
ICON_ENVMAP,
|
||||
ICON_TRANSP_HLT,
|
||||
ICON_TRANSP_DEHLT,
|
||||
@@ -124,7 +123,7 @@ typedef enum {
|
||||
ICON_TPAINT_HLT,
|
||||
ICON_WPAINT_DEHLT,
|
||||
ICON_WPAINT_HLT,
|
||||
ICON_BLANK21,
|
||||
ICON_MARKER,
|
||||
|
||||
ICON_X,
|
||||
ICON_GO_LEFT,
|
||||
@@ -272,13 +271,13 @@ typedef enum {
|
||||
ICON_BLANK52,
|
||||
ICON_BLANK53,
|
||||
ICON_BLANK54,
|
||||
ICON_BLANK55,
|
||||
ICON_BLANK56,
|
||||
ICON_BLANK57,
|
||||
ICON_BLANK58,
|
||||
ICON_BLANK59,
|
||||
ICON_BLANK60,
|
||||
ICON_BLANK61,
|
||||
ICON_VIEWMOVE,
|
||||
ICON_HOME,
|
||||
ICON_CLIPUV_DEHLT,
|
||||
ICON_CLIPUV_HLT,
|
||||
ICON_SOME_WACKY_VERTS_AND_LINES,
|
||||
ICON_A_WACKY_VERT_AND_SOME_LINES,
|
||||
ICON_VPAINT_COL,
|
||||
|
||||
ICON_MAN_TRANS,
|
||||
ICON_MAN_ROT,
|
||||
|
||||
@@ -61,4 +61,5 @@ SpaceType *spacesound_get_type (void);
|
||||
SpaceType *spacetext_get_type (void);
|
||||
SpaceType *spacescript_get_type (void);
|
||||
SpaceType *spaceview3d_get_type (void);
|
||||
SpaceType *spacetime_get_type (void);
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ void test_view2d (struct View2D *v2d, int winx, int winy);
|
||||
void calc_scrollrcts (struct ScrArea *sa, struct View2D *v2d, int winx, int winy);
|
||||
|
||||
int in_ipo_buttons(void);
|
||||
void draw_view2d_numbers_horiz(int drawframes);
|
||||
void drawscroll(int disptype);
|
||||
void drawipospace(struct ScrArea *sa, void *spacedata);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define BSE_HEADERBUTTONS_H
|
||||
|
||||
struct uiBlock;
|
||||
struct ScrArea;
|
||||
struct ID;
|
||||
|
||||
/* these used to be in blender/src/headerbuttons.c: */
|
||||
@@ -85,6 +86,7 @@ void seq_buttons(void);
|
||||
void sound_buttons(void);
|
||||
void text_buttons(void);
|
||||
void script_buttons(void);
|
||||
void time_buttons(struct ScrArea *sa);
|
||||
void view3d_buttons(void);
|
||||
|
||||
void do_global_buttons(unsigned short event);
|
||||
@@ -103,6 +105,7 @@ void do_oops_buttons(short event);
|
||||
void do_seq_buttons(short event);
|
||||
void do_sound_buttons(unsigned short event);
|
||||
void do_text_buttons(unsigned short event);
|
||||
void do_time_buttons(struct ScrArea *sa, unsigned short event);
|
||||
void do_script_buttons(unsigned short event);
|
||||
void do_view3d_buttons(short event);
|
||||
|
||||
|
||||
47
source/blender/include/BSE_time.h
Normal file
47
source/blender/include/BSE_time.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef BSE_TIME_H
|
||||
#define BSE_TIME_H
|
||||
|
||||
|
||||
/* ******** Markers ********* */
|
||||
void add_timeline_marker(int frame);
|
||||
void remove_timeline_marker(void);
|
||||
void rename_timeline_marker(void);
|
||||
void select_timeline_markers(void);
|
||||
|
||||
void nextprev_timeline_key(short dir);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
#define MAXFRAME 30000
|
||||
#define MAXFRAMEF 30000.0f
|
||||
|
||||
#define MINFRAME 1
|
||||
#define MINFRAMEF 1.0
|
||||
|
||||
#define MAXLAMP 32765
|
||||
/* max length material array, 16 because of bits in matfrom */
|
||||
#define MAXPICKBUF 10000
|
||||
@@ -151,6 +154,8 @@
|
||||
#define B_TEXALONE 47
|
||||
#define B_MESHALONE 48
|
||||
#define B_CURVEALONE 49
|
||||
#define B_HEMESHALONE 50
|
||||
|
||||
/* EVENT < 50: alones en locals */
|
||||
|
||||
#define B_KEEPDATA 60
|
||||
@@ -159,6 +164,7 @@
|
||||
#define B_REDRCURW3D 63
|
||||
#define B_FLIPINFOMENU 64
|
||||
#define B_FLIPFULLSCREEN 65
|
||||
#define B_EASYTOOLBOX 66
|
||||
|
||||
|
||||
#define B_SHOWSPLASH 70
|
||||
@@ -223,6 +229,8 @@
|
||||
#define B_MAN_TRANS 161
|
||||
#define B_MAN_ROT 162
|
||||
#define B_MAN_SCALE 163
|
||||
#define B_HEMESHBROWSE 164
|
||||
#define B_HEMESHLOCAL 165
|
||||
|
||||
/* IPO: 200 */
|
||||
#define B_IPOHOME 201
|
||||
@@ -321,6 +329,7 @@
|
||||
#define B_TEXTSTORE 506
|
||||
#define B_TEXTLINENUM 507
|
||||
#define B_TAB_NUMBERS 508
|
||||
#define B_SYNTAX 509
|
||||
|
||||
/* SCRIPT: 525 */
|
||||
#define B_SCRIPTBROWSE 526
|
||||
@@ -340,7 +349,7 @@
|
||||
#define B_SOUNDHOME 653
|
||||
#define B_PACKSOUND 654
|
||||
|
||||
/* ACTION: 701 - 800 */
|
||||
/* ACTION: 701 - 750 */
|
||||
#define B_ACTHOME 701
|
||||
#define B_ACTCOPY 702
|
||||
#define B_ACTPASTE 703
|
||||
@@ -351,12 +360,23 @@
|
||||
#define B_ACTPIN 708
|
||||
#define B_ACTBAKE 709
|
||||
|
||||
#define B_NOTHING -1
|
||||
#define B_NOP -1
|
||||
/* TIME: 751 - 800 */
|
||||
#define B_TL_REW 751
|
||||
#define B_TL_PLAY 752
|
||||
#define B_TL_FF 753
|
||||
#define B_TL_PREVKEY 754
|
||||
#define B_TL_NEXTKEY 755
|
||||
|
||||
/* NLA: 801-900 */
|
||||
#define B_NLAHOME 801
|
||||
|
||||
/* FREE 900 - 999 */
|
||||
|
||||
|
||||
#define B_NOTHING -1
|
||||
#define B_NOP -1
|
||||
|
||||
|
||||
/* editbutflag */
|
||||
#define B_CLOCKWISE 1
|
||||
#define B_KEEPORIG 2
|
||||
|
||||
@@ -242,9 +242,10 @@
|
||||
#define REDRAWTEXT 0x402E
|
||||
#define REDRAWSOUND 0x402F
|
||||
#define REDRAWACTION 0x4030
|
||||
#define REDRAWBUTSCONSTRAINT 0x4034
|
||||
#define REDRAWNLA 0x4031
|
||||
#define REDRAWSCRIPT 0x4032
|
||||
#define REDRAWTIME 0x4033
|
||||
#define REDRAWBUTSCONSTRAINT 0x4034
|
||||
|
||||
#define ONLOAD_SCRIPT 0x4035
|
||||
|
||||
|
||||
@@ -237,11 +237,12 @@ int Crease(TransInfo *t, short mval[2]);
|
||||
struct ListBase;
|
||||
void count_bone_select(TransInfo *t, struct ListBase *lb, int *counter);
|
||||
|
||||
/* exported from transform_manipulator.c */
|
||||
/*********************** exported from transform_manipulator.c ********** */
|
||||
struct ScrArea;
|
||||
void draw_manipulator_ext(struct ScrArea *sa, int type, char axis, int col, float vec[3], float mat[][3]);
|
||||
int calc_manipulator_stats(struct ScrArea *sa);
|
||||
|
||||
/*********************** TransData Creation and General Handling */
|
||||
/*********************** TransData Creation and General Handling *********** */
|
||||
void createTransData(TransInfo *t);
|
||||
void sort_trans_data_dist(TransInfo *t);
|
||||
void clear_trans_object_base_flags(void);
|
||||
|
||||
@@ -114,7 +114,11 @@ typedef struct RenderData {
|
||||
short depth, attrib, rt1, rt2; /* standalone player */
|
||||
|
||||
short stereomode; /* standalone player stereo settings */
|
||||
short pad[3];
|
||||
|
||||
short dimensionspreset; /* for the dimensions presets menu */
|
||||
|
||||
short pad[2];
|
||||
|
||||
|
||||
short size, maximsize; /* size in %, max in Kb */
|
||||
/* from buttons: */
|
||||
@@ -243,6 +247,13 @@ typedef struct GameFraming {
|
||||
#define SCE_GAMEFRAMING_EXTEND 1
|
||||
#define SCE_GAMEFRAMING_SCALE 2
|
||||
|
||||
typedef struct TimeMarker {
|
||||
struct TimeMarker *next, *prev;
|
||||
int frame;
|
||||
char name[64];
|
||||
unsigned int flag;
|
||||
} TimeMarker;
|
||||
|
||||
typedef struct Scene {
|
||||
ID id;
|
||||
struct Object *camera;
|
||||
@@ -278,6 +289,8 @@ typedef struct Scene {
|
||||
|
||||
ScriptLink scriptlink;
|
||||
|
||||
ListBase markers;
|
||||
|
||||
/* none of the dependancy graph vars is mean to be saved */
|
||||
struct DagForest *theDag;
|
||||
short dagisvalid, dagflags;
|
||||
@@ -410,6 +423,7 @@ typedef struct Scene {
|
||||
#define AUDIO_SYNC 2
|
||||
#define AUDIO_SCRUB 4
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -162,7 +162,8 @@ enum {
|
||||
SPACE_SOUND,
|
||||
SPACE_ACTION,
|
||||
SPACE_NLA,
|
||||
SPACE_SCRIPT
|
||||
SPACE_SCRIPT,
|
||||
SPACE_TIME
|
||||
/* SPACE_LOGIC */
|
||||
};
|
||||
|
||||
|
||||
@@ -276,6 +276,20 @@ typedef struct SpaceScript {
|
||||
|
||||
} SpaceScript;
|
||||
|
||||
typedef struct SpaceTime {
|
||||
SpaceLink *next, *prev;
|
||||
int spacetype;
|
||||
float blockscale;
|
||||
struct ScrArea *area;
|
||||
|
||||
View2D v2d;
|
||||
|
||||
int flag, pad;
|
||||
|
||||
} SpaceTime;
|
||||
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
typedef struct OneSelectableIma {
|
||||
@@ -519,4 +533,10 @@ typedef struct SpaceImaSel {
|
||||
#define IMS_INFILE 3
|
||||
#define IMS_INFILESLI 4
|
||||
|
||||
/* time->flag */
|
||||
|
||||
#define TIME_DRAWFRAMES 1
|
||||
#define TIME_CFRA_NUM 2
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -113,6 +113,7 @@ typedef struct bTheme {
|
||||
ThemeSpace timasel;
|
||||
ThemeSpace text;
|
||||
ThemeSpace toops;
|
||||
ThemeSpace ttime;
|
||||
|
||||
} bTheme;
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ source_files = ['B.blend.c',
|
||||
'drawseq.c',
|
||||
'drawsound.c',
|
||||
'drawtext.c',
|
||||
'drawtime.c',
|
||||
'drawview.c',
|
||||
'edit.c',
|
||||
'editaction.c',
|
||||
@@ -66,6 +67,7 @@ source_files = ['B.blend.c',
|
||||
'editseq.c',
|
||||
'editsima.c',
|
||||
'editsound.c',
|
||||
'edittime.c',
|
||||
'editview.c',
|
||||
'eventdebug.c',
|
||||
'filesel.c',
|
||||
@@ -85,6 +87,7 @@ source_files = ['B.blend.c',
|
||||
'header_seq.c',
|
||||
'header_sound.c',
|
||||
'header_text.c',
|
||||
'header_time.c',
|
||||
'header_view3d.c',
|
||||
'imasel.c',
|
||||
'interface.c',
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1354,6 +1354,7 @@ void do_effects_panels(unsigned short event)
|
||||
case B_FRAMEMAP:
|
||||
G.scene->r.framelen= G.scene->r.framapto;
|
||||
G.scene->r.framelen/= G.scene->r.images;
|
||||
allqueue(REDRAWALL, 0);
|
||||
break;
|
||||
case B_NEWEFFECT:
|
||||
if(ob) {
|
||||
|
||||
@@ -1402,8 +1402,8 @@ void anim_panels()
|
||||
uiDefButS(block, NUM,REDRAWSEQ,"Sta:", 320,17,93,27,&G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "Specify the start frame of the animation");
|
||||
uiDefButS(block, NUM,REDRAWSEQ,"End:", 416,17,95,27,&G.scene->r.efra,1.0,MAXFRAMEF, 0, 0, "Specify the end frame of the animation");
|
||||
|
||||
uiDefButS(block, NUM,B_FRAMEMAP,"Map Old:", 320,69,93,22,&G.scene->r.framapto,1.0,900.0, 0, 0, "Specify old map value in frames");
|
||||
uiDefButS(block, NUM,B_FRAMEMAP,"Map New:", 416,69,95,22,&G.scene->r.images,1.0,900.0, 0, 0, "Specify new map value in frames");
|
||||
uiDefButS(block, NUM,B_FRAMEMAP,"Map Old:", 320,69,93,22,&G.scene->r.framapto,1.0,900.0, 0, 0, "Specify old mapping value in frames");
|
||||
uiDefButS(block, NUM,B_FRAMEMAP,"Map New:", 416,69,95,22,&G.scene->r.images,1.0,900.0, 0, 0, "Specify how many frames the Map Old will last");
|
||||
|
||||
uiDefButS(block, NUM,REDRAWSEQ,"Frs/sec:", 320,47,93,19, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ void calc_ipogrid()
|
||||
ipogrid_dx= IPOSTEP*space/pixels;
|
||||
step_to_grid(&ipogrid_dx, &ipomachtx);
|
||||
|
||||
if ELEM(curarea->spacetype, SPACE_SEQ, SPACE_SOUND) {
|
||||
if ELEM3(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME) {
|
||||
if(ipogrid_dx < 0.1) ipogrid_dx= 0.1;
|
||||
ipomachtx-= 2;
|
||||
if(ipomachtx<-2) ipomachtx= -2;
|
||||
@@ -185,7 +185,7 @@ void calc_ipogrid()
|
||||
ipogrid_dy= IPOSTEP*space/pixels;
|
||||
step_to_grid(&ipogrid_dy, &ipomachty);
|
||||
|
||||
if ELEM(curarea->spacetype, SPACE_SEQ, SPACE_SOUND) {
|
||||
if ELEM3(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME) {
|
||||
if(ipogrid_dy < 1.0) ipogrid_dy= 1.0;
|
||||
if(ipomachty<1) ipomachty= 1;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ void draw_ipogrid(void)
|
||||
|
||||
step= (G.v2d->mask.xmax-G.v2d->mask.xmin+1)/IPOSTEP;
|
||||
|
||||
if(curarea->spacetype==SPACE_SOUND) glColor3ub(0x70, 0x70, 0x60);
|
||||
if ELEM(curarea->spacetype, SPACE_SOUND, SPACE_TIME) glColor3ub(0x70, 0x70, 0x60);
|
||||
else BIF_ThemeColor(TH_GRID);
|
||||
|
||||
for(a=0; a<step; a++) {
|
||||
@@ -220,7 +220,7 @@ void draw_ipogrid(void)
|
||||
|
||||
vec2[0]= vec1[0]-= 0.5*ipogrid_dx;
|
||||
|
||||
if(curarea->spacetype==SPACE_SOUND) glColor3ub(0x80, 0x80, 0x70);
|
||||
if ELEM(curarea->spacetype, SPACE_SOUND, SPACE_TIME) glColor3ub(0x80, 0x80, 0x70);
|
||||
else BIF_ThemeColorShade(TH_GRID, 16);
|
||||
|
||||
step++;
|
||||
@@ -231,7 +231,8 @@ void draw_ipogrid(void)
|
||||
vec2[0]= vec1[0]-= ipogrid_dx;
|
||||
}
|
||||
|
||||
if(curarea->spacetype!=SPACE_SOUND && curarea->spacetype!=SPACE_ACTION && curarea->spacetype!=SPACE_NLA) {
|
||||
if ELEM4(curarea->spacetype, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME);
|
||||
else {
|
||||
vec1[0]= ipogrid_startx;
|
||||
vec1[1]= vec2[1]= ipogrid_starty;
|
||||
vec2[0]= G.v2d->cur.xmax;
|
||||
@@ -654,6 +655,38 @@ static void draw_solution(SpaceIpo *sipo)
|
||||
}
|
||||
}
|
||||
|
||||
/* used for drawing timeline */
|
||||
void draw_view2d_numbers_horiz(int drawframes)
|
||||
{
|
||||
float fac, fac2, dfac, val;
|
||||
|
||||
/* the numbers: convert ipogrid_startx and -dx to scroll coordinates */
|
||||
fac= (ipogrid_startx- G.v2d->cur.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
|
||||
fac= G.v2d->mask.xmin+fac*(G.v2d->mask.xmax-G.v2d->mask.xmin);
|
||||
|
||||
dfac= (ipogrid_dx)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
|
||||
dfac= dfac*(G.v2d->mask.xmax-G.v2d->mask.xmin);
|
||||
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
val= ipogrid_startx;
|
||||
while(fac < G.v2d->mask.xmax) {
|
||||
|
||||
if(drawframes) {
|
||||
ipomachtx= 1;
|
||||
scroll_prstr(fac, 2.0+(float)(G.v2d->mask.ymin), val, 'h', 0);
|
||||
}
|
||||
else {
|
||||
fac2= val/(float)G.scene->r.frs_sec;
|
||||
scroll_prstr(fac, 2.0+(float)(G.v2d->mask.ymin), fac2, 'h', 0);
|
||||
}
|
||||
|
||||
fac+= dfac;
|
||||
val+= ipogrid_dx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void drawscroll(int disptype)
|
||||
{
|
||||
rcti vert, hor;
|
||||
@@ -721,6 +754,18 @@ void drawscroll(int disptype)
|
||||
scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
|
||||
}
|
||||
}
|
||||
else if (curarea->spacetype==SPACE_TIME) {
|
||||
SpaceTime *stime= curarea->spacedata.first;
|
||||
|
||||
if(stime->flag & TIME_DRAWFRAMES) {
|
||||
ipomachtx= 1;
|
||||
scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
|
||||
}
|
||||
else {
|
||||
fac2= val/(float)G.scene->r.frs_sec;
|
||||
scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
|
||||
}
|
||||
@@ -1868,7 +1913,9 @@ int view2dzoom(unsigned short event)
|
||||
|
||||
G.v2d->cur.xmin+= dx;
|
||||
G.v2d->cur.xmax-= dx;
|
||||
if(curarea->spacetype!=SPACE_SEQ && curarea->spacetype!=SPACE_SOUND && curarea->spacetype!=SPACE_NLA && curarea->spacetype!=SPACE_ACTION) {
|
||||
|
||||
if ELEM5(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME);
|
||||
else {
|
||||
G.v2d->cur.ymin+= dy;
|
||||
G.v2d->cur.ymax-= dy;
|
||||
}
|
||||
@@ -1946,7 +1993,7 @@ int view2dmove(unsigned short event)
|
||||
/* test where mouse is */
|
||||
getmouseco_areawin(mvalo);
|
||||
|
||||
if ELEM6(curarea->spacetype, SPACE_IPO, SPACE_SEQ, SPACE_OOPS, SPACE_SOUND, SPACE_ACTION, SPACE_NLA)
|
||||
if ELEM7(curarea->spacetype, SPACE_IPO, SPACE_SEQ, SPACE_OOPS, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME)
|
||||
{
|
||||
if( BLI_in_rcti(&G.v2d->mask, (int)mvalo[0], (int)mvalo[1]) ) {
|
||||
facx= (G.v2d->cur.xmax-G.v2d->cur.xmin)/(float)(G.v2d->mask.xmax-G.v2d->mask.xmin);
|
||||
@@ -1979,8 +2026,8 @@ int view2dmove(unsigned short event)
|
||||
/* no x move in outliner */
|
||||
if(curarea->spacetype==SPACE_OOPS && G.v2d->scroll) facx= 0.0;
|
||||
|
||||
/* no y move in audio */
|
||||
if(curarea->spacetype==SPACE_SOUND) facy= 0.0;
|
||||
/* no y move in audio & time */
|
||||
if ELEM(curarea->spacetype, SPACE_SOUND, SPACE_TIME) facy= 0.0;
|
||||
|
||||
if(get_mbut() & mousebut && leftret) return 0;
|
||||
if(facx==0.0 && facy==0.0) return 1;
|
||||
|
||||
298
source/blender/src/drawtime.c
Normal file
298
source/blender/src/drawtime.c
Normal file
@@ -0,0 +1,298 @@
|
||||
/**
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_arithb.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_ipo_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_ipo.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_global.h"
|
||||
|
||||
#include "BIF_gl.h"
|
||||
#include "BIF_mywindow.h"
|
||||
#include "BIF_screen.h"
|
||||
#include "BIF_resources.h"
|
||||
|
||||
#include "BSE_drawipo.h"
|
||||
#include "BSE_view.h"
|
||||
#include "BMF_Api.h"
|
||||
|
||||
#include "blendef.h"
|
||||
|
||||
|
||||
static void draw_cfra_time(SpaceTime *stime)
|
||||
{
|
||||
float vec[2];
|
||||
|
||||
vec[0]= (G.scene->r.cfra);
|
||||
vec[0]*= G.scene->r.framelen;
|
||||
|
||||
vec[1]= G.v2d->cur.ymin;
|
||||
glColor3ub(0x60, 0xc0, 0x40); // no theme, should be global color once...
|
||||
glLineWidth(3.0);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
glVertex2fv(vec);
|
||||
vec[1]= G.v2d->cur.ymax;
|
||||
glVertex2fv(vec);
|
||||
glEnd();
|
||||
|
||||
glLineWidth(1.0);
|
||||
|
||||
if(stime->flag & TIME_CFRA_NUM) {
|
||||
short mval[2];
|
||||
float x, y;
|
||||
char str[32];
|
||||
/* little box with frame */
|
||||
|
||||
glFlush(); // huhh... without this glColor won't work for the text...
|
||||
getmouseco_areawin(mval);
|
||||
|
||||
if(mval[1]>curarea->winy-10) mval[1]= curarea->winy - 13;
|
||||
|
||||
if (curarea->winy < 25) {
|
||||
if (mval[1]<17) mval[1]= 17;
|
||||
} else if (mval[1]<22) mval[1]= 22;
|
||||
|
||||
areamouseco_to_ipoco(G.v2d, mval, &x, &y);
|
||||
|
||||
if(stime->flag & TIME_DRAWFRAMES)
|
||||
sprintf(str, " %d\n", (G.scene->r.cfra));
|
||||
else sprintf(str, " %.2f\n", (G.scene->r.cfra/(float)G.scene->r.frs_sec));
|
||||
|
||||
/* HACK! somehow the green color won't go away... */
|
||||
glColor4ub(0, 0, 0, 0);
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
|
||||
glRasterPos2f(x, y);
|
||||
BMF_DrawString(G.fonts, str);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void draw_markers_time(SpaceTime *stime)
|
||||
{
|
||||
TimeMarker *marker;
|
||||
float xpos, col[3];
|
||||
float xspace, yspace, xpixels, ypixels;
|
||||
|
||||
for(marker= G.scene->markers.first; marker; marker= marker->next) {
|
||||
xpos = marker->frame;
|
||||
/* no time correction for framelen! space is drawn with old values */
|
||||
|
||||
xspace= G.v2d->cur.xmax - G.v2d->cur.xmin;
|
||||
yspace= G.v2d->cur.ymax - G.v2d->cur.ymin;
|
||||
xpixels= G.v2d->mask.xmax-G.v2d->mask.xmin;
|
||||
ypixels= G.v2d->mask.ymax-G.v2d->mask.ymin;
|
||||
|
||||
/* 5 px to offset icon to align properly, space / pixels corrects for zoom */
|
||||
glRasterPos2f(xpos-(5.0*(xspace/xpixels)), 12.0*yspace/ypixels);
|
||||
|
||||
BIF_GetThemeColor3fv(TH_BACK, col);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if(marker->flag & SELECT)
|
||||
BIF_draw_icon_blended(ICON_MARKER_HLT, (int)col, 0);
|
||||
else
|
||||
BIF_draw_icon_blended(ICON_MARKER, (int)col, 0);
|
||||
|
||||
glBlendFunc(GL_ONE, GL_ZERO);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
/* and the marker name too, shifted slightly to the top-right */
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
glRasterPos2f(xpos+(4.0*(xspace/xpixels)), 17.0*yspace/ypixels);
|
||||
|
||||
BMF_DrawString(G.font, marker->name);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_sfra_efra()
|
||||
{
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
glColor4ub(0, 0, 0, 25);
|
||||
|
||||
if (G.scene->r.sfra < G.scene->r.efra) {
|
||||
glRectf(G.v2d->cur.xmin, G.v2d->cur.ymin, G.scene->r.sfra, G.v2d->cur.ymax);
|
||||
|
||||
glRectf(G.scene->r.efra, G.v2d->cur.ymin, G.v2d->cur.xmax, G.v2d->cur.ymax);
|
||||
} else {
|
||||
glRectf(G.v2d->cur.xmin, G.v2d->cur.ymin, G.v2d->cur.xmax, G.v2d->cur.ymax);
|
||||
}
|
||||
|
||||
glColor4ub(0, 0, 0, 90);
|
||||
/* thin lines where the actual frames are */
|
||||
fdrawline(G.scene->r.sfra, G.v2d->cur.ymin, G.scene->r.sfra, G.v2d->cur.ymax);
|
||||
fdrawline(G.scene->r.efra, G.v2d->cur.ymin, G.scene->r.efra, G.v2d->cur.ymax);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
/*draw all the keys in a list (elems) as lines */
|
||||
static void draw_key_list(ListBase elems, char col[3])
|
||||
{
|
||||
CfraElem *ce;
|
||||
float drawframe;
|
||||
|
||||
ce= elems.first;
|
||||
while(ce) {
|
||||
drawframe = ce->cfra; //not correct for G.scene->r.framelen;
|
||||
glColor3ub(col[0], col[1], col[2]);
|
||||
|
||||
fdrawline(drawframe, G.v2d->cur.ymin, drawframe, G.v2d->cur.ymax);
|
||||
|
||||
ce= ce->next;
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_ob_keys()
|
||||
{
|
||||
/*mostly copied from drawobject.c, draw_object() */
|
||||
Object *ob;
|
||||
bActionChannel *achan;
|
||||
bAction *act;
|
||||
int ipoflag;
|
||||
char col[3];
|
||||
|
||||
if (OBACT) {
|
||||
ob = OBACT;
|
||||
|
||||
if(ob) {
|
||||
if(ob!=G.obedit) {
|
||||
if(ob->ipo) {
|
||||
/* convert the ipo to a list of 'current frame elements' */
|
||||
ListBase elems;
|
||||
|
||||
elems.first= elems.last= NULL;
|
||||
make_cfra_list(ob->ipo, &elems);
|
||||
|
||||
/* disable time offset for the purposes of drawing the frame ticks */
|
||||
ipoflag= ob->ipoflag;
|
||||
ob->ipoflag &= ~OB_OFFS_OB;
|
||||
|
||||
set_no_parent_ipo(1);
|
||||
disable_speed_curve(1);
|
||||
|
||||
/* draw the list of current frame elements */
|
||||
col[0] = 0xDD; col[1] = 0xD7; col[2] = 0x00;
|
||||
draw_key_list(elems, col);
|
||||
|
||||
set_no_parent_ipo(0);
|
||||
disable_speed_curve(0);
|
||||
|
||||
ob->ipoflag= ipoflag;
|
||||
|
||||
BLI_freelistN(&elems);
|
||||
}
|
||||
|
||||
if(ob->action) {
|
||||
act = ob->action;
|
||||
|
||||
/* go through each channel in the action */
|
||||
for (achan=act->chanbase.first; achan; achan=achan->next){
|
||||
/* convert the ipo to a list of 'current frame elements' */
|
||||
ListBase elems;
|
||||
|
||||
elems.first= elems.last= NULL;
|
||||
make_cfra_list(achan->ipo, &elems);
|
||||
|
||||
col[0] = 0x00; col[1] = 0x82; col[2] = 0x8B;
|
||||
draw_key_list(elems, col);
|
||||
|
||||
BLI_freelistN(&elems);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawtimespace(ScrArea *sa, void *spacedata)
|
||||
{
|
||||
SpaceTime *stime= sa->spacedata.first;
|
||||
float col[3];
|
||||
|
||||
BIF_GetThemeColor3fv(TH_BACK, col);
|
||||
glClearColor(col[0], col[1], col[2], 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
calc_scrollrcts(sa, &(stime->v2d), curarea->winx, curarea->winy);
|
||||
|
||||
myortho2(stime->v2d.cur.xmin, stime->v2d.cur.xmax, stime->v2d.cur.ymin, stime->v2d.cur.ymax);
|
||||
|
||||
/* draw darkened area outside of active timeline */
|
||||
draw_sfra_efra();
|
||||
|
||||
/* boundbox_seq(); */
|
||||
calc_ipogrid();
|
||||
draw_ipogrid();
|
||||
|
||||
draw_cfra_time(spacedata);
|
||||
draw_ob_keys();
|
||||
draw_markers_time(spacedata);
|
||||
|
||||
/* restore viewport */
|
||||
mywinset(curarea->win);
|
||||
|
||||
/* ortho at pixel level curarea */
|
||||
myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
|
||||
|
||||
/* the bottom with time values */
|
||||
BIF_ThemeColor(TH_HEADER);
|
||||
glRectf(0.0f, 0.0f, (float)curarea->winx, 12.0f);
|
||||
BIF_ThemeColorShade(TH_HEADER, 50);
|
||||
fdrawline(0.0f, 12.0f, (float)curarea->winx, 12.0f);
|
||||
draw_view2d_numbers_horiz(stime->flag & TIME_DRAWFRAMES);
|
||||
|
||||
draw_area_emboss(sa);
|
||||
curarea->win_swap= WIN_BACK_OK;
|
||||
}
|
||||
@@ -4384,9 +4384,7 @@ void nextkey(ListBase *elems, int dir)
|
||||
|
||||
static int float_to_frame (float frame)
|
||||
{
|
||||
int to= (int) frame;
|
||||
|
||||
if (frame-to>0.5) to++;
|
||||
int to= (int) round( frame/G.scene->r.framelen );
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
@@ -700,7 +700,7 @@ void add_primitiveMesh(int type)
|
||||
eve= eve->next;
|
||||
}
|
||||
dia= G.vd->grid;
|
||||
/* one segment first: de X as */
|
||||
/* one segment first: the X axis */
|
||||
phi= 1.0;
|
||||
phid= 2.0/((float)tot-1);
|
||||
for(a=0;a<tot;a++) {
|
||||
@@ -710,7 +710,9 @@ void add_primitiveMesh(int type)
|
||||
Mat3MulVecfl(imat,vec);
|
||||
eve= addvertlist(vec);
|
||||
eve->f= 1+2+4;
|
||||
if (a) addedgelist(eve->prev, eve, NULL);
|
||||
if (a) {
|
||||
addedgelist(eve->prev, eve, NULL);
|
||||
}
|
||||
phi-=phid;
|
||||
}
|
||||
/* extrude and translate */
|
||||
|
||||
@@ -993,7 +993,7 @@ short extrudeflag_vert(short flag, float *nor)
|
||||
|
||||
/* if *one* selected face has edge with unselected face; remove old selected faces */
|
||||
for(efa= em->faces.last; efa; efa= efa->prev) {
|
||||
if(efa->f & SELECT) {
|
||||
if(faceselectedAND(efa, flag)) {
|
||||
if(efa->e1->f1==2 || efa->e2->f1==2 || efa->e3->f1==2 || (efa->e4 && efa->e4->f1==2)) {
|
||||
del_old= 1;
|
||||
break;
|
||||
|
||||
@@ -320,6 +320,12 @@ void areawinset(short win)
|
||||
G.snla= curarea->spacedata.first;
|
||||
G.v2d= &G.snla->v2d;
|
||||
break;
|
||||
case SPACE_TIME:
|
||||
{
|
||||
SpaceTime *stime= curarea->spacedata.first;
|
||||
G.v2d= &stime->v2d;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -387,6 +393,7 @@ void scrarea_do_headdraw(ScrArea *area)
|
||||
case SPACE_SOUND: sound_buttons(); break;
|
||||
case SPACE_ACTION: action_buttons(); break;
|
||||
case SPACE_NLA: nla_buttons(); break;
|
||||
case SPACE_TIME: time_buttons(area); break;
|
||||
}
|
||||
|
||||
//glScissor(area->winrct.xmin, area->winrct.xmax, area->winx, area->winy);
|
||||
|
||||
479
source/blender/src/edittime.c
Normal file
479
source/blender/src/edittime.c
Normal file
@@ -0,0 +1,479 @@
|
||||
/**
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_arithb.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_ipo_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BKE_ipo.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_library.h"
|
||||
|
||||
#include "BIF_space.h"
|
||||
#include "BIF_screen.h"
|
||||
#include "BIF_interface.h"
|
||||
#include "BIF_toolbox.h"
|
||||
#include "BIF_mywindow.h"
|
||||
|
||||
#include "BSE_drawipo.h"
|
||||
#include "BSE_headerbuttons.h"
|
||||
#include "BSE_time.h"
|
||||
|
||||
#include "blendef.h"
|
||||
|
||||
#include "mydevice.h"
|
||||
|
||||
#include "PIL_time.h"
|
||||
|
||||
/* ************* Timeline marker code **************** */
|
||||
|
||||
/* add TimeMarker at curent frame */
|
||||
void add_timeline_marker(int frame)
|
||||
{
|
||||
TimeMarker *marker;
|
||||
|
||||
/* two markers can't be at the same place */
|
||||
for(marker= G.scene->markers.first; marker; marker= marker->next)
|
||||
if(marker->frame == frame) return;
|
||||
/* deselect all */
|
||||
for(marker= G.scene->markers.first; marker; marker= marker->next)
|
||||
marker->flag &= ~SELECT;
|
||||
|
||||
marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
|
||||
marker->flag= SELECT;
|
||||
marker->frame= frame;
|
||||
BLI_addtail(&(G.scene->markers), marker);
|
||||
}
|
||||
|
||||
/* remove TimeMarker */
|
||||
void remove_timeline_marker(void)
|
||||
{
|
||||
TimeMarker *marker;
|
||||
|
||||
for(marker= G.scene->markers.first; marker; marker= marker->next) {
|
||||
if(marker->flag & SELECT){
|
||||
BLI_freelinkN(&G.scene->markers, marker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* rename first selected TimeMarker */
|
||||
void rename_timeline_marker(void)
|
||||
{
|
||||
TimeMarker *marker;
|
||||
char name[64];
|
||||
|
||||
for(marker= G.scene->markers.first; marker; marker= marker->next) {
|
||||
if(marker->flag & SELECT) {
|
||||
sprintf(name, marker->name);
|
||||
if (sbutton(name, 0, sizeof(name)-1, "Name: "))
|
||||
BLI_strncpy(marker->name, name, sizeof(marker->name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int find_nearest_marker(float dx)
|
||||
{
|
||||
TimeMarker *marker, *nearest= NULL;
|
||||
float dist, min_dist= 1000000;
|
||||
|
||||
for(marker= G.scene->markers.first; marker; marker= marker->next) {
|
||||
dist = ABS((float)marker->frame - dx);
|
||||
if(dist < min_dist){
|
||||
min_dist= dist;
|
||||
nearest= marker;
|
||||
}
|
||||
}
|
||||
|
||||
if(nearest) return nearest->frame;
|
||||
else return (int)floor(dx);
|
||||
}
|
||||
|
||||
/* select/deselect TimeMarker at current frame */
|
||||
static void select_timeline_marker_frame(int frame, unsigned char shift)
|
||||
{
|
||||
TimeMarker *marker;
|
||||
|
||||
for(marker= G.scene->markers.first; marker; marker= marker->next) {
|
||||
/* if Shift is not set, then deselect Markers */
|
||||
if(!shift) marker->flag &= ~SELECT;
|
||||
/* this way a not-shift select will allways give 1 selected marker */
|
||||
if(marker->frame == frame) {
|
||||
if(marker->flag & SELECT)
|
||||
marker->flag &= ~SELECT;
|
||||
else
|
||||
marker->flag |= SELECT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* select/deselect all TimeMarkers */
|
||||
void select_timeline_markers(void)
|
||||
{
|
||||
TimeMarker *marker;
|
||||
char any_selected= 0;
|
||||
|
||||
for(marker= G.scene->markers.first; marker; marker= marker->next) {
|
||||
if(marker->flag & SELECT) any_selected= 1;
|
||||
marker->flag &= ~SELECT;
|
||||
}
|
||||
|
||||
/* no TimeMarker selected, then select all TimeMarkers */
|
||||
if(!any_selected){
|
||||
for(marker= G.scene->markers.first; marker; marker= marker->next) {
|
||||
marker->flag |= SELECT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nextprev_timeline_marker(int dir)
|
||||
{
|
||||
TimeMarker *marker, *cur=NULL, *first, *last;
|
||||
int mindist= MAXFRAME, dist;
|
||||
|
||||
first= last= G.scene->markers.first;
|
||||
for(marker= G.scene->markers.first; marker; marker= marker->next) {
|
||||
/* find closest to current frame first */
|
||||
dist= (marker->frame/G.scene->r.framelen) - CFRA;
|
||||
if(dir==1 && dist>0 && dist<mindist) {
|
||||
mindist= dist;
|
||||
cur= marker;
|
||||
}
|
||||
else if(dir==-1 && dist<0 && -dist<mindist) {
|
||||
mindist= -dist;
|
||||
cur= marker;
|
||||
}
|
||||
/* find first/last */
|
||||
if(marker->frame > last->frame) last= marker;
|
||||
if(marker->frame < first->frame) first= marker;
|
||||
}
|
||||
|
||||
if(cur==NULL) {
|
||||
if(dir==1) cur= first;
|
||||
else cur= last;
|
||||
}
|
||||
if(cur) {
|
||||
CFRA= cur->frame/G.scene->r.framelen;
|
||||
update_for_newframe();
|
||||
allqueue(REDRAWALL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* *********** end Markers *************** */
|
||||
|
||||
static int float_to_frame(float frame)
|
||||
{
|
||||
int to= (int) round( frame/G.scene->r.framelen );
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
void nextprev_timeline_key(short dir)
|
||||
{
|
||||
/*mostly copied from drawobject.c, draw_object() AND editipo.c, movekey_obipo() */
|
||||
Object *ob;
|
||||
bActionChannel *achan;
|
||||
bAction *act;
|
||||
CfraElem *ce;
|
||||
int a;
|
||||
float toframe= CFRA;
|
||||
|
||||
if (OBACT) {
|
||||
ob = OBACT;
|
||||
|
||||
if(ob) {
|
||||
if(ob!=G.obedit) {
|
||||
if(ob->ipo) {
|
||||
/* convert the ipo to a list of 'current frame elements' */
|
||||
ListBase elems;
|
||||
|
||||
elems.first= elems.last= 0;
|
||||
make_cfra_list(ob->ipo, &elems);
|
||||
|
||||
/* disable time offset for the purposes of drawing the frame ticks */
|
||||
/* ipoflag= ob->ipoflag;
|
||||
ob->ipoflag &= ~OB_OFFS_OB;
|
||||
|
||||
set_no_parent_ipo(1);
|
||||
disable_speed_curve(1); */
|
||||
|
||||
/* go through the list and decide if we can find a new keyframe to visit */
|
||||
if(elems.first) {
|
||||
ce= elems.first;
|
||||
if (dir==-1) {
|
||||
while (ce && float_to_frame(ce->cfra)<CFRA) {
|
||||
toframe= ce->cfra;
|
||||
ce= ce->next;
|
||||
}
|
||||
} else {
|
||||
while (ce && float_to_frame(ce->cfra)<=CFRA) {
|
||||
ce= ce->next;
|
||||
}
|
||||
if (ce) toframe= ce->cfra;
|
||||
}
|
||||
}
|
||||
/*set_no_parent_ipo(0);
|
||||
disable_speed_curve(0);
|
||||
|
||||
ob->ipoflag= ipoflag; */
|
||||
BLI_freelistN(&elems);
|
||||
}
|
||||
|
||||
if(ob->action) {
|
||||
act = ob->action;
|
||||
/* go through each channel in the action */
|
||||
for (achan=act->chanbase.first; achan; achan=achan->next){
|
||||
/* convert the ipo to a list of 'current frame elements' */
|
||||
ListBase elems;
|
||||
|
||||
elems.first= elems.last= 0;
|
||||
make_cfra_list(achan->ipo, &elems);
|
||||
|
||||
/* go through the list and decide if we can find a new keyframe to visit */
|
||||
if(elems.first) {
|
||||
ce= elems.first;
|
||||
if (dir==-1) {
|
||||
while (ce && float_to_frame(ce->cfra)<CFRA) {
|
||||
if ((ce->cfra > toframe) || (toframe == CFRA)) {
|
||||
toframe= ce->cfra;
|
||||
}
|
||||
ce= ce->next;
|
||||
}
|
||||
} else {
|
||||
while (ce && float_to_frame(ce->cfra)<=CFRA) {
|
||||
ce= ce->next;
|
||||
}
|
||||
if (ce) {
|
||||
if ((ce->cfra < toframe) || (toframe == CFRA))
|
||||
toframe= ce->cfra;
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_freelistN(&elems);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a= float_to_frame(toframe);
|
||||
|
||||
if (a!=CFRA) {
|
||||
CFRA= a;
|
||||
update_for_newframe();
|
||||
}
|
||||
|
||||
BIF_undo_push("Next/Prev Key");
|
||||
allqueue(REDRAWALL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* ***************************** */
|
||||
|
||||
/* Right. Now for some implementation: */
|
||||
void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
{
|
||||
SpaceTime *stime= spacedata;
|
||||
unsigned short event= evt->event;
|
||||
short val= evt->val;
|
||||
float dx, dy;
|
||||
int doredraw= 0, cfra, first = 0;
|
||||
short mval[2], nr;
|
||||
short mousebut = L_MOUSE;
|
||||
|
||||
if(sa->win==0) return;
|
||||
|
||||
if(val) {
|
||||
|
||||
if( uiDoBlocks(&sa->uiblocks, event)!=UI_NOTHING ) event= 0;
|
||||
|
||||
/* swap mouse buttons based on user preference */
|
||||
if (U.flag & USER_LMOUSESELECT) {
|
||||
if (event == LEFTMOUSE) {
|
||||
event = RIGHTMOUSE;
|
||||
mousebut = L_MOUSE;
|
||||
} else if (event == RIGHTMOUSE) {
|
||||
event = LEFTMOUSE;
|
||||
mousebut = R_MOUSE;
|
||||
}
|
||||
}
|
||||
|
||||
switch(event) {
|
||||
case LEFTMOUSE:
|
||||
stime->flag |= TIME_CFRA_NUM;
|
||||
do {
|
||||
getmouseco_areawin(mval);
|
||||
areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
|
||||
|
||||
cfra = (int)dx;
|
||||
if(cfra< MINFRAME) cfra= MINFRAME;
|
||||
|
||||
if( cfra!=CFRA || first )
|
||||
{
|
||||
first= 0;
|
||||
CFRA= cfra;
|
||||
update_for_newframe();
|
||||
force_draw_plus(SPACE_VIEW3D, 1);
|
||||
}
|
||||
else PIL_sleep_ms(30);
|
||||
|
||||
} while(get_mbut() & mousebut);
|
||||
|
||||
stime->flag &= ~TIME_CFRA_NUM;
|
||||
|
||||
doredraw= 1;
|
||||
break;
|
||||
|
||||
case RIGHTMOUSE: /* select/deselect marker */
|
||||
getmouseco_areawin(mval);
|
||||
areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
|
||||
|
||||
cfra= find_nearest_marker(dx);
|
||||
|
||||
if(cfra < MINFRAME) cfra= MINFRAME;
|
||||
|
||||
if (G.qual && LR_SHIFTKEY)
|
||||
select_timeline_marker_frame(cfra, 1);
|
||||
else
|
||||
select_timeline_marker_frame(cfra, 0);
|
||||
|
||||
doredraw= 1;
|
||||
|
||||
break;
|
||||
case MIDDLEMOUSE:
|
||||
case WHEELUPMOUSE:
|
||||
case WHEELDOWNMOUSE:
|
||||
view2dmove(event); /* in drawipo.c */
|
||||
break;
|
||||
case PADPLUSKEY:
|
||||
dx= (float)(0.1154*(G.v2d->cur.xmax-G.v2d->cur.xmin));
|
||||
G.v2d->cur.xmin+= dx;
|
||||
G.v2d->cur.xmax-= dx;
|
||||
test_view2d(G.v2d, sa->winx, sa->winy);
|
||||
|
||||
doredraw= 1;
|
||||
break;
|
||||
case PADMINUS:
|
||||
dx= (float)(0.15*(G.v2d->cur.xmax-G.v2d->cur.xmin));
|
||||
G.v2d->cur.xmin-= dx;
|
||||
G.v2d->cur.xmax+= dx;
|
||||
test_view2d(G.v2d, sa->winx, sa->winy);
|
||||
|
||||
doredraw= 1;
|
||||
break;
|
||||
case HOMEKEY:
|
||||
G.v2d->cur.xmin=G.v2d->tot.xmin= 0.0;
|
||||
G.v2d->cur.xmax=G.v2d->tot.xmax= G.scene->r.efra;
|
||||
doredraw= 1;
|
||||
break;
|
||||
|
||||
case PAGEUPKEY: /* next keyframe */
|
||||
if(G.qual==LR_CTRLKEY)
|
||||
nextprev_timeline_key(1);
|
||||
else
|
||||
nextprev_timeline_marker(1);
|
||||
break;
|
||||
case PAGEDOWNKEY: /* prev keyframe */
|
||||
if(G.qual==LR_CTRLKEY)
|
||||
nextprev_timeline_key(-1);
|
||||
else
|
||||
nextprev_timeline_marker(-1);
|
||||
break;
|
||||
|
||||
case AKEY:
|
||||
/* deselect all TimeMarkers */
|
||||
select_timeline_markers();
|
||||
doredraw= 1;
|
||||
break;
|
||||
case GKEY: /* move marker ... not yet implemented */
|
||||
break;
|
||||
case EKEY: /* set end frame */
|
||||
G.scene->r.efra = CFRA;
|
||||
allqueue(REDRAWBUTSALL, 0);
|
||||
allqueue(REDRAWTIME, 1);
|
||||
break;
|
||||
case MKEY: /* add, rename marker */
|
||||
if (G.qual & LR_CTRLKEY)
|
||||
rename_timeline_marker();
|
||||
else
|
||||
add_timeline_marker(CFRA);
|
||||
allqueue(REDRAWTIME, 0);
|
||||
break;
|
||||
case SKEY: /* set start frame */
|
||||
G.scene->r.sfra = CFRA;
|
||||
allqueue(REDRAWBUTSALL, 0);
|
||||
allqueue(REDRAWTIME, 1);
|
||||
break;
|
||||
case TKEY: /* popup menu */
|
||||
nr= pupmenu("Time value%t|Frames %x1|Seconds%x2");
|
||||
if (nr>0) {
|
||||
if(nr==1) stime->flag |= TIME_DRAWFRAMES;
|
||||
else stime->flag &= ~TIME_DRAWFRAMES;
|
||||
doredraw= 1;
|
||||
}
|
||||
break;
|
||||
case DELKEY:
|
||||
case XKEY:
|
||||
if( okee("Erase selected")==0 ) break;
|
||||
|
||||
remove_timeline_marker();
|
||||
allqueue(REDRAWTIME, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(doredraw)
|
||||
scrarea_queue_winredraw(sa);
|
||||
}
|
||||
|
||||
|
||||
328
source/blender/src/header_time.c
Normal file
328
source/blender/src/header_time.c
Normal file
@@ -0,0 +1,328 @@
|
||||
/**
|
||||
*
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_view2d_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BIF_gl.h"
|
||||
#include "BIF_interface.h"
|
||||
#include "BIF_resources.h"
|
||||
#include "BIF_screen.h"
|
||||
#include "BIF_space.h"
|
||||
#include "BIF_toolbox.h"
|
||||
#include "BIF_butspace.h"
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
|
||||
#include "BSE_drawipo.h"
|
||||
#include "BSE_drawview.h"
|
||||
#include "BSE_editipo.h"
|
||||
#include "BSE_filesel.h"
|
||||
#include "BSE_headerbuttons.h"
|
||||
#include "BSE_time.h"
|
||||
|
||||
#include "blendef.h"
|
||||
#include "mydevice.h"
|
||||
|
||||
void do_time_buttons(ScrArea *sa, unsigned short event)
|
||||
{
|
||||
|
||||
switch(event) {
|
||||
|
||||
case B_TL_REW:
|
||||
CFRA= SFRA;
|
||||
update_for_newframe();
|
||||
break;
|
||||
case B_TL_PLAY:
|
||||
play_anim(1);
|
||||
break;
|
||||
case B_TL_FF:
|
||||
/* end frame */
|
||||
CFRA= EFRA;
|
||||
update_for_newframe();
|
||||
break;
|
||||
case B_TL_PREVKEY:
|
||||
/* previous keyframe */
|
||||
nextprev_timeline_key(-1);
|
||||
break;
|
||||
case B_TL_NEXTKEY:
|
||||
/* next keyframe */
|
||||
nextprev_timeline_key(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void do_time_viewmenu(void *arg, int event)
|
||||
{
|
||||
extern int play_anim(int mode);
|
||||
|
||||
switch(event) {
|
||||
case 1: /* Play Back Animation */
|
||||
play_anim(0);
|
||||
break;
|
||||
case 2: /* Play Back Animation in All */
|
||||
play_anim(1);
|
||||
break;
|
||||
case 3: /* View All */
|
||||
G.v2d->tot.xmin= G.scene->r.sfra;
|
||||
G.v2d->tot.xmax= G.scene->r.efra;
|
||||
G.v2d->cur= G.v2d->tot;
|
||||
|
||||
test_view2d(G.v2d, curarea->winx, curarea->winy);
|
||||
scrarea_queue_winredraw(curarea);
|
||||
break;
|
||||
case 4: /* Maximize Window */
|
||||
/* using event B_FULL */
|
||||
break;
|
||||
}
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
}
|
||||
|
||||
static uiBlock *time_viewmenu(void *arg_unused)
|
||||
{
|
||||
uiBlock *block;
|
||||
short yco= 0, menuwidth=120;
|
||||
|
||||
block= uiNewBlock(&curarea->uiblocks, "time_viewmenu",
|
||||
UI_EMBOSSP, UI_HELV, curarea->headwin);
|
||||
uiBlockSetButmFunc(block, do_time_viewmenu, NULL);
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation|Alt A", 0, yco-=20,
|
||||
menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation in 3D View|Alt Shift A", 0, yco-=20,
|
||||
menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
|
||||
|
||||
if (!curarea->full)
|
||||
uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
|
||||
else
|
||||
uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
|
||||
|
||||
if(curarea->headertype==HEADERTOP) {
|
||||
uiBlockSetDirection(block, UI_DOWN);
|
||||
}
|
||||
else {
|
||||
uiBlockSetDirection(block, UI_TOP);
|
||||
uiBlockFlipOrder(block);
|
||||
}
|
||||
|
||||
uiTextBoundsBlock(block, 50);
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
static void do_time_framemenu(void *arg, int event)
|
||||
{
|
||||
switch(event) {
|
||||
case 1: /*Set as Start */
|
||||
G.scene->r.sfra = CFRA;
|
||||
allqueue(REDRAWALL, 1);
|
||||
break;
|
||||
case 2: /* Set as End */
|
||||
G.scene->r.efra = CFRA;
|
||||
allqueue(REDRAWALL, 1);
|
||||
break;
|
||||
case 3: /* Add Marker */
|
||||
add_timeline_marker(CFRA);
|
||||
break;
|
||||
case 4: /* Remove Marker */
|
||||
remove_timeline_marker();
|
||||
break;
|
||||
case 5: /* Rename Marker */
|
||||
rename_timeline_marker();
|
||||
break;
|
||||
}
|
||||
allqueue(REDRAWTIME, 0);
|
||||
}
|
||||
|
||||
static uiBlock *time_framemenu(void *arg_unused)
|
||||
{
|
||||
uiBlock *block;
|
||||
short yco= 0, menuwidth=120;
|
||||
|
||||
block= uiNewBlock(&curarea->uiblocks, "time_framemenu",
|
||||
UI_EMBOSSP, UI_HELV, curarea->headwin);
|
||||
uiBlockSetButmFunc(block, do_time_framemenu, NULL);
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20,
|
||||
menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remove Marker|X", 0, yco-=20,
|
||||
menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Name Marker|Ctrl M", 0, yco-=20,
|
||||
menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as Start|S", 0, yco-=20,
|
||||
menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as End|E", 0, yco-=20,
|
||||
menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
|
||||
|
||||
if(curarea->headertype==HEADERTOP) {
|
||||
uiBlockSetDirection(block, UI_DOWN);
|
||||
}
|
||||
else {
|
||||
uiBlockSetDirection(block, UI_TOP);
|
||||
uiBlockFlipOrder(block);
|
||||
}
|
||||
|
||||
uiTextBoundsBlock(block, 50);
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
void time_buttons(ScrArea *sa)
|
||||
{
|
||||
uiBlock *block;
|
||||
short xco, xmax;
|
||||
char name[256];
|
||||
|
||||
sprintf(name, "header %d", sa->headwin);
|
||||
block= uiNewBlock(&sa->uiblocks, name, UI_EMBOSS, UI_HELV, sa->headwin);
|
||||
|
||||
if(area_is_active_area(sa)) uiBlockSetCol(block, TH_HEADER);
|
||||
else uiBlockSetCol(block, TH_HEADERDESEL);
|
||||
|
||||
sa->butspacetype= SPACE_TIME;
|
||||
|
||||
xco = 8;
|
||||
|
||||
uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
|
||||
windowtype_pup(), xco, 0, XIC+10, YIC,
|
||||
&(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0,
|
||||
"Displays Current Window Type. "
|
||||
"Click for menu of available types.");
|
||||
|
||||
xco += XIC + 14;
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
if (sa->flag & HEADER_NO_PULLDOWN) {
|
||||
uiDefIconButS(block, TOG|BIT|0, B_FLIPINFOMENU,
|
||||
ICON_DISCLOSURE_TRI_RIGHT,
|
||||
xco,2,XIC,YIC-2,
|
||||
&(sa->flag), 0, 0, 0, 0,
|
||||
"Show pulldown menus");
|
||||
}
|
||||
else {
|
||||
uiDefIconButS(block, TOG|BIT|0, B_FLIPINFOMENU,
|
||||
ICON_DISCLOSURE_TRI_DOWN,
|
||||
xco,2,XIC,YIC-2,
|
||||
&(sa->flag), 0, 0, 0, 0,
|
||||
"Hide pulldown menus");
|
||||
}
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
xco+=XIC;
|
||||
|
||||
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
|
||||
/* pull down menus */
|
||||
uiBlockSetEmboss(block, UI_EMBOSSP);
|
||||
|
||||
xmax= GetButStringLength("View");
|
||||
uiDefPulldownBut(block, time_viewmenu, NULL,
|
||||
"View", xco, -2, xmax-3, 24, "");
|
||||
xco+= xmax;
|
||||
xmax= GetButStringLength("Frame");
|
||||
uiDefPulldownBut(block, time_framemenu, NULL,
|
||||
"Frame", xco, -2, xmax-3, 24, "");
|
||||
xco+= xmax;
|
||||
|
||||
}
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSX);
|
||||
xco += XIC;
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButS(block, NUM, REDRAWALL,"Start:",
|
||||
xco,0, 4.5*XIC, YIC,
|
||||
&G.scene->r.sfra,MINFRAMEF, MAXFRAMEF, 0, 0,
|
||||
"The start frame of the animation");
|
||||
|
||||
xco += 4.5*XIC;
|
||||
|
||||
uiDefButS(block, NUM, REDRAWALL,"End:",
|
||||
xco,0,4.5*XIC,YIC,
|
||||
&G.scene->r.efra,MINFRAMEF,MAXFRAMEF, 0, 0,
|
||||
"The end frame of the animation");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
xco += 4.5*XIC+16;
|
||||
|
||||
uiDefButS(block, NUM, B_NEWFRAME, "",
|
||||
xco,0,3.5*XIC,YIC,
|
||||
&(G.scene->r.cfra), MINFRAMEF, MAXFRAMEF, 0, 0,
|
||||
"Displays Current Frame of animation. Click to change.");
|
||||
|
||||
xco += 3.5*XIC+16;
|
||||
|
||||
uiDefIconBut(block, BUT, B_TL_REW, ICON_REW,
|
||||
xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Skip to Start frame (Shift DownArrow)");
|
||||
xco+= XIC+4;
|
||||
uiDefIconBut(block, BUT, B_TL_PREVKEY, ICON_PREV_KEYFRAME,
|
||||
xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Skip to previous keyframe (Ctrl PageDown)");
|
||||
xco+= XIC+4;
|
||||
uiDefIconBut(block, BUT, B_TL_PLAY, ICON_PLAY,
|
||||
xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Play Timeline (Alt Shift A)");
|
||||
xco+= XIC+4;
|
||||
uiDefIconBut(block, BUT, B_TL_NEXTKEY, ICON_NEXT_KEYFRAME,
|
||||
xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Skip to next keyframe (Ctrl PageUp)");
|
||||
xco+= XIC+4;
|
||||
uiDefIconBut(block, BUT, B_TL_FF, ICON_FF,
|
||||
xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Skip to End frame (Shift UpArrow)");
|
||||
xco+= XIC+8;
|
||||
|
||||
uiDefIconButBitI(block, TOG, G_RECORDKEYS, 0, ICON_REC,
|
||||
xco, 0, XIC, YIC, &(G.flags), 0, 0, 0, 0, "Automatically insert keyframes in Object and Action Ipo curves");
|
||||
|
||||
xco+= XIC+16;
|
||||
|
||||
/* always as last */
|
||||
sa->headbutlen= xco+2*XIC;
|
||||
|
||||
uiDrawBlock(block);
|
||||
}
|
||||
@@ -202,7 +202,8 @@ char *windowtype_pup(void)
|
||||
strcat(string, "|UV/Image Editor %x6"); //117
|
||||
|
||||
strcat(string, "|Video Sequence Editor %x8"); //143
|
||||
strcat(string, "|Audio Timeline %x11"); //163
|
||||
strcat(string, "|Timeline %x15"); //163
|
||||
strcat(string, "|Audio Window %x11"); //163
|
||||
strcat(string, "|Text Editor %x9"); //179
|
||||
|
||||
strcat(string, "|%l"); //192
|
||||
@@ -2100,7 +2101,8 @@ void do_headerbuttons(short event)
|
||||
else if(event<600) do_file_buttons(event);
|
||||
else if(event<650) do_seq_buttons(event);
|
||||
else if(event<700) do_sound_buttons(event);
|
||||
else if(event<800) do_action_buttons(event);
|
||||
else if(event<750) do_action_buttons(event);
|
||||
else if(event<800) do_time_buttons(curarea, event);
|
||||
else if(event<900) do_nla_buttons(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ static void clear_transp_rect_soft(unsigned char *transp, unsigned char *rect, i
|
||||
if(val<20) {
|
||||
pxl[3]= 128;
|
||||
}
|
||||
else if(val<60) {
|
||||
else if(val<50) {
|
||||
// one of pixels surrounding has alpha null?
|
||||
if(pxl[3-4]==0 || pxl[3+4]==0 || pxl0[3]==0 || pxl1[3]==0) {
|
||||
|
||||
@@ -441,6 +441,9 @@ char *BIF_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
||||
case SPACE_INFO:
|
||||
ts= &btheme->tinfo;
|
||||
break;
|
||||
case SPACE_TIME:
|
||||
ts= &btheme->ttime;
|
||||
break;
|
||||
default:
|
||||
ts= &btheme->tv3d;
|
||||
break;
|
||||
@@ -686,7 +689,8 @@ void BIF_InitTheme(void)
|
||||
SETCOL(btheme->tsnd.shade1, 173, 173, 173, 255); // sliders
|
||||
SETCOL(btheme->tsnd.grid, 140, 140, 140, 255);
|
||||
|
||||
|
||||
/* space time */
|
||||
btheme->ttime= btheme->tsnd; // same as sound space
|
||||
}
|
||||
|
||||
char *BIF_ThemeColorsPup(int spacetype)
|
||||
|
||||
@@ -2160,7 +2160,7 @@ static void info_user_themebuts(uiBlock *block, short y1, short y2, short y3)
|
||||
|
||||
/* main choices pup */
|
||||
uiDefButS(block, MENU, B_CHANGE_THEME, "UI and Buttons %x1|%l|3D View %x2|%l|Ipo Curve Editor %x3|Action Editor %x4|"
|
||||
"NLA Editor %x5|%l|UV/Image Editor %x6|Video Sequence Editor %x7|Audio Timeline %x8|Text Editor %x9|%l|User Preferences %x10|"
|
||||
"NLA Editor %x5|%l|UV/Image Editor %x6|Video Sequence Editor %x7|Timeline %x15|Audio Window %x8|Text Editor %x9|%l|User Preferences %x10|"
|
||||
"Outliner %x11|Buttons Window %x12|%l|File Browser %x13|Image Browser %x14",
|
||||
255,y2,200,20, &curmain, 0, 0, 0, 0, "Specify theme for...");
|
||||
if(curmain==1) spacetype= 0;
|
||||
@@ -2177,6 +2177,7 @@ static void info_user_themebuts(uiBlock *block, short y1, short y2, short y3)
|
||||
else if(curmain==12) spacetype= SPACE_BUTS;
|
||||
else if(curmain==13) spacetype= SPACE_FILE;
|
||||
else if(curmain==14) spacetype= SPACE_IMASEL;
|
||||
else if(curmain==15) spacetype= SPACE_IMASEL;
|
||||
else return; // only needed while coding... when adding themes for more windows
|
||||
|
||||
/* color choices pup */
|
||||
@@ -3549,40 +3550,6 @@ static void init_filespace(ScrArea *sa)
|
||||
sfile->spacetype= SPACE_FILE;
|
||||
}
|
||||
|
||||
static void init_textspace(ScrArea *sa)
|
||||
{
|
||||
SpaceText *st;
|
||||
|
||||
st= MEM_callocN(sizeof(SpaceText), "inittextspace");
|
||||
BLI_addhead(&sa->spacedata, st);
|
||||
|
||||
st->spacetype= SPACE_TEXT;
|
||||
st->blockscale= 0.7;
|
||||
st->text= NULL;
|
||||
st->flags= 0;
|
||||
|
||||
st->font_id= 5;
|
||||
st->lheight= 12;
|
||||
st->showlinenrs= 0;
|
||||
st->tabnumber = 4;
|
||||
st->currtab_set = 0;
|
||||
|
||||
st->top= 0;
|
||||
}
|
||||
|
||||
static void init_scriptspace(ScrArea *sa)
|
||||
{
|
||||
SpaceScript *sc;
|
||||
|
||||
sc = MEM_callocN(sizeof(SpaceScript), "initscriptspace");
|
||||
BLI_addhead(&sa->spacedata, sc);
|
||||
|
||||
sc->spacetype = SPACE_SCRIPT;
|
||||
sc->blockscale= 0.7;
|
||||
sc->script = NULL;
|
||||
sc->flags = 0;
|
||||
}
|
||||
|
||||
static void init_imaselspace(ScrArea *sa)
|
||||
{
|
||||
SpaceImaSel *simasel;
|
||||
@@ -4227,12 +4194,90 @@ static void init_nlaspace(ScrArea *sa)
|
||||
extern void drawtextspace(ScrArea *sa, void *spacedata);
|
||||
extern void winqreadtextspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
|
||||
|
||||
static void init_textspace(ScrArea *sa)
|
||||
{
|
||||
SpaceText *st;
|
||||
|
||||
st= MEM_callocN(sizeof(SpaceText), "inittextspace");
|
||||
BLI_addhead(&sa->spacedata, st);
|
||||
|
||||
st->spacetype= SPACE_TEXT;
|
||||
st->blockscale= 0.7;
|
||||
st->text= NULL;
|
||||
st->flags= 0;
|
||||
|
||||
st->font_id= 5;
|
||||
st->lheight= 12;
|
||||
st->showlinenrs= 0;
|
||||
st->tabnumber = 4;
|
||||
st->currtab_set = 0;
|
||||
|
||||
st->top= 0;
|
||||
}
|
||||
|
||||
|
||||
/* ******************** SPACE: Script ********************** */
|
||||
|
||||
extern void drawscriptspace(ScrArea *sa, void *spacedata);
|
||||
extern void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
|
||||
|
||||
/* ******************** SPACE: ALGEMEEN ********************** */
|
||||
static void init_scriptspace(ScrArea *sa)
|
||||
{
|
||||
SpaceScript *sc;
|
||||
|
||||
sc = MEM_callocN(sizeof(SpaceScript), "initscriptspace");
|
||||
BLI_addhead(&sa->spacedata, sc);
|
||||
|
||||
sc->spacetype = SPACE_SCRIPT;
|
||||
sc->blockscale= 0.7;
|
||||
sc->script = NULL;
|
||||
sc->flags = 0;
|
||||
}
|
||||
|
||||
|
||||
/* ******************** SPACE: Time ********************** */
|
||||
|
||||
extern void drawtimespace(ScrArea *sa, void *spacedata);
|
||||
extern void winqreadtimespace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
|
||||
|
||||
static void init_timespace(ScrArea *sa)
|
||||
{
|
||||
SpaceTime *stime;
|
||||
|
||||
stime= MEM_callocN(sizeof(SpaceTime), "init timespace");
|
||||
BLI_addhead(&sa->spacedata, stime);
|
||||
|
||||
stime->spacetype= SPACE_TIME;
|
||||
stime->blockscale= 0.7;
|
||||
|
||||
stime->v2d.tot.xmin= -4.0;
|
||||
stime->v2d.tot.ymin= 0.0;
|
||||
stime->v2d.tot.xmax= 250.0;
|
||||
stime->v2d.tot.ymax= (float)sa->winy;
|
||||
|
||||
stime->v2d.cur.xmin= -4.0;
|
||||
stime->v2d.cur.ymin= 0.0;
|
||||
stime->v2d.cur.xmax= 50.0;
|
||||
stime->v2d.cur.ymax= (float)sa->winy;
|
||||
|
||||
stime->v2d.min[0]= 1.0;
|
||||
stime->v2d.min[1]= (float)sa->winy;
|
||||
|
||||
stime->v2d.max[0]= 32000.0;
|
||||
stime->v2d.max[1]= (float)sa->winy;
|
||||
|
||||
stime->v2d.minzoom= 0.1f;
|
||||
stime->v2d.maxzoom= 10.0;
|
||||
|
||||
stime->v2d.scroll= 0;
|
||||
stime->v2d.keepaspect= 0;
|
||||
stime->v2d.keepzoom= 0;
|
||||
stime->v2d.keeptot= 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ******************** SPACE: GENERAL ********************** */
|
||||
|
||||
void newspace(ScrArea *sa, int type)
|
||||
{
|
||||
@@ -4296,6 +4341,8 @@ void newspace(ScrArea *sa, int type)
|
||||
init_soundspace(sa);
|
||||
else if(type==SPACE_NLA)
|
||||
init_nlaspace(sa);
|
||||
else if(type==SPACE_TIME)
|
||||
init_timespace(sa);
|
||||
|
||||
sl= sa->spacedata.first;
|
||||
sl->area= sa;
|
||||
@@ -4677,6 +4724,12 @@ void allqueue(unsigned short event, short val)
|
||||
scrarea_queue_winredraw(sa);
|
||||
}
|
||||
break;
|
||||
case REDRAWTIME:
|
||||
if(sa->spacetype==SPACE_TIME) {
|
||||
scrarea_queue_headredraw(sa);
|
||||
scrarea_queue_winredraw(sa);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
sa= sa->next;
|
||||
@@ -4953,7 +5006,7 @@ SpaceType *spacesound_get_type(void)
|
||||
|
||||
if (!st) {
|
||||
st= spacetype_new("Sound");
|
||||
spacetype_set_winfuncs(st, drawsoundspace, NULL, winqreadsoundspace);
|
||||
spacetype_set_winfuncs(st, drawsoundspace, changeview2dspace, winqreadsoundspace);
|
||||
}
|
||||
|
||||
return st;
|
||||
@@ -4991,3 +5044,14 @@ SpaceType *spaceview3d_get_type(void)
|
||||
|
||||
return st;
|
||||
}
|
||||
SpaceType *spacetime_get_type(void)
|
||||
{
|
||||
static SpaceType *st= NULL;
|
||||
|
||||
if (!st) {
|
||||
st= spacetype_new("Time");
|
||||
spacetype_set_winfuncs(st, drawtimespace, NULL, winqreadtimespace);
|
||||
}
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ static SpaceType *spacetype_from_code(int spacecode)
|
||||
case SPACE_TEXT: return spacetext_get_type();
|
||||
case SPACE_SCRIPT: return spacescript_get_type();
|
||||
case SPACE_VIEW3D: return spaceview3d_get_type();
|
||||
case SPACE_TIME: return spacetime_get_type();
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1158,7 +1158,7 @@ short sbutton(char *var, float min, float max, char *str)
|
||||
if(mval[1]>G.curscreen->sizey) mval[1]= G.curscreen->sizey-10;
|
||||
|
||||
block= uiNewBlock(&listb, "button", UI_EMBOSS, UI_HELV, G.curscreen->mainwin);
|
||||
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1);
|
||||
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_ENTER_OK);
|
||||
|
||||
x1=mval[0]-150;
|
||||
y1=mval[1]-20;
|
||||
|
||||
@@ -214,6 +214,18 @@ static void init_userdef_file(void)
|
||||
if (U.flag & USER_LMOUSESELECT)
|
||||
U.flag &= ~USER_TWOBUTTONMOUSE;
|
||||
}
|
||||
if (G.main->versionfile <= 236) {
|
||||
bTheme *btheme;
|
||||
/* new space type */
|
||||
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
|
||||
/* check for alpha==0 is safe, then color was never set */
|
||||
if(btheme->ttime.back[3]==0) {
|
||||
btheme->ttime = btheme->tsnd; // copy from sound
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (U.undosteps==0) U.undosteps=32;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user