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')
-rw-r--r--source/blender/editors/interface/interface_templates.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 271eef051c6..a14d12492ec 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -394,32 +394,15 @@ void UI_context_active_but_prop_get_templateID(
PointerRNA *r_ptr, PropertyRNA **r_prop)
{
TemplateID *template_ui;
- ARegion *ar = CTX_wm_region(C);
- uiBlock *block;
- uiBut *but;
-
- memset(r_ptr, 0, sizeof(*r_ptr));
- *r_prop = NULL;
-
- if (!ar)
- return;
+ uiBut *but = UI_context_active_but_get(C);
- 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;