pymel.core.effects.soft

soft(*args, **kwargs)

Makes a soft body from the object(s) passed on the command line or in the selection list. The geometry can be a NURBS, polygonal, lattice object. The resulting soft body is made up of a hierarchy with a particle shape and a geometry shape, thus: T / T G / P Dynamics are applied to the particle shape and the resulting particle positions then drive the locations of the geometry’s CVs, vertices, or lattice points. With the convert option, the particle shape and its transform are simply inserted below the original shape’s hierarchy. With the duplicate option, the original geometry’s transform and shape are duplicated underneath its parent, and the particle shape is placed under the duplicate. Note that any animation on the hierarchy will affect the particle shape as well. If you do not want then, then reparent the structure outside the hierarchy. When duplicating, the soft portion (the duplicate) is given the name copyOf+ original object name. The particle portion is always given the name original object name+ Particles.None of the flags of the soft command can be queried. The soft -q command is used only to identify when an object is a soft body, or when two objects are part of the same soft body. See the examples.

Flags:
Long name (short name) Argument Types Properties
convert (c) bool ../../../_images/create.gif
 

This tells the command that you want the original object to be the actual deformed object. The particle shape portion of the soft body will be inserted in the same hierarchy as the original, under the same parent (with one additional intervening transform which is initially the identity). If no flags are passed, then this is assumed. The combination -c -h 1 is not valid; if you have this in your scripts, remove the -h 1.

duplicate (d) bool ../../../_images/create.gif
 

This tells the command that you want to make a copy of the original object and use the copy as the deforming geometry. Input connections to the original object are duplicated. You would do this if you wanted to keep the original object in your scene and also have a copy of it that was a soft body. This flag and -dh are mutually exclusive.

duplicateHistory (dh) bool ../../../_images/create.gif
 
This is the same as -d, except that upstream history, is duplicated as well, instead of just input connections. This flag and -d are mutually exclusive.
goal (g) float ../../../_images/create.gif
 

This is the same as -d, but in addition it tells the command that you want the resulting soft body to try to follow the original geometry, using the set goal weight as the value that controls how strongly it is to follow it. A value of 1.0 will try to follow exactly, and a value of 0.0 will not follow at all. The default value is 0.5. This value must be from 0.0 to 1.0. You could use -d with -g, but it is redundant. If you want history to be duplicated, you can use -dh and -g together.

hideOriginal (h) bool ../../../_images/create.gif
 

This flag is used only when duplicating (-d, -g, or -dh). If set to true, whichever of the two objects is NOT the soft object will be hidden. In other words, with -d -h true, the original object will be hidden; with -d -c -h 1 the duplicate object will be hidden. You would typically do this if you want to use the non- dynamic object as a goal for the soft one (see -g) but you do not want it visible in the scene. The flags -h 1 and -c are mutually exclusive.

name (n) unicode  
 

This flag is obsolete. If you wish to give your new soft object a name, use the rename command (or from the UI, use the outliner). Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.soft

Example:

import pymel.core as pm

pm.sphere()
# Result: [nt.Transform(u'nurbsSphere1'), nt.MakeNurbSphere(u'makeNurbSphere1')] #
pm.soft( 'nurbsSphere1', c=True )
# Result: [u'nurbsSphere1Particle'] #

# Creates a sphere named nurbsSphere1 and converts nurbSphere1 into
# a soft object.  The particle portion of the soft object will
# be parented (with its own transform) under nurbsSphere1.

pm.sphere()
# Result: [nt.Transform(u'nurbsSphere2'), nt.MakeNurbSphere(u'makeNurbSphere2')] #
pm.soft( 'nurbsSphere1', d=True )

# Same as the previous example, except that the soft command will make
# a duplicate of nurbsSphereShape1.  The resulting soft body will be
# completely independent of nurbSphere1 and its children.  Input connections
# to nurbsSphereShape1 will be duplicated, but not any upstream history
# (in other words, just plain "duplicate").

pm.sphere()
pm.soft( 'nurbsSphere1', dh=True )

# Same as the previous example, except that upstream history on
# nurbsSphereShape1 will be duplicated as well (equivalent to
# "duplicate history").

pm.sphere()
pm.soft( 'nurbSphere1', g=0.3 )

# This will make a duplicate of the shape under nurbSphere1 (as for -d),
# and  use it as the shape for the newly created soft object.
# The original nurbsSphereShape1 will be made a goal for the particles of
# softy, with a goal weight of 0.3.  This will make those particles try to
# follow nurbSphere1 loosely as it moves around.

pm.soft( 'foobar', q=True )
# Returns true if foobar is a soft object.

pm.soft( 'foobar', 'foobarParticles', q=True )

# Returns true if foobar and foobarParticles are parts of the same
# soft object.  This is useful because when you select a soft body,
# both the overall transform and the particle transform get put into
# the selection list.

Previous topic

pymel.core.effects.setParticleAttr

Next topic

pymel.core.effects.spring

Core

Core Modules

Other Modules

This Page