Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c65
1 files changed, 61 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 90639878958..bbc111d91db 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2105,8 +2105,10 @@ void UI_region_message_subscribe(ARegion *region, struct wmMsgBus *mbus)
int ui_but_is_pushed_ex(uiBut *but, double *value)
{
int is_push = 0;
-
- if (but->bit) {
+ if (but->pushed_state_func) {
+ return but->pushed_state_func(but, but->pushed_state_arg);
+ }
+ else if (but->bit) {
const bool state = !ELEM(
but->type, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_CHECKBOX_N);
int lvalue;
@@ -2253,7 +2255,6 @@ void ui_but_v3_get(uiBut *but, float vec[3])
}
else if (but->pointype == UI_BUT_POIN_CHAR) {
const char *cp = (char *)but->poin;
-
vec[0] = ((float)cp[0]) / 255.0f;
vec[1] = ((float)cp[1]) / 255.0f;
vec[2] = ((float)cp[2]) / 255.0f;
@@ -3903,6 +3904,10 @@ static void ui_but_alloc_info(const eButType type,
alloc_size = sizeof(uiButCurveProfile);
alloc_str = "uiButCurveProfile";
break;
+ case UI_BTYPE_DATASETROW:
+ alloc_size = sizeof(uiButDatasetRow);
+ alloc_str = "uiButDatasetRow";
+ break;
default:
alloc_size = sizeof(uiBut);
alloc_str = "uiBut";
@@ -4100,6 +4105,7 @@ static uiBut *ui_def_but(uiBlock *block,
UI_BTYPE_BUT_MENU,
UI_BTYPE_SEARCH_MENU,
UI_BTYPE_PROGRESS_BAR,
+ UI_BTYPE_DATASETROW,
UI_BTYPE_POPOVER)) {
but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT);
}
@@ -6336,10 +6342,11 @@ void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN)
but->tip_argN = argN;
}
-void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, void *arg)
+void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, const void *arg)
{
but->pushed_state_func = func;
but->pushed_state_arg = arg;
+ ui_but_update(but);
}
uiBut *uiDefBlockBut(uiBlock *block,
@@ -6824,6 +6831,56 @@ uiBut *uiDefSearchButO_ptr(uiBlock *block,
return but;
}
+void UI_but_datasetrow_indentation_set(uiBut *but, int indentation)
+{
+ uiButDatasetRow *but_dataset = (uiButDatasetRow *)but;
+ BLI_assert(but->type == UI_BTYPE_DATASETROW);
+
+ but_dataset->indentation = indentation;
+ BLI_assert(indentation >= 0);
+
+}
+
+/**
+ * Adds a hint to the button which draws right aligned, grayed out and never clipped.
+ */
+void UI_but_hint_drawstr_set(uiBut *but, const char *string)
+{
+ ui_but_add_shortcut(but, string, false);
+}
+
+void UI_but_datasetrow_component_set(uiBut *but, uint8_t geometry_component_type)
+{
+ uiButDatasetRow *but_dataset_row = (uiButDatasetRow *)but;
+ BLI_assert(but->type == UI_BTYPE_DATASETROW);
+
+ but_dataset_row->geometry_component_type = geometry_component_type;
+}
+
+void UI_but_datasetrow_domain_set(uiBut *but, uint8_t attribute_domain)
+{
+ uiButDatasetRow *but_dataset_row = (uiButDatasetRow *)but;
+ BLI_assert(but->type == UI_BTYPE_DATASETROW);
+
+ but_dataset_row->attribute_domain = attribute_domain;
+}
+
+uint8_t UI_but_datasetrow_component_get(uiBut *but)
+{
+ uiButDatasetRow *but_dataset_row = (uiButDatasetRow *)but;
+ BLI_assert(but->type == UI_BTYPE_DATASETROW);
+
+ return but_dataset_row->geometry_component_type;
+}
+
+uint8_t UI_but_datasetrow_domain_get(uiBut *but)
+{
+ uiButDatasetRow *but_dataset_row = (uiButDatasetRow *)but;
+ BLI_assert(but->type == UI_BTYPE_DATASETROW);
+
+ return but_dataset_row->attribute_domain;
+}
+
void UI_but_node_link_set(uiBut *but, bNodeSocket *socket, const float draw_color[4])
{
but->flag |= UI_BUT_NODE_LINK;