Maxwell Object functions

openImage( string path )

Loads an image to the Maxwell Render GUI.

Parameters

path: Path of the image. Read the relevant section of the manual for a full description of supported image formats.

Returned Value

Nothing

Example

This code will load an image into Maxwell Render from C:\users\demo\myimages and assign it to the variable "myimage".

var myimage = openImage("C:\users\demo\myimages"); 

openMxi( string path )

Loads an MXI file to the Maxwell Render GUI and displays its parameters in the UI.

Parameters

path: Path of the MXI file.

Returned value

Nothing

Example 1

This code will load an image into Maxwell Render from xxxpath.

some code here

Example 2

The path is stored in a variable which is then specified as the path parameter.

a more complex example

 
 
• Function: void openMxs( string path );
• Description: Loads an MXS file to the Maxwell Render GUI and displays its parameters in the UI.
• Parameters: path: Path of the MXS file.
• Returned Value: Nothing.

• Function: void saveImage( string path );
• Description: Saves the current image buffer displayed in the GUI in the given image file.
• Parameters: path: Path of the image file.
• Returned Value: Nothing.

• Function: int launchProcessAndWait (string execPath, array arguments);
• Description: Launches an external process with the given path and arguments and waits until it finishes.
• Parameters:
     -string execPath: Absolute path of the executable.
     -array arguments: list of command line arguments.
• Returned INT: 0 if the process finished successfully and 1 if the process crashed.

• Function: int launchProcess (string execPath, array arguments);
• Description: Launches a detached process and returns the control immediately, without waiting for the process to finish.
• Parameters: -string execPath: Absolute path of the executable. -array arguments: list of command line arguments.
• Returned INT: 0 if the process was started successfully and 1 if not.

• Function: bool saveLog (string path);
• Description: Saves the console log to the given path.
• Parameters: string path: path of the saved log .
• Returned Value: Bool: TRUE if the log is properly saved. FALSE if not.

• Function: void clearConsole ();
• Description: Clears the console
• Parameters: Nothing.
• Returned Value: Nothing.

• Function: void printError (string message);
• Description: Prints an error message in the console.
• Parameters: string message: message to print.
• Returned Value: Nothing.

• Function: string getOS ();
• Description: Returns the operating system currently used.
• Parameters: Nothing.
• Returned Value: String: OS.

• Function: void saveMxi( string path );
• Description: Saves the current image buffer displayed in the GUI in the given MXI path.
• Parameters: path: Path of the MXI file.
• Returned Value: Nothing.

• Function: void saveChannel( int channelIndex, string path, int depth);
• Description: Saves the channel with the given index to disk.
• Parameters: int channelIndex: Index of the channel / path: Path were the channel will be saved. int depth: bits depth of the saved channel (depths supported are 8, 16 and 32)
Channels indexes are:

  • CHANNEL_RENDER = 0,
  • CHANNEL_ALPHA = 1,
  • CHANNEL_SHADOW = 2,
  • CHANNEL_ID_MATERIAL = 3,
  • CHANNEL_ID_OBJECT = 4,
  • CHANNEL_ZBUFFER = 5,
  • CHANNEL_MOTION = 6 ,
  • CHANNEL_ROUGHNESS = 7,
  • CHANNEL_FRESNEL = 8,

• Returned Value: Nothing.

• Function: void mergeMxis( stringlist paths, string output );
• Description: Merges the given list of MXI files and writes the merged MXI in the given output.
• Parameters: stringlist paths: Path of the MXI file. / string output: Path of the merged MXI file.
• Returned Value: Nothing.

• Function: void startRender( void );
• Description: Renders the scene that is currently loaded. The function does not wait until the render finishes.
• Parameters: No parameters.
• Returned Value: Nothing.

• Function: bool isRendering( void );
• Description: Returns True if the application is rendering and False if it is not rendering.
• Parameters: No parameters.
• Returned Value: Bool (True if the application is rendering and False if it is not rendering).

• Function: void print( string text );
• Description: Prints the given text in the console.
• Parameters: string text: Text to print
• Returned Value: Nothing.

• Function: bool createAbsoluteFolder (string folderPath);
• Description: Creates a folder using the given absolute path.
• Parameters: string folderPath: absolute path of the folder to create.
• Returned Value: Bool: TRUE if the folder is properly created. FALSE if not.

• Function: bool createRelativeFolder (string parentFolder, string folderName);
• Description: Creates a folder with the name folderName in the given parent folder.
• Parameters:
     string parentFolder: Absolute path of the parent folder where the folder is going to be created.
     string folderName: Name of the folder 

• Returned Value: Bool: TRUE if the folder is properly. created. FALSE if not.

• Function: string getEngineVersion( void );
• Description: Returns a string with the version of the engine used.
• Parameters: No parameters.
• Returned Value: String (engine version).

• Function: string getMaxwellFolder( void );
• Description: Returns a string with the path of the folder where Maxwell Render is installed.
• Parameters: No parameters.
• Returned Value: String (path of the Maxwell Render folder).

• Function: string getEnv( string var );
• Description: Returns a string with the value of the given system environment variable.
• Parameters: String var: Environment variable.
• Returned Value: String (value of the environment variable).

• Function: void flush( void );
• Description: Flushes all the pending events in the application. This function can be useful to refresh the GUI elements that are waiting for a pending event (i.e. text printed in console, etc.). Calling this function too often could make the application run significantly slower.
• Parameters: Nothing.
• Returned Value: Nothing.

• Function: string system( string var );
• Description: Calls the OS system() function.
• Parameters: String var: String given to system().
• Returned Value: Nothing.

 

 

Â