would you mind posting what this returns? dataHandle = dataBlock.inputValue( readBandedImageNode.filename ) data = dataHandle.data() print data, type(data)
I am wondering what instance is returned from a '.data()' call for a string. Matt On Mon, Feb 23, 2009 at 11:04 AM, John Riddle <jbrav...@gmail.com> wrote: > The MPlug method that you posted is what works for me. The MFnStringData > bit still throws an error. > > NotImplementedError: No matching function for overloaded > 'new_MFnStringData' // > > But hey, I got a string I can work with! Haha > > Thanks a lot for your help Matt and Dean. > > > On Mon, Feb 23, 2009 at 10:29 AM, Matthew Chapman <chapman...@gmail.com>wrote: > >> >> Let me know if these are wrong I am not able to test this wight now. >> >> # Somthing like this for MPlug I think >> node = self.thisMObject() >> plug = api.MPlug(node, readBandedImageNode.filename) >> strData = plug.asString() >> >> # I am wondering if this might work >> dataHandle = dataBlock.inputValue( readBandedImageNode.filename ) >> data = dataHandle.data() >> strData = api.MFnStringData(data).string() >> >> Matt >> >> On Mon, Feb 23, 2009 at 9:59 AM, John Riddle <jbrav...@gmail.com> wrote: >> > I'm sorry but I'm still very new to the API and can't seem to get the >> syntax >> > right. I'm doing: >> > >> > dataHandle = dataBlock.inputValue( readBandedImageNode.filename ) >> > filenameStr = dataHandle.asString() >> > >> > and getting filenameStr as an MString object. Dean mentioned above I am >> > going to need use MPlug to get the string instead. What would be the >> syntax >> > for pulling a string from an MString object? >> > >> > On Mon, Feb 23, 2009 at 9:29 AM, Matthew Chapman <chapman...@gmail.com> >> > wrote: >> >> >> >> I don't have a way to test this right now but I was wondering if you >> >> could get the MObject of the string data from the dataBlock and pass >> >> it to MFnStringData and call MFnStringData.string()? >> >> >> >> Matt >> >> >> >> On Sat, Feb 21, 2009 at 7:19 PM, Dean Edmonds <dean.edmo...@gmail.com> >> >> wrote: >> >> > >> >> > On Sat, Feb 21, 2009 at 15:20, John Riddle <jbrav...@gmail.com> >> wrote: >> >> >> Woot! Didn't notice you had responded here as well! You're all over >> the >> >> >> place with the answers Dean. Thanks a ton! >> >> >> >> >> >> If someone needs a filename as an input, is string not the way to >> go? >> >> >> Is >> >> >> there something more appropriate? >> >> > >> >> > String is the way to go. >> >> > >> >> > -- >> >> > -deane >> >> > >> >> > > >> >> > >> >> >> >> >> > >> > >> > > >> > >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---