I think what dgovil is suggesting, is to make use of the internal state of
your class, which is being used to represent your UI and contains your
button callbacks:
class MyInterface(object):
def __init__(self):
self.__currentRig = {}
def button1_clicked(self):
results = getResults()
self.__currentRig['first_part'] = results
def button2_clicked(self):
results = getOtherResults()
previewStuff = self.__currentRig['first_part']
newResults = doMore(results, newResults)
self.__currentRig['second_part'] = newResults
def newRig(self):
self.__currentRig = {}
On Thu, Oct 17, 2013 at 11:03 PM, Simen Chris <[email protected]> wrote:
> Thanks for your response, do you mean that I create a class that is called
> "globally" before the UI, so I have an instance of that running before the
> button is pushed? And that way I can write to/get from the instance of that
> class? Sorry I'm still in the process of learning how to work with classes
> :)
>
>
> On Tuesday, October 15, 2013 11:09:03 PM UTC+2, dgovil wrote:
>>
>> If you're using a class, you can have a instance level dict ie self.foo =
>> {}
>> and then whatever method your button calls can update that dictionary
>> which can be used by any other method of the class.
>>
>> On Tuesday, 15 October 2013 08:12:37 UTC-7, Simen Chris wrote:
>>>
>>> Hey guys, I'm creating a rigging script in PyMel, in my UI I have a
>>> button that calls a function that creates a template leg (20 different
>>> objects). The issue I'm having is that when I'm finished with positioning
>>> the template-objects I'm gonna need to work with them in the net function,
>>> so I click another button "Build Rig", what I'm doing to get the
>>> template-objects is to use the same (hardcoded) names as I did when the
>>> were created, one problem with that is that if the names got changed
>>> because of another object with the same name, it won't find them.
>>>
>>> I'm using classes, and I know that if I didn't call the function from a
>>> button I could just return the objects in the template-function, but as I'm
>>> calling the function from a button I don't know if it's even possible to
>>> store the return statements from a function. I could use a textScrollList
>>> to store the names in, but if I do I can't call the function outside of the
>>> UI, also I think it's a bit messy.
>>>
>>> Another thing, as I'm using PyMel, I know that each object I create is
>>> created within the PyMel class, which means that I'm normally able to
>>> rename the object through the instance, but I don't know how to take use of
>>> that when calling the function (again) from a buttom.
>>>
>>>
>>> Any tips would be greatly appreciated! Cheers
>>>
>> --
> 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/6ce314d3-8c15-47bc-bb81-3a15e496452f%40googlegroups.com
> .
>
> 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 view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0A8BS6G%2BsA-k72907fTnkV7Xk_UtMspwYnrz9pOTivFA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.