In short, query the inMesh attribute of the referenced mesh.
Here’s some theory behind that.
________________ ______________ _____________
| | | | | |
| ReferencedMesh |----| SomeDeformer |----| VisibleMesh |
|________________| |______________| |_____________|
The referenced mesh will always be in your scene and will always be untouched, with one exception. The manual “edits” you make when pulling vertices by hand or script. The mesh will have an inMesh and outMesh attribute, the inMesh representing it’s original state and outMesh the point at which those edits have been applied.
Thus, if you query the inMesh of the referenced mesh, you should be getting the mesh exactly as it was at the time of being referenced.
Unless! Unless the mesh already had edits in it’s original scene, in which case those would become lost. In that case, and alternative to the above, I’d create a new reference temporarily, query that, and later discard it.
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/811b9658-2558-40d2-9981-fe668bca5811%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import maya.OpenMaya as OM
# read the selection and get the MObjectsel_list = OM.MSelectionList()OM.MGlobal.getActiveSelectionList(sel_list)mesh_obj = OM.MObject()target_obj = OM.MObject()sel_list.getDependNode(0, mesh_obj)
# get the inMesh plugdg_fn = OM.MFnDependencyNode(mesh_obj)plug = dg_fn.findPlug('inMesh')print plug.isNull()# get the MObject from the pluginMesh_obj = plug.asMObject()# initialize the MFnMeshfn_mesh = OM.MFnMesh(inMesh_obj)# get the point arraypoint_array = OM.MPointArray()fn_mesh.getPoints(point_array)print source_point_array.length()# Error: line 1: (kFailure): Unexpected Internal Failure# Traceback (most recent call last):# File "<maya console>", line 15, in <module># File "c:\builds\maya-2014-w64\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 9233, in asMObject# RuntimeError: (kFailure): Unexpected Internal Failure # Maybe this is a stupid suggestion, but have you considered to save/update the data when you assemble/update the shot? (as reference in your metadata, side file or whatever fits best your pipeline).
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/82ab7630-a048-43fd-a3af-b91b3adbecbe%40googlegroups.com.