Discussion:
[Maya-Python] API 2.0 and Dynamic attribute
miarmy
2018-04-29 08:21:18 UTC
Permalink
Hi...I couldn't create a dynamic attributes in api 2.0.
In the api 1.0 we can use this code :
OpenMaya.MPxNode.addAttribute(createdAttribute, OpenMaya.MFnDependencyNode.kLocalDynamicAttr)
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/54858525-0590-4e49-a0d5-048a201a5428%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
justin hidair
2018-04-29 17:13:16 UTC
Permalink
I have never used dynamic attributes , but from what I saw in the devkit
(example on dynamic attributes), it is fairly simple , all you need is to
overload setDependentsDirty() and predict what attributes are going to pop
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/1ba158b4-da55-451c-866d-96150afbdbfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Marcus Ottosson
2018-04-30 04:12:22 UTC
Permalink
This works for me.

from maya.api import OpenMaya as om

fn = om.MFnDagNode()
mobj = fn.create("transform", "MyTransform")

fna = om.MFnNumericAttribute(mobj)
attr = fna.create("longName", "shortName", om.MFnNumericData.kDouble, 1.0)
fna.storable = True
fna.writable = True
fna.readable = True
fna.keyable = True
fn.addAttribute(attr)

​
Post by justin hidair
I have never used dynamic attributes , but from what I saw in the devkit
(example on dynamic attributes), it is fairly simple , all you need is to
overload setDependentsDirty() and predict what attributes are going to pop
--
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
To view this discussion on the web visit https://groups.google.com/d/
msgid/python_inside_maya/1ba158b4-da55-451c-866d-
96150afbdbfc%40googlegroups.com
<https://groups.google.com/d/msgid/python_inside_maya/1ba158b4-da55-451c-866d-96150afbdbfc%40googlegroups.com?utm_medium=email&utm_source=footer>
.
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCeRAiZBfTu_t8q6VM-7E-F1T0RA6MBkvE8nenkmU2HYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...