svn merge ^/trunk/blender -r49854:49867
This commit is contained in:
@@ -145,13 +145,13 @@ void BLF_shadow_offset(int fontid, int x, int y);
|
||||
/* Set the buffer, size and number of channels to draw, one thing to take care is call
|
||||
* this function with NULL pointer when we finish, for example:
|
||||
*
|
||||
* BLF_buffer(my_fbuf, my_cbuf, 100, 100, 4);
|
||||
* BLF_buffer(my_fbuf, my_cbuf, 100, 100, 4, TRUE);
|
||||
*
|
||||
* ... set color, position and draw ...
|
||||
*
|
||||
* BLF_buffer(NULL, NULL, 0, 0, 0);
|
||||
* BLF_buffer(NULL, NULL, 0, 0, 0, FALSE);
|
||||
*/
|
||||
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch);
|
||||
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, int do_color_management);
|
||||
|
||||
/* Set the color to be used for text. */
|
||||
void BLF_buffer_col(int fontid, float r, float g, float b, float a);
|
||||
|
||||
@@ -746,16 +746,17 @@ void BLF_shadow_offset(int fontid, int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch)
|
||||
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, int do_color_management)
|
||||
{
|
||||
FontBLF *font = BLF_get(fontid);
|
||||
|
||||
if (font) {
|
||||
font->b_fbuf = fbuf;
|
||||
font->b_cbuf = cbuf;
|
||||
font->bw = w;
|
||||
font->bh = h;
|
||||
font->bch = nch;
|
||||
font->buf_info.fbuf = fbuf;
|
||||
font->buf_info.cbuf = cbuf;
|
||||
font->buf_info.w = w;
|
||||
font->buf_info.h = h;
|
||||
font->buf_info.ch = nch;
|
||||
font->buf_info.do_color_management = do_color_management;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -764,10 +765,10 @@ void BLF_buffer_col(int fontid, float r, float g, float b, float a)
|
||||
FontBLF *font = BLF_get(fontid);
|
||||
|
||||
if (font) {
|
||||
font->b_col[0] = r;
|
||||
font->b_col[1] = g;
|
||||
font->b_col[2] = b;
|
||||
font->b_col[3] = a;
|
||||
font->buf_info.col[0] = r;
|
||||
font->buf_info.col[1] = g;
|
||||
font->buf_info.col[2] = b;
|
||||
font->buf_info.col[3] = a;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,7 +776,7 @@ void BLF_draw_buffer(int fontid, const char *str)
|
||||
{
|
||||
FontBLF *font = BLF_get(fontid);
|
||||
|
||||
if (font && font->glyph_cache && (font->b_fbuf || font->b_cbuf)) {
|
||||
if (font && font->glyph_cache && (font->buf_info.fbuf || font->buf_info.cbuf)) {
|
||||
blf_font_buffer(font, str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,11 +225,14 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
||||
size_t i = 0;
|
||||
GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
|
||||
|
||||
/* buffer specific vars*/
|
||||
const unsigned char b_col_char[4] = {font->b_col[0] * 255,
|
||||
font->b_col[1] * 255,
|
||||
font->b_col[2] * 255,
|
||||
font->b_col[3] * 255};
|
||||
/* buffer specific vars */
|
||||
FontBufInfoBLF *buf_info = &font->buf_info;
|
||||
float b_col_float[4];
|
||||
const unsigned char b_col_char[4] = {buf_info->col[0] * 255,
|
||||
buf_info->col[1] * 255,
|
||||
buf_info->col[2] * 255,
|
||||
buf_info->col[3] * 255};
|
||||
|
||||
unsigned char *cbuf;
|
||||
int chx, chy;
|
||||
int y, x;
|
||||
@@ -239,6 +242,14 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
||||
|
||||
blf_font_ensure_ascii_table(font);
|
||||
|
||||
/* another buffer spesific call for color conversion */
|
||||
if (buf_info->do_color_management) {
|
||||
srgb_to_linearrgb_v4(b_col_float, buf_info->col);
|
||||
}
|
||||
else {
|
||||
copy_v4_v4(b_col_float, buf_info->col);
|
||||
}
|
||||
|
||||
while (str[i]) {
|
||||
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
|
||||
|
||||
@@ -259,16 +270,16 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
||||
pen_y = (int)font->pos[1] - (g->height - (int)g->pos_y);
|
||||
}
|
||||
|
||||
if ((chx + g->width) >= 0 && chx < font->bw && (pen_y + g->height) >= 0 && pen_y < font->bh) {
|
||||
if ((chx + g->width) >= 0 && chx < buf_info->w && (pen_y + g->height) >= 0 && pen_y < buf_info->h) {
|
||||
/* don't draw beyond the buffer bounds */
|
||||
int width_clip = g->width;
|
||||
int height_clip = g->height;
|
||||
int yb_start = g->pitch < 0 ? 0 : g->height - 1;
|
||||
|
||||
if (width_clip + chx > font->bw)
|
||||
width_clip -= chx + width_clip - font->bw;
|
||||
if (height_clip + pen_y > font->bh)
|
||||
height_clip -= pen_y + height_clip - font->bh;
|
||||
if (width_clip + chx > buf_info->w)
|
||||
width_clip -= chx + width_clip - buf_info->w;
|
||||
if (height_clip + pen_y > buf_info->h)
|
||||
height_clip -= pen_y + height_clip - buf_info->h;
|
||||
|
||||
/* drawing below the image? */
|
||||
if (pen_y < 0) {
|
||||
@@ -277,7 +288,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
||||
pen_y = 0;
|
||||
}
|
||||
|
||||
if (font->b_fbuf) {
|
||||
if (buf_info->fbuf) {
|
||||
int yb = yb_start;
|
||||
for (y = ((chy >= 0) ? 0 : -chy); y < height_clip; y++) {
|
||||
for (x = ((chx >= 0) ? 0 : -chx); x < width_clip; x++) {
|
||||
@@ -285,18 +296,18 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
||||
|
||||
if (a > 0.0f) {
|
||||
float alphatest;
|
||||
fbuf = font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y) * font->bw));
|
||||
fbuf = buf_info->fbuf + buf_info->ch * ((chx + x) + ((pen_y + y) * buf_info->w));
|
||||
if (a >= 1.0f) {
|
||||
fbuf[0] = font->b_col[0];
|
||||
fbuf[1] = font->b_col[1];
|
||||
fbuf[2] = font->b_col[2];
|
||||
fbuf[3] = (alphatest = (fbuf[3] + (font->b_col[3]))) < 1.0f ? alphatest : 1.0f;
|
||||
fbuf[0] = b_col_float[0];
|
||||
fbuf[1] = b_col_float[1];
|
||||
fbuf[2] = b_col_float[2];
|
||||
fbuf[3] = (alphatest = (fbuf[3] + (b_col_float[3]))) < 1.0f ? alphatest : 1.0f;
|
||||
}
|
||||
else {
|
||||
fbuf[0] = (font->b_col[0] * a) + (fbuf[0] * (1 - a));
|
||||
fbuf[1] = (font->b_col[1] * a) + (fbuf[1] * (1 - a));
|
||||
fbuf[2] = (font->b_col[2] * a) + (fbuf[2] * (1 - a));
|
||||
fbuf[3] = (alphatest = (fbuf[3] + (font->b_col[3] * a))) < 1.0f ? alphatest : 1.0f;
|
||||
fbuf[0] = (b_col_float[0] * a) + (fbuf[0] * (1.0f - a));
|
||||
fbuf[1] = (b_col_float[1] * a) + (fbuf[1] * (1.0f - a));
|
||||
fbuf[2] = (b_col_float[2] * a) + (fbuf[2] * (1.0f - a));
|
||||
fbuf[3] = (alphatest = (fbuf[3] + (b_col_float[3] * a))) < 1.0f ? alphatest : 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -308,7 +319,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
||||
}
|
||||
}
|
||||
|
||||
if (font->b_cbuf) {
|
||||
if (buf_info->cbuf) {
|
||||
int yb = yb_start;
|
||||
for (y = 0; y < height_clip; y++) {
|
||||
for (x = 0; x < width_clip; x++) {
|
||||
@@ -316,7 +327,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
||||
|
||||
if (a > 0.0f) {
|
||||
int alphatest;
|
||||
cbuf = font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y) * font->bw));
|
||||
cbuf = buf_info->cbuf + buf_info->ch * ((chx + x) + ((pen_y + y) * buf_info->w));
|
||||
if (a >= 1.0f) {
|
||||
cbuf[0] = b_col_char[0];
|
||||
cbuf[1] = b_col_char[1];
|
||||
@@ -324,10 +335,10 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
||||
cbuf[3] = (alphatest = ((int)cbuf[3] + (int)b_col_char[3])) < 255 ? alphatest : 255;
|
||||
}
|
||||
else {
|
||||
cbuf[0] = (b_col_char[0] * a) + (cbuf[0] * (1 - a));
|
||||
cbuf[1] = (b_col_char[1] * a) + (cbuf[1] * (1 - a));
|
||||
cbuf[2] = (b_col_char[2] * a) + (cbuf[2] * (1 - a));
|
||||
cbuf[3] = (alphatest = ((int)cbuf[3] + (int)((font->b_col[3] * a) * 255.0f))) <
|
||||
cbuf[0] = (b_col_char[0] * a) + (cbuf[0] * (1.0f - a));
|
||||
cbuf[1] = (b_col_char[1] * a) + (cbuf[1] * (1.0f - a));
|
||||
cbuf[2] = (b_col_char[2] * a) + (cbuf[2] * (1.0f - a));
|
||||
cbuf[3] = (alphatest = ((int)cbuf[3] + (int)((b_col_float[3] * a) * 255.0f))) <
|
||||
255 ? alphatest : 255;
|
||||
}
|
||||
}
|
||||
@@ -507,15 +518,17 @@ static void blf_font_fill(FontBLF *font)
|
||||
font->glyph_cache = NULL;
|
||||
font->blur = 0;
|
||||
font->max_tex_size = -1;
|
||||
font->b_fbuf = NULL;
|
||||
font->b_cbuf = NULL;
|
||||
font->bw = 0;
|
||||
font->bh = 0;
|
||||
font->bch = 0;
|
||||
font->b_col[0] = 0;
|
||||
font->b_col[1] = 0;
|
||||
font->b_col[2] = 0;
|
||||
font->b_col[3] = 0;
|
||||
|
||||
font->buf_info.fbuf = NULL;
|
||||
font->buf_info.cbuf = NULL;
|
||||
font->buf_info.w = 0;
|
||||
font->buf_info.h = 0;
|
||||
font->buf_info.ch = 0;
|
||||
font->buf_info.col[0] = 0;
|
||||
font->buf_info.col[1] = 0;
|
||||
font->buf_info.col[2] = 0;
|
||||
font->buf_info.col[3] = 0;
|
||||
|
||||
font->ft_lib = ft_lib;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +131,28 @@ typedef struct GlyphBLF {
|
||||
short build_tex;
|
||||
} GlyphBLF;
|
||||
|
||||
typedef struct FontBufInfoBLF {
|
||||
/* for draw to buffer, always set this to NULL after finish! */
|
||||
float *fbuf;
|
||||
|
||||
/* the same but unsigned char */
|
||||
unsigned char *cbuf;
|
||||
|
||||
/* buffer size, keep signed so comparisons with negative values work */
|
||||
int w;
|
||||
int h;
|
||||
|
||||
/* number of channels. */
|
||||
int ch;
|
||||
|
||||
/* is the float buffer linear */
|
||||
int do_color_management;
|
||||
|
||||
/* and the color, the alphas is get from the glyph!
|
||||
* color is srgb space */
|
||||
float col[4];
|
||||
} FontBufInfoBLF;
|
||||
|
||||
typedef struct FontBLF {
|
||||
/* font name. */
|
||||
char *name;
|
||||
@@ -198,21 +220,8 @@ typedef struct FontBLF {
|
||||
/* freetype2 face. */
|
||||
FT_Face face;
|
||||
|
||||
/* for draw to buffer, always set this to NULL after finish! */
|
||||
float *b_fbuf;
|
||||
|
||||
/* the same but unsigned char */
|
||||
unsigned char *b_cbuf;
|
||||
|
||||
/* buffer size, keep signed so comparisons with negative values work */
|
||||
int bw;
|
||||
int bh;
|
||||
|
||||
/* number of channels. */
|
||||
int bch;
|
||||
|
||||
/* and the color, the alphas is get from the glyph! */
|
||||
float b_col[4];
|
||||
/* data for buffer usage (drawing into a texture buffer) */
|
||||
FontBufInfoBLF buf_info;
|
||||
} FontBLF;
|
||||
|
||||
typedef struct DirBLF {
|
||||
|
||||
@@ -400,18 +400,8 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
|
||||
copy_v3_v3(verts->txold, verts->x);
|
||||
|
||||
/* Get the current position. */
|
||||
if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) &&
|
||||
((!(cloth->verts[i].flags & CLOTH_VERT_FLAG_PINNED))
|
||||
&& (cloth->verts[i].goal > ALMOST_ZERO)))
|
||||
{
|
||||
copy_v3_v3(verts->xconst, mvert[i].co);
|
||||
mul_m4_v3(ob->obmat, verts->xconst);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This fixed animated goals not to jump back to "first frame position" */
|
||||
copy_v3_v3(verts->xconst, verts->txold);
|
||||
}
|
||||
copy_v3_v3(verts->xconst, mvert[i].co);
|
||||
mul_m4_v3(ob->obmat, verts->xconst);
|
||||
}
|
||||
|
||||
effectors = pdInitEffectors(clmd->scene, ob, NULL, clmd->sim_parms->effector_weights);
|
||||
|
||||
@@ -1496,6 +1496,10 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
float h_fixed;
|
||||
const int mono = blf_mono_font_render; // XXX
|
||||
|
||||
/* this could be an argument if we want to operate on non linear float imbuf's
|
||||
* for now though this is only used for renders which use scene settings */
|
||||
const int do_color_management = (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) != 0;
|
||||
|
||||
#define BUFF_MARGIN_X 2
|
||||
#define BUFF_MARGIN_Y 1
|
||||
|
||||
@@ -1511,7 +1515,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
/* set before return */
|
||||
BLF_size(mono, scene->r.stamp_font_id, 72);
|
||||
|
||||
BLF_buffer(mono, rectf, rect, width, height, channels);
|
||||
BLF_buffer(mono, rectf, rect, width, height, channels, do_color_management);
|
||||
BLF_buffer_col(mono, scene->r.fg_stamp[0], scene->r.fg_stamp[1], scene->r.fg_stamp[2], 1.0);
|
||||
pad = BLF_width_max(mono);
|
||||
|
||||
@@ -1528,7 +1532,8 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
y -= h;
|
||||
|
||||
/* also a little of space to the background. */
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
|
||||
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
|
||||
/* and draw the text. */
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
@@ -1544,7 +1549,8 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
y -= h;
|
||||
|
||||
/* and space for background. */
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
|
||||
0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
BLF_draw_buffer(mono, stamp_data.note);
|
||||
@@ -1559,7 +1565,8 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
y -= h;
|
||||
|
||||
/* and space for background. */
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
|
||||
0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
BLF_draw_buffer(mono, stamp_data.date);
|
||||
@@ -1574,7 +1581,8 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
y -= h;
|
||||
|
||||
/* and space for background. */
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
|
||||
0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
BLF_draw_buffer(mono, stamp_data.rendertime);
|
||||
@@ -1588,7 +1596,8 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
BLF_width_and_height(mono, stamp_data.marker, &w, &h); h = h_fixed;
|
||||
|
||||
/* extra space for background. */
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
|
||||
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
|
||||
/* and pad the text. */
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
@@ -1603,7 +1612,8 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
BLF_width_and_height(mono, stamp_data.time, &w, &h); h = h_fixed;
|
||||
|
||||
/* extra space for background */
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x - BUFF_MARGIN_X, y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
|
||||
x - BUFF_MARGIN_X, y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
|
||||
/* and pad the text. */
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
@@ -1617,7 +1627,8 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
BLF_width_and_height(mono, stamp_data.frame, &w, &h); h = h_fixed;
|
||||
|
||||
/* extra space for background. */
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
|
||||
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
|
||||
/* and pad the text. */
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
@@ -1631,7 +1642,8 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
BLF_width_and_height(mono, stamp_data.camera, &w, &h); h = h_fixed;
|
||||
|
||||
/* extra space for background. */
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
|
||||
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
BLF_draw_buffer(mono, stamp_data.camera);
|
||||
|
||||
@@ -1643,7 +1655,8 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
BLF_width_and_height(mono, stamp_data.cameralens, &w, &h); h = h_fixed;
|
||||
|
||||
/* extra space for background. */
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
|
||||
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
BLF_draw_buffer(mono, stamp_data.cameralens);
|
||||
}
|
||||
@@ -1655,7 +1668,8 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
x = width - w - 2;
|
||||
|
||||
/* extra space for background. */
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
|
||||
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
|
||||
/* and pad the text. */
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
@@ -1670,14 +1684,15 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
|
||||
y = height - h;
|
||||
|
||||
/* extra space for background. */
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
|
||||
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
|
||||
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
BLF_draw_buffer(mono, stamp_data.strip);
|
||||
}
|
||||
|
||||
/* cleanup the buffer. */
|
||||
BLF_buffer(mono, NULL, NULL, 0, 0, 0);
|
||||
BLF_buffer(mono, NULL, NULL, 0, 0, 0, FALSE);
|
||||
|
||||
#undef BUFF_MARGIN_X
|
||||
#undef BUFF_MARGIN_Y
|
||||
|
||||
@@ -289,7 +289,7 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
|
||||
|
||||
BLF_size(mono, 54, 72); /* hard coded size! */
|
||||
|
||||
BLF_buffer(mono, rect_float, rect, width, height, 4);
|
||||
BLF_buffer(mono, rect_float, rect, width, height, 4, TRUE);
|
||||
|
||||
for (y = 0; y < height; y += step) {
|
||||
text[1] = '1';
|
||||
@@ -330,7 +330,7 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
|
||||
}
|
||||
|
||||
/* cleanup the buffer. */
|
||||
BLF_buffer(mono, NULL, NULL, 0, 0, 0);
|
||||
BLF_buffer(mono, NULL, NULL, 0, 0, 0, FALSE);
|
||||
}
|
||||
|
||||
void BKE_image_buf_fill_checker_color(unsigned char *rect, float *rect_float, int width, int height)
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_math_base.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
||||
@@ -1186,10 +1187,48 @@ struct SmoothView2DStore {
|
||||
double time_allowed;
|
||||
};
|
||||
|
||||
/**
|
||||
* function to get a factor out of a rectangle
|
||||
*
|
||||
* note: this doesn't always work as well as it might because the target size
|
||||
* may not be reached because of clamping the desired rect, we _could_
|
||||
* attempt to clamp the rect before working out the zoom factor but its
|
||||
* not really worthwhile for the few cases this happens.
|
||||
*/
|
||||
static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
|
||||
{
|
||||
float size_a[2] = {rect_a->xmax - rect_a->xmin,
|
||||
rect_a->ymax - rect_a->ymin};
|
||||
float size_b[2] = {rect_b->xmax - rect_b->xmin,
|
||||
rect_b->ymax - rect_b->ymin};
|
||||
float cent_a[2] = {(rect_a->xmax + rect_a->xmin) * 0.5f,
|
||||
(rect_a->ymax + rect_a->ymin) * 0.5f};
|
||||
float cent_b[2] = {(rect_b->xmax + rect_b->xmin) * 0.5f,
|
||||
(rect_b->ymax + rect_b->ymin) * 0.5f};
|
||||
|
||||
float fac_max = 0.0f;
|
||||
float tfac;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
/* axis translation normalized to scale */
|
||||
tfac = fabsf(cent_a[i] - cent_b[i]) / minf(size_a[i], size_b[i]);
|
||||
fac_max = maxf(fac_max, tfac);
|
||||
if (fac_max >= 1.0f) break;
|
||||
|
||||
/* axis scale difference, x2 so doubling or half gives 1.0f */
|
||||
tfac = (1.0f - (minf(size_a[i], size_b[i]) / maxf(size_a[i], size_b[i]))) * 2.0f;
|
||||
fac_max = maxf(fac_max, tfac);
|
||||
if (fac_max >= 1.0f) break;
|
||||
}
|
||||
return minf(fac_max, 1.0f);
|
||||
}
|
||||
|
||||
/* will start timer if appropriate */
|
||||
/* the arguments are the desired situation */
|
||||
void UI_view2d_smooth_view(bContext *C, ARegion *ar,
|
||||
const rctf *cur)
|
||||
const rctf *cur)
|
||||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
@@ -1197,6 +1236,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar,
|
||||
View2D *v2d = &ar->v2d;
|
||||
struct SmoothView2DStore sms = {{0}};
|
||||
short ok = FALSE;
|
||||
float fac = 1.0f;
|
||||
|
||||
/* initialize sms */
|
||||
sms.new_cur = v2d->cur;
|
||||
@@ -1204,7 +1244,11 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar,
|
||||
/* store the options we want to end with */
|
||||
if (cur) sms.new_cur = *cur;
|
||||
|
||||
if (C && U.smooth_viewtx) {
|
||||
if (cur) {
|
||||
fac = smooth_view_rect_to_fac(&v2d->cur, cur);
|
||||
}
|
||||
|
||||
if (C && U.smooth_viewtx && fac > FLT_EPSILON) {
|
||||
int changed = 0; /* zero means no difference */
|
||||
|
||||
if (BLI_rctf_compare(&sms.new_cur, &v2d->cur, FLT_EPSILON) == FALSE)
|
||||
@@ -1218,6 +1262,9 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar,
|
||||
|
||||
sms.time_allowed = (double)U.smooth_viewtx / 1000.0;
|
||||
|
||||
/* scale the time allowed the change in view */
|
||||
sms.time_allowed *= (double)fac;
|
||||
|
||||
/* keep track of running timer! */
|
||||
if (v2d->sms == NULL)
|
||||
v2d->sms = MEM_mallocN(sizeof(struct SmoothView2DStore), "smoothview v2d");
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_lattice_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
@@ -430,7 +431,7 @@ static Object *add_hook_object_new(Scene *scene, Object *obedit)
|
||||
return ob;
|
||||
}
|
||||
|
||||
static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob, int mode)
|
||||
static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob, int mode, ReportList *reports)
|
||||
{
|
||||
ModifierData *md = NULL;
|
||||
HookModifierData *hmd = NULL;
|
||||
@@ -439,9 +440,12 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
|
||||
char name[MAX_NAME];
|
||||
|
||||
ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
|
||||
|
||||
if (!ok) return; // XXX error("Requires selected vertices or active Vertex Group");
|
||||
|
||||
|
||||
if (!ok) {
|
||||
BKE_report(reports, RPT_ERROR, "Requires selected vertices or active Vertex Group");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (mode == OBJECT_ADDHOOK_NEWOB && !ob) {
|
||||
|
||||
ob = add_hook_object_new(scene, obedit);
|
||||
@@ -466,6 +470,17 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
|
||||
hmd->totindex = tot;
|
||||
BLI_strncpy(hmd->name, name, sizeof(hmd->name));
|
||||
|
||||
if (mode == OBJECT_ADDHOOK_SELOB_BONE) {
|
||||
bArmature *arm = ob->data;
|
||||
BLI_assert(ob->type == OB_ARMATURE);
|
||||
if (arm->act_bone) {
|
||||
BLI_strncpy(hmd->subtarget, arm->act_bone->name, sizeof(hmd->subtarget));
|
||||
}
|
||||
else {
|
||||
BKE_report(reports, RPT_WARNING, "Armature has no active object bone");
|
||||
}
|
||||
}
|
||||
|
||||
/* matrix calculus */
|
||||
/* vert x (obmat x hook->imat) x hook->obmat x ob->imat */
|
||||
/* (parentinv ) */
|
||||
@@ -477,6 +492,8 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
DAG_scene_sort(bmain, scene);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
|
||||
@@ -485,6 +502,8 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
Object *obsel = NULL;
|
||||
const int use_bone = RNA_boolean_get(op->ptr, "use_bone");
|
||||
const int mode = use_bone ? OBJECT_ADDHOOK_SELOB_BONE : OBJECT_ADDHOOK_SELOB;
|
||||
|
||||
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
|
||||
{
|
||||
@@ -499,11 +518,19 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
|
||||
BKE_report(op->reports, RPT_ERROR, "Can't add hook with no other selected objects");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
if (use_bone && obsel->type != OB_ARMATURE) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Can't add hook bone for a non armature object");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
add_hook_object(bmain, scene, obedit, obsel, OBJECT_ADDHOOK_SELOB);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
|
||||
return OPERATOR_FINISHED;
|
||||
if (add_hook_object(bmain, scene, obedit, obsel, mode, op->reports)) {
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void OBJECT_OT_hook_add_selobj(wmOperatorType *ot)
|
||||
@@ -519,19 +546,25 @@ void OBJECT_OT_hook_add_selobj(wmOperatorType *ot)
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna, "use_bone", FALSE, "Active Bone",
|
||||
"Assign the hook to the hook objects active bone");
|
||||
}
|
||||
|
||||
static int object_add_hook_newob_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int object_add_hook_newob_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
|
||||
add_hook_object(bmain, scene, obedit, NULL, OBJECT_ADDHOOK_NEWOB);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
|
||||
return OPERATOR_FINISHED;
|
||||
if (add_hook_object(bmain, scene, obedit, NULL, OBJECT_ADDHOOK_NEWOB, op->reports)) {
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void OBJECT_OT_hook_add_newobj(wmOperatorType *ot)
|
||||
|
||||
@@ -43,6 +43,7 @@ struct HookModifierData;
|
||||
enum {
|
||||
OBJECT_ADDHOOK_NEWOB = 1,
|
||||
OBJECT_ADDHOOK_SELOB,
|
||||
OBJECT_ADDHOOK_SELOB_BONE
|
||||
} eObject_Hook_Add_Mode;
|
||||
|
||||
/* internal exports only */
|
||||
|
||||
@@ -1039,6 +1039,8 @@ static void node_draw(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTre
|
||||
node->typeinfo->drawfunc(C, ar, snode, ntree, node);
|
||||
}
|
||||
|
||||
#define USE_DRAW_TOT_UPDATE
|
||||
|
||||
void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree)
|
||||
{
|
||||
bNode *node;
|
||||
@@ -1046,9 +1048,22 @@ void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeT
|
||||
int a;
|
||||
|
||||
if (ntree == NULL) return; /* groups... */
|
||||
|
||||
|
||||
#ifdef USE_DRAW_TOT_UPDATE
|
||||
if (ntree->nodes.first) {
|
||||
BLI_rctf_init_minmax(&ar->v2d.tot);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* draw background nodes, last nodes in front */
|
||||
for (a = 0, node = ntree->nodes.first; node; node = node->next, a++) {
|
||||
|
||||
#ifdef USE_DRAW_TOT_UPDATE
|
||||
/* unrelated to background nodes, update the v2d->tot,
|
||||
* can be anywhere before we draw the scroll bars */
|
||||
BLI_rctf_union(&ar->v2d.tot, &node->totr);
|
||||
#endif
|
||||
|
||||
if (!(node->flag & NODE_BACKGROUND))
|
||||
continue;
|
||||
node->nr = a; /* index of node in list, used for exec event code */
|
||||
|
||||
@@ -136,8 +136,6 @@ static int node_view_all_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
snode->yof = 0;
|
||||
|
||||
if (space_node_view_flag(C, snode, ar, 0)) {
|
||||
ED_region_tag_redraw(ar);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
@@ -166,8 +164,6 @@ static int node_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
|
||||
if (space_node_view_flag(C, snode, ar, NODE_SELECT)) {
|
||||
ED_region_tag_redraw(ar);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -491,7 +491,9 @@ void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, i
|
||||
void IMB_rectfill_alpha(struct ImBuf *ibuf, const float value);
|
||||
|
||||
/* this should not be here, really, we needed it for operating on render data, IMB_rectfill_area calls it */
|
||||
void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
|
||||
void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
|
||||
const float col[4], const int do_color_management,
|
||||
int x1, int y1, int x2, int y2);
|
||||
|
||||
/* defined in metadata.c */
|
||||
int IMB_metadata_change_field(struct ImBuf *img, const char *key, const char *field);
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "BLI_blenlib.h" /* BLI_remlink BLI_file_descriptor_size BLI_addtail
|
||||
* BLI_countlist BLI_stringdec */
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_math_base.h"
|
||||
|
||||
@@ -73,7 +73,6 @@
|
||||
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
* \ingroup imbuf
|
||||
*/
|
||||
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include "imbuf.h"
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
* \ingroup imbuf
|
||||
*/
|
||||
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_rand.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "IMB_indexer.h"
|
||||
#include "IMB_anim.h"
|
||||
#include "AVI_avi.h"
|
||||
@@ -29,13 +31,14 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_math_base.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
#include "BKE_global.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WITH_FFMPEG
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "imbuf.h"
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include "imbuf.h"
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include "imbuf.h"
|
||||
#include "IMB_imbuf_types.h"
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "IMB_imbuf_types.h"
|
||||
|
||||
@@ -256,10 +256,10 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
|
||||
from = (unsigned char *)ibuf->rect + channels * i * width;
|
||||
|
||||
for (int j = ibuf->x; j > 0; j--) {
|
||||
to->r = (float)(from[0]) / 255.0;
|
||||
to->g = (float)(from[1]) / 255.0;
|
||||
to->b = (float)(from[2]) / 255.0;
|
||||
to->a = (float)(channels >= 4) ? from[3] / 255.0 : 1.0f;
|
||||
to->r = (float)(from[0]) / 255.0f;
|
||||
to->g = (float)(from[1]) / 255.0f;
|
||||
to->b = (float)(from[2]) / 255.0f;
|
||||
to->a = (float)(channels >= 4) ? from[3] / 255.0f : 1.0f;
|
||||
to++; from += 4;
|
||||
}
|
||||
}
|
||||
@@ -269,10 +269,10 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
|
||||
from = (unsigned char *)ibuf->rect + channels * i * width;
|
||||
|
||||
for (int j = ibuf->x; j > 0; j--) {
|
||||
to->r = srgb_to_linearrgb((float)from[0] / 255.0);
|
||||
to->g = srgb_to_linearrgb((float)from[1] / 255.0);
|
||||
to->b = srgb_to_linearrgb((float)from[2] / 255.0);
|
||||
to->a = channels >= 4 ? (float)from[3] / 255.0 : 1.0f;
|
||||
to->r = srgb_to_linearrgb((float)from[0] / 255.0f);
|
||||
to->g = srgb_to_linearrgb((float)from[1] / 255.0f);
|
||||
to->b = srgb_to_linearrgb((float)from[2] / 255.0f);
|
||||
to->a = channels >= 4 ? (float)from[3] / 255.0f : 1.0f;
|
||||
to++; from += 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
|
||||
#include "png.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
|
||||
@@ -33,16 +33,20 @@
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include "mmap_win.h"
|
||||
#define open _open
|
||||
#define read _read
|
||||
#define close _close
|
||||
# include <io.h>
|
||||
# include <stddef.h>
|
||||
# include <sys/types.h>
|
||||
# include "mmap_win.h"
|
||||
# define open _open
|
||||
# define read _read
|
||||
# define close _close
|
||||
#endif
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include <stdlib.h>
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "imbuf.h"
|
||||
|
||||
@@ -31,9 +31,11 @@
|
||||
* \ingroup imbuf
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_math_color.h"
|
||||
#include "BLI_math_vector.h"
|
||||
|
||||
#include "imbuf.h"
|
||||
#include "IMB_imbuf_types.h"
|
||||
@@ -481,7 +483,9 @@ void IMB_rectfill(struct ImBuf *drect, const float col[4])
|
||||
}
|
||||
|
||||
|
||||
void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2)
|
||||
void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
|
||||
const float col[4], const int do_color_management,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int i, j;
|
||||
float a; /* alpha */
|
||||
@@ -544,21 +548,30 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
|
||||
}
|
||||
|
||||
if (rectf) {
|
||||
float col_conv[4];
|
||||
float *pixel;
|
||||
|
||||
if (do_color_management) {
|
||||
srgb_to_linearrgb_v4(col_conv, col);
|
||||
}
|
||||
else {
|
||||
copy_v4_v4(col_conv, col);
|
||||
}
|
||||
|
||||
for (j = 0; j < y2 - y1; j++) {
|
||||
for (i = 0; i < x2 - x1; i++) {
|
||||
pixel = rectf + 4 * (((y1 + j) * width) + (x1 + i));
|
||||
if (a == 1.0f) {
|
||||
pixel[0] = col[0];
|
||||
pixel[1] = col[1];
|
||||
pixel[2] = col[2];
|
||||
pixel[0] = col_conv[0];
|
||||
pixel[1] = col_conv[1];
|
||||
pixel[2] = col_conv[2];
|
||||
pixel[3] = 1.0f;
|
||||
}
|
||||
else {
|
||||
float alphatest;
|
||||
pixel[0] = (col[0] * a) + (pixel[0] * ai);
|
||||
pixel[1] = (col[1] * a) + (pixel[1] * ai);
|
||||
pixel[2] = (col[2] * a) + (pixel[2] * ai);
|
||||
pixel[0] = (col_conv[0] * a) + (pixel[0] * ai);
|
||||
pixel[1] = (col_conv[1] * a) + (pixel[1] * ai);
|
||||
pixel[2] = (col_conv[2] * a) + (pixel[2] * ai);
|
||||
pixel[3] = (alphatest = (pixel[3] + a)) < 1.0f ? alphatest : 1.0f;
|
||||
}
|
||||
}
|
||||
@@ -568,8 +581,11 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
|
||||
|
||||
void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int do_color_management;
|
||||
if (!ibuf) return;
|
||||
buf_rectfill_area((unsigned char *) ibuf->rect, ibuf->rect_float, ibuf->x, ibuf->y, col, x1, y1, x2, y2);
|
||||
do_color_management = (ibuf->profile == IB_PROFILE_LINEAR_RGB);
|
||||
buf_rectfill_area((unsigned char *) ibuf->rect, ibuf->rect_float, ibuf->x, ibuf->y, col, do_color_management,
|
||||
x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,11 +31,8 @@
|
||||
* \ingroup imbuf
|
||||
*/
|
||||
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "imbuf.h"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
|
||||
@@ -31,9 +31,11 @@
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
# include <io.h>
|
||||
#endif
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "imbuf.h"
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_md5.h"
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
@@ -45,7 +47,6 @@
|
||||
#include "IMB_metadata.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -46,12 +46,10 @@
|
||||
#include "imbuf.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_global.h"
|
||||
|
||||
|
||||
#include "IMB_imbuf_types.h"
|
||||
#include "IMB_imbuf.h"
|
||||
|
||||
|
||||
@@ -33,13 +33,15 @@
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#define open _open
|
||||
#define read _read
|
||||
#define close _close
|
||||
# include <io.h>
|
||||
# define open _open
|
||||
# define read _read
|
||||
# define close _close
|
||||
#endif
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
@@ -168,7 +168,7 @@ typedef struct bNode {
|
||||
void *storage; /* custom data, must be struct, for storage in file */
|
||||
struct bNode *original; /* the original node in the tree (for localized tree) */
|
||||
|
||||
float locx, locy; /* root offset for drawing */
|
||||
float locx, locy; /* root offset for drawing (parent space) */
|
||||
float width, height; /* node custom width and height */
|
||||
float miniwidth; /* node width if hidden */
|
||||
float offsetx, offsety; /* additional offset from loc */
|
||||
@@ -181,7 +181,7 @@ typedef struct bNode {
|
||||
|
||||
short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */
|
||||
void *threaddata; /* optional extra storage for use in thread (read only then!) */
|
||||
rctf totr; /* entire boundbox */
|
||||
rctf totr; /* entire boundbox (worldspace) */
|
||||
rctf butr; /* optional buttons area */
|
||||
rctf prvr; /* optional preview area */
|
||||
bNodePreview *preview; /* optional preview image */
|
||||
|
||||
@@ -104,6 +104,7 @@ typedef struct View2D {
|
||||
|
||||
/* general refresh settings (v2d->flag) */
|
||||
/* global view2d horizontal locking (for showing same time interval) */
|
||||
/* TODO: this flag may be set in old files but is not accessible currently, should be exposed from RNA - Campbell */
|
||||
#define V2D_VIEWSYNC_SCREEN_TIME (1<<0)
|
||||
/* within area (i.e. between regions) view2d vertical locking */
|
||||
#define V2D_VIEWSYNC_AREA_VERTICAL (1<<1)
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
* \todo document
|
||||
*/
|
||||
|
||||
|
||||
/* dna-savable wmStructs here */
|
||||
#include "DNA_windowmanager_types.h"
|
||||
#include "WM_keymap.h"
|
||||
@@ -83,7 +82,7 @@ void WM_check (struct bContext *C);
|
||||
|
||||
struct wmWindow *WM_window_open (struct bContext *C, struct rcti *rect);
|
||||
|
||||
/* defines for 'type' WM_window_open_temp */
|
||||
/* defines for 'type' WM_window_open_temp */
|
||||
#define WM_WINDOW_RENDER 0
|
||||
#define WM_WINDOW_USERPREFS 1
|
||||
#define WM_WINDOW_FILESEL 2
|
||||
@@ -183,7 +182,7 @@ void WM_operator_free (struct wmOperator *op);
|
||||
void WM_operator_stack_clear(struct wmWindowManager *wm);
|
||||
|
||||
struct wmOperatorType *WM_operatortype_find(const char *idnamem, int quiet);
|
||||
struct GHashIterator *WM_operatortype_iter(void);
|
||||
struct GHashIterator *WM_operatortype_iter(void);
|
||||
void WM_operatortype_append (void (*opfunc)(struct wmOperatorType*));
|
||||
void WM_operatortype_append_ptr (void (*opfunc)(struct wmOperatorType*, void *), void *userdata);
|
||||
void WM_operatortype_append_macro_ptr (void (*opfunc)(struct wmOperatorType*, void *), void *userdata);
|
||||
@@ -311,10 +310,10 @@ struct wmJob *WM_jobs_get(struct wmWindowManager *wm, struct wmWindow *win, void
|
||||
|
||||
int WM_jobs_test(struct wmWindowManager *wm, void *owner);
|
||||
float WM_jobs_progress(struct wmWindowManager *wm, void *owner);
|
||||
char *WM_jobs_name(struct wmWindowManager *wm, void *owner);
|
||||
char *WM_jobs_name(struct wmWindowManager *wm, void *owner);
|
||||
|
||||
int WM_jobs_is_running(struct wmJob *);
|
||||
void * WM_jobs_customdata_get(struct wmJob *);
|
||||
void *WM_jobs_customdata_get(struct wmJob *);
|
||||
void WM_jobs_customdata_set(struct wmJob *, void *customdata, void (*free)(void *));
|
||||
void WM_jobs_timer(struct wmJob *, double timestep, unsigned int note, unsigned int endnote);
|
||||
void WM_jobs_callbacks(struct wmJob *,
|
||||
@@ -331,8 +330,8 @@ void WM_jobs_stop_all(struct wmWindowManager *wm);
|
||||
int WM_jobs_has_running(struct wmWindowManager *wm);
|
||||
|
||||
/* clipboard */
|
||||
char *WM_clipboard_text_get(int selection);
|
||||
void WM_clipboard_text_set(char *buf, int selection);
|
||||
char *WM_clipboard_text_get(int selection);
|
||||
void WM_clipboard_text_set(char *buf, int selection);
|
||||
|
||||
/* progress */
|
||||
void WM_progress_set(struct wmWindow *win, float progress);
|
||||
|
||||
@@ -454,28 +454,28 @@ typedef struct wmTabletData {
|
||||
|
||||
typedef enum { /* motion progress, for modal handlers */
|
||||
P_NOT_STARTED,
|
||||
P_STARTING, // <--
|
||||
P_IN_PROGRESS, // <-- only these are sent for NDOF motion
|
||||
P_FINISHING, // <--
|
||||
P_STARTING, /* <-- */
|
||||
P_IN_PROGRESS, /* <-- only these are sent for NDOF motion*/
|
||||
P_FINISHING, /* <-- */
|
||||
P_FINISHED
|
||||
} wmProgress;
|
||||
} wmProgress;
|
||||
|
||||
typedef struct wmNDOFMotionData {
|
||||
/* awfully similar to GHOST_TEventNDOFMotionData... */
|
||||
// Each component normally ranges from -1 to +1, but can exceed that.
|
||||
// These use blender standard view coordinates, with positive rotations being CCW about the axis.
|
||||
/* Each component normally ranges from -1 to +1, but can exceed that.
|
||||
* These use blender standard view coordinates, with positive rotations being CCW about the axis. */
|
||||
union {
|
||||
float tvec[3]; // translation
|
||||
float tvec[3]; /* translation */
|
||||
struct { float tx, ty, tz; };
|
||||
};
|
||||
};
|
||||
union {
|
||||
float rvec[3]; // rotation:
|
||||
float rvec[3]; /* rotation: */
|
||||
struct { float rx, ry, rz; };
|
||||
};
|
||||
// axis = (rx,ry,rz).normalized
|
||||
// amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg]
|
||||
float dt; // time since previous NDOF Motion event
|
||||
wmProgress progress; // is this the first event, the last, or one of many in between?
|
||||
};
|
||||
/* axis = (rx,ry,rz).normalized */
|
||||
/* amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg] */
|
||||
float dt; /* time since previous NDOF Motion event */
|
||||
wmProgress progress; /* is this the first event, the last, or one of many in between? */
|
||||
} wmNDOFMotionData;
|
||||
|
||||
typedef struct wmTimer {
|
||||
|
||||
Reference in New Issue
Block a user