thanks Justin
yes you are right, as allways :)
i'm over complicating i guess.
the thing is i wanted not to changed them all at once.
i want to build a ui with several toggle buttons, each one generated
for each file node and a slider for gamma correction. so i can toggle
only the ones i want.
i have these methods:
def addGammaAttr(self):
cmds.addAttr(self.name,ln="vrayFileGammaEnable")
cmds.addAttr(self.name,ln="vrayFileColorSpace")
cmds.addAttr(self.name,ln="vrayFileGammaValue")
def toggleGamma(self):
if cmds.getAttr("%s.vrayFileGammaEnable" %self.name)==1:
cmds.setAttr("%s.vrayFileGammaEnable" %self.name ,0)
else:
cmds.setAttr("%s.vrayFileGammaEnable" %self.name ,1)
cmds.setAttr("%s.vrayFileColorSpace" %self.name ,1)
cmds.setAttr("%s.vrayFileGammaValue" %self.name ,2.2)
the snippet you send should work to create several objects.
gonna try it.
fileObj[i] is just my dumbness lol.
On 06/04/2013 09:26 PM, Justin Israel wrote:
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 <http://cmds.ls>(type="file")
gammaNodes = [FileGammaNode(f) for f in fileList]
On Jun 5, 2013 6:35 AM, "Ricardo Viana" <[email protected]
<mailto:[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 <http://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]
<mailto:python_inside_maya%[email protected]>.
To post to this group, send email to
[email protected]
<mailto:[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.
--
////////////////////////////////////
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.