MakeHuman  0.95beta
 All Data Structures Files Functions Variables Typedefs Macros Pages
Macros | Functions | Variables
main.c File Reference

The main C application file. More...

Go to the source code of this file.

Macros

#define MAX_PATH   1024

Functions

static void initGlobals (void)
 Initialize Globals.
static PyObject * mh_updatePickingBuffer (PyObject *self, PyObject *unused)
static PyObject * mh_getColorPicked (PyObject *self, PyObject *unused)
 Get the RGB value of the color that has been picked.
static PyObject * mh_getMousePos (PyObject *self, PyObject *unused)
 Get the current mouse x, y cursor position on the screen, in pixels. This function retrieves the x and y mouse position in screen coordinates returning two integer values to the Python code.
static PyObject * mh_getKeyModifiers (PyObject *self, PyObject *unused)
 Get an integer representing the current modifier key settings.
static PyObject * mh_getWindowSize (PyObject *self, PyObject *unused)
 Get the current window (viewport) width and height in pixels. This function retrieves the current width and height of the drawable area within the MakeHuman window in pixels (the viewport size).
static PyObject * mh_startWindow (PyObject *self, PyObject *args)
 Start the GUI window at application launch.
static PyObject * mh_startEventLoop (PyObject *self, PyObject *unused)
 Start the event loop at application launch.
static PyObject * mh_shutDown (PyObject *self, PyObject *unused)
 End the GUI application.
static PyObject * mh_redraw (PyObject *self, PyObject *args)
 Redraws the scene in the GUI window.
static PyObject * mh_setFullscreen (PyObject *self, PyObject *args)
 Sets the fullscreen state of the GUI window.
static PyObject * mh_setClearColor (PyObject *self, PyObject *args)
static PyObject * mh_LoadTexture (PyObject *self, PyObject *args)
 Load texture of an object from file.
static PyObject * mh_CreateVertexShader (PyObject *self, PyObject *args)
static PyObject * mh_CreateFragmentShader (PyObject *self, PyObject *args)
static PyObject * mh_CreateShader (PyObject *self, PyObject *args)
static PyObject * mh_GrabScreen (PyObject *self, PyObject *args)
static PyObject * mh_addTimer (PyObject *self, PyObject *args)
 Adds a timer which will call a callback after the specified number of milliseconds has elapsed.
static PyObject * mh_removeTimer (PyObject *self, PyObject *args)
static PyObject * mh_callAsync (PyObject *self, PyObject *callback)
static PyObject * mh_SetResizeCallback (PyObject *self, PyObject *callback)
static PyObject * mh_SetMouseDownCallback (PyObject *self, PyObject *callback)
static PyObject * mh_SetMouseUpCallback (PyObject *self, PyObject *callback)
static PyObject * mh_SetMouseMovedCallback (PyObject *self, PyObject *callback)
static PyObject * mh_SetKeyDownCallback (PyObject *self, PyObject *callback)
static PyObject * mh_SetKeyUpCallback (PyObject *self, PyObject *callback)
static PyObject * mh_getPath (PyObject *self, PyObject *type)
 Gets program specific path locations. MakeHuman uses pathes to export objects and to (re)store exports and screen grabs. Since the various locations depend from the system (Linux, Windows, Mac OS) the program is running on theses pathes may be queried by this function.
int main (int argc, char *argv[])
 The main function initializes the MakeHuman application.

Variables

Global G
static PyMethodDef EmbMethods []
 Defines a set of functions as an array that can be passed into the Py_InitModule function.

Detailed Description

The main C application file.

Project Name: MakeHuman
Product Home Page: http://www.makehuman.org/
SourceForge Home Page: http://sourceforge.net/projects/makehuman/
Authors: Manuel Bastioni, Paolo Colombo, Simone Re, Hans-Peter Dusel
Copyright(c): MakeHuman Team 2001-2011
Licensing: GPL3 (see also http://makehuman.wiki.sourceforge.net/Licensing)
Coding Standards: See http://makehuman.wiki.sourceforge.net/DG_Coding_Standards

This is the main C application file used to run the MakeHuman application. A large part of this file is dedicated to providing an integration layer between the C core application and the Python GUI control scripts.

Much of the core C application is used to implement OpenGL library functions that are used to control the 3D graphics environment. See http://makehuman.wiki.sourceforge.net/DG_Application_Overview for a description of how the integration between C and Python works.

Definition in file main.c.


Macro Definition Documentation

#define MAX_PATH   1024

Function Documentation

static void initGlobals ( void  )
static

Initialize Globals.

This function initializes a small number of global settings that define the initial view of the Humanoid figure that the MakeHuman application manipulates (e.g. Field of View, Window Dimensions, Rotation Settings etc.).

Definition at line 73 of file main.c.

int main ( int  argc,
char *  argv[] 
)

The main function initializes the MakeHuman application.

This function sets up the integration layer between Python and the C core application then runs the 'main' Python module to start up the MakeHuman application.

When the user quits the application, the SDL loop controlling user interaction with the MakeHuman GUI is terminated by the mhShutDown function from glmodule.c which issues a system exit. This function traps the exit condition and displays a goodbye message into the message window before releasing the memory used by the global variables and ending.

This function returns a '1'.

Definition at line 753 of file main.c.

static PyObject* mh_addTimer ( PyObject *  self,
PyObject *  args 
)
static

Adds a timer which will call a callback after the specified number of milliseconds has elapsed.

This function adds a timer which will call a callback after the specified number of milliseconds has elapsed. It returns a timer id.

Definition at line 328 of file main.c.

static PyObject* mh_callAsync ( PyObject *  self,
PyObject *  callback 
)
static

Definition at line 363 of file main.c.

static PyObject* mh_CreateFragmentShader ( PyObject *  self,
PyObject *  args 
)
static

Definition at line 266 of file main.c.

static PyObject* mh_CreateShader ( PyObject *  self,
PyObject *  args 
)
static

Definition at line 278 of file main.c.

static PyObject* mh_CreateVertexShader ( PyObject *  self,
PyObject *  args 
)
static

Definition at line 254 of file main.c.

static PyObject* mh_getColorPicked ( PyObject *  self,
PyObject *  unused 
)
static

Get the RGB value of the color that has been picked.

This function returns the color that has been picked as a Python list of 3 integers, each between 0 and 255, representing an RGB value.

Definition at line 112 of file main.c.

static PyObject* mh_getKeyModifiers ( PyObject *  self,
PyObject *  unused 
)
static

Get an integer representing the current modifier key settings.

This function returns the current modifier key settings as a Python integer value (e.g. Whether the Shift or Ctrl keys are currently depressed).

Definition at line 133 of file main.c.

static PyObject* mh_getMousePos ( PyObject *  self,
PyObject *  unused 
)
static

Get the current mouse x, y cursor position on the screen, in pixels. This function retrieves the x and y mouse position in screen coordinates returning two integer values to the Python code.

Definition at line 121 of file main.c.

static PyObject* mh_getPath ( PyObject *  self,
PyObject *  type 
)
static

Gets program specific path locations. MakeHuman uses pathes to export objects and to (re)store exports and screen grabs. Since the various locations depend from the system (Linux, Windows, Mac OS) the program is running on theses pathes may be queried by this function.

Parameters:
typeDetermines which path actually has to be queried. Type has to be either 'exports', 'models' or 'grab'. NULL will be returnded if it does not fit these requirements.

The symantics is as follow:

type synopsis Windows Linux Mac OS X
"exports" Declares the path to where exported to. "./exports/" "./exports/" From preferences
(defaults to "${USER}/Documents/MakeHuman/exports/")
"models" Declares the path where the models are stored to. "./models/" "./models/" From preferences
(defaults to "${USER}/Documents/MakeHuman/models/")
"grab" Declares the target for screenshots. "./" "./" From preferences
(defaults to "${USER}/Desktop/")
Returns:
The Path according the property 'type'.

Definition at line 539 of file main.c.

static PyObject* mh_getWindowSize ( PyObject *  self,
PyObject *  unused 
)
static

Get the current window (viewport) width and height in pixels. This function retrieves the current width and height of the drawable area within the MakeHuman window in pixels (the viewport size).

Definition at line 142 of file main.c.

static PyObject* mh_GrabScreen ( PyObject *  self,
PyObject *  args 
)
static

Definition at line 290 of file main.c.

static PyObject* mh_LoadTexture ( PyObject *  self,
PyObject *  args 
)
static

Load texture of an object from file.

This function passes a string containing the file system path to a texture file into OpenGL. The texture from this file is applied to the specified object. It returns a null value.

Definition at line 242 of file main.c.

static PyObject* mh_redraw ( PyObject *  self,
PyObject *  args 
)
static

Redraws the scene in the GUI window.

This function passes through the instruction to the SDL module to redraw the main application GUI window. Drawing asynchronous will queue an update, drawing synchronous will render immediately. It returns a null value.

Definition at line 199 of file main.c.

static PyObject* mh_removeTimer ( PyObject *  self,
PyObject *  args 
)
static

Definition at line 350 of file main.c.

static PyObject* mh_setClearColor ( PyObject *  self,
PyObject *  args 
)
static

Definition at line 226 of file main.c.

static PyObject* mh_setFullscreen ( PyObject *  self,
PyObject *  args 
)
static

Sets the fullscreen state of the GUI window.

This function passes through the instruction to the SDL module to set the fullscreen state of the main application GUI window. It returns a null value.

Definition at line 217 of file main.c.

static PyObject* mh_SetKeyDownCallback ( PyObject *  self,
PyObject *  callback 
)
static

Definition at line 459 of file main.c.

static PyObject* mh_SetKeyUpCallback ( PyObject *  self,
PyObject *  callback 
)
static

Definition at line 477 of file main.c.

static PyObject* mh_SetMouseDownCallback ( PyObject *  self,
PyObject *  callback 
)
static

Definition at line 405 of file main.c.

static PyObject* mh_SetMouseMovedCallback ( PyObject *  self,
PyObject *  callback 
)
static

Definition at line 441 of file main.c.

static PyObject* mh_SetMouseUpCallback ( PyObject *  self,
PyObject *  callback 
)
static

Definition at line 423 of file main.c.

static PyObject* mh_SetResizeCallback ( PyObject *  self,
PyObject *  callback 
)
static

Definition at line 387 of file main.c.

static PyObject* mh_shutDown ( PyObject *  self,
PyObject *  unused 
)
static

End the GUI application.

This function constitutes part of the application termination processing. It passes through the instruction to exit from the main event loop which controls the GUI environment. It returns a null value.

Definition at line 186 of file main.c.

static PyObject* mh_startEventLoop ( PyObject *  self,
PyObject *  unused 
)
static

Start the event loop at application launch.

This function constitutes part of the application initiation processing. It passes through the instruction to launch the main event loop which will control the GUI environment until the termination of the application. It returns a null value.

Definition at line 173 of file main.c.

static PyObject* mh_startWindow ( PyObject *  self,
PyObject *  args 
)
static

Start the GUI window at application launch.

This function constitutes part of the application initiation processing. It passes through the instruction to create the SDL window. It returns a null value.

Definition at line 153 of file main.c.

static PyObject* mh_updatePickingBuffer ( PyObject *  self,
PyObject *  unused 
)
static

Definition at line 101 of file main.c.


Variable Documentation

PyMethodDef EmbMethods[]
static
Initial value:
{
{"addTimer", mh_addTimer, METH_VARARGS, ""},
{"removeTimer", mh_removeTimer, METH_VARARGS, ""},
{"getWindowSize", mh_getWindowSize, METH_NOARGS, ""},
{"getMousePos", mh_getMousePos, METH_NOARGS, ""},
{"getKeyModifiers", mh_getKeyModifiers, METH_NOARGS, ""},
{"updatePickingBuffer", mh_updatePickingBuffer, METH_NOARGS, ""},
{"getColorPicked", mh_getColorPicked, METH_NOARGS, ""},
{"redraw", mh_redraw, METH_VARARGS, ""},
{"setFullscreen", mh_setFullscreen, METH_VARARGS, ""},
{"setClearColor", mh_setClearColor, METH_VARARGS, ""},
{"loadTexture", mh_LoadTexture, METH_VARARGS, ""},
{"createVertexShader", mh_CreateVertexShader, METH_VARARGS, ""},
{"createFragmentShader", mh_CreateFragmentShader, METH_VARARGS, ""},
{"createShader", mh_CreateShader, METH_VARARGS, ""},
{"grabScreen", mh_GrabScreen, METH_VARARGS, ""},
{"startWindow", mh_startWindow, METH_VARARGS, ""},
{"startEventLoop", mh_startEventLoop, METH_NOARGS, ""},
{"shutDown", mh_shutDown, METH_NOARGS, ""},
{"getPath", mh_getPath, METH_O, ""},
{"callAsync", mh_callAsync, METH_O, ""},
{"setResizeCallback", mh_SetResizeCallback, METH_O, ""},
{"setMouseDownCallback", mh_SetMouseDownCallback, METH_O, ""},
{"setMouseUpCallback", mh_SetMouseUpCallback, METH_O, ""},
{"setMouseMovedCallback", mh_SetMouseMovedCallback, METH_O, ""},
{"setKeyDownCallback", mh_SetKeyDownCallback, METH_O, ""},
{"setKeyUpCallback", mh_SetKeyUpCallback, METH_O, ""},
{NULL, NULL, 0, NULL}
}

Defines a set of functions as an array that can be passed into the Py_InitModule function.

This array declaration is used to list a set of functions that can be called from Python. The array is passed into the Py_InitModule function when it is used to dynamically initialize the 'mh' moduleas.

Definition at line 689 of file main.c.

Global G

Definition at line 64 of file main.c.