hi, 
thanks mahmoodreza, justin. yes i found that grandchild name works but it's 
very annoying that some widgets work others not. 
and you're right about that this is not a good coding. at the end (even if 
it costs more lines) i split the field and text to two diffrent widgets.
maybe wrapping with some class may work, don't know.
thanks anyway :)


13 Eylül 2014 Cumartesi 00:24:06 UTC+3 tarihinde Justin Israel yazdı:
>
> What is annoying is that when you set the window into the dockControl, 
> Maya changes a bunch of the parenting/path references for those existing 
> controls in your window. So the path you stored, before having set the 
> window into the dockControl, is no longer valid after the dockControl. But 
> Maya does keep naming controls sequentially on a global level, so the short 
> name would still be valid after splitting. It would have been cool if they 
> thought to expose a form of an object id, specifically through the Maya 
> commands, such as a guid. That way you could retain a reference that is 
> always valid no matter where an object lives in the hierarchy or what is it 
> named. 
>
> On Sat, Sep 13, 2014 at 8:39 AM, Mahmoodreza Aarabi <[email protected] 
> <javascript:>> wrote:
>
>> Hey
>> i fix it in this way: (not professional manner in writing code, but it 
>> works for you now)
>> name = mc.textFieldGrp()
>> self.wg['textFieldGrp'] = name.split('|')[-1]
>>
>> new code:
>> import maya.cmds as mc
>>
>> class SimpleUI(object):
>>     def __init__(self, *args):
>>         self.wg={}
>>         self.wg['win'] = 'MySimpleWindow'
>>         self.wg['dock'] = 'MySimpleDock'
>>
>>         if mc.dockControl(self.wg['dock'], exists=True):
>>             mc.deleteUI(self.wg['dock'])
>>         # window
>>         mc.window(self.wg['win'])
>>         # layout
>>         mc.rowColumnLayout(nc=1)
>>         """ controls """
>>         mc.button(l='textField_button',
>>                   c=self.com_button_command)
>>         # this works
>>         name = mc.textField()
>>         self.wg['textField'] = name.split('|')[-1]
>>         mc.button(l='textFieldGrp_button',
>>                   c=self.com_grp_button_command)
>>         # this does not work
>>         name = mc.textFieldGrp()
>>         self.wg['textFieldGrp'] = name.split('|')[-1]
>>         mc.dockControl(self.wg['dock'],
>>                        area='left',
>>                        content=self.wg['win'])
>>
>>     def com_button_command(self, *args):
>>         # this works
>>         mc.textField(self.wg['textField'], e=True, tx='blabla')
>>
>>     def com_grp_button_command(self, *args):
>>         # this does not work
>>         mc.textFieldGrp(self.wg['textFieldGrp'], e=True, tx='blabla')
>>
>> SimpleUI()
>>
>> good luck
>>
>> On Fri, Sep 12, 2014 at 6:34 PM, <[email protected] <javascript:>> 
>> wrote:
>>
>>> Hi
>>>
>>> (sorry for my english)
>>>
>>> I'm having a hard time about this. So my problem is, when i just create 
>>> a window and put some controls (textField, textFieldGrp) in it. Editing or 
>>> querying with class methods is not a problem. but when i use dockControl to 
>>> build my ui, maya cannot find "_grp" controls
>>>
>>> here i post some code:
>>> textField querying is working, but textField querying is not (error 
>>> message below)
>>> maya can't find the control. even i print its name and its same as the 
>>> name in the error message.
>>>
>>> is it a known bug ?
>>>
>>> (by the way, if i change textFieldGrp command to textField, it works)
>>> (and if i change this to a window (not dock) it works either)
>>>
>>>
>>>
>>> import maya.cmds as mc
>>>
>>> class SimpleUI(object):
>>>     def __init__(self, *args):
>>>         self.wg={}
>>>         self.wg['win'] = 'MySimpleWindow'
>>>         self.wg['dock'] = 'MySimpleDock'
>>>
>>>         if mc.dockControl(self.wg['dock'], exists=True):
>>>             mc.deleteUI(self.wg['dock'])
>>>         # window
>>>         mc.window(self.wg['win'])
>>>         # layout
>>>         mc.rowColumnLayout(nc=1)
>>>         """ controls """
>>>         mc.button(l='textField_button',
>>>                   c=self.com_button_command)
>>>         # this works
>>>         self.wg['textField'] = mc.textField()
>>>         mc.button(l='textFieldGrp_button',
>>>                   c=self.com_grp_button_command)
>>>         # this does not work
>>>         self.wg['textFieldGrp'] = mc.textFieldGrp()
>>>         mc.dockControl(self.wg['dock'],
>>>                        area='left',
>>>                        content=self.wg['win'])
>>>
>>>     def com_button_command(self, *args):
>>>         # this works
>>>         mc.textField(self.wg['textField'], e=True, tx='blabla')
>>>
>>>     def com_grp_button_command(self, *args):
>>>         # this does not work
>>>         mc.textFieldGrp(self.wg['textFieldGrp'], e=True, tx='blabla')
>>>
>>> SimpleUI()
>>>
>>>
>>> """Error Code"""
>>>
>>> --
>>> 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] 
>>> <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/python_inside_maya/195e1b55-5bcb-4248-8a63-7b13d6d90bf2%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>>
>>
>> Bests,
>> madoodia
>>  
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/CADvbQw%2BzAPuEZk8L-BEWUCHvievsh4PtwCo3hW4zMH_7AWJCHA%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/CADvbQw%2BzAPuEZk8L-BEWUCHvievsh4PtwCo3hW4zMH_7AWJCHA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/bc90858b-1f56-4730-b5fa-1836509eb05f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to