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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user