Hi all,
I’m trying to figure out convert a crash into an exception.
The crash is coming from use of a function set when the MObject it’s
managing is pointing to a node I’ve just deleted. Here’s the shortest I
could make of it (Maya 2018).
from maya.api import OpenMaya as om
fn = om.MFnDagNode()
mobj = fn.create("transform")fn.name()# u'transform3'
mod = om.MDGModifier()
mod.deleteNode(mobj);
mod.doIt();del modfn.name()
Which throws this..
Stack trace:
Foundation.dll!TmtRefCounter::add
Foundation.dll!Tstring::operator=
OpenMaya.dll!Autodesk::Maya::OpenMaya20180000::MString::operator=
OpenMaya.dll!Autodesk::Maya::OpenMaya20180000::MFnDependencyNode::name
OpenMaya.dll!MPyMFnDependencyNode_Type::addToModule
python27.dll!PyEval_GetFuncDesc
python27.dll!PyEval_EvalFrameEx
python27.dll!PyEval_EvalCodeEx
python27.dll!PyRun_FileExFlags
python27.dll!PyRun_InteractiveOneFlags
python27.dll!PyRun_InteractiveLoopFlags
python27.dll!PyRun_AnyFileExFlags
python27.dll!Py_Main
KERNEL32.DLL!BaseThreadInitThunk
ntdll.dll!RtlUserThreadStart
Result: untitled
Fatal Error. Attempting to save in
C:/Users/marcus/AppData/Local/Temp/marcus.20180103.0935.ma
The fact that it crashes isn’t a problem, it makes sense. But what I’d like
to try and do is instead of having it crash raise an exception.
I went for MObject.isNull()
<http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__py_ref_class_open_maya_1_1_m_object_html>
at first, but that seems to always return False.
Any ideas?
Best,
Marcus
--
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/CAFRtmOBw42L51ULyNjOCmKGMOJTcnw44w-r5VjPMocLbpj%2BhfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.