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_templates.c')
-rw-r--r--source/blender/editors/interface/interface_templates.c60
1 files changed, 35 insertions, 25 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index fbfa64cbdbd..2dcc18af4ea 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -390,36 +390,22 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
/* for new/open operators */
void UI_context_active_but_prop_get_templateID(
- bContext *C,
- PointerRNA *r_ptr, PropertyRNA **r_prop)
+ bContext *C,
+ PointerRNA *r_ptr, PropertyRNA **r_prop)
{
TemplateID *template_ui;
- ARegion *ar = CTX_wm_region(C);
- uiBlock *block;
- uiBut *but;
+ uiBut *but = UI_context_active_but_get(C);
memset(r_ptr, 0, sizeof(*r_ptr));
*r_prop = NULL;
- if (!ar)
- return;
-
- for (block = ar->uiblocks.first; block; block = block->next) {
- for (but = block->buttons.first; but; but = but->next) {
- /* find the button before the active one */
- if ((but->flag & (UI_BUT_LAST_ACTIVE | UI_ACTIVE))) {
- if (but->func_argN) {
- template_ui = but->func_argN;
- *r_ptr = template_ui->ptr;
- *r_prop = template_ui->prop;
- return;
- }
- }
- }
+ if (but && but->func_argN) {
+ template_ui = but->func_argN;
+ *r_ptr = template_ui->ptr;
+ *r_prop = template_ui->prop;
}
}
-
static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
{
TemplateID *template_ui = (TemplateID *)arg_litem;
@@ -535,7 +521,7 @@ static const char *template_id_browse_tip(const StructRNA *type)
case ID_IM: return N_("Browse Image to be linked");
case ID_LS: return N_("Browse Line Style Data to be linked");
case ID_LT: return N_("Browse Lattice Data to be linked");
- case ID_LA: return N_("Browse Lamp Data to be linked");
+ case ID_LA: return N_("Browse Light Data to be linked");
case ID_CA: return N_("Browse Camera Data to be linked");
case ID_WO: return N_("Browse World Settings to be linked");
case ID_SCR: return N_("Choose Screen layout");
@@ -1880,7 +1866,7 @@ void uiTemplatePreview(
char _preview_id[UI_MAX_NAME_STR];
if (id && !ELEM(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA, ID_LS)) {
- RNA_warning("Expected ID of type material, texture, lamp, world or line style");
+ RNA_warning("Expected ID of type material, texture, light, world or line style");
return;
}
@@ -1971,7 +1957,7 @@ void uiTemplatePreview(
pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
}
else if (GS(parent->name) == ID_LA) {
- uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Lamp"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+ uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Light"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
}
else if (GS(parent->name) == ID_WO) {
@@ -3057,6 +3043,24 @@ void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname,
}
}
+void uiTemplateCryptoPicker(uiLayout *layout, PointerRNA *ptr, const char *propname)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+ uiBlock *block;
+ uiBut *but;
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ block = uiLayoutGetBlock(layout);
+
+ but = uiDefIconTextButO(block, UI_BTYPE_BUT, "UI_OT_eyedropper_color_crypto", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, RNA_property_ui_name(prop), 0, 0, UI_UNIT_X, UI_UNIT_Y, RNA_property_ui_description(prop));
+ but->rnapoin = *ptr;
+ but->rnaprop = prop;
+ but->rnaindex = -1;
+}
/********************* Layer Buttons Template ************************/
@@ -4347,6 +4351,10 @@ void uiTemplateInputStatus(uiLayout *layout, struct bContext *C)
return;
}
+ if (WM_window_modal_keymap_status_draw(C, win, layout)) {
+ return;
+ }
+
/* Otherwise should cursor keymap status. */
for (int i = 0; i < 3; i++) {
uiLayout *box = uiLayoutRow(layout, false);
@@ -4357,7 +4365,9 @@ void uiTemplateInputStatus(uiLayout *layout, struct bContext *C)
const char *msg = WM_window_cursor_keymap_status_get(win, i, 0);
const char *msg_drag = WM_window_cursor_keymap_status_get(win, i, 1);
- uiItemL(row, msg ? msg : "", (ICON_MOUSE_LMB + i));
+ if (msg || (msg_drag == NULL)) {
+ uiItemL(row, msg ? msg : "", (ICON_MOUSE_LMB + i));
+ }
if (msg_drag) {
uiItemL(row, msg_drag, (ICON_MOUSE_LMB_DRAG + i));