By "dynamic" you may be referring to having your GUI refresh whenever your scene changes.
What may be simpler, at least as a start, may be to rely on a refresh on first launch of your GUI, or alternatively a refresh button within your GUI that the user could press whenever something has changed. It depends on how long you expect the GUI to be running at each run. To refresh would mean to run a loop over all lights, pm.ls(type='VRayLightRectShape') and instantiate lightObject() from there (which by the way should have upper-case formatting - see PEP08 <http://www.python.org/dev/peps/pep-0008/> ) Although I have to say, running a QTableWidget as a first excercise in OO is rather intense. You would probably have to composite lightObject within a QTableWidgetItem and override whatever method it has that deals with displaying and editing its corresponding field, either by monkey-patching or prior subclassing. Have a look here for some more hints http://qt-project.org/doc/qt-4.8/model-view-programming.html Best, Marcus On 10 February 2014 11:21, olheiros <[email protected]> wrote: > Hi all. > I am taking my first steps at object oriented, and i'm > trying to build a tool to aid me in the lighting process. > > i want to list all my Vray lights in a QTableWidget and some of its > attributes > so i can change them more easily. > > I have made a base class with all the methods of the Tool UI and its > working fine. > > I also created another class Light() with all the Light parameters and > methods. > The thing is i wanted (if possible) to instantiate as many Light() objects > as there are in the scene > so i can refer to them in the UI when changing values. But this has to be > dynamic, i mean. > > hope you see what i mean. All the examples i have seen are static > instantiation like a = light() > > in the following example i can only reach to one object. In this case the > last one to be created. > > Maybe it's my methodology that is wrong in the first place. How would you > go about this > Thanks in advance. > > Best > Ric > > > ----------------------------------------------------------------------------- > > import pymel.core as pm > > class lightObject(): > > def __init__(self,name): > > self.name = name > > self.color = (255,255,255) > > def __repr__(self): > > return self.name > > > > lights = pm.ls(shapes=1) > > for light in lights: > > if light.nodeType() == "VRayLightRectShape" or light.nodeType() == > "VRayLightDomeShape": > > lightNode = lightObject("%s" %light) > > > > > > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/045c727c-ac97-4fbf-8ceb-a89d240d6f86%40googlegroups.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- *Marcus Ottosson* [email protected] -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOA24eb3BeCO-jF_2qnoJQ-75rL2L6%3D0n_c4gTr%3DfuK1DA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
