Fix a few issues in GP legacy to v3 conversion operator.
* Use name of old GP data for the new one, _not_ the object name. * Properly decrease usercount of old GP ID. Pull Request: https://projects.blender.org/blender/blender/pulls/118366
This commit is contained in:
@@ -3232,10 +3232,15 @@ static int object_convert_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
GreasePencil *new_grease_pencil = static_cast<GreasePencil *>(
|
||||
BKE_id_new(bmain, ID_GP, newob->id.name + 2));
|
||||
BKE_id_new(bmain, ID_GP, gpd->id.name + 2));
|
||||
newob->data = new_grease_pencil;
|
||||
newob->type = OB_GREASE_PENCIL;
|
||||
|
||||
/* NOTE: Could also use #BKE_id_free_us, to also free the legacy GP if not used anymore? */
|
||||
id_us_min(&gpd->id);
|
||||
/* No need to increase usercount of `new_grease_pencil`, since ID creation already set it
|
||||
* to 1. */
|
||||
|
||||
bke::greasepencil::convert::legacy_gpencil_to_grease_pencil(
|
||||
*bmain, *new_grease_pencil, *gpd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user