[Maya-Python] Maya C++ Plugin and Dynamic Memory Allocation
Hi all, I'm working on a plugin that needs to create a dynamic hierarchical pointer octree. I'm storing it on the heap and make sure to do the required clean up after I'm through with it. However, I noticed that Maya won't release the allocated memory until the plugin is unloaded. It doesn't seem to make a difference whether I delete the plugin elements from the scene, flush undo stack, open new scene, etc. Does this sound familiar to anyone? Any suggestions would be appreciated! -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com.
[Maya-Python] Multi level undo in one go
Hi, I am changing the values of attributes on multiple objects in the maya scene. Now, if I have to go to the previous state(before the setting of the attributes), it takes lots of Undo. Is thee is a way to undone all the changes at once. Also, if I run the setting of the attributes from a function or procedure, all the changes get undone at once. But, I am not able to attain the same functionality from my script. Thanks. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com.
Re: [Maya-Python] Multi level undo in one go
Blue pencil plug? Anyone? El 23/01/2013 15:08, DayDreamer day.dreamer.m...@gmail.com escribió: Hi, I am changing the values of attributes on multiple objects in the maya scene. Now, if I have to go to the previous state(before the setting of the attributes), it takes lots of Undo. Is thee is a way to undone all the changes at once. Also, if I run the setting of the attributes from a function or procedure, all the changes get undone at once. But, I am not able to attain the same functionality from my script. Thanks. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com.
Re: [Maya-Python] Multi level undo in one go
Hi, What you can try is an open and close chunk of your undo queue. ## Opens a new undo chunk cmds.undoInfo(openChunk = True) ## Closes the chunk again cmds.undoInfo(closeChunk = True) Keep in mind though that if you have an error in your script halfway you might lose your entire undo stack. Maybe make a button that closes the undo chunk. so you can always preserve your undo stack. if you really want to make your life easy make a decorator function out of it. That way you can use it for every function you want to wrap in one undo call. Hope that helps. 2013/1/23 blindtresddd blindtres...@gmail.com Blue pencil plug? Anyone? El 23/01/2013 15:08, DayDreamer day.dreamer.m...@gmail.com escribió: Hi, I am changing the values of attributes on multiple objects in the maya scene. Now, if I have to go to the previous state(before the setting of the attributes), it takes lots of Undo. Is thee is a way to undone all the changes at once. Also, if I run the setting of the attributes from a function or procedure, all the changes get undone at once. But, I am not able to attain the same functionality from my script. Thanks. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com.
Re: [Maya-Python] Multi level undo in one go
The decorator is a nice suggestion. You could also create a context using contextlib (http://docs.python.org/2/library/contextlib.html) so that you can wrap sections of code in something that first starts the chunk and then closes it regardless of an exception: with undoable(): func1() # maybe calls 10 other things func2() # ah, raises an exception! On Thu, Jan 24, 2013 at 8:38 AM, Jan: jan@gmail.com wrote: Hi, What you can try is an open and close chunk of your undo queue. ## Opens a new undo chunk cmds.undoInfo(openChunk = True) ## Closes the chunk again cmds.undoInfo(closeChunk = True) Keep in mind though that if you have an error in your script halfway you might lose your entire undo stack. Maybe make a button that closes the undo chunk. so you can always preserve your undo stack. if you really want to make your life easy make a decorator function out of it. That way you can use it for every function you want to wrap in one undo call. Hope that helps. 2013/1/23 blindtresddd blindtres...@gmail.com Blue pencil plug? Anyone? El 23/01/2013 15:08, DayDreamer day.dreamer.m...@gmail.com escribió: Hi, I am changing the values of attributes on multiple objects in the maya scene. Now, if I have to go to the previous state(before the setting of the attributes), it takes lots of Undo. Is thee is a way to undone all the changes at once. Also, if I run the setting of the attributes from a function or procedure, all the changes get undone at once. But, I am not able to attain the same functionality from my script. Thanks. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com . To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com.
[Maya-Python] Re: Maya C++ Plugin and Dynamic Memory Allocation
Hey Serguei, I was running into this issue at our previous place of employment :) I never figured out a way to release all the memory that Maya allocated. On Wednesday, January 23, 2013 2:24:48 AM UTC-8, serguei.k...@gmail.com wrote: Hi all, I'm working on a plugin that needs to create a dynamic hierarchical pointer octree. I'm storing it on the heap and make sure to do the required clean up after I'm through with it. However, I noticed that Maya won't release the allocated memory until the plugin is unloaded. It doesn't seem to make a difference whether I delete the plugin elements from the scene, flush undo stack, open new scene, etc. Does this sound familiar to anyone? Any suggestions would be appreciated! -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com.