On Thu, Dec 17, 2015 at 8:48 PM Padraig Ó Cuínn <
[email protected]> wrote:

>
>
> Hi again.
>
> so i have a little thingy i am working on ( a type of node renamer )
>
> so far I manage to get everything working. I am on a Model / View GUI
> compared to the old QListWidget.
>
> so my question is, is it doable to get the text of a QStandardItem in the
> Model pumped from a Pymel object
>

Do you mean that you want to be able to take a QStandardItem instance, at
some point in a slot/callback and be able to use a pymel object that is
associated with it? There are a few ways you can approach this and all of
them deal with storing more inforation on your QStandarItems. You can use
setData() to store custom data such as the full dag path or even the pymel
instance itself:

# a class constant
MayaObjectRole = QtCore.Qt.UserRole + 1
MayaPathRole = QtCore.Qt.UserRole + 2
...def foo(self):
    ...
    item = QtGui.QStandardItem()
    item.setData(pyMelObject, self.MayaObjectRole)
    item.setData(dagPath, self.MayaPathRole)
def bar(self, anItem):
    pyMelObject = anItem.data(self.MayaObjectRole)
    dagPath = anItem.data(self.MayaPathRole)

​


>
>
> *PasteBin Code:*
> http://pastebin.com/3YHMJxgB
>
>
> so while I was pasting my pastebin, I had another 2 questions.
>
> 1. How easy would it be to implement status changes of a rename, %s
> _object to %s _newobject .... Would i be able to just include it in the
> selectionchanged status or create a new connection.
>

I don't see any renaming logic in your code. Are you talking about
responding to renames that happen within Maya, that you want to track and
respond to? Any of this stuff falls into the category of setting up
MMessage callbacks through the Maya API, and responding to those event in
your GUI


> 2. As far as the renaming goes, it would be nice for the ui to maintain
> itself on certain changes, One i had in mind was the refresh functionality
> is it possible to swap its function and text on selecting an item in the
> model and it changes to rename and uses a renaming connection.
>

Can you explain this question again? What do you mean by swapping its
function? Under what condition would you want to swap the function from one
to another? Can you give a specific example of how you see this happening?


>
> I know they are somewhat advanced subject and may go into metadata
> contexts but yeah :) you guys are super smart and I am just me haha.
>
> Thank you again for your help
>
> --
> 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/d451ffe9-9f9f-4da4-bfdb-8c40e408a8d5%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/d451ffe9-9f9f-4da4-bfdb-8c40e408a8d5%40googlegroups.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/CAPGFgA0EOcwiqG1CNgpwN2ny247kvrkWsOtKF%2BVEnEh9nXqN1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to