UI: use RNA for colorband interpolation menu
authorCampbell Barton <ideasman42@gmail.com>
Sun, 9 Feb 2014 19:52:57 +0000 (06:52 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 10 Feb 2014 02:04:43 +0000 (13:04 +1100)
source/blender/editors/interface/interface_templates.c
source/blender/makesrna/intern/rna_color.c

index 35733eb7783768eb986c670c3147c2f465e74017..e11055fe278f0cc1d82d28cc63341e7405b0b96c 100644 (file)
@@ -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);
 
index cfbf0193649ae0c5ec3aecd3fb31f4d58ac91fef..408f99bd96ac6f511a10bc5e418f43d2aeda30bc 100644 (file)
@@ -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) */