Cortex
10.0.0-a4
|
This class defines a means of parsing a list of string arguments with respect to a Parameter definition. More...
Public Member Functions | |
def | parse (self, args, parameters) |
Parses the args to set the values of the parameters held by a CompoundParameter object. More... | |
def | serialise |
Returns a list of strings representing the values contained within parameters, or alternately, the values contained within the values argument. More... | |
def | registerType (cls, typeId, parser, serialiser) |
Registers a parser and serialiser for a new Parameter type. More... | |
def | registerTypeWithRepr (cls, typeId) |
Registers a default parser and serialiser for a Parameter type for which repr( parameter.getValue() ) yields a valid python statement. More... | |
This class defines a means of parsing a list of string arguments with respect to a Parameter definition.
It's main use is in providing values to be passed to Op instances in the do script. It now also provides the reverse operation - serialising parameter values into a form which can later be parsed.
def IECore.ParameterParser.parse | ( | self, | |
args, | |||
parameters | |||
) |
Parses the args to set the values of the parameters held by a CompoundParameter object.
args must be a list of strings.
Parsing expects a series of entries of the form -parameterName value(s). It is also possible to specify a series of child parameters which can be parsed without their name being specified - this provides much less verbose command lines for commonly used parameters, and the possibility of supporting the very common "command [options] filenames" form of command. Flagless parameters are specified as userData in the parameters object passed - this should be a StringVectorData named "flagless" in a CompoundData called "parser" - these flagless parameters are parsed in the order they are specified in the data element. If parsing fails at any time then a descriptive exception is raised.
References IECore.ParameterParser.__typesToParsers, IECore::RunTimeTyped.baseTypeId(), and IECore::Reader.create().
def IECore.ParameterParser.registerType | ( | cls, | |
typeId, | |||
parser, | |||
serialiser | |||
) |
Registers a parser and serialiser for a new Parameter type.
Referenced by IECore.ClassVectorParameter.newParameterName(), and IECore.ClassParameter.setClass().
def IECore.ParameterParser.registerTypeWithRepr | ( | cls, | |
typeId | |||
) |
Registers a default parser and serialiser for a Parameter type for which repr( parameter.getValue() ) yields a valid python statement.
References IECore::Object.load(), IECoreHoudini::SOP_CortexConverter.parameters, IECore::ParameterisedInterface.parameters(), IECoreHoudini::ParameterisedHolder< SOP_Node >.parameters, IECoreHoudini::ParameterisedHolder< BaseType >.parameters, IECore::Light.parameters(), IECore::Shader.parameters(), IECore::ExternalProcedural.parameters(), IECore::Display.parameters(), IECore::Camera.parameters(), IECore::Parameterised.parameters(), IECore::ParameterisedProcedural.parameters(), IECore::CompoundParameter.parameters(), IECore::Renderer::ExternalProcedural.parameters(), IECoreMaya.ParameterPanel.ParameterUIContainer.parameters, IECore.registerRunTimeTyped(), and IECore::RunTimeTyped.staticTypeId().
def IECore.ParameterParser.serialise | ( | self, | |
parameters, | |||
values = None |
|||
) |
Returns a list of strings representing the values contained within parameters, or alternately, the values contained within the values argument.
This can later be passed to parse() to retrieve the values. Parameter values will be validated, and may throw an exception, unless the alternate values argument is used.
References IECore.ParameterParser.__serialiseWalk(), IECore.ParameterParser.__typesToSerialisers, IECore::RunTimeTyped.baseTypeId(), and IECore::RunTimeTyped.staticTypeId().