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:
authorJoshua Leung <aligorith@gmail.com>2009-11-11 11:12:54 +0300
committerJoshua Leung <aligorith@gmail.com>2009-11-11 11:12:54 +0300
commit1dfc7942d3f35cbb8bb0e94fec57828da0eb756c (patch)
tree4b3c51a8c36725c31de241ee8e81637d5b61d80f /source/blender/editors/gpencil
parent7206437c7247040c7b3f00d7b76c715103282c4c (diff)
Grease Pencil for Nodes Editor:
This commit restores Grease Pencil functionality for the Nodes Editor. Grease Pencil data is now stored at the NodeTree level, which means that annotations remain with the NodeTree they were made for. Possible TODO's: * In future, it may be worth investigating attaching Grease Pencil data to individual nodes, to allow annotations to stay attached to nodes as they are moved * Include the settings for the 'active node' in a panel in the new NKEY region where the Grease Pencil buttons appear.
Diffstat (limited to 'source/blender/editors/gpencil')
-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
3 files changed, 24 insertions, 34 deletions
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