Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c27
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c12
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c19
-rw-r--r--source/blender/editors/include/ED_gpencil.h1
-rw-r--r--source/blender/editors/space_node/node_buttons.c138
-rw-r--r--source/blender/editors/space_node/node_draw.c37
-rw-r--r--source/blender/editors/space_node/node_intern.h9
-rw-r--r--source/blender/editors/space_node/node_ops.c12
-rw-r--r--source/blender/editors/space_node/space_node.c106
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/makesdna/DNA_node_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c11
13 files changed, 262 insertions, 117 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 0082bfd546e..b6ec8376b12 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1983,6 +1983,8 @@ static void lib_link_ntree(FileData *fd, ID *id, bNodeTree *ntree)
if(ntree->adt) lib_link_animdata(fd, &ntree->id, ntree->adt);
+ ntree->gpd= newlibadr_us(fd, id->lib, ntree->gpd);
+
for(node= ntree->nodes.first; node; node= node->next)
node->id= newlibadr_us(fd, id->lib, node->id);
}
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 9a0187dde04..6651c7745bb 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -765,31 +765,4 @@ void draw_gpencil_3dview (bContext *C, short only3d)
draw_gpencil_3dview_ext(scene, ar, only3d);
}
-/* draw grease-pencil sketches to opengl render window assuming that matrices are already set correctly */
-// XXX porting note, ogl render will probably be a window with one 3d region
-void draw_gpencil_oglrender (bContext *C)
-{
- ScrArea *sa= CTX_wm_area(C);
- View3D *v3d= (View3D *)sa->spacedata.first;
- ARegion *ar= CTX_wm_region(C);
- Scene *scene= CTX_data_scene(C);
- bGPdata *gpd;
-
- /* assume gpencil data comes from v3d */
- if (v3d == NULL) return;
- gpd= gpencil_data_get_active(C);
- if (gpd == NULL) return;
-
- /* pass 1: draw 3d-strokes ------------ > */
- gp_draw_data(gpd, 0, 0, ar->winx, ar->winy, CFRA, (GP_DRAWDATA_NOSTATUS|GP_DRAWDATA_ONLY3D));
-
- /* pass 2: draw 2d-strokes ------------ > */
- /* adjust view matrices */
- wmOrtho2(-0.375f, (float)(ar->winx)-0.375f, -0.375f, (float)(ar->winy)-0.375f); // XXX may not be correct anymore
- glLoadIdentity();
-
- /* draw it! */
- gp_draw_data(gpd, 0, 0, ar->winx, ar->winy, CFRA, GP_DRAWDATA_NOSTATUS);
-}
-
/* ************************************************** */
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 1358ed80f7a..c2b9a1a4bb9 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -45,6 +45,7 @@
#include "DNA_curve_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_object_types.h"
+#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
@@ -113,9 +114,18 @@ bGPdata **gpencil_data_get_pointers (bContext *C, PointerRNA *ptr)
case SPACE_NODE: /* Nodes Editor */
{
- //SpaceNode *snode= (SpaceNode *)CTX_wm_space_data(C);
+ SpaceNode *snode= (SpaceNode *)CTX_wm_space_data(C);
/* return the GP data for the active node block/node */
+ if (snode && snode->nodetree) {
+ /* for now, as long as there's an active node tree, default to using that in the Nodes Editor */
+ if (ptr) RNA_id_pointer_create(&snode->nodetree->id, ptr);
+ return &snode->nodetree->gpd;
+ }
+ else {
+ /* even when there is no node-tree, don't allow this to flow to scene */
+ return NULL;
+ }
}
break;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 64e68fab508..4229c66353c 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -808,16 +808,17 @@ static tGPsdata *gp_session_initpaint (bContext *C)
#endif
}
break;
-#if 0 // XXX these other spaces will come over time...
+
case SPACE_NODE:
{
- SpaceNode *snode= curarea->spacedata.first;
+ //SpaceNode *snode= curarea->spacedata.first;
/* set current area */
p->sa= curarea;
p->ar= ar;
p->v2d= &ar->v2d;
+#if 0 // XXX will this sort of antiquated stuff be restored?
/* check that gpencil data is allowed to be drawn */
if ((snode->flag & SNODE_DISPGP)==0) {
p->status= GP_STATUS_ERROR;
@@ -825,8 +826,10 @@ static tGPsdata *gp_session_initpaint (bContext *C)
printf("Error: In active view, Grease Pencil not shown \n");
return;
}
+#endif
}
break;
+#if 0 // XXX these other spaces will come over time...
case SPACE_SEQ:
{
SpaceSeq *sseq= curarea->spacedata.first;
@@ -983,12 +986,13 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
p->gpd->sbuffer_sflag |= GP_STROKE_3DSPACE;
}
break;
-#if 0 // XXX other spacetypes to be restored in due course
+
case SPACE_NODE:
{
p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE;
}
break;
+#if 0 // XXX other spacetypes to be restored in due course
case SPACE_SEQ:
{
SpaceSeq *sseq= (SpaceSeq *)p->sa->spacedata.first;
@@ -1298,12 +1302,15 @@ static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event)
tGPsdata *p = NULL;
wmWindow *win= CTX_wm_window(C);
- //printf("GPencil - Starting Drawing \n");
+ if (G.f & G_DEBUG)
+ printf("GPencil - Starting Drawing \n");
/* try to initialise context data needed while drawing */
if (!gpencil_draw_init(C, op)) {
- if (op->customdata) MEM_freeN(op->customdata);
- printf("\tGP - no valid data \n");
+ if (op->customdata)
+ MEM_freeN(op->customdata);
+ if (G.f & G_DEBUG)
+ printf("\tGP - no valid data \n");
return OPERATOR_CANCELLED;
}
else
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 31c8e93c683..ef5169465ab 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -73,7 +73,6 @@ void draw_gpencil_2dimage(struct bContext *C, struct ImBuf *ibuf);
void draw_gpencil_2dview(struct bContext *C, short onlyv2d);
void draw_gpencil_3dview(struct bContext *C, short only3d);
void draw_gpencil_3dview_ext(struct Scene *scene, struct ARegion *ar, short only3d);
-void draw_gpencil_oglrender(struct bContext *C);
void gpencil_panel_standard(const struct bContext *C, struct Panel *pa);
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
new file mode 100644
index 00000000000..63361f2be66
--- /dev/null
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -0,0 +1,138 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+#include <float.h>
+
+#include "DNA_ID.h"
+#include "DNA_gpencil_types.h"
+#include "DNA_node_types.h"
+#include "DNA_space_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_userdef_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_rand.h"
+
+#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+#include "BKE_idprop.h"
+#include "BKE_object.h"
+#include "BKE_global.h"
+#include "BKE_scene.h"
+#include "BKE_screen.h"
+#include "BKE_utildefines.h"
+
+#include "BIF_gl.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "ED_gpencil.h"
+#include "ED_screen.h"
+#include "ED_types.h"
+#include "ED_util.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+#include "UI_view2d.h"
+
+#include "node_intern.h" // own include
+
+
+/* ******************* node space & buttons ************** */
+#define B_NOP 1
+#define B_REDR 2
+
+#if 0 // XXX not used...
+static void do_node_region_buttons(bContext *C, void *arg, int event)
+{
+ //SpaceNode *snode= CTX_wm_space_node(C);
+
+ switch(event) {
+ case B_REDR:
+ ED_area_tag_redraw(CTX_wm_area(C));
+ return; /* no notifier! */
+ }
+}
+#endif
+
+/* ******************* node buttons registration ************** */
+
+void node_buttons_register(ARegionType *art)
+{
+ PanelType *pt;
+
+ // XXX active node
+
+ pt= MEM_callocN(sizeof(PanelType), "spacetype node panel gpencil");
+ strcpy(pt->idname, "NODE_PT_gpencil");
+ strcpy(pt->label, "Grease Pencil");
+ pt->draw= gpencil_panel_standard;
+ BLI_addtail(&art->paneltypes, pt);
+}
+
+static int node_properties(bContext *C, wmOperator *op)
+{
+ ScrArea *sa= CTX_wm_area(C);
+ ARegion *ar= node_has_buttons_region(sa);
+
+ if(ar)
+ ED_region_toggle_hidden(C, ar);
+
+ return OPERATOR_FINISHED;
+}
+
+/* non-standard poll operator which doesn't care if there are any nodes */
+static int node_properties_poll(bContext *C)
+{
+ ScrArea *sa= CTX_wm_area(C);
+ return (sa && (sa->spacetype == SPACE_NODE));
+}
+
+void NODE_OT_properties(wmOperatorType *ot)
+{
+ ot->name= "Properties";
+ ot->description= "Toggles the properties panel display.";
+ ot->idname= "NODE_OT_properties";
+
+ ot->exec= node_properties;
+ ot->poll= node_properties_poll;
+
+ /* flags */
+ ot->flag= 0;
+}
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 1ebb7e13193..4ac6fbebea1 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -66,14 +66,13 @@
#include "BKE_text.h"
#include "BKE_utildefines.h"
-/* #include "BDR_gpencil.h" XXX */
-
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "WM_api.h"
#include "WM_types.h"
+#include "ED_gpencil.h"
#include "ED_screen.h"
#include "ED_util.h"
#include "ED_types.h"
@@ -1102,38 +1101,16 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
}
/* draw grease-pencil ('canvas' strokes) */
- /*if ((snode->flag & SNODE_DISPGP) && (snode->nodetree))
- draw_gpencil_2dview(sa, 1);*/
-
- /* restore viewport (not needed yet) */
- /*mywinset(sa->win);*/
-
- /* ortho at pixel level curarea */
- /*myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);*/
-
- /* draw grease-pencil (screen strokes) */
- /*if ((snode->flag & SNODE_DISPGP) && (snode->nodetree))
- draw_gpencil_2dview(sa, 0);*/
-
- //draw_area_emboss(sa);
-
- /* it is important to end a view in a transform compatible with buttons */
- /*bwin_scalematrix(sa->win, snode->blockscale, snode->blockscale, snode->blockscale);
- nodes_blockhandlers(sa);*/
-
- //curarea->win_swap= WIN_BACK_OK;
-
- /* in the end, this is a delayed previewrender test, to allow buttons to be first */
- /*if(snode->flag & SNODE_DO_PREVIEW) {
- addafterqueue(sa->win, RENDERPREVIEW, 1);
- snode->flag &= ~SNODE_DO_PREVIEW;
- }*/
-
-
+ if (/*(snode->flag & SNODE_DISPGP) &&*/ (snode->nodetree))
+ draw_gpencil_2dview((bContext*)C, 1);
/* reset view matrix */
UI_view2d_view_restore(C);
+ /* draw grease-pencil (screen strokes, and also paintbuffer) */
+ if (/*(snode->flag & SNODE_DISPGP) && */(snode->nodetree))
+ draw_gpencil_2dview((bContext*)C, 0);
+
/* scrollers */
scrollers= UI_view2d_scrollers_calc(C, v2d, 10, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
UI_view2d_scrollers_draw(C, v2d, scrollers);
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index f55ecf1d0f4..2d4d7035568 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -44,6 +44,9 @@ struct wmWindowManager;
#define NODE_EXTEND 1
#define NODE_EXCLUSIVE 3
+/* space_node.c */
+ARegion *node_has_buttons_region(ScrArea *sa);
+
/* node_header.c */
void node_header_buttons(const bContext *C, ARegion *ar);
void node_menus_register(struct ARegionType *art);
@@ -51,6 +54,10 @@ void node_menus_register(struct ARegionType *art);
/* node_draw.c */
void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d);
+/* node_buttons.c */
+void node_buttons_register(struct ARegionType *art);
+void NODE_OT_properties(struct wmOperatorType *ot);
+
/* node_ops.c */
void node_operatortypes(void);
void node_keymap(wmKeyConfig *keyconf);
@@ -121,6 +128,6 @@ enum {
B_MATPRV,
B_NODE_LOADIMAGE,
B_NODE_SETIMAGE,
-} eActHeader_ButEvents;
+} eNodeSpace_ButEvents;
#endif /* ED_NODE_INTERN_H */
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index 443b83a91bc..b78fc864a11 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -49,6 +49,8 @@
void node_operatortypes(void)
{
+ WM_operatortype_append(NODE_OT_properties);
+
WM_operatortype_append(NODE_OT_select);
WM_operatortype_append(NODE_OT_select_extend);
WM_operatortype_append(NODE_OT_select_all);
@@ -69,9 +71,17 @@ void node_operatortypes(void)
void node_keymap(struct wmKeyConfig *keyconf)
{
- wmKeyMap *keymap= WM_keymap_find(keyconf, "Node", SPACE_NODE, 0);
+ wmKeyMap *keymap;
wmKeyMapItem *kmi;
+ /* Entire Editor only ----------------- */
+ keymap= WM_keymap_find(keyconf, "Node Generic", SPACE_NODE, 0);
+
+ WM_keymap_add_item(keymap, "NODE_OT_properties", NKEY, KM_PRESS, 0, 0);
+
+ /* Main Area only ----------------- */
+ keymap= WM_keymap_find(keyconf, "Node", SPACE_NODE, 0);
+
/* mouse select in nodes used to be both keys, it's UI elements... */
RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select", ACTIONMOUSE, KM_PRESS, 0, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select", SELECTMOUSE, KM_PRESS, 0, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index d8c6272dd77..17bb96f5163 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -65,6 +65,35 @@
#include "node_intern.h" // own include
+/* ******************** manage regions ********************* */
+
+ARegion *node_has_buttons_region(ScrArea *sa)
+{
+ ARegion *ar, *arnew;
+
+ for(ar= sa->regionbase.first; ar; ar= ar->next)
+ if(ar->regiontype==RGN_TYPE_UI)
+ return ar;
+
+ /* add subdiv level; after header */
+ for(ar= sa->regionbase.first; ar; ar= ar->next)
+ if(ar->regiontype==RGN_TYPE_HEADER)
+ break;
+
+ /* is error! */
+ if(ar==NULL) return NULL;
+
+ arnew= MEM_callocN(sizeof(ARegion), "buttons for node");
+
+ BLI_insertlinkafter(&sa->regionbase, ar, arnew);
+ arnew->regiontype= RGN_TYPE_UI;
+ arnew->alignment= RGN_ALIGN_RIGHT;
+
+ arnew->flag = RGN_FLAG_HIDDEN;
+
+ return arnew;
+}
+
/* ******************** default callbacks for node space ***************** */
static SpaceLink *node_new(const bContext *C)
@@ -82,16 +111,13 @@ static SpaceLink *node_new(const bContext *C)
ar->regiontype= RGN_TYPE_HEADER;
ar->alignment= RGN_ALIGN_BOTTOM;
-#if 0
- /* channels */
- ar= MEM_callocN(sizeof(ARegion), "nodetree area for node");
+ /* buttons/list view */
+ ar= MEM_callocN(sizeof(ARegion), "buttons for node");
BLI_addtail(&snode->regionbase, ar);
- ar->regiontype= RGN_TYPE_CHANNELS;
- ar->alignment= RGN_ALIGN_LEFT;
-
- //ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
-#endif
+ ar->regiontype= RGN_TYPE_UI;
+ ar->alignment= RGN_ALIGN_RIGHT;
+ ar->flag = RGN_FLAG_HIDDEN;
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for node");
@@ -128,9 +154,7 @@ static SpaceLink *node_new(const bContext *C)
/* not spacelink itself */
static void node_free(SpaceLink *sl)
{
-// SpaceNode *snode= (SpaceNode*) sl;
-// XXX if(snode->gpd) free_gpencil_data(snode->gpd);
}
@@ -210,41 +234,26 @@ static SpaceLink *node_duplicate(SpaceLink *sl)
/* clear or remove stuff from old */
snoden->nodetree= NULL;
-// XXX snoden->gpd= gpencil_data_duplicate(snode->gpd);
return (SpaceLink *)snoden;
}
-#if 0
-static void node_channel_area_init(wmWindowManager *wm, ARegion *ar)
+
+/* add handlers, stuff you only do once or on area/region changes */
+static void node_buttons_area_init(wmWindowManager *wm, ARegion *ar)
{
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
+ wmKeyMap *keymap;
+
+ ED_region_panels_init(wm, ar);
+
+ keymap= WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
+ WM_event_add_keymap_handler(&ar->handlers, keymap);
}
-static void node_channel_area_draw(const bContext *C, ARegion *ar)
+static void node_buttons_area_draw(const bContext *C, ARegion *ar)
{
- View2D *v2d= &ar->v2d;
- View2DScrollers *scrollers;
- float col[3];
-
- /* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- UI_view2d_view_ortho(C, v2d);
-
- /* data... */
-
- /* reset view matrix */
- UI_view2d_view_restore(C);
-
- /* scrollers */
- scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
- UI_view2d_scrollers_draw(C, v2d, scrollers);
- UI_view2d_scrollers_free(scrollers);
+ ED_region_panels(C, ar, 1, NULL, -1);
}
-#endif
/* Initialise main area, setting handlers. */
static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
@@ -253,7 +262,10 @@ static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
- /* own keymap */
+ /* own keymaps */
+ keymap= WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
+ WM_event_add_keymap_handler(&ar->handlers, keymap);
+
keymap= WM_keymap_find(wm->defaultconf, "Node", SPACE_NODE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -343,7 +355,7 @@ void ED_spacetype_node(void)
art->init= node_main_area_init;
art->draw= node_main_area_draw;
art->listener= node_region_listener;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_GPENCIL;
BLI_addhead(&st->regiontypes, art);
@@ -360,19 +372,17 @@ void ED_spacetype_node(void)
node_menus_register(art);
-#if 0
- /* regions: channels */
+ /* regions: listview/buttons */
art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
- art->regionid = RGN_TYPE_CHANNELS;
- art->minsizex= 100;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
-
- art->init= node_channel_area_init;
- art->draw= node_channel_area_draw;
-
+ art->regionid = RGN_TYPE_UI;
+ art->minsizex= 180; // XXX
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
+ art->listener= node_region_listener;
+ art->init= node_buttons_area_init;
+ art->draw= node_buttons_area_draw;
BLI_addhead(&st->regiontypes, art);
-#endif
+ node_buttons_register(art);
BKE_spacetype_register(st);
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index ee0830e85da..8aa63518e96 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2176,7 +2176,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
glDisable(GL_DEPTH_TEST);
}
- /* draw grease-pencil stuff */
+ /* draw grease-pencil stuff (3d-space strokes) */
//if (v3d->flag2 & V3D_DISPGP)
draw_gpencil_3dview((bContext *)C, 1);
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 9d80f7f720e..ab7277ee840 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -40,6 +40,7 @@ struct bNodeLink;
struct bNodeType;
struct bNodeGroup;
struct AnimData;
+struct bGPdata;
struct uiBlock;
#define NODE_MAXSTR 32
@@ -168,6 +169,8 @@ typedef struct bNodeTree {
ID id;
struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
+ struct bGPdata *gpd; /* grease pencil data */
+
ListBase nodes, links;
bNodeStack *stack; /* stack is only while executing, no read/write in file */
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 8d8ed565d1c..2aef756bc8e 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2051,12 +2051,21 @@ static void rna_def_nodetree(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "bNodeTree");
RNA_def_struct_ui_icon(srna, ICON_NODETREE);
+ /* AnimData */
rna_def_animdata_common(srna);
-
+
+ /* Nodes Collection */
prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
RNA_def_property_struct_type(prop, "Node");
RNA_def_property_ui_text(prop, "Nodes", "");
+
+ /* Grease Pencil */
+ prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gpd");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "GreasePencil");
+ RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock");
}
static void define_specific_node(BlenderRNA *brna, int id, void (*func)(StructRNA*))