fix for linking on msvc with own recent changes.
[blender.git] / source / blender / editors / space_node / node_header.c
index 17c50b32e9836ba38a311784550191f1d0a586b0..1ad5954b56eff256e2ad1220541775c92a7349ab 100644 (file)
 
 
 #include "UI_interface.h"
+#include "UI_view2d.h"
 
 #include "node_intern.h"
 
 /* ************************ add menu *********************** */
 
-static void do_node_add(bContext *C, void *arg, int event)
+static void do_node_add(bContext *C, void *UNUSED(arg), int event)
 {
        SpaceNode *snode= CTX_wm_space_node(C);
        bNode *node;
@@ -125,7 +126,7 @@ static void node_auto_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclas
 
                for(tot=0, a=0; ngroup; ngroup= ngroup->id.next, tot++) {
                        if(ngroup->type==ntree->type) {
-                               uiItemV(layout, ngroup->id.name+2, 0, NODE_GROUP_MENU+tot);
+                               uiItemV(layout, ngroup->id.name+2, ICON_NULL, NODE_GROUP_MENU+tot);
                                a++;
                        }
                }
@@ -137,11 +138,11 @@ static void node_auto_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclas
                for(a=0, type= ntree->alltypes.first; type; type=type->next) {
                        if(type->nclass == nodeclass && type->name) {
                                if(type->type == NODE_DYNAMIC) {
-                                       uiItemV(layout, type->name, 0, NODE_DYNAMIC_MENU+script);
+                                       uiItemV(layout, type->name, ICON_NULL, NODE_DYNAMIC_MENU+script);
                                        script++;
                                }
                                else
-                                       uiItemV(layout, type->name, 0, type->type);
+                                       uiItemV(layout, type->name, ICON_NULL, type->type);
 
                                a++;
                        }
@@ -153,6 +154,18 @@ static void node_menu_add(const bContext *C, Menu *menu)
 {
        uiLayout *layout= menu->layout;
        SpaceNode *snode= CTX_wm_space_node(C);
+       ScrArea *sa= CTX_wm_area(C);
+       ARegion *ar;
+
+       /* get location to add node at mouse */
+       for(ar=sa->regionbase.first; ar; ar=ar->next) {
+               if(ar->regiontype == RGN_TYPE_WINDOW) {
+                       wmWindow *win= CTX_wm_window(C);
+                       UI_view2d_region_to_view(&ar->v2d,
+                               win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin, 
+                               &snode->mx, &snode->my);
+               }
+       }
 
        if(!snode->nodetree)
                uiLayoutSetActive(layout, 0);
@@ -189,7 +202,7 @@ static void node_menu_add(const bContext *C, Menu *menu)
        }
 }
 
-void node_menus_register(ARegionType *art)
+void node_menus_register(void)
 {
        MenuType *mt;