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:
authorBastien Montagne <montagne29@wanadoo.fr>2013-01-22 19:22:46 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-01-22 19:22:46 +0400
commit711c0e4fddaa8013261ca51c04ecf0c95fdbd1c9 (patch)
tree1e2a1195c62a827c08dadf7921ad050447380b8a /source/blender/editors/gpencil
parent63edcf785e2c08a77a248845310a1498fb18e96a (diff)
Fix [#33962] Grease Pencil crashing blender
Own fault from grease pencil to curve enhacement. Fixed the bug itself, and made poll of convert operator more strict (no only active when there is something to convert, i.e. at least one stroke!).
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index e4e640eeefc..671adfb8d1e 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -1387,12 +1387,15 @@ static void gp_layer_to_curve(bContext *C, ReportList *reports, bGPdata *gpd, bG
static int gp_convert_check_has_valid_timing(bContext *C, bGPDlayer *gpl, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- bGPDframe *gpf = gpencil_layer_getframe(gpl, CFRA, 0);
- bGPDstroke *gps = gpf->strokes.first;
+ bGPDframe *gpf = NULL;
+ bGPDstroke *gps = NULL;
bGPDspoint *pt;
double base_time, cur_time, prev_time = -1.0;
int i, valid = TRUE;
+ if (!gpl || !(gpf = gpencil_layer_getframe(gpl, CFRA, 0)) || !(gps = gpf->strokes.first))
+ return FALSE;
+
do {
base_time = cur_time = gps->inittime;
if (cur_time <= prev_time) {
@@ -1438,11 +1441,19 @@ static void gp_convert_set_end_frame(struct Main *UNUSED(main), struct Scene *UN
static int gp_convert_poll(bContext *C)
{
bGPdata *gpd = gpencil_data_get_active(C);
+ bGPDlayer *gpl = NULL;
+ bGPDframe *gpf = NULL;
ScrArea *sa = CTX_wm_area(C);
Scene *scene = CTX_data_scene(C);
- /* only if there's valid data, and the current view is 3D View */
- return ((sa && sa->spacetype == SPACE_VIEW3D) && gpencil_layer_getactive(gpd) && (scene->obedit == NULL));
+ /* only if the current view is 3D View, if there's valid data (i.e. at least one stroke!),
+ * and if we are not in edit mode!
+ */
+ return ((sa && sa->spacetype == SPACE_VIEW3D) &&
+ (gpl = gpencil_layer_getactive(gpd)) &&
+ (gpf = gpencil_layer_getframe(gpl, CFRA, 0)) &&
+ (gpf->strokes.first) &&
+ (scene->obedit == NULL));
}
static int gp_convert_layer_exec(bContext *C, wmOperator *op)