Re: So why won't this conditional work?

Date : Wed, 19 Apr 2006 18:39:14 +0000
To : XSI(at)Softimage.COM
From : "brad" <brad(at)cg-soup.com>
Subject : Re: So why won't this conditional work?
When trying to match two XSI objects, use the following:

objectA.IsEqualTo(ObjectB)
             or
objectB.IsEqualTo(ObjectA)

The objectA and objectB variants themselves are not equal, since they are both objects that consume different memory spaces. However, if they point to the same scene object memory space, the IsEqualTo() method returns true.

This should be much faster en masse than converting and comparing string names.


>  -------Original Message-------
>  I suppose I should have been more clear. Ian your example was an avery
>  dequate solution and would have worked nicely given my current problem,
>  however I was also interested in a more specific solution in case I
>  can't rely on the Index property in the futiure for what I need to
>  match. What I was originally looking for was an exact unmistakable
>  match. I did not make this clear. Sorry.  
>  Thanks again.
>  Joey
>  
>  kim aldis wrote:
>  >
>  > Sorry, I'm misreading the mail.
>  >
>  > > -----Original Message-----
>  > > From: owner-xsi(at)Softimage.COM
>  > > [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Ian Stewart
>  > > Sent: 19-April-2006 17:02
>  > > To: XSI(at)Softimage.COM
>  > > Subject: RE: So why won't this conditional work?
>  > >
>  > > I'm not sure what you are asking, Kim...
>  > > The "This works" is the solution to his problem; I am trying
>  > > to avoid the fact that it is comparing objects, by comparing
>  > > the vertex index instead...
>  > >
>  > > -----Original Message-----
>  > > From: owner-xsi(at)Softimage.COM
>  > > [mailto:owner-xsi(at)Softimage.COM]On Behalf Of kim aldis Posted
>  > > At: April 19, 2006 11:40 AM Posted To: xsi
>  > > Conversation: So why won't this conditional work?
>  > > Subject: RE: So why won't this conditional work?
>  > >
>  > >
>  > > I'm sure you're right but isn't Index a property, in which
>  > > case it should be returning a number, not an object? Or is
>  > > this just another peversity of OM scripting?
>  > >
>  > > > -----Original Message-----
>  > > > From: owner-xsi(at)Softimage.COM
>  > > > [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Ian Stewart
>  > > > Sent: 19-April-2006 16:19
>  > > > To: XSI(at)Softimage.COM
>  > > > Subject: RE: So why won't this conditional work?
>  > > >
>  > > > Someone can correct me if I am wrong, but I believe the
>  > > conditionals
>  > > > are comparing the mini sdk object that _wraps_ the vertex
>  > > in question,
>  > > > and hence are different.
>  > > >
>  > > > This works:
>  > > >     if( oPolyVerts(2).Index == oEdgeVerts(1).Index ){
>  > > >     //would this be a bad test even if the conditional worked
>  > > >
>  > > > Ian Stewart
>  > > > XSI Modeling, Texturing and Stuff
>  > > >
>  > > > -----Original Message-----
>  > > > From: owner-xsi(at)Softimage.COM
>  > > > [mailto:owner-xsi(at)Softimage.COM]On Behalf Of Joey Ponthieux
>  > > Posted At:
>  > > > April 19, 2006 10:37 AM Posted To: xsi
>  > > > Conversation: So why won't this conditional work?
>  > > > Subject: So why won't this conditional work?
>  > > >
>  > > >
>  > > >
>  > > >
>  > > > var oCube = ActiveSceneRoot.AddGeometry( "Cube",
>  > > "MeshSurface" ); var
>  > > > oGeometry = oCube.ActivePrimitive.Geometry; var oEdge =
>  > > > oGeometry.Polygons(0).Edges(1); var oPolyNeighbors =
>  > > > oEdge.NeighborPolygons(1);
>  > > > var oPolyVerts = oPolyNeighbors(0).NeighborVertices(1);
>  > > > var oEdgeVerts = oEdge.NeighborVertices(1);
>  > > >
>  > > > var testA = oPolyVerts(2).SubComponent; var testB =
>  > > > oEdgeVerts(1).SubComponent;
>  > > >
>  > > > //What they look like
>  > > > LogMessage (oPolyVerts(2));
>  > > > LogMessage (oEdgeVerts(1));
>  > > > LogMessage (testA);
>  > > > LogMessage (testB);
>  > > >
>  > > > //test it even further, both select the same exact point
>  > > > SelectGeometryComponents(oPolyVerts(2));    //"cube.pnt[3]"
>  > > > SelectGeometryComponents(oEdgeVerts(1));    //"cube.pnt[3]"
>  > > >
>  > > > //but these conditionals fail
>  > > > if( oPolyVerts(2) == oEdgeVerts(1) ){               //would this be
>  > > > a bad test even
>  > > > if the conditional worked
>  > > >     LogMessage("hello");                    //I expext it
>  > > > is testing if Vertex == Vertex
>  > > >
>  > > > }else if (eval(oPolyVerts(2)) == eval(oEdgeVerts(1)) ){
>  > > > //same results
>  > > > as above,
>  > > >     LogMessage("world")                             //still
>  > > > no joy on the condition
>  > > >
>  > > > }else if (testA == testB ){         //this would be a
>  > > > better test, but still
>  > > > why does this fail
>  > > >     LogMessage("foo")
>  > > >
>  > > > }else{
>  > > >     LogMessage("Why won't this work?")
>  > > > }
>  > > >
>  > > >
>  > > >
>  > > >
>  > > >
>  > > >
>  > > >
>  > > >
>  > > > --
>  > > >
>  > > > Joey Ponthieux
>  > > > NCI Information Systems Inc.
>  > > > NASA Langley Research Center
>  > > > ____________________________________________________________
>  > > > Opinions stated here-in are strictly those of the author and do not
>  > > > represent the opinions of NASA or any other party.
>  > > > ---
>  > > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the
>  > > following text in
>  > > > body:
>  > > > unsubscribe xsi
>  > > >
>  > > > ---
>  > > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the
>  > > following text in
>  > > > body:
>  > > > unsubscribe xsi
>  > > >
>  > >
>  > > ---
>  > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following
>  > > text in body:
>  > > unsubscribe xsi
>  > >
>  > > ---
>  > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following
>  > > text in body:
>  > > unsubscribe xsi
>  > >
>  >
>  > ---
>  > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
>  > unsubscribe xsi
>  
>  --
>  
>  Joey Ponthieux              
>  NCI Information Systems Inc.
>  NASA Langley Research Center
>  ____________________________________________________________
>  Opinions stated here-in are strictly those of the author and
>  do not represent the opinions of NASA or any other party.
>  ---
>  Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
>  unsubscribe xsi
>  

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.