diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-04-05 10:52:27 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-04-05 10:52:27 +0400 |
commit | 747b98582482bb447cad03bc9ffc52a1c50440e2 (patch) | |
tree | a57c9363ea961a4d7adf49f9abd5802fc5c3b648 /source/blender/editors | |
parent | 547838476109b909259a7608e4c092214da91387 (diff) |
Bugfixes for Grease Pencil and the Image Editor (includes fix for #20921):
* Fixed crash with when/after undoing Grease Pencil sketches in the Image Editor. To get this working, I've had to sacrifice the backwards-compat loading for old .blend files from 2.49 which were using the same pointer as the new data (local data vs datablock data). If anyone has any ingenious hacks to fix this, go ahead, but otherwise, some caution is advised here...
* Grease Pencil block used for Image Editor instances can now be changed
* Enabled proper active polls on the advanced 3D-view projection methods for drawing. These are not valid in views other than the 3D-View, and so should not be shown as available for use elsewhere (though may still be shown just so that users know what mode an 'imported' datablock may be using).
* Enabled proper updates for Grease Pencil editing in the Image Editor. Was missing notifiers for this stuff.
* When drawing in the Image Editor with no image active, the system now (quietly) switches to using screen-space 'view' vs 'cursor' space for the strokes, since the previous behaviour was confusing with strokes disappearing after drawing them. IMO this is a much better option than the confusion that occurred before, even though it does change the user's settings under their feet!
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_buttons.c | 22 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 15 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 9 |
3 files changed, 37 insertions, 9 deletions
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index cc4a05c3421..e719d9ab392 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -227,6 +227,7 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi PointerRNA gpd_ptr; bGPDlayer *gpl; uiLayout *col, *row; + short v3d_stroke_opts_on = 0; /* make new PointerRNA for Grease Pencil block */ RNA_id_pointer_create((ID *)gpd, &gpd_ptr); @@ -255,17 +256,24 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi /* label */ uiItemL(col, "Drawing Settings:", 0); - /* 'stick to view' option */ + /* check whether advanced 3D-View drawing space options can be used */ + if (CTX_wm_view3d(C)) { + if (gpd->flag & (GP_DATA_DEPTH_STROKE|GP_DATA_DEPTH_VIEW)) + v3d_stroke_opts_on = 1; + } + + /* drawing space options */ row= uiLayoutRow(col, 1); - uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "VIEW", NULL, 0); - uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "CURSOR", NULL, 0); + uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "VIEW", NULL, 0); + uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "CURSOR", NULL, 0); row= uiLayoutRow(col, 1); - uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "SURFACE", NULL, 0); - uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "STROKE", NULL, 0); + uiLayoutSetActive(row, v3d_stroke_opts_on); + uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "SURFACE", NULL, 0); + uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "STROKE", NULL, 0); row= uiLayoutRow(col, 0); - uiLayoutSetActive(row, (gpd->flag & (GP_DATA_DEPTH_STROKE|GP_DATA_DEPTH_VIEW)) ? 1:0); - uiItemR(row, &gpd_ptr, "use_stroke_endpoints", 0, NULL, 0); + uiLayoutSetActive(row, v3d_stroke_opts_on); + uiItemR(row, &gpd_ptr, "use_stroke_endpoints", 0, NULL, 0); } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 59c9150fc14..c4df1bde1c2 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1096,7 +1096,20 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode) #endif case SPACE_IMAGE: { - p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE; + SpaceImage *sima= (SpaceImage *)p->sa->spacedata.first; + + /* only set these flags if the image editor doesn't have an image active, + * otherwise user will be confused by strokes not appearing after they're drawn + * + * Admittedly, this is a bit hacky, but it works much nicer from an ergonomic standpoint! + */ + if ELEM(NULL, sima, sima->image) { + /* make strokes be drawn in screen space */ + p->gpd->sbuffer_sflag &= ~GP_STROKE_2DSPACE; + p->gpd->flag &= ~GP_DATA_VIEWALIGN; + } + else + p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE; } break; } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index e641f720054..0eb377450e9 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -781,7 +781,10 @@ static void image_main_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ switch(wmn->category) { - /* nothing yet */ + case NC_SCREEN: + if (wmn->data==ND_GPENCIL) + ED_region_tag_redraw(ar); + break; } } @@ -807,6 +810,10 @@ static void image_buttons_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ switch(wmn->category) { + case NC_SCREEN: + if (wmn->data==ND_GPENCIL) + ED_region_tag_redraw(ar); + break; case NC_BRUSH: if(wmn->action==NA_EDITED) ED_region_tag_redraw(ar); |