GPencil: Remove curve objects after converting to strokes (unreported)

This was detected fixing T69459

Part of Differential Revision: https://developer.blender.org/D6045

Note: done in a separated commit to keep track of changes done not directly related to bug reported in T69459.
This commit is contained in:
Antonio Vazquez
2019-10-11 13:18:39 +02:00
parent 15ffa3e7db
commit 74f9b9d144

View File

@@ -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! */
@@ -2398,6 +2399,7 @@ static int convert_exec(bContext *C, wmOperator *op)
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;
}
}
}
@@ -2497,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);