/* TODO de-duplicate redo panel functions - campbell */
static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
{
	wmOperator *op = WM_operator_last_redo(C);
	ARegion *ar;
	ARegion *ar1;

	if (op == NULL) {
		return;
	}

	/* keep in sync with logic in ED_undo_operator_repeat() */
	ar = CTX_wm_region(C);
	ar1 = BKE_area_find_region_active_win(CTX_wm_area(C));
	if (ar1)
		CTX_wm_region_set((bContext *)C, ar1);

	if (WM_operator_poll((bContext *)C, op->type)) {
		uiBlock *block = uiLayoutGetBlock(pa->layout);

		if (!WM_operator_check_ui_enabled(C, op->type->name))
			uiLayoutSetEnabled(pa->layout, false);

		/* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
		UI_block_func_handle_set(block, ED_undo_operator_repeat_cb_evt, op);

		view3d_panel_operator_redo_operator(C, pa, op);
	}

	/* set region back */
	CTX_wm_region_set((bContext *)C, ar);
}
static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op)
{
	if (op->type->flag & OPTYPE_MACRO) {
		for (op = op->macro.first; op; op = op->next) {
			uiItemL(pa->layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
			view3d_panel_operator_redo_operator(C, pa, op);
		}
	}
	else {
		view3d_panel_operator_redo_buts(C, pa, op);
	}
}
Beispiel #3
0
static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
{
	wmOperator *op= view3d_last_operator(C);
	uiBlock *block;
	
	if(op==NULL)
		return;
	if(WM_operator_poll((bContext*)C, op->type) == 0)
		return;
	
	block= uiLayoutGetBlock(pa->layout);
	
	if(ED_undo_valid(C, op->type->name)==0)
		uiLayoutSetEnabled(pa->layout, 0);

	/* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
	uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
	
	view3d_panel_operator_redo_operator(C, pa, op);
}