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_regions.c')
-rw-r--r--source/blender/editors/interface/interface_regions.c69
1 files changed, 50 insertions, 19 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 623651083d2..a55ee01202c 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -424,7 +424,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if (unit_type == PROP_UNIT_ROTATION) {
if (RNA_property_type(but->rnaprop) == PROP_FLOAT) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex));
+ float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", value);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -484,6 +485,17 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
}
}
}
+ else if (ELEM(but->type, MENU, PULLDOWN)) {
+ if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
+ if(but->menu_create_func && WM_menutype_contains((MenuType *)but->poin)) {
+ MenuType *mt= (MenuType *)but->poin;
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", mt->idname);
+ data->color[data->totline]= 0x888888;
+ data->totline++;
+ }
+ }
+
+ }
assert(data->totline < MAX_TOOLTIP_LINES);
@@ -1177,7 +1189,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
uiBut *bt;
uiSafetyRct *saferct;
rctf butrct;
- float aspect;
+ /*float aspect;*/ /*UNUSED*/
int xsize, ysize, xof=0, yof=0, center;
short dir1= 0, dir2=0;
@@ -1212,7 +1224,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
}
}
- aspect= (float)(block->maxx - block->minx + 4);
+ /*aspect= (float)(block->maxx - block->minx + 4);*/ /*UNUSED*/
ui_block_to_window_fl(butregion, but->block, &block->minx, &block->miny);
ui_block_to_window_fl(butregion, but->block, &block->maxx, &block->maxy);
@@ -1221,7 +1233,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
xsize= block->maxx - block->minx+4; // 4 for shadow
ysize= block->maxy - block->miny+4;
- aspect/= (float)xsize;
+ /*aspect/= (float)xsize;*/ /*UNUSED*/
if(but) {
int left=0, right=0, top=0, down=0;
@@ -1923,31 +1935,31 @@ static void do_picker_new_mode_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(a
#define PICKER_TOTAL_W (PICKER_W+PICKER_SPACE+PICKER_BAR)
-static void circle_picker(uiBlock *block, PointerRNA *ptr, const char *propname)
+static void circle_picker(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop)
{
uiBut *bt;
/* HS circle */
- bt= uiDefButR(block, HSVCIRCLE, 0, "", 0, 0, PICKER_H, PICKER_W, ptr, propname, 0, 0.0, 0.0, 0, 0, "Color");
+ bt= uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, PICKER_H, PICKER_W, ptr, prop, 0, 0.0, 0.0, 0, 0, "Color");
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
/* value */
- bt= uiDefButR(block, HSVCUBE, 0, "", PICKER_W+PICKER_SPACE,0,PICKER_BAR,PICKER_H, ptr, propname, 0, 0.0, 0.0, UI_GRAD_V_ALT, 0, "Value");
+ bt= uiDefButR_prop(block, HSVCUBE, 0, "", PICKER_W+PICKER_SPACE,0,PICKER_BAR,PICKER_H, ptr, prop, 0, 0.0, 0.0, UI_GRAD_V_ALT, 0, "Value");
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
}
-static void square_picker(uiBlock *block, PointerRNA *ptr, const char *propname, int type)
+static void square_picker(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int type)
{
uiBut *bt;
int bartype = type + 3;
/* HS square */
- bt= uiDefButR(block, HSVCUBE, 0, "", 0, PICKER_BAR+PICKER_SPACE, PICKER_TOTAL_W, PICKER_H, ptr, propname, 0, 0.0, 0.0, type, 0, "Color");
+ bt= uiDefButR_prop(block, HSVCUBE, 0, "", 0, PICKER_BAR+PICKER_SPACE, PICKER_TOTAL_W, PICKER_H, ptr, prop, 0, 0.0, 0.0, type, 0, "Color");
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
/* value */
- bt= uiDefButR(block, HSVCUBE, 0, "", 0, 0, PICKER_TOTAL_W, PICKER_BAR, ptr, propname, 0, 0.0, 0.0, bartype, 0, "Value");
+ bt= uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, PICKER_TOTAL_W, PICKER_BAR, ptr, prop, 0, 0.0, 0.0, bartype, 0, "Value");
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
}
@@ -1962,7 +1974,6 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
static char hexcol[128];
float rgb_gamma[3];
float min, max, step, precision;
- const char *propname = RNA_property_identifier(prop);
float *hsv= ui_block_hsv_get(block);
ui_block_hsv_get(block);
@@ -1988,16 +1999,16 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
switch (U.color_picker_type) {
case USER_CP_CIRCLE:
- circle_picker(block, ptr, propname);
+ circle_picker(block, ptr, prop);
break;
case USER_CP_SQUARE_SV:
- square_picker(block, ptr, propname, UI_GRAD_SV);
+ square_picker(block, ptr, prop, UI_GRAD_SV);
break;
case USER_CP_SQUARE_HS:
- square_picker(block, ptr, propname, UI_GRAD_HS);
+ square_picker(block, ptr, prop, UI_GRAD_HS);
break;
case USER_CP_SQUARE_HV:
- square_picker(block, ptr, propname, UI_GRAD_HV);
+ square_picker(block, ptr, prop, UI_GRAD_HV);
break;
}
@@ -2016,11 +2027,11 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
/* RGB values */
uiBlockBeginAlign(block);
- bt= uiDefButR(block, NUMSLI, 0, "R ", 0, -60, butwidth, UI_UNIT_Y, ptr, propname, 0, 0.0, 0.0, 0, 3, "Red");
+ bt= uiDefButR_prop(block, NUMSLI, 0, "R ", 0, -60, butwidth, UI_UNIT_Y, ptr, prop, 0, 0.0, 0.0, 0, 3, "Red");
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
- bt= uiDefButR(block, NUMSLI, 0, "G ", 0, -80, butwidth, UI_UNIT_Y, ptr, propname, 1, 0.0, 0.0, 0, 3, "Green");
+ bt= uiDefButR_prop(block, NUMSLI, 0, "G ", 0, -80, butwidth, UI_UNIT_Y, ptr, prop, 1, 0.0, 0.0, 0, 3, "Green");
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
- bt= uiDefButR(block, NUMSLI, 0, "B ", 0, -100, butwidth, UI_UNIT_Y, ptr, propname, 2, 0.0, 0.0, 0, 3, "Blue");
+ bt= uiDefButR_prop(block, NUMSLI, 0, "B ", 0, -100, butwidth, UI_UNIT_Y, ptr, prop, 2, 0.0, 0.0, 0, 3, "Blue");
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
// could use uiItemFullR(col, ptr, prop, -1, 0, UI_ITEM_R_EXPAND|UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2037,7 +2048,7 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
uiBlockEndAlign(block);
if(rgb[3] != FLT_MAX) {
- bt= uiDefButR(block, NUMSLI, 0, "A ", 0, -120, butwidth, UI_UNIT_Y, ptr, propname, 3, 0.0, 0.0, 0, 0, "Alpha");
+ bt= uiDefButR_prop(block, NUMSLI, 0, "A ", 0, -120, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 0, "Alpha");
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
}
else {
@@ -2582,6 +2593,25 @@ void uiPupBlock(bContext *C, uiBlockCreateFunc func, void *arg)
uiPupBlockO(C, func, arg, NULL, 0);
}
+void uiPupBlockEx(bContext *C, uiBlockCreateFunc func, uiBlockCancelFunc cancel_func, void *arg)
+{
+ wmWindow *window= CTX_wm_window(C);
+ uiPopupBlockHandle *handle;
+
+ handle= ui_popup_block_create(C, NULL, NULL, func, NULL, arg);
+ handle->popup= 1;
+ handle->retvalue= 1;
+
+ handle->popup_arg= arg;
+ // handle->popup_func= operator_cb;
+ handle->cancel_func= cancel_func;
+ // handle->opcontext= opcontext;
+
+ UI_add_popup_handlers(C, &window->modalhandlers, handle);
+ WM_event_add_mousemove(C);
+}
+
+#if 0 /* UNUSED */
void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int opcontext)
{
wmWindow *window= CTX_wm_window(C);
@@ -2599,6 +2629,7 @@ void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int
UI_add_popup_handlers(C, &window->modalhandlers, handle);
WM_event_add_mousemove(C);
}
+#endif
void uiPupBlockClose(bContext *C, uiBlock *block)
{