Created
December 23, 2022 19:08
-
-
Save redglasses67/286b1b208c13c8fcb68e969e19449974 to your computer and use it in GitHub Desktop.
removeAttribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.api.OpenMaya as om2 | |
selList = om2.MGlobal.getActiveSelectionList() | |
mObject = selList.getDependNode(0) | |
fnDepNode = om2.MFnDependencyNode(mObject) | |
floatLongName = "floatLongName" | |
dstAttrPlug = fnDepNode.findPlug(floatLongName, False) | |
if fnDepNode.hasAttribute(floatLongName): | |
fnDepNode.removeAttribute(dstAttrPlug.attribute()) | |
# MDGModifier を使う方法もあります | |
# dgModifier = om2.MDGModifier() | |
# dgModifier.removeAttribute(fnDepNode.object(), dstAttrPlug.attribute()) | |
# dgModifier.doIt() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment