[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58223] branches/soc-2013-paint: rename ID_PALETTE to ID_PAL, also expose palettes to RNA and present a

Antony Riakiotakis kalast at gmail.com
Sat Jul 13 22:02:14 CEST 2013


Revision: 58223
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58223
Author:   psy-fi
Date:     2013-07-13 20:02:13 +0000 (Sat, 13 Jul 2013)
Log Message:
-----------
rename ID_PALETTE to ID_PAL, also expose palettes to RNA and present a
list of possible palettes under the colours in the UI.

Modified Paths:
--------------
    branches/soc-2013-paint/release/scripts/startup/bl_ui/space_image.py
    branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/soc-2013-paint/source/blender/blenkernel/intern/library.c
    branches/soc-2013-paint/source/blender/blenkernel/intern/paint.c
    branches/soc-2013-paint/source/blender/editors/interface/interface_templates.c
    branches/soc-2013-paint/source/blender/makesdna/DNA_ID.h
    branches/soc-2013-paint/source/blender/makesrna/intern/rna_ID.c
    branches/soc-2013-paint/source/blender/makesrna/intern/rna_sculpt_paint.c

Modified: branches/soc-2013-paint/release/scripts/startup/bl_ui/space_image.py
===================================================================
--- branches/soc-2013-paint/release/scripts/startup/bl_ui/space_image.py	2013-07-13 19:33:25 UTC (rev 58222)
+++ branches/soc-2013-paint/release/scripts/startup/bl_ui/space_image.py	2013-07-13 20:02:13 UTC (rev 58223)
@@ -710,6 +710,7 @@
                 col.template_color_picker(brush, "color", value_slider=True)
                 col.prop(brush, "color", text="")
                 col.prop(brush, "secondary_color", text="")
+                col.template_ID(settings, "palette", new="palette.new")
 
             row = col.row(align=True)
             self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")

Modified: branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-07-13 19:33:25 UTC (rev 58222)
+++ branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-07-13 20:02:13 UTC (rev 58223)
@@ -689,6 +689,7 @@
                 col.template_color_picker(brush, "color", value_slider=True)
                 col.prop(brush, "color", text="")
                 col.prop(brush, "secondary_color", text="")
+                col.template_ID(settings, "palette", new="palette.new")
 
             row = col.row(align=True)
             self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
@@ -741,6 +742,7 @@
             col = layout.column()
             col.template_color_picker(brush, "color", value_slider=True)
             col.prop(brush, "color", text="")
+            col.template_ID(settings, "palette", new="palette.new")
 
             row = col.row(align=True)
             self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")

Modified: branches/soc-2013-paint/source/blender/blenkernel/intern/library.c
===================================================================
--- branches/soc-2013-paint/source/blender/blenkernel/intern/library.c	2013-07-13 19:33:25 UTC (rev 58222)
+++ branches/soc-2013-paint/source/blender/blenkernel/intern/library.c	2013-07-13 20:02:13 UTC (rev 58223)
@@ -515,7 +515,7 @@
 			return &(mainlib->mask);
 		case ID_LS:
 			return &(mainlib->linestyle);
-		case ID_PALETTE:
+		case ID_PAL:
 			return &(mainlib->palettes);
 	}
 	return NULL;
@@ -730,7 +730,7 @@
 		case ID_LS:
 			id = MEM_callocN(sizeof(FreestyleLineStyle), "Freestyle Line Style");
 			break;
-		case ID_PALETTE:
+		case ID_PAL:
 			id = MEM_callocN(sizeof(Palette), "Palette");
 			break;
 	}
@@ -979,7 +979,7 @@
 		case ID_LS:
 			BKE_free_linestyle((FreestyleLineStyle *)id);
 			break;
-		case ID_PALETTE:
+		case ID_PAL:
 			break;
 	}
 

Modified: branches/soc-2013-paint/source/blender/blenkernel/intern/paint.c
===================================================================
--- branches/soc-2013-paint/source/blender/blenkernel/intern/paint.c	2013-07-13 19:33:25 UTC (rev 58222)
+++ branches/soc-2013-paint/source/blender/blenkernel/intern/paint.c	2013-07-13 20:02:13 UTC (rev 58223)
@@ -286,7 +286,7 @@
 {
 	Palette *palette;
 
-	palette = BKE_libblock_alloc(&bmain->palettes, ID_PALETTE, name);
+	palette = BKE_libblock_alloc(&bmain->palettes, ID_PAL, name);
 
 	/* enable fake user by default */
 	palette->id.flag |= LIB_FAKEUSER;

Modified: branches/soc-2013-paint/source/blender/editors/interface/interface_templates.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/interface/interface_templates.c	2013-07-13 19:33:25 UTC (rev 58222)
+++ branches/soc-2013-paint/source/blender/editors/interface/interface_templates.c	2013-07-13 20:02:13 UTC (rev 58223)
@@ -353,6 +353,7 @@
 			case ID_BR:  return N_("Browse Brush to be linked");
 			case ID_PA:  return N_("Browse Particle System to be linked");
 			case ID_GD:  return N_("Browse Grease Pencil Data to be linked");
+			case ID_PAL: return N_("Browse Palette Data to be linked");
 		}
 	}
 	return N_("Browse ID data to be linked");

Modified: branches/soc-2013-paint/source/blender/makesdna/DNA_ID.h
===================================================================
--- branches/soc-2013-paint/source/blender/makesdna/DNA_ID.h	2013-07-13 19:33:25 UTC (rev 58222)
+++ branches/soc-2013-paint/source/blender/makesdna/DNA_ID.h	2013-07-13 20:02:13 UTC (rev 58223)
@@ -213,7 +213,7 @@
 #define ID_MC		MAKE_ID2('M', 'C') /* MovieClip */
 #define ID_MSK		MAKE_ID2('M', 'S') /* Mask */
 #define ID_LS		MAKE_ID2('L', 'S') /* FreestyleLineStyle */
-#define ID_PALETTE	MAKE_ID2('P', 'L') /* Palette */
+#define ID_PAL		MAKE_ID2('P', 'L') /* Palette */
 
 	/* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */
 #define ID_SEQ		MAKE_ID2('S', 'Q')

Modified: branches/soc-2013-paint/source/blender/makesrna/intern/rna_ID.c
===================================================================
--- branches/soc-2013-paint/source/blender/makesrna/intern/rna_ID.c	2013-07-13 19:33:25 UTC (rev 58222)
+++ branches/soc-2013-paint/source/blender/makesrna/intern/rna_ID.c	2013-07-13 20:02:13 UTC (rev 58223)
@@ -152,6 +152,7 @@
 	if (RNA_struct_is_a(type, &RNA_WindowManager)) return ID_WM;
 	if (RNA_struct_is_a(type, &RNA_MovieClip)) return ID_MC;
 	if (RNA_struct_is_a(type, &RNA_Mask)) return ID_MSK;
+	if (RNA_struct_is_a(type, &RNA_Palette)) return ID_PAL;
 
 	return 0;
 }
@@ -189,6 +190,8 @@
 		case ID_WM: return &RNA_WindowManager;
 		case ID_MC: return &RNA_MovieClip;
 		case ID_MSK: return &RNA_Mask;
+		case ID_PAL: return &RNA_Palette;
+
 		default: return &RNA_ID;
 	}
 }

Modified: branches/soc-2013-paint/source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
--- branches/soc-2013-paint/source/blender/makesrna/intern/rna_sculpt_paint.c	2013-07-13 19:33:25 UTC (rev 58222)
+++ branches/soc-2013-paint/source/blender/makesrna/intern/rna_sculpt_paint.c	2013-07-13 20:02:13 UTC (rev 58223)
@@ -287,6 +287,15 @@
 }
 #else
 
+static void rna_def_palette(BlenderRNA *brna)
+{
+	StructRNA *srna;
+
+	srna = RNA_def_struct(brna, "Palette", "ID");
+	RNA_def_struct_ui_text(srna, "Palette", "");
+}
+
+
 static void rna_def_paint(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -302,6 +311,11 @@
 	RNA_def_property_ui_text(prop, "Brush", "Active Brush");
 	RNA_def_property_update(prop, 0, "rna_Paint_brush_update");
 
+	prop = RNA_def_property(srna, "palette", PROP_POINTER, PROP_NONE);
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, NULL);
+	RNA_def_property_ui_text(prop, "Palette", "Active Palette");
+
 	prop = RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH);
 	RNA_def_property_ui_text(prop, "Show Brush", "");
@@ -679,6 +693,7 @@
 {
 	/* *** Non-Animated *** */
 	RNA_define_animate_sdna(false);
+	rna_def_palette(brna);
 	rna_def_paint(brna);
 	rna_def_sculpt(brna);
 	rna_def_uv_sculpt(brna);




More information about the Bf-blender-cvs mailing list