25#include "RNA_prototypes.hh"
37 for (
int a = 0; a < coba->
tot; a++) {
38 data_tmp[a] = coba->
data[coba->
tot - (a + 1)];
40 for (
int a = 0; a < coba->
tot; a++) {
41 data_tmp[a].
pos = 1.0f - data_tmp[a].
pos;
42 coba->
data[a] = data_tmp[a];
54 const int tot = evenly ? coba->
tot - 1 : coba->
tot;
55 const float gap = 1.0f / tot;
57 for (
int a = 0; a < coba->
tot; a++) {
62 "Distribute Stops Evenly") :
64 "Distribute Stops from Left");
100 ICON_ARROW_LEFTRIGHT,
101 IFACE_(
"Flip Color Ramp"),
119 IFACE_(
"Distribute Stops from Left"),
137 IFACE_(
"Distribute Stops Evenly"),
153 layout.
op(
"UI_OT_eyedropper_colorramp",
IFACE_(
"Eyedropper"), ICON_EYEDROPPER);
162 IFACE_(
"Reset Color Ramp"),
222 const float xs = butr->
xmin;
223 const float ys = butr->
ymin;
243 TIP_(
"Add a new color stop to the color ramp"));
256 TIP_(
"Delete the active position"));
264 RNAUpdateCb *tools_cb = MEM_new<RNAUpdateCb>(__func__, cb);
287 row = &
split->row(
false);
299 row = &layout->
row(
false);
302 block,
ButType::ColorBand, 0,
"", xs, ys,
BLI_rctf_size_x(butr),
UI_UNIT_Y, coba, 0, 0,
"");
307 row = &layout->
row(
false);
317 row = &
split->row(
false);
328 float(std::max(0, coba->
tot - 1)),
329 TIP_(
"Choose active color stop"));
332 row = &
split->row(
false);
335 row = &layout->
row(
false);
342 row = &subsplit->
row(
false);
353 float(std::max(0, coba->
tot - 1)),
354 TIP_(
"Choose active color stop"));
357 row = &subsplit->
row(
false);
360 row = &
split->row(
false);
375 if (
STREQ(prop_identifier,
"position")) {
379 if (
STREQ(prop_identifier,
"color")) {
CBData * BKE_colorband_element_add(ColorBand *coba, float position)
void BKE_colorband_update_sort(ColorBand *coba)
bool BKE_colorband_element_remove(ColorBand *coba, int index)
void BKE_colorband_init(ColorBand *coba, bool rangetype)
ARegion * CTX_wm_region(const bContext *C)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
#define CTX_N_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define ID_IS_EDITABLE(_id)
void ED_region_tag_redraw(ARegion *region)
void ED_undo_push(bContext *C, const char *str)
static void split(const char *text, const char *seps, char ***str, int *count)
void UI_but_func_set(uiBut *but, std::function< void(bContext &)> func)
void * but_func_argN_copy(const void *argN)
void but_func_argN_free(void *argN)
uiBut * uiDefIconTextBut(uiBlock *block, uiButTypeWithPointerType but_and_ptr_type, int retval, int icon, blender::StringRef str, int x, int y, short width, short height, void *poin, std::optional< blender::StringRef > tip)
void UI_block_emboss_set(uiBlock *block, blender::ui::EmbossType emboss)
uiBlock * UI_block_begin(const bContext *C, ARegion *region, std::string name, blender::ui::EmbossType emboss)
void UI_block_lock_clear(uiBlock *block)
const uiStyle * UI_style_get_dpi()
void UI_but_number_step_size_set(uiBut *but, float step_size)
uiBut * uiDefButS(uiBlock *block, ButType type, int retval, blender::StringRef str, int x, int y, short width, short height, short *poin, float min, float max, std::optional< blender::StringRef > tip)
void UI_block_bounds_set_text(uiBlock *block, int addval)
void UI_block_align_begin(uiBlock *block)
void UI_block_direction_set(uiBlock *block, char direction)
uiBut * uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, int x, int y, short width, short height, std::optional< blender::StringRef > tip)
void UI_but_funcN_set(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2, uiButArgNFree func_argN_free_fn=MEM_freeN, uiButArgNCopy func_argN_copy_fn=MEM_dupallocN)
void UI_block_lock_set(uiBlock *block, bool val, const char *lockstr)
uiBut * uiDefBut(uiBlock *block, uiButTypeWithPointerType but_and_ptr_type, int retval, blender::StringRef str, int x, int y, short width, short height, void *poin, float min, float max, std::optional< blender::StringRef > tip)
void UI_block_align_end(uiBlock *block)
constexpr const char * c_str() const
#define UI_MENU_WIDTH_MIN
static void colorband_flip(bContext *C, ColorBand *coba)
static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, const rctf *butr, const RNAUpdateCb &cb, int expand)
static void colorband_add(bContext &C, const RNAUpdateCb &cb, ColorBand &coba)
static void colorband_update_cb(bContext *, void *bt_v, void *coba_v)
static void colorband_distribute(bContext *C, ColorBand *coba, bool evenly)
static uiBlock * colorband_tools_fn(bContext *C, ARegion *region, void *cb_v)
void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname, bool expand)
static void rna_update_cb(bContext &C, const RNAUpdateCb &cb)
#define ERROR_LIBDATA_MESSAGE
uiLayout & block_layout(uiBlock *block, LayoutDirection direction, LayoutType type, int x, int y, int size, int em, int padding, const uiStyle *style)
void block_layout_set_current(uiBlock *block, uiLayout *layout)
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
PropertyType RNA_property_type(PropertyRNA *prop)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
const char * RNA_property_identifier(const PropertyRNA *prop)
blender::Vector< std::unique_ptr< uiBut > > buttons
uiBlock * absolute_block()
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
void context_ptr_set(blender::StringRef name, const PointerRNA *ptr)
uiLayout & row(bool align)
uiLayout & split(float percentage, bool align)
PointerRNA op(wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, blender::wm::OpCallContext context, eUI_Item_Flag flag)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)