/* 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);
}
示例#2
0
/* 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);
	uiBlock *block;
	
	if (op == NULL)
		return;
	if (WM_operator_poll((bContext *)C, op->type) == 0)
		return;
	
	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 */
	uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
	
	view3d_panel_operator_redo_operator(C, pa, op);
}
示例#3
0
文件: undo.c 项目: wisaac407/blender
static int ed_undo_redo_poll(bContext *C)
{
	wmOperator *last_op = WM_operator_last_redo(C);
	return last_op && ED_operator_screenactive(C) && 
		WM_operator_check_ui_enabled(C, last_op->type->name);
}