Fix ID buttons not working in popover menus.
This commit is contained in:
		@@ -394,32 +394,15 @@ void UI_context_active_but_prop_get_templateID(
 | 
				
			|||||||
	PointerRNA *r_ptr, PropertyRNA **r_prop)
 | 
						PointerRNA *r_ptr, PropertyRNA **r_prop)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	TemplateID *template_ui;
 | 
						TemplateID *template_ui;
 | 
				
			||||||
	ARegion *ar = CTX_wm_region(C);
 | 
						uiBut *but = UI_context_active_but_get(C);
 | 
				
			||||||
	uiBlock *block;
 | 
					 | 
				
			||||||
	uiBut *but;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	memset(r_ptr, 0, sizeof(*r_ptr));
 | 
						if (but && but->func_argN) {
 | 
				
			||||||
	*r_prop = NULL;
 | 
							template_ui = but->func_argN;
 | 
				
			||||||
 | 
							*r_ptr = template_ui->ptr;
 | 
				
			||||||
	if (!ar)
 | 
							*r_prop = template_ui->prop;
 | 
				
			||||||
		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;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
 | 
					static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	TemplateID *template_ui = (TemplateID *)arg_litem;
 | 
						TemplateID *template_ui = (TemplateID *)arg_litem;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user