You can use just one piece of geo and one shrinkWrap node for multiple
pieces of geometry.
If you select all your curves and the geo and shrinkWrap there is a flag in
the options to use one shrinkWrap node. In the code you just parse in a
list of curve as an argument to the deformer command
This code will work if you have all your curves selected. Also if you
create the sphere using pymel and assign it to a variable you don't need to
use the PyNode class when connecting the worldMesh attribute.
##############################################
import pymel.core as pm
curves = pm.selected()
sphere = pm.polySphere(n='sphere',sx=400, sy=400)[0]
shrinkWrapNode = pm.deformer(curves, type='shrinkWrap')[0]
sphere.worldMesh[0] >> shrinkWrapNode.targetGeom
shrinkWrapNode.projection.set(4) # closest
shrinkWrapNode.closestIfNoIntersection.set(True)
###############################################
--
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/45730e38-986d-4ad0-ad27-0ebb7d5927ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.