CommandService Reference
commands are executed and queried directly through the command syntax. Specific information on each command is available from the Command History Viewport's List tab, but this can also be obtained procedurally through the command service ScriptQuery interface.
Querying the commandservice ScriptQuery interface reveals three root attributes and two attribute groups:
- commands
- command.???
- categories
- category.???
- currentExecDepth
Contents
- 1 commands
- 1.1 commands
- 1.2 command Attributes
- 1.2.1 command.username
- 1.2.2 command.desc
- 1.2.3 command.usage
- 1.2.4 command.example
- 1.2.5 command.tooltip
- 1.2.6 command.help
- 1.2.7 command.icon
- 1.2.8 command.flags
- 1.2.9 command.toggleArg
- 1.2.10 command.argNames
- 1.2.11 command.argUsernames
- 1.2.12 command.argDescs
- 1.2.13 command.argExamples
- 1.2.14 command.argTypes
- 1.2.15 command.argTypeNames
- 1.2.16 command.argflags
- 1.2.17 command.isAlias
- 1.2.18 command.isContainer
- 2 categories
- 3 currentExecDepth
- 4 More Information
commands
commands requires no selection. It simply returns a a full list of all available commands. Specific categories of commands can be listed through the categories and category attributes.
commands
Get a list of all available commands.
Datatype | string |
Example | query commandservice commands ? |
Result | [list of all commands] |
command Attributes
The command attributes are used to obtain information about specific commands. These all require that the target command is selected by providing its internal name as the selector. As these are queries against prototype commands (as opposed to instanced commands with their arguments set), these cannot provide dynamic states that would be otherwise modified by the argument values or environment.
command.username
Get a command’s human-readable name.
Datatype | string |
Example | query commandservice command.username ? poly.setMaterial |
Result | Set Material |
command.desc
Get a command’s description, which provides a string describing how to use the command.
Datatype | string |
Example | query commandservice command.desc ? poly.setMaterial |
Result | Assign a new or existing material to the selected polygons. |
command.usage
Get a usage string, similar to that saved by Cmds.saveList.
Datatype | string |
Example | query commandservice command.usage ? poly.setMaterial |
Result | poly.setMaterial name:string <color:percent3> <diffuse:percent> <specular:percent> <smoothing:integer> <default:integer> |
command.example
An example of how the command and its arguments are used.
Datatype | string |
Example | query commandservice command.example ? select.typeFrom |
Result | select.typeFrom "vertex;edge;polygon;item" 1 |
command.tooltip
The default tooltip shown when the user hovers the mouse pointer over a button on the interface.
Datatype | string |
Example | query commandservice command.tooltip ? app.load |
Result | Open file |
command.help
The URL to the specific help for this file, if available, relative to the help directory.
Datatype | string |
Example | query commandservice command.help ? poly.boolean |
Result | pages/Boolean.html |
command.icon
Get the name of the default icon for the command. Often this will simply be the name of the command. This name is used to look up the icon in the config, which references a rectangular region within an image.
Datatype | string |
Example | query commandservice command.icon ? poly.boolean |
Result | poly.boolean |
command.flags
Get the command’s default flags. See Command System: Basics and the Command Reference SDK pages for a list of flags. Note that the flags may change at execution time depending on the values of the arguments.
Datatype | integer |
Example | query commandservice command.flags ? poly.boolean |
Result | 6291456 [in hexadecimal, this is 0x00600000] |
command.toggleArg
Index of the toggle argument, if available. See the section on Command Arguments earlier in this guide for more information on ToggleValue commands. Indices start from 0.
Datatype | integer |
Example | query commandservice command.toggleArg ? tool.set |
Result | 1 |
command.argNames
Internal names of all of the command’s arguments. These can be used to set the value of an argument by name, with the syntax name:value. See the section on Command Arguments earlier in this guide for more information on using named arguments.
Datatype | string |
Example | query commandservice command.argNames ? tool.set |
Result | preset mode task |
command.argUsernames
Human-readable names of all of the command’s arguments. These are presented in the command arguments dialog instead of the internal names.
Datatype | string |
Example | query commandservice command.argUsernames ? tool.set |
Result | Tool Preset Tool Set Mode Tool Task Value |
command.argDescs
Descriptions of all of the command’s arguments.
Datatype | string |
Example | query commandservice command.argDescs ? tool.set |
Result | Name of the material. Assign the material to the polygon. |
command.argExamples
Examples of all of the command’s arguments.
Datatype | string |
Example | query commandservice command.argExamples ? material.new |
Result | [empty string; no example for argument 0]
[empty string; no example for argument 1] |
command.argTypes
The simple type code for each of the command's arguments. This is 0 for generic objects, 1 for integers, 2 for floats and 3 for strings. See command.argTypeNames for the specific argument datatypes
Datatype | integer |
Example | query commandservice command.argTypes ? poly.setMaterial |
Result | 3 0 2 2 1 |
command.argTypeNames
The specific datatypes of all of the command’s arguments.
Datatype | string |
Example | query commandservice command.argTypeNames ? poly.setMaterial |
Result | string |
command.argflags
Flags defining the argument. Command Reference SDK pages for a list of flags
Datatype | integer |
Example | query commandservice command.argFlags ? poly.setMaterial |
Result | 0 [in hexadecimal, this is 0x00000000] 1 [in hexadecimal, this is 0x00000001] 1 [in hexadecimal, this is 0x00000001] 1 [in hexadecimal, this is 0x00000001] 1 [in hexadecimal, this is 0x00000001] |
command.isAlias
Returns 1 if the command is an alias. See Command System: Basics for more information
Datatype | integer |
Example | query commandservice command.isAlias ? material.name |
Result | 0 |
command.isContainer
Returns 1 if the command is a container. See Command System: Basics for more information.
Datatype | integer |
Example | query commandservice command.isContainer ? extrude |
Result | 1 |
categories
categories requires no selection. It simply returns a full list of all root-level command categories. Specific categories and commands within can be listed using the category attributes. There are also three special command categories: Containers contains all command containers, Uncategorized contains commands not in any other categories, and All contains every command.
categories
Get a list of all root-level command categories.
Datatype | string |
Example | query commandservice commands ? |
Result | [list of all root-level command categories] |
category Attributes
The category attributes are used to get a list of sub-categories or commands within a category. All of the category attributes take the category name as the selector.
category.categories
Get a list of sub-categories within a category.
Datatype | string |
Example | query commandservice category.categories ? "Command System" |
Result | [list of all categories inside the Command System category] |
category.commands
Get a list of commands within a category.
Datatype | string |
Example | query commandservice category.commands ? Macros |
Result | [list of all commands inside the Macros category] |
currentExecDepth
This attribute returns the current execution depth of a command. This can be used to tell if a command is being executed as a root-level command or a sub-command. If no commands are currently executing, this will be –1, while root-level command executions will return 0 and sub-command executions will be 1 or higher.
Note that this value only changes when commands execute, not when they are queried; thus, using the query example below will return –1 when executed as a root-level command. Similarly, querying this attribute from within a script will return the execution depth of the script, not the depth of the query command, as the query command is not executing.
This attribute does not require a selector, as it operates on global state.
currentExecDepth
Returns the current command execution stack depth, or -1 when no commands are executing.
Datatype | integer |
Example | query commandservice currentExecDepth ? |
Result | -1 |