Application Commands
Visionary Render accepts some high level commands, which can be sent from Lua vrPostCommand.
Example
Here is a simple example of automating a CAD import / VRNative save operation
-- define a function to perform a task when a file import is finished
function importComplete(filename, node)
vrPostCommand("visren_save_document_as", "E:\\VR\\output.VRNative")
__unregisterCallback("onDocumentImported", importComplete)
end
-- register the function to be called when the onDocumentImported event is fired
__registerCallback("onDocumentImported", importComplete)
-- instruct visionary render to import the specified file (the importer for the file must be installed).
-- note the double backslashes, \ is an escape character in a Lua string, so you need to use two to represent a real \
vrPostCommand("visren_import_data", "file|E:\\Scenes\\tools\\tools.pvs")
The parameters accepted by commands are text strings.
Command Listing
This is a listing of app commands and their parameters.
| Command | Description | Parameter |
|---|---|---|
visren_new_document | Starts a new, empty scene | Any non-empty string disables the "Do you want to save" prompt |
visren_open_document | Opens a VRNative or VRText file | An empty string triggers a file browsing dialog. Otherwise, a string in cmd|val format, specifying the file or directory to open (e.g. file|C:\temp\test.VRNative or directory|C:\temp) |
visren_show_mergeassistant | Displays the merge dialog. | No parameters |
visren_close_document | Same as visren_new_document except it also loads the startup environment | Same as visren_new_document |
visren_save_document | Saves the scene if it has a name (i.e. has been saved before and modified), otherwise triggers Save-As | No parameters. |
visren_save_document_as | Saves the scene with a specified name, or prompts the user to choose one | cmd|val format - the command is optional. val is the path to the file to save as, cmd can be either monolithic to save as monolithic, or finished to save as finished (as per save-as menu items) |
visren_import_data | Imports data using installed importer plugins - the imported data appears in whichever scene is currently loaded. | An empty string summons a file browse dialog filtering for all supported importers. Otherwise, string is expected in cmd|val format - see the supplementary section below this table for the syntax. |
visren_import_as_new_document | Same as above except triggers a visren_new_document first. | Same as visren_import_data. There is no way to skip the save prompt triggered by the new document command. |
visren_import_merge_data | Same as above except imported data is merged using the current merge assistant settings. | Same as visren_import_data |
visren_export_data | Exports data from the scene using installed exporter plugins | Same as visren_import_data except importer commands are replaced with exporter |
visren_exit | Exits the application. | An empty string triggers the "Do you want to save" dialog. noquerysave suppresses this dialog. |
visren_cut_selection | Cuts the selected nodes to the clipboard | If specified, expects a path to the selection. Otherwise, uses the view that the user last selected nodes in (e.g. if selection was made in Scenes, that selection is cut) |
visren_copy_selection | Copies the selected nodes to the clipboard | Same as cut |
visren_paste_selection | Pastes the contents of the clipboard as children the current selection of nodes | Same as cut |
visren_paste_as_sibling | Pastes the contents of the clipboard as siblings of the current selection of nodes | Same as cut |
visren_delete_selection | Deletes the selected nodes | Same as cut |
visren_clear_selection | Clears the selection so nothing is selected | Same as cut |
visren_show_user_manual | Shows user manuals | Defaults to showing the Visionary Render user manual. May be given a path to a specific chm file to display that instead |
visren_show_about | Shows the about dialog | No parameters |
visren_undo | Undoes the last operation | No parameters |
visren_redo | Redoes the last operation | No parameters |
visren_clear_history | Clears the undo stack | No parameters |