Quick questions here :
How do you properly destroy your objects and MScriptutils.. ?
Any optimization tricks ?
--
Finally how many of you guys use Python API 2.O ?
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/08bf227c-8566-4016-8520-625a04a0f46e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
def getPtr():return MScriptUtil().asDoublePtr()ptr = getPtr()maya.OpenMaya.someFuncThatNeedsADoublePtr(ptr)
ptr = pymel.api.allapi.SafeApiPtr('double')maya.OpenMaya.someFuncThatNeedsADoublePtr(ptr())
...as the SafeApiPtr, and thus the MScriptUtil, may be destroyed by the time the OpenMaya function is called. Essentially, you need to make sure the SafeApiPtr object is kept around until the OpenMaya C++ functions are "done with it".maya.OpenMaya.someFuncThatNeedsADoublePtr(SafeApiPtr('double')())
On Thu, Feb 23, 2017, 9:04 PM justin hidair <justin...@gmail.com> wrote:Quick questions here :
How do you properly destroy your objects and MScriptutils.. ?I assume this is a C++ question, since Python is garbage collected?"When an MScriptUtil object is destroyed any pointers to its data immediately become invalid."So any data being managed by MScriptUtil should get cleaned up when the dtor is called. Is that what you are after?
Any optimization tricks ?What specifically are you after?
--
Finally how many of you guys use Python API 2.O ?
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 python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/08bf227c-8566-4016-8520-625a04a0f46e%40googlegroups.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 python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2p3%2ByouTDi-d83XMubKfce_UY_B5-8V4rMtYQbFxAvdw%40mail.gmail.com.
The net result is that it's possible for python to destroy the MScriptUtil, and it's associated C++ objects... but still have a ptr object created by that MScriptUtil, which tries to use that now-freed space.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/08bf227c-8566-4016-8520-625a04a0f46e%40googlegroups.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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2p3%2ByouTDi-d83XMubKfce_UY_B5-8V4rMtYQbFxAvdw%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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAAssL7aGz%2B8RE5Cu9DpkaticQOvq1OR2s1yB5kmQ_%3DeLCAK%2B0g%40mail.gmail.com.
On Sat, Feb 25, 2017 at 12:13 PM Paul Molodowitch <elro...@gmail.com> wrote:The net result is that it's possible for python to destroy the MScriptUtil, and it's associated C++ objects... but still have a ptr object created by that MScriptUtil, which tries to use that now-freed space.In all fairness though, the documentation does say the pointers are only valid for the lifetime of the MScriptUtil instance :-)
They do now, true. They didn't always... at one point they did an overhaul of the MScriptUtil docs that made things MUCH clearer. (Though the underlying design is still awkward. Don't even get me started on the whole "initial values" vs "working values" thing - had to figure out that bit of oddball logic before there was any documentation on it's behavior!) The better change was when it was removed entirely in the python 2.0 api. Kudos to Autodesk for realizing it was a problem, and trying to fix it, both with the doc update, and the 2.0 overhaul.Speaking of 2.0 - does anyone know if it's feature complete? I thought it was dead, but then they added a bunch more classes an update or two ago, so maybe there's still hope of it getting there. Would be nice to never have to use the python 1.0 api...- Paul