Fix T50123 - GreasePencil: Modifying name of new color in new palette via bpy segfaults
When there were no prior palettes, creating a new one didn't automatically make it active. This caused problems when trying to rename the color, as the RNA code assumed that if there's a color, it must come from the active palette. This commit partially fixes the problem by ensuring that if there are no palettes, the first one will always be made active.
This commit is contained in:
parent
d20f5b7de0
commit
e2d223461e
Notes:
blender-bot
2023-02-14 07:23:24 +01:00
Referenced by issue #50123, GreasePencil: Modifying name of new color in new palette segfaults
|
@ -382,7 +382,8 @@ bGPDpalette *BKE_gpencil_palette_addnew(bGPdata *gpd, const char *name, bool set
|
|||
sizeof(palette->info));
|
||||
|
||||
/* make this one the active one */
|
||||
if (setactive) {
|
||||
/* NOTE: Always make this active if there's nothing else yet (T50123) */
|
||||
if ((setactive) || (gpd->palettes.first == gpd->palettes.last)) {
|
||||
BKE_gpencil_palette_setactive(gpd, palette);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue