[Bf-blender-cvs] [452028c] master: GPencil RNA API: "set_active" option for layer.new() and palette.new() is now true/enabled by default

Joshua Leung noreply at git.blender.org
Sun Nov 27 14:34:58 CET 2016


Commit: 452028c77ccea3846c7e1104c50e682b9b957ecc
Author: Joshua Leung
Date:   Mon Nov 28 02:32:03 2016 +1300
Branches: master
https://developer.blender.org/rB452028c77ccea3846c7e1104c50e682b9b957ecc

GPencil RNA API: "set_active" option for layer.new() and palette.new() is now true/enabled by default

To bring the API more into line with the UI (and the general expected behaviour of
Blender when it comes to adding stuff), newly created layers and palettes will be
made the active ones by default. It's possible to override this behaviour still
(e.g. in cases where you're auto-generating a large number of them), but otherwise,
this change will help prevent errors like T50123.

===================================================================

M	source/blender/makesrna/intern/rna_gpencil.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 7ba8953..6abead4 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1354,7 +1354,7 @@ static void rna_def_gpencil_layers_api(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Add a new grease pencil layer");
 	parm = RNA_def_string(func, "name", "GPencilLayer", MAX_NAME, "Name", "Name of the layer");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	RNA_def_boolean(func, "set_active", 0, "Set Active", "Set the newly created layer to the active layer");
+	RNA_def_boolean(func, "set_active", true, "Set Active", "Set the newly created layer to the active layer");
 	parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "The newly created layer");
 	RNA_def_function_return(func, parm);
 
@@ -1557,7 +1557,7 @@ static void rna_def_gpencil_palettes_api(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_function_ui_description(func, "Add a new grease pencil palette");
 	parm = RNA_def_string(func, "name", "GPencilPalette", MAX_NAME, "Name", "Name of the palette");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	RNA_def_boolean(func, "set_active", 0, "Set Active", "Activate the newly created palette");
+	RNA_def_boolean(func, "set_active", true, "Set Active", "Activate the newly created palette");
 	parm = RNA_def_pointer(func, "palette", "GPencilPalette", "", "The newly created palette");
 	RNA_def_function_return(func, parm);




More information about the Bf-blender-cvs mailing list