It doesn't sounds like you really need an entire class structure with methods, to change the properties of the file nodes in the scene, unless each instance has some state that needs to be preserved? Sounds just like a function.
What is fileObj in this snippet? You could have your class take a file node path in its constructor and then just do fileList=cmds.ls(type="file") gammaNodes = [FileGammaNode(f) for f in fileList] On Jun 5, 2013 6:35 AM, "Ricardo Viana" <[email protected]> wrote: > Hi all. > > I'm trying to build a file texture gamma toggler. So i can switch the > gamma on several file nodes at once. > > i'm a bit newb with oop. But i tried to go this route. > > what i did: > a class with all the methods i need to do the stwiching and ui. > > problem: > i want to instantiate an object of this class for each file node in the > scene. > but when i try something like: > > > fileList=cmds.ls(type="file") > > for i in range(len(fileList)): > > fileObj[i]=FileGammaNode() > > i get: > > # TypeError: 'FileGammaNode' object does not support item assignment # > > > is there any other way to create objects dynamically? > > > cheers > thank you. > > -- > //////////////////////////////////// > Ricardo Viana > VFX Generalist > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
