|
Salut Christopher ;-)
Thanks for the advice.
Right now I'm using a somewhat ugly but effective approach:
def compareTransforms( oTransform1, oTransform2 ):
"""
RETURN VALUE: boolean
"""
bSame = True
if round( oTransform1.PosX, 4 ) != round( oTransform2.PosX, 4 ): bSame = False
elif round( oTransform1.PosY, 4 ) != round( oTransform2.PosY
, 4 ): bSame = False
elif round( oTransform1.PosZ, 4 ) != round( oTransform2.PosZ, 4 ):
bSame = False
elif round( oTransform1.RotX, 4 ) != round( oTransform2.RotX, 4 ):
bSame = False
elif round( oTransform1.RotY, 4 ) != round( oTransform2.RotY, 4 ): bSame = False
elif round( oTransform1.RotZ, 4 ) != round( oTransform2.RotZ
, 4 ): bSame = False
elif round( oTransform1.SclX, 4 ) != round( oTransform2.SclX, 4 ):
bSame = False
elif round( oTransform1.SclY, 4 ) != round( oTransform2.SclY, 4 ):
bSame = False
elif round( oTransform1.SclZ, 4 ) != round( oTransform2.SclZ, 4 ): bSame = False
#~ if not bSame: #~ xsi.logmessage( '< bb_ReplaceModels > :: Not same transforms.', c.siWarning
) #~ else:
#~ xsi.logmessage( ' < bb_ReplaceModels > :: Same transforms.' )
return bSame
I wish there was a one-liner way to do this.
Bernard
On 1/9/07, Christopher Crouzet <
christopher.crouzet(at)gmail.com> wrote: > A such function that compare two CTransformation objects exists in the C++ > API. > > However, in scripting language I don't see anything equivalent (in
5.1), > except the 'Equals' method that applies on SIVector3 and SIQuaternion > objects which means that you have to first extract them from the > SITransformation object by using the 'GetRotation', 'GetTranslation' and
> 'GetScaling' methods. > > > Hope it helps, > Christopher. > > (wouhou, my first post on this list, hello everyone !!) > > > > On 1/9/07, Bernard Lebel <
3dbernard(at)gmail.com> wrote: > > > > Hello, > > > > Is there a quick way, say a one-liner, to determine if two transforms > > hold the same values?
> > > > I have two objects, I just want to know if they have the same > > transforms. If they do, then do something. If not, do something else. > > > > > > Thanks
> > Bernard > > --- > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: > > unsubscribe xsi > > >
>
|