RE: get object name from scripted op

Date : Wed, 31 Jan 2007 16:14:40 -0800
To : XSI(at)Softimage.COM
From : Bradley Gabe <withanar(at)stanwinston.com>
Subject : RE: get object name from scripted op
>From our siggraph presentation three years ago, I had to use this exact
"naughty" workaround on the Dementor animation system in Harry Potter 3:

We were using XSI to compose animated crowds, and each crowd member
needed a large, clear number displayed above its icon in the scene.

That number is what we plugged into all of the action sources and used
as a suffix in order to pass the animation info through the rest of the
pipeline. To facilitate this, we needed to make sure there were no
overlaps, so we wanted to use the Model name as a guarantee of unique
namespace. 

The quickest solution at the time was to use a SCOP with a regular
expression to pull the number off the end of the Model names, then drive
a text generation operator to display the number in the scene.

At the time, Jill and Simon were threatening to cut off SCOP access to
the findObject and Collection.Items and their ilk to prevent such hacks
in the future. Fortunately they didn't. ;^)

-Brad

> Well the rules are that you don't have the right to traverse the graph
> inside from inside an Update function of an operator.  When the graph
> is traversed, each node needs to be evaluated and that's done by
> evaluating operators.  
> So if an operator goes and traverses the graph, that means the
> evaluation order is non-determinstic and we can get into situation
> where the scene do not refresh properly, especially if A is dependant
> on B and B is asking for A.  It's possible that accessing the 3dobject
> is 'safe' since the parameters are not technically dependant on the
> kinestate.
>  
> IMHO it might be safer to take the string from the value of output and
> trim it to get what you need.  just by curiosity, what are you going
> to do with the name of object?
>         -----Original Message-----
>         From: owner-xsi(at)Softimage.COM [mailto:owner-
>         xsi(at)Softimage.COM]On Behalf Of Serguei Kalentchouk
>         Posted At: Wednesday, January 31, 2007 5:38 PM
>         Posted To: xsi
>         Conversation: get object name from scripted op
>         Subject: RE: get object name from scripted op
>         
>         
>         
>         The problem you might run into is that if you draw a value
>         from an object that is not defined as an input then in some
>         cases if that object is changed the SCOP might not mark is a
>         dirty and hence no update will take place.
>         
>          
>         
>         However even though it is âevilâ I still find myself doing
>         same thing in many cases.
>         
>         I think there needs to be a method or property in the scop
>         that gives you the target object the operator is on.
>         
>          
>         
>                                        
>         ______________________________________________________________
>         
>         From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]
>         On Behalf Of Mathieu Leclaire
>         Sent: January 31, 2007 5:27 PM
>         To: XSI(at)Softimage.COM
>         Subject: RE: get object name from scripted op
>         
>         
>          
>         
>         Well, it all seems to work fine... why is it so evil? What can
>         I expect to go wrong? And if it ain't the right way then
>         please show me the right one!
>         
>         
>                 -----Original Message-----
>                 From: owner-xsi(at)Softimage.COM [mailto:owner-
>                 xsi(at)Softimage.COM]On Behalf Of Luc-Eric Rousseau
>                 Sent: Wednesday, January 31, 2007 4:58 PM
>                 To: XSI(at)Softimage.COM
>                 Subject: RE: get object name from scripted op
>                 
>                 It's evil though. You shouldn't be doing a GetValue in
>                 an operator on an object that you are not connected to
>                 as input.
>                 
>                 
>                         -----Original Message-----
>                         From: owner-xsi(at)Softimage.COM [mailto:owner-
>                         xsi(at)Softimage.COM]On Behalf Of Mathieu
>                         Leclaire
>                         Posted At: Wednesday, January 31, 2007 4:52 PM
>                         Posted To: xsi
>                         Conversation: get object name from scripted op
>                         Subject: RE: get object name from scripted op
>                         
>                         Oh right... why didn't I think of that!? Yeah,
>                         I don't use scops much anymore myself but in
>                         this case it's much quicker to do it that way.
>                         Thanks!
>                         
>                         
>                                 -----Original Message-----
>                                 From: owner-xsi(at)Softimage.COM
>                                 [mailto:owner-xsi(at)Softimage.COM]On
>                                 Behalf Of Graham D Clark
>                                 Sent: Wednesday, January 31, 2007 4:37
>                                 PM
>                                 To: XSI(at)Softimage.COM
>                                 Subject: Re: get object name from
>                                 scripted op
>                                 
>                                 (its been a while I don't use scops
>                                 too much now.)
>                                 
>                                 
>                                 I recall you can use
>                                 dictionary,getobject and traverse up.
>                                 
>                                 
>                                 -----------------------
>                                 Graham D Clark (avail soon)
>                                 http://www.grahamdclark.com
>                                 http://www.linkedin.com/in/grahamclark 
>                                 http://www.xsibase.com/articles.php?
>                                 detail=117 
>                                 
>                                  
>                                 
>                                 
>                                 On 1/31/07, Mathieu Leclaire
>                                 <mleclair(at)hybride.com> wrote: 
>                                 
>                                 Heu, this might sound weird but how
>                                 can I get, from within the scripted
>                                 operator, the name of the object on
>                                 which the scripted operator is
>                                 applied? Lets say for example the
>                                 output of the scripted op is "
>                                 null.kine.local", well, I want to
>                                 extract the string "null". If I do a
>                                  LogMessage(out.value);  it will log
>                                 me "null.kine.local". So I though I
>                                 would try getting it using
>                                 out.value.parent.parent   but it gives
>                                 me an error message. I must be missing
>                                 something obvious but I can't seem to
>                                 find it. Anyone has a suggestion?
>                                 Thanks.
>                                 
>                                 
>                                 Mathieu Leclaire
>                                 R&D Programmer
>                                 Hybride Technologies
>                                 
>                                 


---
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.