diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-10-11 14:29:25 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-10-11 14:29:43 +0300 |
commit | ec295c1168a8b3a458644f4c9c7f455ecfd37f7e (patch) | |
tree | ef98f3cbcb3ff9a3846f5a12408c4698278d8ea6 /source/blender | |
parent | 7d3ea8f12ba89ef7b87a99b8cde0f14fdab7eb2b (diff) | |
parent | 74f9b9d144e517132f36bf372ae8987b2a191dfd (diff) |
Merge branch 'blender-v2.81-release'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/object/object_add.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index bbd8c425386..bdb23c5ce6f 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -2145,6 +2145,7 @@ static int convert_exec(bContext *C, wmOperator *op) const short target = RNA_enum_get(op->ptr, "target"); bool keep_original = RNA_boolean_get(op->ptr, "keep_original"); int a, mballConverted = 0; + bool gpencilConverted = false; /* don't forget multiple users! */ @@ -2385,20 +2386,20 @@ static int convert_exec(bContext *C, wmOperator *op) } else if (target == OB_GPENCIL) { if (ob->type != OB_CURVE) { + ob->flag &= ~OB_DONE; BKE_report( op->reports, RPT_ERROR, "Convert Surfaces to Grease Pencil is not supported."); } else { - /* Create a new grease pencil object only if it was not created before. - * All curves selected are converted as strokes of the same grease pencil object. + /* Create a new grease pencil object and copy transformations. * Nurbs Surface are not supported. */ - if (gpencil_ob == NULL) { - const float *cur = scene->cursor.location; - ushort local_view_bits = (v3d && v3d->localvd) ? v3d->local_view_uuid : 0; - gpencil_ob = ED_gpencil_add_object(C, scene, cur, local_view_bits); - } + ushort local_view_bits = (v3d && v3d->localvd) ? v3d->local_view_uuid : 0; + gpencil_ob = ED_gpencil_add_object(C, scene, ob->loc, local_view_bits); + copy_v3_v3(gpencil_ob->rot, ob->rot); + copy_v3_v3(gpencil_ob->scale, ob->scale); BKE_gpencil_convert_curve(bmain, scene, gpencil_ob, ob, false, false, true); + gpencilConverted = true; } } } @@ -2498,6 +2499,17 @@ static int convert_exec(bContext *C, wmOperator *op) } FOREACH_SCENE_OBJECT_END; } + /* Remove curves converted to Grease Pencil object. */ + if (gpencilConverted) { + FOREACH_SCENE_OBJECT_BEGIN (scene, ob_curve) { + if (ob_curve->type == OB_CURVE) { + if (ob_curve->flag & OB_DONE) { + ED_object_base_free_and_unlink(bmain, scene, ob_curve); + } + } + } + FOREACH_SCENE_OBJECT_END; + } } // XXX ED_object_editmode_enter(C, 0); |