Note: The following code samples demonstrate how to call OgreMax commands using the JScript language.
To get the version of the installed OgreMax plugin:
var version = OgreMaxGetVersion()The scene and object settings that are normally accessible through the Scene Settings and Object Settings dialogs can also be accessed through script.
To get the scene settings:
var sceneSettings = OgreMaxGetSceneSettings()var objectSettings = OgreMaxGetObjectSettingsByName("")var objectSettings = OgreMaxGetObjectSettingsByName("Box01")var objectSettings = OgreMaxGetObjectSettingsByObject(theObject)To add a mesh animation:
var animSettings = OgreMaxAddMeshAnimationForObjectName("Box01", "Idle")var animSettings = OgreMaxAddMeshAnimationForObject(theObject or objectSettings, "Idle")To add a node animation:
var animSettings = OgreMaxAddNodeAnimationForObjectName("Box01", "Box01Move")var animSettings = OgreMaxAddNodeAnimationForObject(theObject or objectSettings, "Box01Move")After retrieving any of the settings objects, you can inspect their parameters:
InspectObj(sceneSettings)InspectObj(objectSettings)InspectObj(animSettings)In the following lines of code fileName is assumed to contain the path to the file where the scene will be exported. It must have the '.scene', '.model', or '.mesh' extension.
OgreMaxExportScene(fileName)OgreMaxExportSelectedObjects(fileName)To get all the shader program names for a particular shader type, shaderType must contain "VertexShader", "PixelShader", "ShadowCasterVertexShader", "ShadowReceiverVertexShader", or "ShadowReceiverPixelShader":
OgreMaxGetShaderNames(shaderType)When you open the Object Settings dialog for a mesh, the submesh settings are automatically synchronized to the mesh and its materials so that the Customize Submeshes settings may be set. The synchronization can also be performed by script:
OgreMaxSyncSubmeshSettingsByName("")OgreMaxSyncSubmeshSettingsByName("Box01", "Box02", "Box03")OgreMaxSyncSubmeshSettingsByObject(theObject1, theObject2, theObject3)