Create polygonal mesh bounding boxes for geometry. Can also create a single bounding box per hierarchy.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
bakeAnimation (ba) | bool | ||
|
|||
combineMesh (cm) | bool | ||
|
|||
endTime (et) | time | ||
|
|||
keepOriginal (ko) | bool | ||
|
|||
name (n) | unicode | ||
|
|||
nameSuffix (ns) | unicode | ||
|
|||
sampleBy (sb) | time | ||
|
|||
shaderColor (sc) | float, float, float | ||
|
|||
single (s) | bool | ||
|
|||
startTime (st) | time | ||
Used with bakeAnimation flag. Specifies the start time of the baking process.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
Derived from mel command maya.cmds.geomToBBox
Example:
import pymel.core as pm
# Create two poly spheres and parent them together
#
pm.polySphere()
# Result: [nt.Transform(u'pSphere1'), nt.PolySphere(u'polySphere1')] #
pm.move(-1, 0, 3)
pm.polySphere()
# Result: [nt.Transform(u'pSphere2'), nt.PolySphere(u'polySphere2')] #
pm.move(3, 0, -1)
pm.parent( 'pSphere2', 'pSphere1' )
# Result: [nt.Transform(u'pSphere2')] #
# Select the parent sphere
#
pm.select( 'pSphere1', replace=True )
# Create a bounding box per shape in the object hierarchy selected,
# add a name and suffix for that bounding box and add a RGB color for the
# shader color.
#
pm.geomToBBox(name='MyBBox', nameSuffix='_perShape', shaderColor=[0,1,0.043])
# Result: [u'MyBBox_perShape', u'MyBBox_perShape1'] #
# Create two poly spheres and parent them together
#
pm.polySphere()
# Result: [nt.Transform(u'pSphere1'), nt.PolySphere(u'polySphere1')] #
pm.move(-1, 5, 3)
pm.polySphere()
# Result: [nt.Transform(u'pSphere2'), nt.PolySphere(u'polySphere2')] #
pm.move(3, 5, -1)
pm.parent( 'pSphere2', 'pSphere1' )
# Result: [nt.Transform(u'pSphere2')] #
# Select the parent sphere
#
pm.select( 'pSphere1', replace=True )
# Create one bounding box for the entire hierarchy selected,
# add a name and suffix for that bounding box and add a RGB color for the
# shader color.
#
pm.geomToBBox(single=True, name='MyBBox', nameSuffix='_hierarchy', shaderColor=[0.928,0.460,1])
# Result: [u'MyBBox_hierarchy'] #
# Create and simple animation and bake the animation on the bounding box for
# a specific time frame and incremental evaluation time.
pm.polySphere(name="BouncingBall")
# Result: [nt.Transform(u'BouncingBall'), nt.PolySphere(u'polySphere1')] #
pm.currentTime(1)
# Result: 1.0 #
pm.setKeyframe()
# Result: 10 #
pm.currentTime(5)
# Result: 5.0 #
pm.move( 0, 10, 0)
pm.setKeyframe()
# Result: 10 #
pm.currentTime(9)
# Result: 9.0 #
pm.move( 0, 0, 0)
pm.setKeyframe()
# Result: 10 #
pm.geomToBBox(keepOriginal=True, name="BakedAnimBBox", bakeAnimation=True, startTime=3, endTime=7, sampleBy=0.5)
# Result: [u'BakedAnimBBox1'] #
pm.currentTime(1)
# Result: 1.0 #