Commit: e2d223461efeea4792defb254c692828266478d1
Author: Joshua Leung
Date: Mon Nov 28 02:28:12 2016 +1300
Branches: master
https://developer.blender.org/rBe2d223461efeea4792defb254c692828266478d1
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.
===================================================================
M source/blender/blenkernel/intern/gpencil.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil.c
b/source/blender/blenkernel/intern/gpencil.c
index 2242113..c22fd0e 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -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);
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs