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
path: root/source
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2022-10-03 19:13:57 +0300
committerJulian Eisel <julian@blender.org>2022-10-03 19:20:59 +0300
commit13b3c408e39a232e0c676cf2e8ab9125f2554bf1 (patch)
tree8f439cf0b3f381e2d64e794eb95a6bf68d67b85a /source
parentd20be55c1a9fc9f503a507fe47ace6ef5d70573e (diff)
Fix T101510: Incorrect context for running data unlink from template ID
There was already a fix for this, but it got broken again with c973d333da31.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/interface/interface_templates.c8
2 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index c3376493413..2a1941f0d9e 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1393,6 +1393,7 @@ void UI_but_extra_icon_string_info_get(struct bContext *C, uiButExtraOpIcon *ext
* - AutoButR: RNA property button with type automatically defined.
*/
enum {
+ UI_ID_NOP = 0,
UI_ID_RENAME = 1 << 0,
UI_ID_BROWSE = 1 << 1,
UI_ID_ADD_NEW = 1 << 2,
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 0b72c358dc9..86971dd7778 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -910,6 +910,11 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
const char *undo_push_label = NULL;
switch (event) {
+ case UI_ID_NOP:
+ /* Don't do anything, typically set for buttons that execute an operator instead. They may
+ * still assign the callback so the button can be identified as part of an ID-template. See
+ * #UI_context_active_but_prop_get_templateID(). */
+ break;
case UI_ID_BROWSE:
case UI_ID_PIN:
RNA_warning("warning, id event %d shouldn't come here", event);
@@ -1543,7 +1548,8 @@ static void template_ID(const bContext *C,
UI_UNIT_Y,
NULL);
/* so we can access the template from operators, font unlinking needs this */
- UI_but_funcN_set(but, NULL, MEM_dupallocN(template_ui), NULL);
+ UI_but_funcN_set(
+ but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_NOP));
}
else {
if ((RNA_property_flag(template_ui->prop) & PROP_NEVER_UNLINK) == 0) {