Merge branch 'master' into 28
This commit is contained in:
@@ -84,8 +84,6 @@ void mul_qt_qtqt(float q[4], const float q1[4], const float q2[4])
|
||||
* \note:
|
||||
* Assumes a unit quaternion?
|
||||
*
|
||||
* \note: multiplying by 3x3 matrix is ~25% faster.
|
||||
*
|
||||
* in fact not, but you may want to use a unit quat, read on...
|
||||
*
|
||||
* Shortcut for 'q v q*' when \a v is actually a quaternion.
|
||||
@@ -98,6 +96,8 @@ void mul_qt_qtqt(float q[4], const float q1[4], const float q2[4])
|
||||
*
|
||||
* For people used to python mathutils, its like:
|
||||
* def mul_qt_v3(q, v): (q * Quaternion((0.0, v[0], v[1], v[2])) * q.conjugated())[1:]
|
||||
*
|
||||
* \note: multiplying by 3x3 matrix is ~25% faster.
|
||||
*/
|
||||
void mul_qt_v3(const float q[4], float v[3])
|
||||
{
|
||||
|
||||
@@ -217,7 +217,6 @@ enum {
|
||||
/* scale fixed button widths by this to account for DPI */
|
||||
|
||||
#define UI_DPI_FAC ((U.pixelsize * (float)U.dpi) / 72.0f)
|
||||
#define UI_DPI_WINDOW_FAC (((float)U.dpi) / 72.0f)
|
||||
/* 16 to copy ICON_DEFAULT_HEIGHT */
|
||||
#define UI_DPI_ICON_SIZE ((float)16 * UI_DPI_FAC)
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "wm_window.h"
|
||||
|
||||
@@ -128,8 +129,8 @@ static ScrArea *find_area_image_empty(bContext *C)
|
||||
/* new window uses x,y to set position */
|
||||
ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
wmWindow *win = NULL;
|
||||
ScrArea *sa = NULL;
|
||||
SpaceImage *sima;
|
||||
bool area_was_image = false;
|
||||
@@ -138,25 +139,15 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports)
|
||||
return NULL;
|
||||
|
||||
if (scene->r.displaymode == R_OUTPUT_WINDOW) {
|
||||
rcti rect;
|
||||
int sizex, sizey;
|
||||
|
||||
sizex = 10 + (scene->r.xsch * scene->r.size) / 100;
|
||||
sizey = 40 + (scene->r.ysch * scene->r.size) / 100;
|
||||
int sizex = 30 * UI_DPI_FAC + (scene->r.xsch * scene->r.size) / 100;
|
||||
int sizey = 60 * UI_DPI_FAC + (scene->r.ysch * scene->r.size) / 100;
|
||||
|
||||
/* arbitrary... miniature image window views don't make much sense */
|
||||
if (sizex < 320) sizex = 320;
|
||||
if (sizey < 256) sizey = 256;
|
||||
|
||||
/* some magic to calculate postition */
|
||||
/* pixelsize: mouse coords are in U.pixelsize units :/ */
|
||||
rect.xmin = (mx / U.pixelsize) + win->posx - sizex / 2;
|
||||
rect.ymin = (my / U.pixelsize) + win->posy - sizey / 2;
|
||||
rect.xmax = rect.xmin + sizex;
|
||||
rect.ymax = rect.ymin + sizey;
|
||||
|
||||
/* changes context! */
|
||||
if (WM_window_open_temp(C, &rect, WM_WINDOW_RENDER) == NULL) {
|
||||
if (WM_window_open_temp(C, mx, my, sizex, sizey, WM_WINDOW_RENDER) == NULL) {
|
||||
BKE_report(reports, RPT_ERROR, "Failed to open window!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -3888,22 +3888,11 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot)
|
||||
|
||||
static int userpref_show_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
rcti rect;
|
||||
int sizex, sizey;
|
||||
|
||||
sizex = 800 * UI_DPI_WINDOW_FAC;
|
||||
sizey = 480 * UI_DPI_WINDOW_FAC;
|
||||
|
||||
/* some magic to calculate postition */
|
||||
/* pixelsize: mouse coords are in U.pixelsize units :/ */
|
||||
rect.xmin = (event->x / U.pixelsize) + win->posx - sizex / 2;
|
||||
rect.ymin = (event->y / U.pixelsize) + win->posy - sizey / 2;
|
||||
rect.xmax = rect.xmin + sizex;
|
||||
rect.ymax = rect.ymin + sizey;
|
||||
int sizex = 800 * UI_DPI_FAC;
|
||||
int sizey = 480 * UI_DPI_FAC;
|
||||
|
||||
/* changes context! */
|
||||
if (WM_window_open_temp(C, &rect, WM_WINDOW_USERPREFS) != NULL) {
|
||||
if (WM_window_open_temp(C, event->x, event->y, sizex, sizey, WM_WINDOW_USERPREFS) != NULL) {
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -3373,7 +3373,6 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link,
|
||||
/* store current linewidth */
|
||||
float linew;
|
||||
float arrow[2], arrow1[2], arrow2[2];
|
||||
const float px_fac = UI_DPI_WINDOW_FAC;
|
||||
glGetFloatv(GL_LINE_WIDTH, &linew);
|
||||
unsigned int pos;
|
||||
|
||||
@@ -3407,7 +3406,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link,
|
||||
|
||||
if (do_triple) {
|
||||
immUniformThemeColorShadeAlpha(th_col3, -80, -120);
|
||||
glLineWidth(4.0f * px_fac);
|
||||
glLineWidth(4.0f);
|
||||
|
||||
immBegin(PRIM_LINE_STRIP, (LINK_RESOL + 1));
|
||||
|
||||
@@ -3426,7 +3425,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link,
|
||||
}
|
||||
}
|
||||
|
||||
glLineWidth(1.5f * px_fac);
|
||||
glLineWidth(1.5f);
|
||||
|
||||
if (drawarrow) {
|
||||
immUniformThemeColorBlend(th_col1, th_col2, 0.5f);
|
||||
|
||||
@@ -7376,19 +7376,16 @@ static void draw_editnurb(
|
||||
vec_a[0] = fac;
|
||||
vec_a[1] = 0.0f;
|
||||
vec_a[2] = 0.0f;
|
||||
|
||||
vec_b[0] = -fac;
|
||||
vec_b[1] = 0.0f;
|
||||
vec_b[2] = 0.0f;
|
||||
|
||||
|
||||
mul_qt_v3(bevp->quat, vec_a);
|
||||
mul_qt_v3(bevp->quat, vec_b);
|
||||
madd_v3_v3fl(vec_a, bevp->dir, -fac);
|
||||
|
||||
reflect_v3_v3v3(vec_b, vec_a, bevp->dir);
|
||||
negate_v3(vec_b);
|
||||
|
||||
add_v3_v3(vec_a, bevp->vec);
|
||||
add_v3_v3(vec_b, bevp->vec);
|
||||
|
||||
madd_v3_v3fl(vec_a, bevp->dir, -fac);
|
||||
madd_v3_v3fl(vec_b, bevp->dir, -fac);
|
||||
|
||||
immVertex3fv(pos, vec_a);
|
||||
immVertex3fv(pos, bevp->vec);
|
||||
immVertex3fv(pos, bevp->vec);
|
||||
|
||||
@@ -110,7 +110,7 @@ enum {
|
||||
};
|
||||
|
||||
struct wmWindow *WM_window_open(struct bContext *C, const struct rcti *rect);
|
||||
struct wmWindow *WM_window_open_temp(struct bContext *C, const struct rcti *rect_init, int type);
|
||||
struct wmWindow *WM_window_open_temp(struct bContext *C, int x, int y, int sizex, int sizey, int type);
|
||||
|
||||
/* returns true if draw method is triple buffer */
|
||||
bool WM_is_draw_triple(struct wmWindow *win);
|
||||
|
||||
@@ -1830,13 +1830,13 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
|
||||
if (version_suffix != NULL && version_suffix[0]) {
|
||||
/* placed after the version number in the image,
|
||||
* placing y is tricky to match baseline */
|
||||
int x = 260 - (2 * UI_DPI_WINDOW_FAC);
|
||||
int y = 242 + (4 * UI_DPI_WINDOW_FAC);
|
||||
int w = 240;
|
||||
int x = 260 * U.pixelsize - (2 * UI_DPI_FAC);
|
||||
int y = 242 * U.pixelsize + (4 * UI_DPI_FAC);
|
||||
int w = 240 * U.pixelsize;
|
||||
|
||||
/* hack to have text draw 'text_sel' */
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
but = uiDefBut(block, UI_BTYPE_LABEL, 0, version_suffix, x * U.pixelsize, y * U.pixelsize, w * U.pixelsize, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
|
||||
but = uiDefBut(block, UI_BTYPE_LABEL, 0, version_suffix, x, y, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
|
||||
/* XXX, set internal flag - UI_SELECT */
|
||||
UI_but_flag_enable(but, 1);
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
|
||||
@@ -666,14 +666,27 @@ wmWindow *WM_window_open(bContext *C, const rcti *rect)
|
||||
* \param type: WM_WINDOW_RENDER, WM_WINDOW_USERPREFS...
|
||||
* \return the window or NULL.
|
||||
*/
|
||||
wmWindow *WM_window_open_temp(bContext *C, const rcti *rect_init, int type)
|
||||
wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, int type)
|
||||
{
|
||||
wmWindow *win_prev = CTX_wm_window(C);
|
||||
wmWindow *win;
|
||||
ScrArea *sa;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
const char *title;
|
||||
rcti rect = *rect_init;
|
||||
|
||||
/* convert to native OS window coordinates */
|
||||
const float native_pixel_size = GHOST_GetNativePixelSize(win_prev->ghostwin);
|
||||
x /= native_pixel_size;
|
||||
y /= native_pixel_size;
|
||||
sizex /= native_pixel_size;
|
||||
sizey /= native_pixel_size;
|
||||
|
||||
/* calculate postition */
|
||||
rcti rect;
|
||||
rect.xmin = x + win_prev->posx - sizex / 2;
|
||||
rect.ymin = y + win_prev->posy - sizey / 2;
|
||||
rect.xmax = rect.xmin + sizex;
|
||||
rect.ymax = rect.ymin + sizey;
|
||||
|
||||
/* changes rect to fit within desktop */
|
||||
wm_window_check_position(&rect);
|
||||
|
||||
Reference in New Issue
Block a user