예제 #1
0
/* the python exec operator uses this */
static int console_scrollback_append_exec(bContext *C, wmOperator *op)
{
	SpaceConsole *sc = CTX_wm_space_console(C);
	ARegion *ar = CTX_wm_region(C);
	ConsoleLine *ci;
	
	char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, don't free */
	int type = RNA_enum_get(op->ptr, "type");

	console_history_verify(C);
	
	ci = console_scrollback_add_str(sc, str, 1); /* own the string */
	ci->type = type;
	
	console_scrollback_limit(sc);

	/* 'ar' can be null depending on the operator that runs
	 * rendering with invoke default for eg causes this */
	if (ar) {
		console_textview_update_rect(sc, ar);
	}

	ED_area_tag_redraw(CTX_wm_area(C));
	
	return OPERATOR_FINISHED;
}
예제 #2
0
/* the python exec operator uses this */
static int scrollback_append_exec(bContext *C, wmOperator *op)
{
	SpaceConsole *sc= CTX_wm_space_console(C);
	ARegion *ar= CTX_wm_region(C);
	ConsoleLine *ci;
	
	char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */
	int type= RNA_enum_get(op->ptr, "type");

	console_history_verify(C);
	
	ci= console_scrollback_add_str(sc, str, 1); /* own the string */
	ci->type= type;
	
	console_scrollback_limit(sc);

	console_textview_update_rect(sc, ar);
	ED_area_tag_redraw(CTX_wm_area(C));
	
	return OPERATOR_FINISHED;
}