24#include "RNA_prototypes.hh"
50 const float2 offset = curr_bounds.
size() * 0.5f * (scale - 1.0f);
58 const float2 threshold = 0.01f * clip_bounds.
size();
59 if (clamped_bounds.
min.x < clip_bounds.
min.x + threshold.
x) {
60 clamped_bounds.
min.x = clip_bounds.
min.x;
62 if (clamped_bounds.
min.y < clip_bounds.
min.y + threshold.
y) {
63 clamped_bounds.
min.y = clip_bounds.
min.y;
65 if (clamped_bounds.
max.x > clip_bounds.
max.x - threshold.
x) {
66 clamped_bounds.
max.x = clip_bounds.
max.x;
68 if (clamped_bounds.
max.y > clip_bounds.
max.y - threshold.
y) {
69 clamped_bounds.
max.y = clip_bounds.
max.y;
227 IFACE_(
"Extend Horizontal"),
247 IFACE_(
"Extend Extrapolated"),
324 std::optional<blender::StringRef> tip,
326 const bool neg_slope,
330 uiBut *bt =
uiDefIconBut(block,
ButType::Row, 0, icon, 0, 0, dx, dx, &cumap->
cur, 0.0, 3.0, tip);
375 if (labeltype ==
'v') {
381 bt =
uiDefButI(block,
ButType::Row, 0,
"X", 0, 0, dx, dx, &cumap->
cur, 0.0, 0.0,
"");
385 bt =
uiDefButI(block,
ButType::Row, 0,
"Y", 0, 0, dx, dx, &cumap->
cur, 0.0, 1.0,
"");
389 bt =
uiDefButI(block,
ButType::Row, 0,
"Z", 0, 0, dx, dx, &cumap->
cur, 0.0, 2.0,
"");
410 TIP_(
"Combined channels"));
425 TIP_(
"Red channel"));
440 TIP_(
"Green channel"));
455 TIP_(
"Blue channel"));
459 else if (labeltype ==
'h') {
491 TIP_(
"Saturation level"));
506 TIP_(
"Value level"));
514 if (labeltype ==
'h') {
526 block,
ButType::But, 0, ICON_ZOOM_IN, 0, 0, dx, dx,
nullptr, 0.0, 0.0,
TIP_(
"Zoom in"));
534 block,
ButType::But, 0, ICON_ZOOM_OUT, 0, 0, dx, dx,
nullptr, 0.0, 0.0,
TIP_(
"Zoom out"));
541 const int icon = (cumap->
flag &
CUMA_DO_CLIP) ? ICON_CLIPUV_HLT : ICON_CLIPUV_DEHLT;
548 RNAUpdateCb *tools_cb = MEM_new<RNAUpdateCb>(__func__, cb);
549 if (brush && neg_slope) {
565 else if (neg_slope) {
584 MEM_new<RNAUpdateCb>(__func__, cb),
591 row = &layout->
row(
false);
612 bool point_last_or_first =
false;
620 point_last_or_first =
true;
649 TIP_(
"Auto handle"));
673 TIP_(
"Vector handle"));
687 ICON_HANDLE_AUTOCLAMPED,
695 TIP_(
"Auto clamped"));
747 block,
ButType::But, 0, ICON_X, 0, 0, dx, dx,
nullptr, 0.0, 0.0,
TIP_(
"Delete points"));
753 if (point_last_or_first) {
776 TIP_(
"Reset curves and black/white point"));
779 for (
int a = 0; a <
CM_TOT; a++) {
794 row = &layout->
row(
true);
799 TIP_(
"Smooth preset"),
807 TIP_(
"Round preset"),
817 TIP_(
"Sharp preset"),
865 layout, &cptr, type, levels, brush, neg_slope, tone, presets,
RNAUpdateCb{*
ptr, prop});
ARegion * CTX_wm_region(const bContext *C)
MINLINE int max_ii(int a, int b)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_COLOR
#define ID_IS_EDITABLE(_id)
@ CUMA_EXTEND_EXTRAPOLATE
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)
#define RNA_warning(format,...)
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 * uiDefButF(uiBlock *block, ButType type, int retval, blender::StringRef str, int x, int y, short width, short height, float *poin, float min, float max, std::optional< blender::StringRef > tip)
uiBut * uiDefButI(uiBlock *block, ButType type, int retval, blender::StringRef str, int x, int y, short width, short height, int *poin, float min, float max, std::optional< blender::StringRef > tip)
void UI_but_disable(uiBut *but, const char *disabled_hint)
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)
@ UI_BLOCK_MOVEMOUSE_QUIT
void UI_block_theme_style_set(uiBlock *block, char theme_style)
uiBlock * UI_block_begin(const bContext *C, ARegion *region, std::string name, blender::ui::EmbossType emboss)
void UI_block_lock_clear(uiBlock *block)
uiBut * uiDefIconBut(uiBlock *block, uiButTypeWithPointerType but_and_ptr_type, int retval, int icon, int x, int y, short width, short height, void *poin, float min, float max, std::optional< blender::StringRef > tip)
void UI_block_bounds_set_normal(uiBlock *block, int addval)
void UI_but_number_step_size_set(uiBut *but, float step_size)
void UI_block_bounds_set_text(uiBlock *block, int addval)
void UI_block_align_begin(uiBlock *block)
void UI_block_funcN_set(uiBlock *block, uiButHandleNFunc funcN, void *argN, void *arg2, uiButArgNFree func_argN_free_fn=MEM_freeN, uiButArgNCopy func_argN_copy_fn=MEM_dupallocN)
void UI_but_number_precision_set(uiBut *but, float precision)
void UI_block_direction_set(uiBlock *block, char direction)
@ UI_BLOCK_THEME_STYLE_POPUP
void UI_block_flag_enable(uiBlock *block, int flag)
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)
uiBut * uiDefButBitI(uiBlock *block, ButType type, int bit, int retval, blender::StringRef str, int x, int y, short width, short height, int *poin, float min, float max, std::optional< blender::StringRef > tip)
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_but_flag_enable(uiBut *but, int flag)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
constexpr const char * c_str() const
VecBase< float, 2 > float2
static void curvemap_buttons_redraw(bContext &C)
static uiBlock * curvemap_tools_negslope_func(bContext *C, ARegion *region, void *cb_v)
static bool curvemap_can_zoom_in(CurveMapping *cumap)
static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labeltype, bool levels, bool brush, bool neg_slope, bool tone, bool presets, const RNAUpdateCb &cb)
static void add_preset_button(uiBlock *block, const float dx, const int icon, std::optional< blender::StringRef > tip, CurveMapping *cumap, const bool neg_slope, const int preset, const RNAUpdateCb &cb)
static void curvemap_zoom(CurveMapping &cumap, const float scale)
static uiBlock * curvemap_tools_func(bContext *C, ARegion *region, RNAUpdateCb &cb, bool show_extend, CurveMapSlopeType reset_mode)
static uiBlock * curvemap_brush_tools_func(bContext *C, ARegion *region, void *cb_v)
static void curvemap_buttons_zoom_in(bContext *C, CurveMapping *cumap)
static uiBlock * curvemap_tools_posslope_func(bContext *C, ARegion *region, void *cb_v)
static bool curvemap_can_zoom_out(CurveMapping *cumap)
static void curvemap_buttons_zoom_out(bContext *C, CurveMapping *cumap)
static uiBlock * curvemap_brush_tools_negslope_func(bContext *C, ARegion *region, void *cb_v)
void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname, int type, bool levels, bool brush, bool neg_slope, bool tone, bool presets)
static uiBlock * curvemap_clipping_func(bContext *C, ARegion *region, void *cumap_v)
static void rna_update_cb(bContext &C, const RNAUpdateCb &cb)
#define ERROR_LIBDATA_MESSAGE
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)
const char * RNA_struct_identifier(const StructRNA *type)
eButGradientType gradient_type
void alignment_set(blender::ui::LayoutAlign alignment)
uiLayout & row(bool align)
uiLayout & split(float percentage, bool align)