Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-10-20 18:41:10 +0400
committerTon Roosendaal <ton@blender.org>2005-10-20 18:41:10 +0400
commit7a7dadc107452063db1aa4a47ce9899211c17b1c (patch)
tree683da314cfc31b41899e6a2c73bfa326d726115c /source/blender
parent89597ed362052510ffe4c6c6db39fcccf41721c0 (diff)
New option; "Lock Time to Other Windows" for Ipo, Action, NLA and Time
windows. If set (in View pulldown), it synchronizes the horizontal scale of the current window with the other Windows with this option set. That way you always have these windows showing an identical part of the time you work on. Also added because Action Window now displays its content relative to NLA strips.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/include/BSE_drawipo.h1
-rw-r--r--source/blender/makesdna/DNA_view2d_types.h10
-rw-r--r--source/blender/src/drawipo.c69
-rw-r--r--source/blender/src/editaction.c4
-rw-r--r--source/blender/src/editipo.c2
-rw-r--r--source/blender/src/editnla.c2
-rw-r--r--source/blender/src/editsound.c4
-rw-r--r--source/blender/src/edittime.c4
-rw-r--r--source/blender/src/header_action.c31
-rw-r--r--source/blender/src/header_ipo.c11
-rw-r--r--source/blender/src/header_nla.c10
-rw-r--r--source/blender/src/header_sound.c1
-rw-r--r--source/blender/src/header_time.c9
13 files changed, 130 insertions, 28 deletions
diff --git a/source/blender/include/BSE_drawipo.h b/source/blender/include/BSE_drawipo.h
index cd72a147741..07f116d8d67 100644
--- a/source/blender/include/BSE_drawipo.h
+++ b/source/blender/include/BSE_drawipo.h
@@ -53,6 +53,7 @@ void areamouseco_to_ipoco (struct View2D *v2d, short *mval, float *x, float *y);
void ipoco_to_areaco (struct View2D *v2d, float *vec, short *mval);
void ipoco_to_areaco_noclip (struct View2D *v2d, float *vec, short *mval);
+void view2d_do_locks (struct ScrArea *cursa, int flag);
void view2d_zoom (struct View2D *v2d, float factor, int winx, int winy);
void test_view2d (struct View2D *v2d, int winx, int winy);
void calc_scrollrcts (struct ScrArea *sa, struct View2D *v2d, int winx, int winy);
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index 797df42c5a3..cfd6f682e71 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -44,12 +44,20 @@ typedef struct View2D {
short scroll, keeptot;
short keepaspect, keepzoom;
short oldwinx, oldwiny;
- int pad;
+ int flag;
} View2D;
+/* v2d->keepzoom */
#define V2D_KEEPZOOM 0x0001
#define V2D_LOCKZOOM_X 0x0100
#define V2D_LOCKZOOM_Y 0x0200
+/* event codes for locking function */
+#define V2D_LOCK_COPY 1
+#define V2D_LOCK_REDRAW 2
+
+/* v2d->flag */
+#define V2D_VIEWLOCK 1
+
#endif
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
index f7870fda239..aab228c5df0 100644
--- a/source/blender/src/drawipo.c
+++ b/source/blender/src/drawipo.c
@@ -50,6 +50,7 @@
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
+#include "DNA_action_types.h"
#include "DNA_curve_types.h"
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
@@ -383,7 +384,62 @@ int in_ipo_buttons(void)
else return 1;
}
+static View2D *spacelink_get_view2d(SpaceLink *sl)
+{
+ if(sl->spacetype==SPACE_IPO)
+ return &((SpaceIpo *)sl)->v2d;
+ else if(sl->spacetype==SPACE_SOUND)
+ return &((SpaceSound *)sl)->v2d;
+ if(sl->spacetype==SPACE_ACTION)
+ return &((SpaceAction *)sl)->v2d;
+ if(sl->spacetype==SPACE_NLA)
+ return &((SpaceNla *)sl)->v2d;
+ if(sl->spacetype==SPACE_TIME)
+ return &((SpaceTime *)sl)->v2d;
+
+ return NULL;
+}
+
+/* copies changes in this view from or to all 2d views with lock option open */
+void view2d_do_locks(ScrArea *cursa, int flag)
+{
+ ScrArea *sa;
+ View2D *v2d, *curv2d;
+ SpaceLink *sl;
+
+ curv2d= spacelink_get_view2d(cursa->spacedata.first);
+ if(curv2d==NULL) return;
+ if((curv2d->flag & V2D_VIEWLOCK)==0) return;
+ for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
+ if(sa!=cursa) {
+ for(sl= sa->spacedata.first; sl; sl= sl->next) {
+
+ v2d= spacelink_get_view2d(sl);
+ if(v2d) {
+ if(v2d->flag & V2D_VIEWLOCK) {
+ if(flag & V2D_LOCK_COPY) {
+ v2d->cur.xmin= curv2d->cur.xmin;
+ v2d->cur.xmax= curv2d->cur.xmax;
+ }
+ else {
+ curv2d->cur.xmin= v2d->cur.xmin;
+ curv2d->cur.xmax= v2d->cur.xmax;
+ scrarea_queue_winredraw(sa);
+ }
+
+ if(flag & V2D_LOCK_REDRAW)
+ scrarea_do_windraw(sa);
+ else
+ scrarea_queue_winredraw(sa);
+ }
+ }
+ }
+ }
+ }
+}
+
+/* event based, note: curarea is in here... */
void view2d_zoom(View2D *v2d, float factor, int winx, int winy)
{
float dx= factor*(v2d->cur.xmax-v2d->cur.xmin);
@@ -397,6 +453,7 @@ void view2d_zoom(View2D *v2d, float factor, int winx, int winy)
v2d->cur.ymax-= dy;
}
test_view2d(v2d, winx, winy);
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
}
@@ -2159,6 +2216,8 @@ int view2dzoom(unsigned short event)
}
test_view2d(G.v2d, curarea->winx, curarea->winy); /* cur min max rects */
+ view2d_do_locks(curarea, V2D_LOCK_COPY|V2D_LOCK_REDRAW);
+
scrarea_do_windraw(curarea);
screen_swapbuffers();
}
@@ -2177,17 +2236,14 @@ void center_currframe(void)
*/
float width;
- areawinset(curarea->win);
- curarea->head_swap= 0;
-
width = G.v2d->cur.xmax - G.v2d->cur.xmin;
G.v2d->cur.xmin = CFRA - 0.5*(width);
G.v2d->cur.xmax = CFRA + 0.5*(width);
test_view2d(G.v2d, curarea->winx, curarea->winy);
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
- curarea->head_swap= 0;
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
+
+ scrarea_queue_winredraw(curarea);
}
/* total mess function, especially with mousewheel, needs cleanup badly (ton) */
@@ -2334,6 +2390,7 @@ int view2dmove(unsigned short event)
G.v2d->cur.ymax+= right*dy;
test_view2d(G.v2d, curarea->winx, curarea->winy);
+ view2d_do_locks(curarea, V2D_LOCK_COPY|V2D_LOCK_REDRAW);
scrarea_do_windraw(curarea);
screen_swapbuffers();
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index 44f16abe886..8fb1186af1d 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -2287,11 +2287,15 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
case PADPLUSKEY:
view2d_zoom(G.v2d, 0.1154, sa->winx, sa->winy);
test_view2d(G.v2d, sa->winx, sa->winy);
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
+
doredraw= 1;
break;
case PADMINUS:
view2d_zoom(G.v2d, -0.15, sa->winx, sa->winy);
test_view2d(G.v2d, sa->winx, sa->winy);
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
+
doredraw= 1;
break;
case MIDDLEMOUSE:
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index c29b98b3768..53c1c7f4b6f 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -890,6 +890,8 @@ static void make_editipo(void)
else {
ipo_default_v2d_cur(G.sipo->blocktype, &G.v2d->cur);
}
+
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
}
/* evaluates context in the current UI */
diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c
index 89479f53d91..d018e58bd13 100644
--- a/source/blender/src/editnla.c
+++ b/source/blender/src/editnla.c
@@ -326,11 +326,13 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
case PADPLUSKEY:
view2d_zoom(G.v2d, 0.1154, sa->winx, sa->winy);
test_view2d(G.v2d, sa->winx, sa->winy);
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
doredraw= 1;
break;
case PADMINUS:
view2d_zoom(G.v2d, -0.15, sa->winx, sa->winy);
test_view2d(G.v2d, sa->winx, sa->winy);
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
doredraw= 1;
break;
case MIDDLEMOUSE:
diff --git a/source/blender/src/editsound.c b/source/blender/src/editsound.c
index 5eec31adb12..30b38d2c2d7 100644
--- a/source/blender/src/editsound.c
+++ b/source/blender/src/editsound.c
@@ -175,7 +175,7 @@ void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
G.v2d->cur.xmin+= dx;
G.v2d->cur.xmax-= dx;
test_view2d(G.v2d, curarea->winx, curarea->winy);
-
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
doredraw= 1;
break;
case PADMINUS:
@@ -183,7 +183,7 @@ void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
G.v2d->cur.xmin-= dx;
G.v2d->cur.xmax+= dx;
test_view2d(G.v2d, curarea->winx, curarea->winy);
-
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
doredraw= 1;
break;
case HOMEKEY:
diff --git a/source/blender/src/edittime.c b/source/blender/src/edittime.c
index 0bb4250c5a4..1cf94f85608 100644
--- a/source/blender/src/edittime.c
+++ b/source/blender/src/edittime.c
@@ -552,7 +552,7 @@ void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
G.v2d->cur.xmin+= dx;
G.v2d->cur.xmax-= dx;
test_view2d(G.v2d, sa->winx, sa->winy);
-
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
doredraw= 1;
break;
case PADMINUS:
@@ -560,7 +560,7 @@ void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
G.v2d->cur.xmin-= dx;
G.v2d->cur.xmax+= dx;
test_view2d(G.v2d, sa->winx, sa->winy);
-
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
doredraw= 1;
break;
case HOMEKEY:
diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c
index 49f5ee3fd0d..0ace342a2ae 100644
--- a/source/blender/src/header_action.c
+++ b/source/blender/src/header_action.c
@@ -82,6 +82,7 @@
#define ACTMENU_VIEW_PLAYALL 3
#define ACTMENU_VIEW_ALL 4
#define ACTMENU_VIEW_MAXIMIZE 5
+#define ACTMENU_VIEW_LOCK 6
#define ACTMENU_SEL_BORDER 0
#define ACTMENU_SEL_ALL_KEYS 1
@@ -152,7 +153,7 @@ void do_action_buttons(unsigned short event)
G.v2d->tot= G.v2d->cur;
test_view2d(G.v2d, curarea->winx, curarea->winy);
-
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
addqueue (curarea->win, REDRAW, 1);
@@ -210,6 +211,11 @@ static void do_action_viewmenu(void *arg, int event)
case ACTMENU_VIEW_ALL: /* View All */
do_action_buttons(B_ACTHOME);
break;
+ case ACTMENU_VIEW_LOCK:
+ G.v2d->flag ^= V2D_VIEWLOCK;
+ if(G.v2d->flag & V2D_VIEWLOCK)
+ view2d_do_locks(curarea, 0);
+ break;
case ACTMENU_VIEW_MAXIMIZE: /* Maximize Window */
/* using event B_FULL */
break;
@@ -231,24 +237,21 @@ static uiBlock *action_viewmenu(void *arg_unused)
menuwidth, 19, NULL, 0.0, 0.0, 1,
ACTMENU_VIEW_CENTERVIEW, "");
+ uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
+ "Lock Time to Other Windows|", 0, yco-=20,
+ menuwidth, 19, NULL, 0.0, 0.0, 1,
+ ACTMENU_VIEW_LOCK, "");
+
uiDefBut(block, SEPR, 0, "", 0, yco-=6,
menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- if(BTST(G.saction->lock, 0)) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT,
- "Update Automatically|", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_AUTOUPDATE, "");
- }
- else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT,
- "Update Automatically|", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_AUTOUPDATE, "");
- }
+ uiDefIconTextBut(block, BUTM, 1, BTST(G.saction->lock, 0)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
+ "Update Automatically|", 0, yco-=20,
+ menuwidth, 19, NULL, 0.0, 0.0, 1,
+ ACTMENU_VIEW_AUTOUPDATE, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Play Back Animation|Alt A", 0, yco-=20,
diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c
index 44e9ddf6425..1508c61830d 100644
--- a/source/blender/src/header_ipo.c
+++ b/source/blender/src/header_ipo.c
@@ -645,6 +645,11 @@ static void do_ipo_viewmenu(void *arg, int event)
case 8:
add_blockhandler(curarea, IPO_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
break;
+ case 9:
+ G.v2d->flag ^= V2D_VIEWLOCK;
+ if(G.v2d->flag & V2D_VIEWLOCK)
+ view2d_do_locks(curarea, 0);
+ break;
}
}
@@ -659,8 +664,8 @@ static uiBlock *ipo_viewmenu(void *arg_unused)
block= uiNewBlock(&curarea->uiblocks, "ipo_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
uiBlockSetButmFunc(block, do_ipo_viewmenu, NULL);
-
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Channel Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
+
if (G.sipo->showkey)
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Show Keys|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
else
@@ -681,6 +686,8 @@ static uiBlock *ipo_viewmenu(void *arg_unused)
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, 0, 1, "");
+ uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
+ "Lock Time to Other Windows|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
if (ei != NULL && (ei->flag & IPO_EDIT)) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Current Frame to Selected|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
@@ -863,6 +870,7 @@ void do_ipo_buttons(short event)
v2d->cur.ymax= v2d->tot.ymax+ dy;
test_view2d(G.v2d, curarea->winx, curarea->winy);
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
if(G.sipo->ipo) G.sipo->ipo->cur = G.v2d->cur;
scrarea_queue_winredraw(curarea);
@@ -880,6 +888,7 @@ void do_ipo_buttons(short event)
G.v2d->cur.ymin= ymin;
test_view2d(G.v2d, curarea->winx, curarea->winy);
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
scrarea_queue_winredraw(curarea);
}
break;
diff --git a/source/blender/src/header_nla.c b/source/blender/src/header_nla.c
index d0139b82992..ef4949bcfef 100644
--- a/source/blender/src/header_nla.c
+++ b/source/blender/src/header_nla.c
@@ -83,6 +83,7 @@ void do_nla_buttons(unsigned short event)
v2d->cur.ymax= 5; // at least stuff is visiable then?
test_view2d(G.v2d, curarea->winx, curarea->winy);
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
addqueue (curarea->win, REDRAW, 1);
break;
}
@@ -110,6 +111,11 @@ static void do_nla_viewmenu(void *arg, int event)
case 4: /* Maximize Window */
/* using event B_FULL */
break;
+ case 5:
+ G.v2d->flag ^= V2D_VIEWLOCK;
+ if(G.v2d->flag & V2D_VIEWLOCK)
+ view2d_do_locks(curarea, 0);
+ break;
}
}
@@ -136,7 +142,9 @@ static uiBlock *nla_viewmenu(void *arg_unused)
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, "");
-
+ uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
+ "Lock Time to Other Windows|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
+
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, "");
diff --git a/source/blender/src/header_sound.c b/source/blender/src/header_sound.c
index cebc9e9afd6..d3a577075d6 100644
--- a/source/blender/src/header_sound.c
+++ b/source/blender/src/header_sound.c
@@ -163,6 +163,7 @@ void do_sound_buttons(unsigned short event)
}
G.v2d->cur= G.v2d->tot;
test_view2d(G.v2d, curarea->winx, curarea->winy);
+ view2d_do_locks(curarea, V2D_LOCK_COPY);
scrarea_queue_winredraw(curarea);
break;
}
diff --git a/source/blender/src/header_time.c b/source/blender/src/header_time.c
index c3261aabdea..0b48d51bd47 100644
--- a/source/blender/src/header_time.c
+++ b/source/blender/src/header_time.c
@@ -212,6 +212,11 @@ static void do_time_viewmenu(void *arg, int event)
case 10:
timeline_frame_to_center();
break;
+ case 11:
+ G.v2d->flag ^= V2D_VIEWLOCK;
+ if(G.v2d->flag & V2D_VIEWLOCK)
+ view2d_do_locks(curarea, 0);
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -247,7 +252,9 @@ static uiBlock *time_viewmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center View|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
+ uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
+ "Lock Time to Other Windows|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
+
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