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:
authorCampbell Barton <ideasman42@gmail.com>2009-07-16 04:50:27 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-07-16 04:50:27 +0400
commit2f74b5a2605d3bb83f6c7500f9d3899296bfbb59 (patch)
treec1b951cd060da50afce59791dbbd123347d18a46 /source/blender/blenkernel
parentce431c5c6e17877846812bab2d6bf9f8dc40fd48 (diff)
Console Space Type
* interactive console python console. * display reports and filter types. defaults to operator display so you can see the python commands for tools as you use them, eventually it should be possible to select commands and make macto/tools from them. Example use of autocomp. b<tab>, bpy.<tab>, bpy.<tab>, bpy.data.<tab> etc. basic instructions are printed when opening the console. Details... * Console exec and autocomp are done with operators written in python. * added CTX_wm_reports() to get the global report list. * The window manager had a report ListBase but reports have their own struct, switched to allocate and assign when initializing the WM since the type is not available in DNA. * changed report types flags for easier display filtering. * added report type RPT_OPERATOR * logging operators also adds a python-syntax report into CTX_wm_reports() so they can be displayed in the console as well as calling a notifier for console to redraw. * RnaAPI context.area.tag_redraw() to redraw the current area from a python operator. Todo... * better interactions with the console, scrolling, copy/paste. * the text displayed doesnt load back. * colors need to be themed. * scroll limit needs to be a user pref. * only tested with cmake and scons.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_context.h2
-rw-r--r--source/blender/blenkernel/BKE_report.h21
-rw-r--r--source/blender/blenkernel/intern/context.c12
-rw-r--r--source/blender/blenkernel/intern/report.c1
4 files changed, 29 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 92c79ff757f..5baf5af81d1 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -111,11 +111,13 @@ struct SpaceLink *CTX_wm_space_data(const bContext *C);
struct ARegion *CTX_wm_region(const bContext *C);
void *CTX_wm_region_data(const bContext *C);
struct ARegion *CTX_wm_menu(const bContext *C);
+struct ReportList *CTX_wm_reports(const bContext *C);
struct View3D *CTX_wm_view3d(const bContext *C);
struct RegionView3D *CTX_wm_region_view3d(const bContext *C);
struct SpaceText *CTX_wm_space_text(const bContext *C);
struct SpaceImage *CTX_wm_space_image(const bContext *C);
+struct SpaceConsole *CTX_wm_space_console(const bContext *C);
void CTX_wm_manager_set(bContext *C, struct wmWindowManager *wm);
void CTX_wm_window_set(bContext *C, struct wmWindow *win);
diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h
index 1bb7152fbf3..26853866ebb 100644
--- a/source/blender/blenkernel/BKE_report.h
+++ b/source/blender/blenkernel/BKE_report.h
@@ -40,15 +40,22 @@ extern "C" {
* is needed. */
typedef enum ReportType {
- RPT_DEBUG = 0,
- RPT_INFO = 1000,
- RPT_WARNING = 2000,
- RPT_ERROR = 3000,
- RPT_ERROR_INVALID_INPUT = 3001,
- RPT_ERROR_INVALID_CONTEXT = 3002,
- RPT_ERROR_OUT_OF_MEMORY = 3003
+ RPT_DEBUG = 1<<0,
+ RPT_INFO = 1<<1,
+ RPT_OPERATOR = 1<<2,
+ RPT_WARNING = 1<<3,
+ RPT_ERROR = 1<<4,
+ RPT_ERROR_INVALID_INPUT = 1<<5,
+ RPT_ERROR_INVALID_CONTEXT = 1<<6,
+ RPT_ERROR_OUT_OF_MEMORY = 1<<7
} ReportType;
+#define RPT_DEBUG_ALL (RPT_DEBUG)
+#define RPT_INFO_ALL (RPT_INFO)
+#define RPT_OPERATOR_ALL (RPT_OPERATOR)
+#define RPT_WARNING_ALL (RPT_WARNING)
+#define RPT_ERROR_ALL (RPT_ERROR|RPT_ERROR_INVALID_INPUT|RPT_ERROR_INVALID_CONTEXT|RPT_ERROR_OUT_OF_MEMORY)
+
enum ReportListFlags {
RPT_PRINT = 1,
RPT_STORE = 2,
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 1b499384886..bbf3ceb01e8 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -204,6 +204,11 @@ struct ARegion *CTX_wm_menu(const bContext *C)
return C->wm.menu;
}
+struct ReportList *CTX_wm_reports(const bContext *C)
+{
+ return C->wm.manager->reports;
+}
+
View3D *CTX_wm_view3d(const bContext *C)
{
if(C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D)
@@ -226,6 +231,13 @@ struct SpaceText *CTX_wm_space_text(const bContext *C)
return NULL;
}
+struct SpaceConsole *CTX_wm_space_console(const bContext *C)
+{
+ if(C->wm.area && C->wm.area->spacetype==SPACE_CONSOLE)
+ return C->wm.area->spacedata.first;
+ return NULL;
+}
+
struct SpaceImage *CTX_wm_space_image(const bContext *C)
{
if(C->wm.area && C->wm.area->spacetype==SPACE_IMAGE)
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index 8de8cf8d0f4..6564329ef82 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -49,6 +49,7 @@ static char *report_type_str(int type)
switch(type) {
case RPT_DEBUG: return "Debug";
case RPT_INFO: return "Info";
+ case RPT_OPERATOR: return "Operator";
case RPT_WARNING: return "Warning";
case RPT_ERROR: return "Error";
case RPT_ERROR_INVALID_INPUT: return "Invalid Input Error";