Added view2d_getscale function for getting the opengl x/y scale for 2d windows.
Display/Edit TimeOffset accounting for its added parent offset. removed Extension button by mistake.
This commit is contained in:
@@ -55,6 +55,7 @@ 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 view2d_getscale (struct View2D *v2d, float *x, float *y);
|
||||
void test_view2d (struct View2D *v2d, int winx, int winy);
|
||||
void calc_scrollrcts (struct ScrArea *sa, struct View2D *v2d, int winx, int winy);
|
||||
|
||||
|
||||
@@ -2446,9 +2446,16 @@ static void object_panel_object(Object *ob)
|
||||
uiNewPanelHeight(block, 204 - (120-yco));
|
||||
}
|
||||
|
||||
static void object_panel_anim_timeoffset_callback( void *data, void *timeoffset_ui) {
|
||||
Object *ob = (Object *)data;
|
||||
ob->sf = (*(float *)timeoffset_ui) - (give_timeoffset(ob) - ob->sf);
|
||||
}
|
||||
|
||||
static void object_panel_anim(Object *ob)
|
||||
{
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
static float timeoffset_ui;
|
||||
char str[32];
|
||||
|
||||
block= uiNewBlock(&curarea->uiblocks, "object_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
|
||||
@@ -2500,7 +2507,11 @@ static void object_panel_anim(Object *ob)
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,35,115,20, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Animation offset in frames for ipo's and dupligroup instances");
|
||||
|
||||
timeoffset_ui = give_timeoffset(ob);
|
||||
but = uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,35,115,20, &timeoffset_ui, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Animation offset in frames for ipo's and dupligroup instances");
|
||||
uiButSetFunc(but, object_panel_anim_timeoffset_callback, ob, &timeoffset_ui);
|
||||
|
||||
uiDefBut(block, BUT, B_AUTOTIMEOFS, "Auto", 139,35,34,20, 0, 0, 0, 0, 0, "Assign selected objects a timeoffset within a range, starting from the active object");
|
||||
uiDefBut(block, BUT, B_OFSTIMEOFS, "Ofs", 173,35,34,20, 0, 0, 0, 0, 0, "Offset selected objects timeoffset");
|
||||
uiDefBut(block, BUT, B_RANDTIMEOFS, "Rand", 207,35,34,20, 0, 0, 0, 0, 0, "Randomize selected objects timeoffset");
|
||||
|
||||
@@ -1873,6 +1873,8 @@ static void render_panel_output(void)
|
||||
uiDefButS(block, MENU, B_REDR, "Render Display %t|Render Window %x1|Image Editor %x0|Full Screen %x2",
|
||||
72, 10, 120, 19, &G.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output display");
|
||||
|
||||
uiDefButBitS(block, TOG, R_EXTENSION, B_NOP, "Extensions", 205, 10, 105, 19, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds filetype extensions to the filename when rendering animations");
|
||||
|
||||
/* Dither control */
|
||||
uiDefButF(block, NUM,B_DIFF, "Dither:", 205,31,105,19, &G.scene->r.dither_intensity, 0.0, 2.0, 0, 0, "The amount of dithering noise present in the output image (0.0 = no dithering)");
|
||||
|
||||
|
||||
@@ -521,6 +521,10 @@ void view2d_zoom(View2D *v2d, float factor, int winx, int winy)
|
||||
view2d_do_locks(curarea, V2D_LOCK_COPY);
|
||||
}
|
||||
|
||||
void view2d_getscale(View2D *v2d, float *x, float *y) {
|
||||
if (x) *x = (G.v2d->mask.xmax-G.v2d->mask.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
|
||||
if (y) *y = (G.v2d->mask.ymax-G.v2d->mask.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
|
||||
}
|
||||
|
||||
void test_view2d(View2D *v2d, int winx, int winy)
|
||||
{
|
||||
|
||||
@@ -132,8 +132,7 @@ static void draw_cfra_time(SpaceTime *stime)
|
||||
glColor4ub(0, 0, 0, 0);
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
|
||||
xscale = (G.v2d->mask.xmax-G.v2d->mask.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
|
||||
yscale = (G.v2d->mask.ymax-G.v2d->mask.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
|
||||
view2d_getscale(G.v2d, &xscale, &yscale);
|
||||
|
||||
/* because the frame number text is subject to the same scaling as the contents of the view */
|
||||
glScalef( 1.0/xscale, 1.0/yscale, 1.0);
|
||||
@@ -157,9 +156,8 @@ static void draw_marker(TimeMarker *marker, int flag)
|
||||
/* no time correction for framelen! space is drawn with old values */
|
||||
|
||||
ypixels= G.v2d->mask.ymax-G.v2d->mask.ymin;
|
||||
xscale = (G.v2d->mask.xmax-G.v2d->mask.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
|
||||
yscale = (G.v2d->mask.ymax-G.v2d->mask.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
|
||||
|
||||
view2d_getscale(G.v2d, &xscale, &yscale);
|
||||
|
||||
glScalef( 1.0/xscale, 1.0/yscale, 1.0);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
@@ -1477,10 +1477,10 @@ void mouse_select_ipo(void)
|
||||
|
||||
if(G.sipo->showkey) {
|
||||
float pixelwidth;
|
||||
pixelwidth= (G.v2d->cur.xmax-G.v2d->cur.xmin)/(G.v2d->mask.xmax-G.v2d->mask.xmin); /* could make a generic function */
|
||||
|
||||
view2d_getscale(G.v2d, &pixelwidth, NULL);
|
||||
|
||||
getmouseco_areawin(mval);
|
||||
|
||||
areamouseco_to_ipoco(G.v2d, mval, &x, &y);
|
||||
actik= 0;
|
||||
mindist= 1000.0;
|
||||
|
||||
Reference in New Issue
Block a user