Creates a new Command. Takes a name
and a set of parameters
. Typically
once constructed commands are not modified.
Note: Command parameters should consist of the following JavaScript types only:
- String
- Number
- Boolean
- Null
- Array
- ArrayBuffer
Any other type provided will be interpreted as an Object and have it's
enumerable properties sent in a Map using Object.keys(value).forEach()
.
The provided parameter Object will be copied internally and any properties whose
values is undefined
will be removed.
This means if you are using some form of framework that modifies or extends core JavaScript types, EG: MobX or Immutable.js, you need to ensure you convert these to native JavaScript types before passing them as command parameters.
Name | Type | Description |
---|---|---|
name |
String |
the command name to execute. |
parameters |
Object |
the command parameters. |
Example
let c = new Command('import_scene',
{
scene_name:'meyemii',
block:true,
filename: 'scenes/meyemII.mi'
});
c = new Command('render',
{
scene_name:'meyemii',
renderer:'iray',
format: 'png',
render_context_options: {
scheduler_mode: {
value: 'batch',
type: 'String'
}
}
});
Members
-
The command name
-
The command parameters. Object keys are the parameter names and values are their values.