[Bf-blender-cvs] [21b60ea] master: UI: use RNA for colorband interpolation menu

Campbell Barton noreply at git.blender.org
Mon Feb 10 03:06:10 CET 2014


Commit: 21b60ea7e16c825a05eab910d13337dd079b8bbf
Author: Campbell Barton
Date:   Mon Feb 10 06:52:57 2014 +1100
https://developer.blender.org/rB21b60ea7e16c825a05eab910d13337dd079b8bbf

UI: use RNA for colorband interpolation menu

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

M	source/blender/editors/interface/interface_templates.c
M	source/blender/makesrna/intern/rna_color.c

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

diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 35733eb..e11055f 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1470,6 +1470,9 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand
 	float unit = BLI_rctf_size_x(butr) / 14.0f;
 	float xs = butr->xmin;
 	float ys = butr->ymin;
+	PointerRNA ptr;
+
+	RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRamp, coba, &ptr);
 
 	split = uiLayoutSplit(layout, 0.4f, false);
 
@@ -1493,10 +1496,8 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand
 	uiBlockSetEmboss(block, UI_EMBOSS);
 
 	row = uiLayoutRow(split, false);
-	bt = uiDefButS(block, MENU, 0, IFACE_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"),
-	               0, ys + UI_UNIT_Y, 8.0f * unit, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0,
-	               TIP_("Set interpolation between color stops"));
-	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
+
+	uiItemR(row, &ptr, "interpolation", 0, "", ICON_NONE);
 
 	row = uiLayoutRow(layout, false);
 
@@ -1507,7 +1508,6 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand
 
 	if (coba->tot) {
 		CBData *cbd = coba->data + coba->cur;
-		PointerRNA ptr;
 
 		RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr);
 
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index cfbf019..408f99b 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -901,7 +901,7 @@ static void rna_def_color_ramp(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ipotype");
 	RNA_def_property_enum_items(prop, prop_interpolation_items);
-	RNA_def_property_ui_text(prop, "Interpolation", "");
+	RNA_def_property_ui_text(prop, "Interpolation", "Set interpolation between color stops");
 	RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
 
 #if 0 /* use len(elements) */




More information about the Bf-blender-cvs mailing list