Last active
January 21, 2018 17:49
-
-
Save PeterDrakeNichols/5a8a5cfc7aa8c191e56a44ccb4bdadf4 to your computer and use it in GitHub Desktop.
softTarget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.mel as mm | |
from rigit.v1_0.utils import hair | |
def makeSoftTarget(prefix, smoothness = 10, parent = None): | |
''' | |
a function for making a single transform with soft body effects | |
@param prefix: str, prefix for naming objects | |
@param smoothness: float, how loosely particle fallows, 10 is very loose 0 is 100% fallow | |
@param parent: str, where should parts be parented? | |
''' | |
sftBase = mc.polyPlane(n=prefix + 'Base_sft', sx=1, sy=1)[0] | |
sftPrt = 'copyOf' + sftBase | |
mm.eval('dynCreateNSoft 1 0 1 .5 1;') | |
sftShape = mc.rename(sftPrt + 'ParticleShape', prefix + 'Shape_sft') | |
sftPrt = mc.rename(sftPrt, prefix + 'Target_sft') | |
mc.setAttr(sftShape + '.goalSmoothness', smoothness) | |
folData = hair.makeFollicleOnSurface( surface = sftPrt, prefix = prefix, uvCoordinates = [.5, .5], ) | |
sftTarget = mc.group(n=prefix + 'target_grp', em=1) | |
mc.parent(sftTarget, folData[0]) | |
sftMainGrp = mc.group(sftBase, sftPrt, folData[0], n = prefix + 'softTarget_grp') | |
if parent: | |
mc.parent(sftMainGrp, parent) | |
return { | |
'sftBase':sftBase, | |
'sftTarget': sftTarget, | |
'sftMainGrp': sftMainGrp, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment