[Bf-blender-cvs] [6d6e06d39b4] greasepencil-object: Palette Slots - Changing assigned palette via RNA calls relevant API func to set things correctly

Joshua Leung noreply at git.blender.org
Wed Oct 4 14:17:07 CEST 2017


Commit: 6d6e06d39b466aa5fb3c9027493bf4958a08c7d2
Author: Joshua Leung
Date:   Tue Oct 3 19:40:02 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rB6d6e06d39b466aa5fb3c9027493bf4958a08c7d2

Palette Slots - Changing assigned palette via RNA calls relevant API func to set things correctly

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

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 351d0f8e54c..94cb5f65429 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -152,6 +152,16 @@ static void rna_GPencilPaletteSlot_name_get(PointerRNA *ptr, char *str)
 		str[0] = '\0';
 }
 
+static void rna_GPencilPaletteSlot_palette_set(PointerRNA *ptr, PointerRNA value)
+{
+	bGPdata *gpd = ptr->id.data;
+	bGPDpaletteref *palslot = ptr->data;
+	
+	Palette *palette = value.data;
+	
+	BKE_gpencil_paletteslot_set_palette(gpd, palslot, palette);
+}
+
 static char *rna_GPencilLayer_path(PointerRNA *ptr)
 {
 	bGPDlayer *gpl = (bGPDlayer *)ptr->data;
@@ -707,7 +717,11 @@ static void rna_def_gpencil_palette_slot(BlenderRNA *brna)
 	
 	prop = RNA_def_property(srna, "palette", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
-	//RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_GPencilPalette_id_poll");
+	RNA_def_property_pointer_funcs(prop, 
+	                               NULL, 
+	                               "rna_GPencilPaletteSlot_palette_set", 
+	                               NULL, 
+	                               NULL /*"rna_GPencilPalette_id_poll"*/);
 	RNA_def_property_ui_text(prop, "Palette", "Palette data-block used by this palette slot");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 }
@@ -715,10 +729,10 @@ static void rna_def_gpencil_palette_slot(BlenderRNA *brna)
 static void rna_def_gpencil_palette_slots_api(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
-	PropertyRNA *prop;
+	//PropertyRNA *prop;
 
-	FunctionRNA *func;
-	PropertyRNA *parm;
+	//FunctionRNA *func;
+	//PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "GreasePencilPaletteSlots");
 	srna = RNA_def_struct(brna, "GreasePencilPaletteSlots", NULL);



More information about the Bf-blender-cvs mailing list