Fix T69459: Convert Curve to Grease Pencil clears Transform
Also changed to create a grease pencil object for each curve. Part of differential revision: https://developer.blender.org/D6045
This commit is contained in:
parent
2b35ee3ea2
commit
15ffa3e7db
Notes:
blender-bot
2023-02-14 07:31:34 +01:00
Referenced by issue #69459, GPencil: Convert Curve to Grease Pencil clears Transform.
|
@ -2385,19 +2385,18 @@ 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue