ImageEngine/gaffer — pull request #828 by johnhaddon (2014-05-07 11:38:09+00:00)
Title: VectorData UI Improvements

This adds a "presets only" type mode to the CompoundVectorParameter UI, and proper path editing with tab completion and a browser to the PathVectorParameterUI. This fixes #470 and lays much of the groundwork for #18.

I've been testing with the following Op, which you might find useful both for testing and for an example of usage :

```
import IECore

class vectorData( IECore.Op ) :

def __init__( self ) :

IECore.Op.__init__( self,
"",
IECore.IntParameter(
name = "result",
description = "",
defaultValue = 0,
)
)
self.parameters().addParameters(

[

IECore.CompoundVectorParameter(
name = "compoundVector",
description = "",
userData = {
"UI" : {
"collapsed" : IECore.BoolData( False ),
"sizeEditable" : IECore.BoolData( True ),
}
},
members = [

IECore.BoolVectorParameter(
name = "bools",
description = "",
defaultValue = IECore.BoolVectorData(),
userData = { "UI" : { "editable" : IECore.BoolData( False ) } }
),
IECore.StringVectorParameter(
name = "strings",
description = "",
defaultValue = IECore.StringVectorData(),
),
IECore.FloatVectorParameter(
name = "numbers",
description = "",
defaultValue = IECore.FloatVectorData(),
userData = {
"UI" : {
"elementPresetsOnly" : IECore.BoolData( True ),
"elementPresets" : IECore.ObjectVector( [
IECore.CompoundData( {
"label" : "One",
"value" : 1.0,
} ),
IECore.CompoundData( {
"label" : "Two",
"value" : 2.0,
} ),
] ),
},
},
),
]
),

IECore.PathVectorParameter(
name = "paths",
description = "",
defaultValue = IECore.StringVectorData(),
),
]
)

def doOperation( self, args ) :

return IECore.IntData( 1 )

IECore.registerRunTimeTyped( vectorData )
```