[Maya-Python] Re: Python API: Read outputValue in a custom deformer
> I guess by intermediate object you mean somehing like "ShapeOrig" node > that gets created when a deformer, skincluster, etc is applied and contains > the mesh before the deformer was applied. > Yes, that's it. I haven't written a node like this either, but it looks like you need to write a "geometry filter" node (aka a "deformer"), which is the sort of node that moves verts, like a skincluster or a lattice deformer. Check out "Writing a Deformer Node" here: http://help.autodesk.com/view/MAYAUL/2018/ENU/?guid=__files_Writing_a_Deformer_Node_htm -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/89f68fa9-27d6-48fb-9642-9da4da781b69%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Maya-Python] Re: Python API: Read outputValue in a custom deformer
Thanks Michael for the answer, there are still tons of things I don't understand about the API but you've helped me to start in the correct path, I will do a lot of research and start with the devkit example you told me. I will come back to post (hopefully) the answer. I guess by intermediate object you mean somehing like "ShapeOrig" node that gets created when a deformer, skincluster, etc is applied and contains the mesh before the deformer was applied. -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/9abbe1c4-56d2-4a9c-ae03-72683aa0fbe1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Maya-Python] Re: Python API: Read outputValue in a custom deformer
You're trying to do the point snapper, from around 10:20 in that video? It sounds to me like you need two input meshes - a "source" and a "target" - and you want to store a list of verts that are the same in those two, then when verts move in the source, you want to move verts in a copy of the target, and then output that to an output mesh plug. "Source" I think is what you're currently calling "input". It's the small control mesh. "Target" is part of what you're currently calling "output". It will be the same visible mesh as the output, but it's an input plug on your deformer and (I think) would be connected to the outmesh plugin of an "intermediate object" in the construction history of that mesh. I think if it was me, I'd start by trying to convert polyModifierCmd example in the docs to Python (or do it in C++...this looks like it will be slow in Python), then add a "source" mesh input to that. (You could maybe skip the part where it tries to make a tweak node, for now at least.) On Friday, 13 April 2018 10:24:21 UTC+10, justin hidair wrote: > > Lol , you're gonna have to be clearer than that, still don't understand > what you're trying to do friend ,maybe compare the vtx positions of the > input and output ? cache the output and do it then ? I feel like you want > to access the output node itself , and I don't think it's recommended to be > that savage bro, just sayin' , your example code seem like a basic template > for deformer implementation , it doesn't say alot idk ; > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c5e52529-0676-4d5e-83d3-fe57c1b5cf3c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Maya-Python] Re: Python API: Read outputValue in a custom deformer
Lol , you're gonna have to be clearer than that, still don't understand what you're trying to do friend ,maybe compare the vtx positions of the input and output ? cache the output and do it then ? I feel like you want to access the output node itself , and I don't think it's recommended to be that savage bro, just sayin' , your example code seem like a basic template for deformer implementation , it doesn't say alot idk ; -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/667b7502-2e78-42f0-8863-00fc154f9e49%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Maya-Python] Re: Python API: Read outputValue in a custom deformer
Hi! Sure, this is the complete code: import maya.OpenMayaMPx as OpenMayaMPx import maya.OpenMaya as OpenMaya class BlendNode(OpenMayaMPx.MPxDeformerNode): kPluginNodeId = OpenMaya.MTypeId(0x0002) aBlendMesh = OpenMaya.MObject() aBlendWeight = OpenMaya.MObject() def __init__(self): OpenMayaMPx.MPxDeformerNode.__init__(self) self.matchedVertices = {} def compute(self, pPlug, data): if pPlug == self.outputGeom: iBlendMesh = data.inputValue(BlendNode.aBlendMesh).asMesh() fnBlendMesh = OpenMaya.MFnMesh(iBlendMesh) blendPoints = OpenMaya.MPointArray() fnBlendMesh.getPoints(blendPoints) outputMeshHandle = data.outputValue( self.outputGeom ).asMesh() fnOutputMesh = OpenMaya.MFnMesh(outputMeshHandle) outputPoints = OpenMaya.MPointArray() fnOutputMesh.getPoints(outputPoints) print outputPoints.length() def deform(self, data, itGeo, localToWorldMatrix, mIndex): pass def creator(): return OpenMayaMPx.asMPxPtr(BlendNode()) def initialize(): tAttr = OpenMaya.MFnTypedAttribute() nAttr = OpenMaya.MFnNumericAttribute() BlendNode.aBlendMesh = tAttr.create('blendMesh', 'bm', OpenMaya.MFnData.kMesh) BlendNode.addAttribute( BlendNode.aBlendMesh ) outputGeom = OpenMayaMPx.cvar.MPxDeformerNode_outputGeom BlendNode.attributeAffects(BlendNode.aBlendMesh, outputGeom) BlendNode.aBlendWeight = nAttr.create('blendWeight', 'bw', OpenMaya.MFnNumericData.kFloat) nAttr.setKeyable(True) BlendNode.addAttribute(BlendNode.aBlendWeight) BlendNode.attributeAffects(BlendNode.aBlendWeight, outputGeom) # Make deformer weights paintable cmds.makePaintable('blendNode', 'weights', attrType='multiFloat', shapeMode='deformer') def initializePlugin(obj): plugin = OpenMayaMPx.MFnPlugin(obj, 'Chad Vernon', '1.0', 'Any') try: plugin.registerNode('blendNode', BlendNode.kPluginNodeId, creator, initialize, OpenMayaMPx.MPxNode.kDeformerNode) except: raise RuntimeError, 'Failed to register node' def uninitializePlugin(obj): plugin = OpenMayaMPx.MFnPlugin(obj) try: plugin.deregisterNode(BlendNode.kPluginNodeId) except: raise RuntimeError, 'Failed to deregister node' Basically what I want to do is to compare the vertices of the input mesh and the output mesh and check which ones are in the same worldSpace, store them in a list, and perform the desired operations in the deform method, I want to move the matched output vertices to the input vertices as shown in the video I shared, I'm stuck at reading the points from the output Mesh. -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/e44d8aaf-a6fe-44bb-9241-e373874d8b54%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Maya-Python] Re: Python API: Read outputValue in a custom deformer
Would it be possible to share an example of what you've got so far? -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODxdrFOt1chW1fgdvk3mNWZambVrhGtNvSQdBfqquU0Xw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
[Maya-Python] Re: Python API: Read outputValue in a custom deformer
Hi! I want to read the points' position of the output mesh El miércoles, 11 de abril de 2018, 21:45:55 (UTC-5), justin hidair escribió: > > I don't really understand your concerns , you mean you want to set the > output mesh ? > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/9c42aeb8-c102-4c9b-9c57-baa692ad34c1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Maya-Python] Re: Python API: Read outputValue in a custom deformer
I don't really understand your concerns , you mean you want to set the output mesh ? -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/1ecebc6f-7636-45c9-9e3e-9928dd76e3e6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.