They do not, you will have to re-add it for each session.

On 14 July 2016 at 07:30, Mahmoodreza Aarabi <[email protected]> wrote:

> i mean the callback will stick to the scene or not?
> i think custom callbacks does not stick to the scene.
>
> On Thu, Jul 14, 2016 at 10:56 AM, Mahmoodreza Aarabi <[email protected]>
> wrote:
>
>> thanks marcus
>> this is when i run a module in maya and in a function in it i want to
>> remove it,
>> but maybe i saved the scene with this callback
>> restart maya and want to remove it.
>> what is the solution?
>> make sense?
>>
>> On Thu, Jul 14, 2016 at 10:53 AM, Marcus Ottosson <[email protected]
>> > wrote:
>>
>>> You can temporarily store it somewhere global, such as in any of your
>>> own modules.
>>>
>>> import my_module
>>> # Add
>>> my_module.idx = OpenMaya.MEventMessage.addEventCallback("timeChanged", 
>>> get_sec)
>>> # Remove
>>> OpenMaya.MEventMessage.removeEventCallback(my_module.idx)
>>>
>>> ​
>>>
>>> On 14 July 2016 at 07:14, Mahmoodreza Aarabi <[email protected]> wrote:
>>>
>>>> Hello guys
>>>> i know that this thread is old, but recently i was searching about one
>>>> problem and i see this in group.
>>>>
>>>> i do this in another way, but i have different problem that i will say.
>>>> i did this:
>>>>
>>>> def do_something(*args, **kwargs):
>>>>     print "hello"
>>>>
>>>> idx = OpenMaya.MEventMessage.addEventCallback("timeChanged", get_sec)
>>>>
>>>> this snippet works well, but problem is that i want to get all
>>>> callbacks of the current scene and remove it.
>>>> i know that the code is something like this:
>>>>
>>>> OpenMaya.MMessage.removeCallback(idx)
>>>>
>>>> but, finding the idx from the current scene is a problem now.
>>>>
>>>> i can’t run this codes in one step, maybe i want to run the second code
>>>> after a while, for example, after closing the scene again.
>>>>
>>>> any idea?
>>>>
>>>> thanks
>>>> ​
>>>>
>>>> --
>>>> 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/a9930e11-c931-4a0e-837a-a9329248c2e7%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/python_inside_maya/a9930e11-c931-4a0e-837a-a9329248c2e7%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> *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/CAFRtmOBo-vERZ0P72%3DP1qbYqGk%3DE-zMaa%2Br-guZJNedcOhGVAA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBo-vERZ0P72%3DP1qbYqGk%3DE-zMaa%2Br-guZJNedcOhGVAA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>>
>> Bests,
>> madoodia
>>
>
>
>
> --
>
>
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CADvbQwKO%3DSNaF07TyMQ3zYACW%3DQ_dqunuHk9wmoeXgS48Qn4jg%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CADvbQwKO%3DSNaF07TyMQ3zYACW%3DQ_dqunuHk9wmoeXgS48Qn4jg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*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/CAFRtmOB79uDHA_C%3DspQjORTqVX7DrkPO5ZFacLjfSOO3WdH2Tw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to