pymel.core.general.transformCompare¶
- transformCompare(*args, **kwargs)¶
Compares two transforms passed as arguments. If they are the same, returns 0. If they are different, returns 1. If no transforms are specified in the command line, then the transforms from the active list are used.
Flags:
Long Name / Short Name Argument Types Properties root / r bool Compare the root only, rather than the entire hierarchy below the roots. Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.transformCompare
Example:
import pymel.core as pm # Create some joints # pm.select( d=True ) pm.joint( p=(-3.226531, 0, -4.866136) ) # Result: nt.Joint(u'joint1') # pm.joint( p=(2.817897, 0, -4.016915) ) # Result: nt.Joint(u'joint2') # pm.joint( 'joint1', e=True, zso=True, oj='xyz', sao='yup' ) # Result: nt.Joint(u'joint2') # # Compare 2 different joints, a 1 will be returned # pm.select( 'joint1', 'joint2', r=True ) pm.transformCompare() # Result: 1 # # Duplicate joint1 and compare the duplicate # pm.select( 'joint1', r=True ) pm.duplicate() # Result: [nt.Joint(u'joint3')] # pm.select( cl=True ) pm.select( 'joint1', 'joint3', r=True ) pm.transformCompare() # Result: 0 #