Public Member Functions | |
| void | print (string str) |
| NodeGraph * | rootGraph (void) |
| NodeGraph * | current (void) |
| void | setCurrent (NodeGraph *graph) |
| NodeGraphList * | selected (void) |
| float | randomFloat (float min, float max) |
| int | randomInt (int min, int max) |
| void | registerFunctionDesc (string decl, string description) |
| void | registerMacro (string macro, string function) |
| int | year (void) |
| void | setYear (int year) |
The ScriptContext class provides a global context for scripts, it can be access via the global g_ctx variable and provides utility functions like print().
| NodeGraph* ScriptContext::current | ( | void | ) |
Returns the current NodeGraph. The current() / setCurrent() functions are mostly used by Shell function to store the hierarchy level the user is working on.
| void ScriptContext::print | ( | string | str) |
Prints the given string to the console. Can be used for debug output or for showing progress to the user.
| str | The string to print. |
| float ScriptContext::randomFloat | ( | float | min, |
| float | max | ||
| ) |
Returns a random float between min and max.
| min | The minimum value for the random float. |
| max | The maximum value for the random float. |
| int ScriptContext::randomInt | ( | int | min, |
| int | max | ||
| ) |
Returns a random int between min and max.
| min | The minimum value for the random int. |
| max | The maximum value for the random int. |
| void ScriptContext::registerFunctionDesc | ( | string | decl, |
| string | description | ||
| ) |
Registers a function and it's description. Used in registerFunctions() in Include files who want to make their functions and macros available to the Shell.
| decl | The declaration of the function, like "void meshStatistics( int )". |
| description | The description of the function, like "Prints statistics for the mesh of the given NodeGraph.". |
| void ScriptContext::registerMacro | ( | string | macro, |
| string | function | ||
| ) |
Registers a macro for a function in an Include file for use in the Shell.
| macro | The macro, for example "mstats int". Currently only int, float and string macros at the end of the macro cmd are supported. |
| function | The function name the macro expands in, like "meshStatistics(int);". |
| NodeGraph* ScriptContext::rootGraph | ( | void | ) |
Returns the root graph of the current project.
| NodeGraphList* ScriptContext::selected | ( | void | ) |
Returns a list of currently selected Objects / NodeGraphs in the current RaySupreme project.
| void ScriptContext::setCurrent | ( | NodeGraph * | graph) |
| void ScriptContext::setYear | ( | int | year) |
Sets the year of the current context.
| The | year to be set as the current year. |
| int ScriptContext::year | ( | void | ) |
Returns the year of the current context. Default is the current year.
1.8.4