super weird, it seems to work fine on 2022, meaning it might not be an
actual deprecation warning. Any chance you can try it with a newer version
of maya ?
Le mercredi 28 juillet 2021 à 18:17:52 UTC-4, juan c a écrit :
> hi
> i am trying to get some value at time:
>
> from maya.api import OpenMaya
> time = OpenMaya.MTime(20)
> context = OpenMaya.MDGContext(time)
> node_obj = OpenMaya.MSelectionList().add('persp').getDependNode(0)
> node = OpenMaya.MFnDependencyNode(node_obj)
> plug = node.findPlug('tx', False)
> value = plug.asMDistance(context)
>
> this freezes maya for a second or two and spits out this error:
>
> # sys:1: DeprecationWarning: Call MPlug::asType() instead. If needed, use
> MDGContextGuard switch context.
>
> it works fine on older maya versions, and using the old api.
>
> any ideas?
> cheers!
>
>
--
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/1a246a62-a110-4dd1-ae7f-792bc1dfff42n%40googlegroups.com.