Message 1 of 4
Custom node stringArray attribute
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all! I've been banging my head against the desk all day over this one. I just cannot figure out how to output a string array from a python custom node.
I can initialize the plug:
tAttr = OpenMaya.MFnTypedAttribute()
myPlugin.outPath = tAttr .create('outPath', 'outPath', OpenMaya.MFnData.kStringArray)
tAttr .setWritable(False)
myPlugin.addAttribute(myPlugin.outPath)
But in my compute function I cannot figure out how to parse a string array as an output value. Eg for a string I would do this:
data.outputValue(self.outPath).setString("stringToOutput")
I thought I'd cracked it with this:
strArrayDataFn = OpenMaya.MFnStringArrayData()
strArrayDataFn.create(["STRING"])
strArray = strArrayDataFn.array()
data.outputArrayValue(self.outPath).setStringArray(strArray)
But I still get a "(kInvalidParameter): Data is not an array" result.
If someone could please point out what I'm missing here I would be eternally grateful!
Thanks,
Jan.