Merging r50049 through r50076 from trunk into soc-2011-tomato
[blender.git] / source / blender / editors / space_node / space_node.c
index bfc83018dbb641667cf7567b0134a01a207be519..fbe282915000c8cc5ec2c941c7fd1842fd9bcf05 100644 (file)
  */
 
 
-#include <string.h>
-#include <stdio.h>
 
 #include "DNA_lamp_types.h"
 #include "DNA_material_types.h"
 #include "DNA_node_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
 #include "DNA_world_types.h"
 
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_rand.h"
-#include "BLI_utildefines.h"
 
+#include "BKE_colortools.h"
 #include "BKE_context.h"
 #include "BKE_screen.h"
 #include "BKE_node.h"
 
-#include "ED_space_api.h"
 #include "ED_render.h"
 #include "ED_screen.h"
-
+#include "ED_node.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -63,7 +57,7 @@
 
 #include "RNA_access.h"
 
-#include "node_intern.h"    // own include
+#include "node_intern.h"  /* own include */
 
 /* ******************** manage regions ********************* */
 
@@ -104,6 +98,8 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
        /* backdrop */
        snode->zoom = 1.0f;
 
+       BKE_color_managed_view_settings_init(&snode->view_settings);
+
        /* header */
        ar = MEM_callocN(sizeof(ARegion), "header for node");
 
@@ -296,8 +292,9 @@ static void node_area_refresh(const struct bContext *C, ScrArea *sa)
                                        snode->recalc = 0;
                                        node_render_changed_exec((struct bContext *)C, NULL);
                                }
-                               else
-                                       snode_composite_job(C, sa);
+                               else {
+                                       ED_node_composite_job(C, snode->nodetree, scene);
+                               }
                        }
                }
                else if (snode->treetype == NTREE_TEXTURE) {
@@ -311,12 +308,15 @@ static void node_area_refresh(const struct bContext *C, ScrArea *sa)
 
 static SpaceLink *node_duplicate(SpaceLink *sl)
 {
+       SpaceImage *snode = (SpaceImage *) sl;
        SpaceNode *snoden = MEM_dupallocN(sl);
-
+       
        /* clear or remove stuff from old */
        snoden->nodetree = NULL;
        snoden->linkdrag.first = snoden->linkdrag.last = NULL;
 
+       BKE_color_managed_view_settings_copy(&snoden->view_settings, &snode->view_settings);
+
        return (SpaceLink *)snoden;
 }
 
@@ -343,7 +343,7 @@ static void node_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
 
        /* convert mouse coordinates to v2d space */
        UI_view2d_region_to_view(&ar->v2d, win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin,
-                                &snode->mx, &snode->my);
+                                &snode->cursor[0], &snode->cursor[1]);
 
        node_set_cursor(win, snode);
 }