Hey guys,
Perhaps someone might be able to help me out: I have a piece of code that
creates a bunch of attributes, and afterwards I want to remove them, all using
the api. Here is the test code I wrote to do the same on a small set (this is
in Maya 2012):
import maya.OpenMaya as om
import maya.OpenMayaAnim as oma
depFn = om.MFnDependencyNode()
setObj = depFn.create("objectSet", "SaveLoadAnim")
uAttr = om.MFnUnitAttribute()
startAttr = uAttr.create("Start", "s", om.MFnUnitAttribute.kTime)
uAttr.setStorable(True)
uAttr.setKeyable(False)
endAttr = uAttr.create("End", "e", om.MFnUnitAttribute.kTime)
uAttr.setStorable(True)
uAttr.setKeyable(False)
dgModifier = om.MDGModifier()
dgModifier.addAttribute(setObj, startAttr)
dgModifier.addAttribute(setObj, endAttr)
dgModifier.doIt()
startPlug = depFn.findPlug(startAttr)
endPlug = depFn.findPlug(endAttr)
startPlug.setMTime(oma.MAnimControl.minTime())
endPlug.setMTime(oma.MAnimControl.maxTime())
dgModifier.removeAttribute(setObj, depFn.findPlug('Start').node())
As I run this in Maya, I get a crash, with a rather unhelpful crash stack...
Any ideas?
--
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 post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.