I'm just getting errors after errors haha. Maybe it's time to quit this. -------- Original message -------- From: Justin Israel <[email protected]> Date: 2015-12-22 11:09 PM (GMT-08:00) To: Python Programming for Autodesk Maya <[email protected]> Subject: Re: [Maya-Python] Re: renaming a QStandardItem to its corresponding pymel object
If you don't have specific nodes that you want to monitor (meaning you want to watch any node and not just the ones in your ui) then maybe you want to look at MDagMessage or MDGMessage? http://docs.autodesk.com/MAYAUL/2014/ENU/Maya-API-Documentation/cpp_ref/class_m_dag_message.html#aec1c63360030ad4c4d85e0a19652904c http://docs.autodesk.com/MAYAUL/2014/ENU/Maya-API-Documentation/cpp_ref/class_m_d_g_message.html#abc9426c46ee4abae884a8dca5a97929a If you look at the signature of the functions, you will see that the client data parameter is NULL by default. That means you don't have to pass anything for that param. It is used to associate some kind of extra data with the callback, and that data will get transmitted later when the callback fires. But if you only want to know the name of the node that was removed, it looks like the callback that you register will receive the information (MDagPath of removed node, etc) What you are currently doing isn't making much sense. Again you have a signal defined to emit with a list as a param. And yes you emit the signal, passing the current selection with it. But your slot never uses it. It accepts no parameters. So I don't understand the purpose of how you have configured that signal/slot. You can mostly keep doing what you have so far, but try a different message callback type, and actually accept the callback parameters that Maya wants to pass you for that callback type, so that it can tell you what was removed and you can display it in your status bar. Justin On Sun, 20 Dec 2015 10:27 PM Padraig Ó Cuínn <[email protected]> wrote: Hey again I was back to this after a while and I was wondering how I go about hooking the MDGMessage.addnoderemoved to the signal. Is this a plausible way of accessing the MMessages? Signal in constructoritemRemoved = Signal(list) connection from signal to statusBardef update_statusbar2(): txt = '%s deleted.' self.statusbar.showMessage(txt) self.itemRemoved.connect(update_statusbar2) emitting the signaldef emit_itemdeleted(): self.itemRemoved.emit( pmc.selected()) OpenMaya.MDGMessage.addNodeRemovedCallback( Node, update_statusbar2(),emit_itemdeleted()) according to the docs you give a node, a function and clientdata ( I think i have done that here. But even if this is correct wouldn't this mean that I only send the signal for the given Node (hardocded). I am looking for a way to dynamically show the name of the removed item on the statusbar which is why I have pmc.selected there because i thought it would reflect on the signal and then show the MDGMessgae from that. Any help along here would be great with some kind of reference of a snippet of code how i would tackle this. there is practically no help on line for any of this at all like it isn't used. thanks -Padraig -- 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/69c2b96f-644b-4d66-9859-623bc019250f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/XC9rqzRjw1w/unsubscribe. To unsubscribe from this group and all its topics, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2kcXnCTVZ1AX5CgGwUFVec2y_WnBjPHFjpT%2BZg5dWBXw%40mail.gmail.com. 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/xu96ruxm04onurwsjxocnxnn.1451501159444%40email.android.com. For more options, visit https://groups.google.com/d/optout.
