This is an open source Maya plug-in (deformer) with full Python and C++
implementations. It is possible to create a node with the C++ plug-in and
open the maya file with the Python plug-in loaded and the other way around.
The deformer does attract mesh vertices to either: polygons, curves or nurbs-surfaces.
Use cases:
- Sticky area between lips
- Attract simple proxy geometry to real geometry, for lowres rig (this can
also be done with closestPoint nodes in MEL, etc. But with the deformer you
can blend in stuff like normalProjection and you can see the result interactively)
- Attract meshes for modeling
- Attract complex shape to simple shape (both rigged) for deformation in rig
- Attract along normal with limit for shrinkwrap effect
L I N K S:
- Demo video with link to latest version
https://vimeo.com/20002149
- Background information on my blog
https://pazrot3d.blogspot.com/2012/01/openmp-and-maya-api.html
- This was written in my spare time. If you found it useful for rigging or coding, consider supporting the author:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7X4EJ8Z7NUSQW
U S A G E:
The Python version (prAttractNode.py) should run on all Operation Systems
and Maya versions (2008+). The compiled cpp versions (prAttractNode.mll)
are faster, but not compiled for all OSs/Maya versions.
- First load the plug-in via Window->Settings->Prefs->Plug-in Manager
- Automated setup:
Select driver then driven. Then execute MEL command: "prAttractNode"
- Manual setup:
Select driven mesh, then execute (MEL): deformer -type "prAttractNode"
Now two connections have to be made
1. driverTransform.worldMatrix[0] >>> prAttractNode1.inputMatrix
2. driverShape.outShape >>> prAttractNode1.inputShape
A T T R I B U T E S:
default:
- envelope: Multiply deformation effect. (For sticky lips: Increase over 1.0, to overshoot vertices, to have closed geometry after smoothing)
- weights (paintable): Same effect as envelope, but paintable per vertex. Points with zero weights improve performance.
control:
- maxDistance: Only vertices closer than maxDistance get attracted
- projectOnNormal: Project deformation on vertex normal
- normalDirectionLimit: When projectOnNormal is on, limit deformation to positive or negative normal direction
- falloff: Amount of attraction depending on distance (scaled to maxDistance)
- maxDistanceUv: Rescale maxDistance, depending on U value of closest point on target
- closestVertex: When target is polygon, move to closest vertex instead of closest point on surface
rig:
- inputMatrix: pPlane1.worldMatrix[0] / nurbsCircle1.worldMatrix[0] / nurbsPlane1.worldMatrix[0]
- inputShape: pPlaneShape1.outMesh / nurbsCircleShape1.local / nurbsPlaneShape1.local
V E R S I O N S:
2013-09-01 / 0.9.4: compiled for maya 2014/win64
2012-12-22 / 0.9.4: closest vertex for polygon target / project on normal (+/- limit) / compiled for maya 2013/win64
2012-04-24 / 0.9.3: fixed cpp version weights problem, when removing vertices from deformer
2012-01-30 / 0.9.3: added openMP multithreading to cpp version, maxDistanceUv for poly fixed
2012-01-25 / 0.9.3: cpp version, createPrAttractNode def, merged inputShape attrs, ramp init
2011-11-09 / 0.9.2: added switch for curve/polygon/nurbs target
2011-06-23 / 0.9.1: fixed to work in Maya 2012
2011-02-17 / 0.9.0: release
T O D O:
- clean up / speed up
- creation script should work with vertex selection
- (maybe) time dependent falloff
C O D E:
This is a list of things others might learn from the code. I only mention stuff that I could
not find anywhere else and that is often useful:
- How/Where to properly initialize a ramp attribute
- How to setup everything in a single .py/.mll file, for easy installation
- (C++) OpenMP usage (see blogpost under L I N K S)
R E F E R E N C E:
- I saw a video, to have vertices attracted by a curve for sticky lips on https://www.chadvernon.com
- How to read ramp attribute with Python API: jlCollisionDeformer https://vimeo.com/13150202
Please use the Feature Requests to give me ideas.
Please use the Support Forum if you have any questions or problems.
Please rate and review in the Review section.