From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Blender Execution - 2.5A2 30518M



Execution


The main entrypoint is in (blender\source\creator\creator.c)

The main program loop is in (blender\source\blender\windowmanager\intern\wm.c)

// 0999 blender\source\creator\creator.c
// --------------------------------------------------------------------------------
int main(int argc, char **argv)		/* Entrypoint */
{
	SYS_SystemHandle syshandle;
	bContext *C= CTX_create();
	bArgs *ba;
// --------------------------------------------------------------------------------
 
 
// 1147 blender\source\creator\creator.c
// --------------------------------------------------------------------------------
	WM_main(C);			/* Main program loop */
// --------------------------------------------------------------------------------
 
 
// 0058 blender\source\blender\windowmanager\WM_api.h
// --------------------------------------------------------------------------------
void WM_main (struct bContext *C);		/* WM_main declarartion */
// --------------------------------------------------------------------------------
 
 
// 0328 blender\source\blender\windowmanager\intern\wm.c
// --------------------------------------------------------------------------------
void WM_main(bContext *C)			/* WM_main definition */
{
	while(1)
	{
 
	/* get events from ghost, handle window events, add to window queues */
		wm_window_process_events(C); 
 
	/* per window, all events to the window, screen, area and region handlers */
		wm_event_do_handlers(C);
 
	/* events have left notes about changes, we handle and cache it */
		wm_event_do_notifiers(C);
 
	/* execute cached changes draw */
		wm_draw_update(C);
	}
}
// --------------------------------------------------------------------------------



Context


..

// 0054 blender\source\blender\blenkernel\intern\context.c
// --------------------------------------------------------------------------------
struct bContext
{
	int thread;
 
	/* windowmanager context */
	struct
	{
		struct wmWindowManager *manager;
		struct wmWindow *window;
		struct bScreen *screen;
		struct ScrArea *area;
		struct ARegion *region;
		struct ARegion *menu;
		struct bContextStore *store;
	} wm;
 
	/* data context */
	struct
	{
		struct Main *main;
		struct Scene *scene;
		int recursion;
		int py_init; /* true if python is initialized */
		void *py_context;
	} data;
 
	/* data evaluation */
	struct
	{
		int render;
	} eval;
};
// --------------------------------------------------------------------------------