svn merge ^/trunk/blender -r49854:49867
authorCampbell Barton <ideasman42@gmail.com>
Mon, 13 Aug 2012 09:35:11 +0000 (09:35 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 13 Aug 2012 09:35:11 +0000 (09:35 +0000)
37 files changed:
release/scripts/startup/bl_ui/properties_mask_common.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenfont/BLF_api.h
source/blender/blenfont/intern/blf.c
source/blender/blenfont/intern/blf_font.c
source/blender/blenfont/intern/blf_internal_types.h
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/image_gen.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_intern.h
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/node_view.c
source/blender/imbuf/IMB_imbuf.h
source/blender/imbuf/intern/anim_movie.c
source/blender/imbuf/intern/bmp.c
source/blender/imbuf/intern/divers.c
source/blender/imbuf/intern/indexer.c
source/blender/imbuf/intern/iris.c
source/blender/imbuf/intern/jp2.c
source/blender/imbuf/intern/jpeg.c
source/blender/imbuf/intern/metadata.c
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/imbuf/intern/png.c
source/blender/imbuf/intern/readimage.c
source/blender/imbuf/intern/rectop.c
source/blender/imbuf/intern/rotate.c
source/blender/imbuf/intern/scaling.c
source/blender/imbuf/intern/targa.c
source/blender/imbuf/intern/thumbs.c
source/blender/imbuf/intern/tiff.c
source/blender/imbuf/intern/util.c
source/blender/makesdna/DNA_node_types.h
source/blender/makesdna/DNA_view2d_types.h
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/WM_types.h

index 7cd2ae0b5095ee6e8a1fb93bc64557402efefb85..bb25f8fa0763b9929e229fd5b871cd0c71d25ad1 100644 (file)
@@ -237,6 +237,13 @@ class MASK_PT_tools():
         col.operator("mask.parent_set")
         col.operator("mask.parent_clear")
 
+        col = layout.column(align=True)
+        col.label(text="Animation:")
+        col.operator("mask.shape_key_clear")
+        col.operator("mask.shape_key_insert")
+        col.operator("mask.shape_key_feather_reset")
+        col.operator("mask.shape_key_rekey")
+
 
 class MASK_MT_mask(Menu):
     bl_label = "Mask"
index 2d9c9467a013f3d856ae84ac4386c40bdc47a005..9368d3ab5db4d50db88497354e5cbd1b385ba04a 100644 (file)
@@ -1183,6 +1183,7 @@ class VIEW3D_MT_hook(Menu):
         layout.operator_context = 'EXEC_AREA'
         layout.operator("object.hook_add_newob")
         layout.operator("object.hook_add_selob")
+        layout.operator("object.hook_add_selob", text="Hook to Selected Object Bone").use_bone = True
 
         if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
             layout.separator()
index 364d5f90af382a5794b855e307c1195ab1320bc2..0732e02b5fc9d8aaf3f88c952495c80f8763ee2c 100644 (file)
@@ -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);
index 683ef3f821c0214fb8514fbeadd29233a7e9cfab..d4739b37f93dfb612d8aab9fd2778107b06b82d9 100644 (file)
@@ -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);
        }
 }
index 945565e22a9d7bfbb3c636119e8b64d1be7ab8bb..dcefcc68d23cf58a4bd8f6510052879edf972fff 100644 (file)
@@ -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;
 }
 
index bf9b98583481e08f68cddcdcc268128e4d3c8661..4c617da75836db3ca1bf8e28d434d6a6f1f733a8 100644 (file)
@@ -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 {
index af7afe7bf30836c328a77520c520ed89d6af50b4..b0de7a5ea6c88be004c1214bb0f908f242129ac9 100644 (file)
@@ -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);
index cf25a0090a43c73290d0bc8a50fa4d1c2a485d65..8042c4d2807e3f34f8f8b54648d21559dab9e1c8 100644 (file)
@@ -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
index d460368784ac1b06ae9b8299c8a9d1fb85eca462..4d7013b9f73b17df856272c9fe73292eefa3ab7b 100644 (file)
@@ -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)
index 5b5ccc0582c22caabbfd98acc79b1911069f5a2c..33b72b3478465e519d0f3510991db3e24f848057 100644 (file)
@@ -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");
index 65dd9a12d3b8a85ccb00b2bd0b048bd5ec61795f..7c8386d55dcbd919bad086482dc6a6eb1064b2e2 100644 (file)
@@ -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)
index f7e7c87d9563a4427077f68e5874d9c12488dff0..b62ff67606601c3b334d33b24b4fa466994e161a 100644 (file)
@@ -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 */
index 57b08de2d71621ca56cac96cfaeda83052c40fc2..643ac177933640150da048d60ed1322af05a834f 100644 (file)
@@ -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 */
index 0566611dc0e52eee614a9a6675eb5cc07d1a1d72..4be51a0213798835807dcb52c4a147038191f2c0 100644 (file)
@@ -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 {
index a2124ab9cde4ab3662763eaa149c3d012d014a90..f6dc6735567b1e7fb6f074e17cc6e79996be81de 100644 (file)
@@ -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);
index 9367511522d681c1c0396e80ac5613c4a4b7a9b9..f07a18cb89ce5dc37eaf16b9a02ee60fe89e1738 100644 (file)
@@ -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"
 
index 8734ea90cb1c90a4ea1c0ddcc218703ea8315b4b..eb12b219da9b44409817bc27c048e9301a867af3 100644 (file)
@@ -29,8 +29,7 @@
  *  \ingroup imbuf
  */
 
-
-#include "BLI_blenlib.h"
+#include "BLI_fileops.h"
 
 #include "imbuf.h"
 
index 62d8d273fdd68a183a045289c06d3bedd5b42fc9..581b55d4377e64efaac85d1afcf0819a0ca89d32 100644 (file)
@@ -31,8 +31,6 @@
  *  \ingroup imbuf
  */
 
-
-#include "BLI_blenlib.h"
 #include "BLI_rand.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
index 9cf06b08ba429070f89ce58e96ee02b5ec07c7eb..d5ca7da7d936c13c7c3b2e21a6190b4d064961e1 100644 (file)
@@ -22,6 +22,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
+#include <stdlib.h>
+
 #include "IMB_indexer.h"
 #include "IMB_anim.h"
 #include "AVI_avi.h"
 #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
 
index 10c6a0fd012823a9fc40c799a65f33279fe1ba2a..e76a59905cb566b14da762adf9dd8c807f25d2e3 100644 (file)
@@ -32,7 +32,8 @@
 
 #include <string.h>
 
-#include "BLI_blenlib.h"
+#include "BLI_fileops.h"
+
 #include "MEM_guardedalloc.h"
 
 #include "imbuf.h"
index 9fb4cbae3837917a97ef0e343bd151c2c8c46790..8be7a9ea28b50edcff60c26d411218c3e1b1383d 100644 (file)
@@ -26,8 +26,8 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_blenlib.h"
 #include "BLI_math.h"
+#include "BLI_fileops.h"
 
 #include "imbuf.h"
 
index d49080d8741e1cead4d1915bd4bc94b00235a60f..364950b99cb515b7f1dbf3b886b256fc9871b3ed 100644 (file)
@@ -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"
index a7caae7367903dc239864a8b2f1756a58c8720d9..1ce2053fde589a711750fcb0c66cded4455a00ae 100644 (file)
@@ -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"
index f5479bce5706154f7ff69dc34ca3373c9e3fc6a4..b66a74497815a3da53a3d0c9a23874afe6f4c742 100644 (file)
@@ -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;
                                        }
                                }
index 928eb219ea5dd126dac5126bdfe5dba9cb836756..92cd96228499d37908898eddbd3252aaf0270b15 100644 (file)
@@ -33,7 +33,8 @@
 
 #include "png.h"
 
-#include "BLI_blenlib.h"
+#include "BLI_fileops.h"
+
 #include "BLI_math.h"
 #include "MEM_guardedalloc.h"
 
index cb6cc2c082b4f943b6df629c526c04b4f2e51746..4bde71588b703d880ddafde29938d5f81f29fe18 100644 (file)
 
 
 #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"
index da7618ef8062d6be87295801126d78d745353ca7..ab805ea66662637fa044ff818b4946991b7cf91b 100644 (file)
  *  \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);
 }
 
 
index b3fe363a266319d434fff1ff36a8c39e3681091c..e98757883be743d5b2d890353f1144717b7ede6e 100644 (file)
  *  \ingroup imbuf
  */
 
-
-#include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
-
 #include "MEM_guardedalloc.h"
 
 #include "imbuf.h"
index ea1d483090c154d6c8cffba21454f7f553228856..e90269a0986d6bb112958d410e66ba48a3eefa21 100644 (file)
@@ -32,7 +32,6 @@
  */
 
 
-#include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 #include "MEM_guardedalloc.h"
 
index 0260ed46b0059e0f9a721380c6605c8aacf97cbe..4df49386ce1cec8e72e94aeb42211acbafba0e62 100644 (file)
 
 
 #ifdef WIN32
-#include <io.h>
+#  include <io.h>
 #endif
-#include "BLI_blenlib.h"
+
+#include "BLI_fileops.h"
+
 #include "MEM_guardedalloc.h"
 
 #include "imbuf.h"
index 54d90ec5c56c5f507866217aeb27dfd52fb16465..6a234b8e29a328b0c7b7c8b55b5edaffecf17d3d 100644 (file)
@@ -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>
index cc57ffff812d502635b62d628da48caef3c347e4..985c575daaa0b987e331bd64c204ede902ca59fe 100644 (file)
 #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"
 
index 92c10a094d370baa17abc15f52be029e15bfb3c7..2b0597d64a5bcc32e1614d6817a28ae25def3297 100644 (file)
 
 
 #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"
index 4776c975618a0c38cd8285b19df824da059bcc25..54c1b1bb77322fe3f87cabdc211063e00f77d5d5 100644 (file)
@@ -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 */
index ab533b2859b560c1b3e5d521db8321c61ca106b2..a3f4b362672d27bdb7e1ca3944d1a96654586185 100644 (file)
@@ -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)
index 55783c3b9809e8ce399f332bbabee615b46a2f77..584790b4cdae80b1178dcb78e65b9ec806372e95 100644 (file)
@@ -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);
index 8d7dc21d95bd4800590ffa92984d0a752d4c4076..91f93828235a91bdd74a2569283b558c2f71e0ff 100644 (file)
@@ -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 {