svn merge ^/trunk/blender -r49890:49917
authorCampbell Barton <ideasman42@gmail.com>
Wed, 15 Aug 2012 10:36:31 +0000 (10:36 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 15 Aug 2012 10:36:31 +0000 (10:36 +0000)
1  2 
CMakeLists.txt
release/scripts/startup/bl_ui/space_node.py
source/blender/editors/interface/interface_templates.c
source/blender/editors/render/render_internal.c
source/blender/editors/space_node/drawnode.c
source/blender/makesdna/DNA_node_types.h
source/blender/makesrna/intern/rna_nodetree.c
source/blender/windowmanager/intern/wm_init_exit.c

diff --combined CMakeLists.txt
index 1500181800cfee7df915c0a0b2ae78ccc9433c54,94eea7bd6aa019a3831a4d431c558701fe6d6ad9..3ac95833b4efec0225973ac6e086b8a1cbc5ed8d
@@@ -130,7 -130,6 +130,7 @@@ option(WITH_FFTW3         "Enable FFTW
  option(WITH_BULLET        "Enable Bullet (Physics Engine)" ON)
  option(WITH_GAMEENGINE    "Enable Game Engine" ON)
  option(WITH_PLAYER        "Build Player" OFF)
 +option(WITH_OPENCOLORIO   "Enable OpenColorIO color management" ON)
  option(WITH_COMPOSITOR    "Enable the tile based nodal compositor" ON)
  
  # GHOST Windowing Library Options
@@@ -671,24 -670,6 +671,24 @@@ if(UNIX AND NOT APPLE
                endif()
        endif()
  
 +      if(WITH_OPENCOLORIO)
 +              # use lib dir if available and nothing else specified
 +              if(LIBDIR AND NOT OPENCOLORIO_ROOT_DIR)
 +                      set(OPENCOLORIO_ROOT_DIR ${LIBDIR}/ocio)
 +              endif()
 +
 +              find_package(OpenColorIO)
 +
 +              set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
 +              set(OPENCOLORIO_LIBPATH)  # TODO, remove and reference the absolute path everywhere
 +              set(OPENCOLORIO_DEFINITIONS)
 +
 +              if(NOT OPENCOLORIO_FOUND)
 +                      set(WITH_OPENCOLORIO OFF)
 +                      message(STATUS "OpenColorIO not found")
 +              endif()
 +      endif()
 +
        # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
        set(PLATFORM_LINKLIBS "-lutil -lc -lm -lpthread -lstdc++")
  
@@@ -995,9 -976,10 +995,10 @@@ elseif(WIN32
                        # normally cached but not since we include them with blender
                        set(PYTHON_VERSION 3.2) # CACHE STRING)
                        set_lib_path(PYTHON "python")
-                       set(PYTHON_INCLUDE_DIR ${PYTHON}/include/python${PYTHON_VERSION})
                        set(PYTHON_LIBRARY ${PYTHON}/lib/python32.lib) #CACHE FILEPATH
-                       
+                       #Shared includes for both vc2008 and vc2010
+                       set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/include/python${PYTHON_VERSION})
                        # uncached vars
                        set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
                        set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
                        set(BOOST ${LIBDIR}/boost)
                        set(BOOST_INCLUDE_DIR ${BOOST}/include)
                        if(MSVC10)
-                               set(BOOST_LIBPATH ${BOOST}/lib/vc_10)
+                               set(BOOST_LIBPATH ${BOOST}/vc2010/lib)
                                set(BOOST_POSTFIX "vc100-mt-s-1_49.lib")
                                set(BOOST_DEBUG_POSTFIX "vc100-mt-sgd-1_49.lib")
                        else()
                        set(OPENIMAGEIO_DEFINITIONS)
                endif()
  
 +              if(WITH_OPENCOLORIO)
 +                      set(OPENCOLORIO ${LIBDIR}/opencolorio)
 +                      set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
 +                      set(OPENCOLORIO_LIBRARIES OpenColorIO)
 +                      set_lib_path(OPENCOLORIO_LIBPATH "opencolorio/lib")
 +                      set(OPENCOLORIO_DEFINITIONS)
 +              endif()
 +
                set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
  
                # MSVC only, Mingw doesnt need
                        set(OPENIMAGEIO_DEFINITIONS)
                endif()
                
 +              if(WITH_OPENCOLORIO)
 +                      set(OPENCOLORIO ${LIBDIR}/opencolorio)
 +                      set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
 +                      set(OPENCOLORIO_LIBRARIES OpenColorIO)
 +                      set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
 +                      set(OPENCOLORIO_DEFINITIONS)
 +              endif()
 +
                set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
  
                ## DISABLE - causes linking errors 
@@@ -1462,14 -1428,6 +1463,14 @@@ elseif(APPLE
                set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
        endif()
  
 +      if(WITH_OPENCOLORIO)
 +              set(OPENCOLORIO ${LIBDIR}/opencolorio)
 +              set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
 +              set(OPENCOLORIO_LIBRARIES OpenColorIO tinyxml yaml-cpp)
 +              set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
 +              set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
 +      endif()
 +
        set(EXETYPE MACOSX_BUNDLE)
  
        set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
@@@ -1843,7 -1801,6 +1844,7 @@@ if(FIRST_RUN
        info_cfg_option(WITH_INTERNATIONAL)
        info_cfg_option(WITH_INPUT_NDOF)
        info_cfg_option(WITH_CYCLES)
 +      info_cfg_option(WITH_OPENCOLORIO)
  
        info_cfg_text("Compiler Options:")
        info_cfg_option(WITH_BUILDINFO)
index 7ea48d77cf0ddb686901d2e6f7f7fcf066886694,5b7ecbfb6180fc18c65fee568b9acbac81e3f5a1..3a0f64e66dee11588be10395e572c921b8028ed3
@@@ -182,6 -182,7 +182,7 @@@ class NODE_MT_node(Menu)
          layout.operator("node.preview_toggle")
          layout.operator("node.hide_socket_toggle")
          layout.operator("node.options_toggle")
+         layout.operator("node.collapse_hide_unused_toggle")
  
          layout.separator()
  
          layout.operator("node.read_fullsamplelayers")
  
  
 +class NODE_PT_display_properties(Panel):
 +    bl_space_type = 'NODE_EDITOR'
 +    bl_region_type = 'UI'
 +    bl_label = "Display Properties"
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        space = context.space_data
 +
 +        layout.template_colormanaged_view_settings(space, "view_settings", True)
 +
 +
  # Node Backdrop options
  class NODE_PT_properties(Panel):
      bl_space_type = 'NODE_EDITOR'
index 5997bd77699e25b422d340a009e85c23c7d5661b,0c69a1888d08a5afe60815faa11e7caf8ce5eca8..450c4c8920e7b14f2284943fa539007d09ce4bf6
@@@ -1743,13 -1743,6 +1743,13 @@@ static void curvemap_buttons_redraw(bCo
        ED_region_tag_redraw(CTX_wm_region(C));
  }
  
 +static void curvemap_buttons_update(bContext *UNUSED(C), void *UNUSED(arg1), void *cumap_v)
 +{
 +      CurveMapping *cumap = cumap_v;
 +
 +      curvemapping_changed(cumap, TRUE);
 +}
 +
  static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
  {
        CurveMapping *cumap = cumap_v;
  static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labeltype, int levels, int brush, RNAUpdateCb *cb)
  {
        CurveMapping *cumap = ptr->data;
 +      CurveMap *cm = &cumap->cm[cumap->cur];
 +      CurveMapPoint *cmp = NULL;
        uiLayout *row, *sub, *split;
        uiBlock *block;
        uiBut *bt;
        float dx = UI_UNIT_X;
        int icon, size;
 -      int bg = -1;
 +      int bg = -1, i;
  
        block = uiLayoutGetBlock(layout);
  
        row = uiLayoutRow(layout, FALSE);
        uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, MIN2(size, 200), cumap, 0.0f, 1.0f, bg, 0, "");
  
 +      /* sliders for selected point */
 +      for (i = 0; i < cm->totpoint; i++) {
 +              if (cm->curve[i].flag & CUMA_SELECT) {
 +                      cmp = &cm->curve[i];
 +                      break;
 +              }
 +      }
 +
 +      if (cmp) {
 +              uiLayoutColumn(layout, TRUE);
 +              uiBlockSetNFunc(block, curvemap_buttons_update, NULL, cumap);
 +              uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->x, 0.0f, 1.0f, 1, 5, "");
 +              uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->y, 0.0f, 1.0f, 1, 5, "");
 +      }
 +
        /* black/white levels */
        if (levels) {
                split = uiLayoutSplit(layout, 0.0f, FALSE);
@@@ -2595,7 -2571,7 +2595,7 @@@ static void do_running_jobs(bContext *C
                        WM_operator_name_call(C, "SCREEN_OT_animation_play", WM_OP_INVOKE_SCREEN, NULL);
                        break;
                case B_STOPCOMPO:
-                       WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
+                       WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL);
                        break;
                case B_STOPSEQ:
                        WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
@@@ -2620,29 -2596,30 +2620,30 @@@ void uiTemplateRunningJobs(uiLayout *la
  
        uiBlockSetHandleFunc(block, do_running_jobs, NULL);
  
-       if (sa->spacetype == SPACE_NODE) {
-               if (WM_jobs_test(wm, sa))
-                       owner = sa;
-               handle_event = B_STOPCOMPO;
-       }
-       else if (sa->spacetype == SPACE_SEQ) {
-               if (WM_jobs_test(wm, sa))
+       if (sa->spacetype == SPACE_SEQ) {
+               if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY))
                        owner = sa;
                handle_event = B_STOPSEQ;
        }
        else if (sa->spacetype == SPACE_CLIP) {
-               if (WM_jobs_test(wm, sa))
+               if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY))
                        owner = sa;
                handle_event = B_STOPCLIP;
        }
        else {
                Scene *scene;
                /* another scene can be rendering too, for example via compositor */
-               for (scene = CTX_data_main(C)->scene.first; scene; scene = scene->id.next)
-                       if (WM_jobs_test(wm, scene))
+               for (scene = CTX_data_main(C)->scene.first; scene; scene = scene->id.next) {
+                       if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
+                               handle_event = B_STOPRENDER;
                                break;
+                       }
+                       else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) {
+                               handle_event = B_STOPCOMPO;
+                               break;
+                       }
+               }
                owner = scene;
-               handle_event = B_STOPRENDER;
        }
  
        if (owner) {
                
                uiLayoutRow(layout, FALSE);
        }
-       if (WM_jobs_test(wm, screen))
+       if (WM_jobs_test(wm, screen, WM_JOB_TYPE_SCREENCAST))
                uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, 85, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
                                 TIP_("Stop screencast"));
        if (screen->animtimer)
@@@ -2792,66 -2769,3 +2793,66 @@@ void uiTemplateKeymapItemProperties(uiL
        }
  }
  
 +/********************************* Color management *************************************/
 +
 +void uiTemplateColorspaceSettings(uiLayout *layout, PointerRNA *ptr, const char *propname)
 +{
 +      PropertyRNA *prop;
 +      PointerRNA colorspace_settings_ptr;
 +
 +      prop = RNA_struct_find_property(ptr, propname);
 +
 +      if (!prop) {
 +              printf("%s: property not found: %s.%s\n",
 +                     __func__, RNA_struct_identifier(ptr->type), propname);
 +              return;
 +      }
 +
 +      colorspace_settings_ptr = RNA_property_pointer_get(ptr, prop);
 +
 +      uiItemL(layout, "Color Space:", ICON_NONE);
 +      uiItemR(layout, &colorspace_settings_ptr, "name", 0, "", ICON_NONE);
 +}
 +
 +void uiTemplateColormanagedViewSettings(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, int show_global_settings)
 +{
 +      PropertyRNA *prop;
 +      PointerRNA view_transform_ptr;
 +      uiLayout *col;
 +      ColorManagedViewSettings *view_settings;
 +
 +      prop = RNA_struct_find_property(ptr, propname);
 +
 +      if (!prop) {
 +              printf("%s: property not found: %s.%s\n",
 +                     __func__, RNA_struct_identifier(ptr->type), propname);
 +              return;
 +      }
 +
 +      view_transform_ptr = RNA_property_pointer_get(ptr, prop);
 +      view_settings = view_transform_ptr.data;
 +
 +      col = uiLayoutColumn(layout, FALSE);
 +
 +      if (show_global_settings) {
 +              wmWindow *win = CTX_wm_window(C);
 +              bScreen *screen = CTX_wm_screen(C);
 +
 +              uiItemR(col, &view_transform_ptr, "use_global_settings", 0, NULL, ICON_NONE);
 +
 +              if (view_settings->flag & COLORMANAGE_VIEW_USE_GLOBAL) {
 +                      PointerRNA window_ptr;
 +
 +                      RNA_pointer_create(&screen->id, &RNA_Window, win, &window_ptr);
 +
 +                      prop = RNA_struct_find_property(&window_ptr, "view_settings");
 +                      view_transform_ptr = RNA_property_pointer_get(&window_ptr, prop);
 +              }
 +      }
 +
 +      uiItemR(col, &view_transform_ptr, "view_transform", 0, "View", ICON_NONE);
 +
 +      col = uiLayoutColumn(layout, FALSE);
 +      uiItemR(col, &view_transform_ptr, "exposure", 0, NULL, ICON_NONE);
 +      uiItemR(col, &view_transform_ptr, "gamma", 0, NULL, ICON_NONE);
 +}
index 031ad017c79764fe79c0e05c387801c2c953064d,1cc241f17dbb09076eb46ecf3b92a529d9e2e878..96e2b3f1c3a537c6df2a3b93a9c13eb10beed8e4
@@@ -61,7 -61,6 +61,7 @@@
  #include "ED_object.h"
  
  #include "RE_pipeline.h"
 +#include "IMB_colormanagement.h"
  #include "IMB_imbuf.h"
  #include "IMB_imbuf_types.h"
  
@@@ -151,9 -150,6 +151,9 @@@ void image_buffer_rect_update(Scene *sc
        IMB_buffer_byte_from_float(rectc, rectf,
                                   4, ibuf->dither, IB_PROFILE_SRGB, profile_from, predivide,
                                   xmax, ymax, ibuf->x, rr->rectx);
 +
 +      IMB_partial_display_buffer_update(ibuf, rectf, rr->rectx, rxmin, rymin,
 +                                        rxmin, rymin, rxmin + xmax, rymin + ymax);
  }
  
  /* ****************************** render invoking ***************** */
@@@ -461,7 -457,7 +461,7 @@@ static int screen_render_modal(bContex
        Scene *scene = (Scene *) op->customdata;
  
        /* no running blender, remove handler and pass through */
-       if (0 == WM_jobs_test(CTX_wm_manager(C), scene)) {
+       if (0 == WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER)) {
                return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
        }
  
@@@ -483,7 -479,7 +483,7 @@@ static int screen_render_invoke(bContex
        SceneRenderLayer *srl = NULL;
        View3D *v3d = CTX_wm_view3d(C);
        Render *re;
-       wmJob *steve;
+       wmJob *wm_job;
        RenderJob *rj;
        Image *ima;
        int jobflag;
        const char *name;
        
        /* only one render job at a time */
-       if (WM_jobs_test(CTX_wm_manager(C), scene))
+       if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER))
                return OPERATOR_CANCELLED;
  
        if (!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
        if (RE_seq_render_active(scene, &scene->r)) name = "Sequence Render";
        else name = "Render";
  
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag);
-       WM_jobs_customdata_set(steve, rj, render_freejob);
-       WM_jobs_timer(steve, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
-       WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag, WM_JOB_TYPE_RENDER);
+       WM_jobs_customdata_set(wm_job, rj, render_freejob);
+       WM_jobs_timer(wm_job, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
+       WM_jobs_callbacks(wm_job, render_startjob, NULL, NULL, render_endjob);
  
        /* get a render result image, and make sure it is empty */
        ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
         */
        op->customdata = scene;
  
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
  
        WM_cursor_wait(0);
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
index c1d416fb219471e93b38a3b92da227e7b7c48e8e,615c4fb4b46a2c911f3d83b317067d1eeea35a90..cde7e494927766c2c74e989ba92737d14c3dd6d2
@@@ -63,7 -63,6 +63,7 @@@
  
  #include "UI_resources.h"
  
 +#include "IMB_colormanagement.h"
  #include "IMB_imbuf.h"
  #include "IMB_imbuf_types.h"
  
@@@ -1325,10 -1324,6 +1325,10 @@@ static void node_shader_buts_tex_image(
  
        uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
        uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
 +      uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
 +
 +      if(RNA_enum_get(ptr, "projection") == SHD_PROJ_BOX)
 +              uiItemR(layout, ptr, "projection_blend", 0, "Blend", ICON_NONE);
  
        /* note: image user properties used directly here, unlike compositor image node,
         * which redefines them in the node struct RNA to get proper updates.
@@@ -1525,11 -1520,11 +1525,11 @@@ static void node_composit_buts_blur(uiL
        
        col = uiLayoutColumn(layout, FALSE);
        filter = RNA_enum_get(ptr, "filter_type");
-       reference = RNA_boolean_get(ptr, "use_reference");
+       reference = RNA_boolean_get(ptr, "use_variable_size");
  
        uiItemR(col, ptr, "filter_type", 0, "", ICON_NONE);
        if (filter != R_FILTER_FAST_GAUSS) {
-               uiItemR(col, ptr, "use_reference", 0, NULL, ICON_NONE);
+               uiItemR(col, ptr, "use_variable_size", 0, NULL, ICON_NONE);
                if (!reference) {
                        uiItemR(col, ptr, "use_bokeh", 0, NULL, ICON_NONE);
                }
@@@ -2356,6 -2351,13 +2356,13 @@@ static void node_composit_buts_bokehima
        uiItemR(layout, ptr, "shift", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
  }
  
+ static void node_composit_buts_bokehblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+ {
+       uiItemR(layout, ptr, "use_variable_size", 0, NULL, ICON_NONE);
+       // uiItemR(layout, ptr, "f_stop", 0, NULL, ICON_NONE);  // UNUSED
+       uiItemR(layout, ptr, "blur_max", 0, NULL, ICON_NONE);
+ }
  void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
  {
  //    node_composit_backdrop_canvas(snode, backdrop, node, x, y);
@@@ -2769,6 -2771,9 +2776,9 @@@ static void node_composit_set_butfunc(b
                case CMP_NODE_BOKEHIMAGE:
                        ntype->uifunc = node_composit_buts_bokehimage;
                        break;
+               case CMP_NODE_BOKEHBLUR:
+                       ntype->uifunc = node_composit_buts_bokehblur;
+                       break;
                case CMP_NODE_VIEWER:
                        ntype->uifunc = NULL;
                        ntype->uifuncbut = node_composit_buts_viewer_but;
@@@ -3014,7 -3019,7 +3024,7 @@@ void ED_node_init_butfuncs(void
  
  /* ************** Generic drawing ************** */
  
 -void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
 +void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode)
  {
        
        if ((snode->flag & SNODE_BACKDRAW) && snode->treetype == NTREE_COMPOSIT) {
                void *lock;
                ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
                if (ibuf) {
 +                      SpaceNode *snode = CTX_wm_space_node(C);
 +                      wmWindow *win = CTX_wm_window(C);
 +                      const ColorManagedViewSettings *view_settings;
                        float x, y; 
 +                      unsigned char *display_buffer;
 +                      void *cache_handle;
                        
                        glMatrixMode(GL_PROJECTION);
                        glPushMatrix();
                        x = (ar->winx - snode->zoom * ibuf->x) / 2 + snode->xof;
                        y = (ar->winy - snode->zoom * ibuf->y) / 2 + snode->yof;
                        
 -                      if (!ibuf->rect) {
 -                              if (color_manage)
 -                                      ibuf->profile = IB_PROFILE_LINEAR_RGB;
 -                              else
 -                                      ibuf->profile = IB_PROFILE_NONE;
 -                              IMB_rect_from_float(ibuf);
 -                      }
  
 -                      if (ibuf->rect) {
 +                      view_settings = IMB_view_settings_get_effective(win, &snode->view_settings);
 +                      display_buffer = IMB_display_buffer_acquire(ibuf, view_settings, &win->display_settings, &cache_handle);
 +
 +                      if (display_buffer) {
                                if (snode->flag & (SNODE_SHOW_R | SNODE_SHOW_G | SNODE_SHOW_B)) {
                                        int ofs;
  
  #ifdef __BIG_ENDIAN__
                                        glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
  #endif
 -                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ibuf->rect);
 +                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, display_buffer);
  
  #ifdef __BIG_ENDIAN__
                                        glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
                                        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                                        glPixelZoom(snode->zoom, snode->zoom);
                                        
 -                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 +                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, display_buffer);
                                        
                                        glPixelZoom(1.0f, 1.0f);
                                        glDisable(GL_BLEND);
                                else {
                                        glPixelZoom(snode->zoom, snode->zoom);
                                        
 -                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 +                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, display_buffer);
                                        
                                        glPixelZoom(1.0f, 1.0f);
                                }
                        }
  
 +                      IMB_display_buffer_release(cache_handle);
 +
                        /** @note draw selected info on backdrop */
                        if (snode->edittree) {
                                bNode *node = snode->edittree->nodes.first;
index 54c1b1bb77322fe3f87cabdc211063e00f77d5d5,ffb16b96b5539e644204f79ce0d29b57e037fcc9..541593aa8107ef78bbbebf592554d846d6266f80
@@@ -127,7 -127,7 +127,7 @@@ typedef struct bNodeSocket 
  /* sock->flag, first bit is select */
        /* hidden is user defined, to hide unused */
  #define SOCK_HIDDEN                           2
-       /* only used now for groups... */
+       /* for quick check if socket is linked */
  #define SOCK_IN_USE                           4       /* XXX deprecated */
        /* unavailable is for dynamic sockets */
  #define SOCK_UNAVAIL                  8
@@@ -389,7 -389,7 +389,7 @@@ enum 
  };
  
  enum {
-       CMP_NODEFLAG_BLUR_REFERENCE = (1 << 0),
+       CMP_NODEFLAG_BLUR_VARIABLE_SIZE = (1 << 0)
  };
  
  typedef struct NodeFrame {
  
  /* this one has been replaced with ImageUser, keep it for do_versions() */
  typedef struct NodeImageAnim {
-       int frames, sfra, nr;
-       char cyclic, movie;
+       int frames   DNA_DEPRECATED;
+       int sfra     DNA_DEPRECATED;
+       int nr       DNA_DEPRECATED;
+       char cyclic  DNA_DEPRECATED;
+       char movie   DNA_DEPRECATED;
        short pad;
  } NodeImageAnim;
  
@@@ -611,10 -614,7 +614,10 @@@ typedef struct NodeTexSky 
  typedef struct NodeTexImage {
        NodeTexBase base;
        ImageUser iuser;
 -      int color_space, pad;
 +      int color_space;
 +      int projection;
 +      float projection_blend;
 +      int pad;
  } NodeTexImage;
  
  typedef struct NodeTexChecker {
  typedef struct NodeTexEnvironment {
        NodeTexBase base;
        ImageUser iuser;
 -      int color_space, projection;
 +      int color_space;
 +      int projection;
  } NodeTexEnvironment;
  
  typedef struct NodeTexGradient {
@@@ -765,10 -764,6 +768,10 @@@ typedef struct NodeTrackPosData 
  #define SHD_PROJ_EQUIRECTANGULAR      0
  #define SHD_PROJ_MIRROR_BALL          1
  
 +/* image texture */
 +#define SHD_PROJ_FLAT                         0
 +#define SHD_PROJ_BOX                          1
 +
  /* blur node */
  #define CMP_NODE_BLUR_ASPECT_NONE             0
  #define CMP_NODE_BLUR_ASPECT_Y                        1
index bcd1b0e610b232443757f1c1cd18a0ec12a6d5d9,27201ea638987ee5e825a4149db39c0126ad63af..667d85706e05d4303287ddd34dfd0df0de0a28db
@@@ -324,6 -324,20 +324,20 @@@ static char *rna_NodeSocket_path(Pointe
        return NULL;
  }
  
+ static void rna_NodeSocket_hide_set(PointerRNA *ptr, int value)
+ {
+       bNodeSocket *sock = (bNodeSocket *)ptr->data;
+       
+       /* don't hide linked sockets */
+       if (sock->flag & SOCK_IN_USE)
+               return;
+       
+       if (value)
+               sock->flag |= SOCK_HIDDEN;
+       else
+               sock->flag &= ~SOCK_HIDDEN;
+ }
  /* Button Set Funcs for Matte Nodes */
  static void rna_Matte_t1_set(PointerRNA *ptr, float value)
  {
@@@ -1504,15 -1518,6 +1518,15 @@@ static void def_sh_tex_image(StructRNA 
                {0, NULL, 0, NULL, NULL}
        };
  
 +      static const EnumPropertyItem prop_projection_items[] = {
 +              {SHD_PROJ_FLAT, "FLAT", 0, "Flat",
 +                              "Image is projected flat using the X and Y coordinates of the texture vector"},
 +              {SHD_PROJ_BOX,  "BOX", 0, "Box",
 +                              "Image is projected using different components for each side of the object space bounding box"},
 +              {0, NULL, 0, NULL, NULL}
 +      };
 +
 +
        PropertyRNA *prop;
  
        prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
        RNA_def_property_ui_text(prop, "Color Space", "Image file color space");
        RNA_def_property_update(prop, 0, "rna_Node_update");
  
 +      prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
 +      RNA_def_property_enum_items(prop, prop_projection_items);
 +      RNA_def_property_ui_text(prop, "Projection", "Method to project 2D image on object with a 3D texture vector");
 +      RNA_def_property_update(prop, 0, "rna_Node_update");
 +
 +      prop = RNA_def_property(srna, "projection_blend", PROP_FLOAT, PROP_FACTOR);
 +      RNA_def_property_ui_text(prop, "Projection Blend", "For box projection, amount of blend to use between sides");
 +      RNA_def_property_update(prop, 0, "rna_Node_update");
 +
        prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
        RNA_def_property_pointer_sdna(prop, NULL, "iuser");
@@@ -1741,9 -1737,10 +1755,10 @@@ static void def_cmp_blur(StructRNA *srn
                {0, NULL, 0, NULL, NULL}
        };
  
-       prop = RNA_def_property(srna, "use_reference", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_REFERENCE);
-       RNA_def_property_ui_text(prop, "Reference", "Use size socket as a reference image");
+       /* duplicated in def_cmp_bokehblur */
+       prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE);
+       RNA_def_property_ui_text(prop, "Variable Size", "Support variable blue per-pixel when using an image for size input");
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
  
        RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
@@@ -3372,6 -3369,14 +3387,14 @@@ static void def_cmp_ellipsemask(StructR
  static void def_cmp_bokehblur(StructRNA *srna)
  {
        PropertyRNA *prop;
+       /* duplicated in def_cmp_blur */
+       prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE);
+       RNA_def_property_ui_text(prop, "Variable Size", "Support variable blue per-pixel when using an image for size input");
+       RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ #if 0
        prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "custom3");
        RNA_def_property_range(prop, 0.0f, 128.0f);
                                 "Amount of focal blur, 128=infinity=perfect focus, half the value doubles "
                                 "the blur radius");
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-       
+ #endif
        prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "custom4");
        RNA_def_property_range(prop, 0.0f, 10000.0f);
@@@ -4114,6 -4120,17 +4138,17 @@@ static void rna_def_node_socket(Blender
        RNA_def_property_ui_text(prop, "Group Socket",
                                 "For group nodes, the group input or output socket this corresponds to");
  
+       prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDDEN);
+       RNA_def_property_boolean_funcs(prop, NULL, "rna_NodeSocket_hide_set");
+       RNA_def_property_ui_text(prop, "Hide", "Hide the socket");
+       RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
+       prop = RNA_def_property(srna, "is_linked", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_IN_USE);
+       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Linked", "True if the socket is connected");
        prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_COLLAPSED);
        RNA_def_property_ui_text(prop, "Expanded", "Socket links are expanded in the user interface");
index 337c8937de8d8fe229941356a7afc079f3b17859,af24ea81fe69dbd4a9814828c8c77678123bb6a4..a892b1c686144697d932f474eefbb7da892840f0
@@@ -67,6 -67,7 +67,6 @@@
  #include "BKE_tracking.h" /* free tracking clipboard */
  
  #include "BLI_listbase.h"
 -#include "BLI_math_color.h"
  #include "BLI_string.h"
  #include "BLI_utildefines.h"
  
  #include "BKE_sound.h"
  #include "COM_compositor.h"
  
 +#include "IMB_colormanagement.h"
 +
  static void wm_init_reports(bContext *C)
  {
        BKE_reports_init(CTX_wm_reports(C), RPT_STORE);
@@@ -150,8 -149,8 +150,8 @@@ void WM_init(bContext *C, int argc, con
        BLF_init(11, U.dpi); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */
        BLF_lang_init();
  
 -      /* initialize color stuff */
 -      BLI_init_srgb_conversion();
 +      /* initialize color management stuff */
 +      IMB_colormanagement_init();
  
        /* get the default database, plus a wm */
        WM_homefile_read(C, NULL, G.factory_startup);
@@@ -368,20 -367,19 +368,21 @@@ static void wait_for_console_key(void
  /* note, doesnt run exit() call WM_exit() for that */
  void WM_exit_ext(bContext *C, const short do_python)
  {
-       wmWindow *win;
+       wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL;
  
        sound_exit();
  
 +      IMB_colormanagement_exit();
 +
        /* first wrap up running stuff, we assume only the active WM is running */
        /* modal handlers are on window level freed, others too? */
        /* note; same code copied in wm_files.c */
-       if (C && CTX_wm_manager(C)) {
-               
-               WM_jobs_stop_all(CTX_wm_manager(C));
-               
-               for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
+       if (C && wm) {
+               wmWindow *win;
+               WM_jobs_stop_all(wm);
+               for (win = wm->windows.first; win; win = win->next) {
                        
                        CTX_wm_window_set(C, win);  /* needed by operator close callbacks */
                        WM_event_remove_handlers(C, &win->handlers);
        
        ED_preview_free_dbase();  /* frees a Main dbase, before free_blender! */
  
-       if (C && CTX_wm_manager(C))
+       if (C && wm)
                wm_free_reports(C);  /* before free_blender! - since the ListBases get freed there */
  
        BKE_sequencer_free_clipboard(); /* sequencer.c */