Re: [script] models vs instances

Date : Tue, 20 Nov 2007 14:41:45 -0500
To : XSI(at)Softimage.COM
From : "Bernard Lebel" <3dbernard(at)gmail.com>
Subject : Re: [script] models vs instances
Interesting.

About getmaster(), you don't have to do error catching. It either
return a source model or nothing. ie:

if oObject.type == c.siModelType and xsi.getmaster( oObject ) == None:
    # object is an non-instance model

I suppose that knowing in advance the object is a model could make
things even better.

Cheers
Bernard



On Nov 20, 2007 2:08 PM, peter boeykens <peter_b(at)skynet.be> wrote:
>
> I tried the two approaches, cant really spot a performance difference.
>
> both take between 3 and 4 seconds on 1600 instances -
> that is including a logmessage listing the instance and the master.
>
> if tried a complete version in OM (the logic I described below), doing
> several tests, with typename, amount of childs, groups, amount of owner,
> typename of owners, untill all conditions were met for an instance. Ten or
> so lines, about four conditions in there, two "for each" loops.
> then I stripped everything down to the bare minimum, assuming that instances
> were selected, immediately navigating to owners, finding a group in there
> and going to the owner, one "for each" loop and one condition. I was
> surprised to see that it didnt affect the speed noticeably.
> And the command getmaster() was the same speed, however you would have to do
> some error catching for when you run it on something which is no instance.
>
>
>
>
>
> > As far as determining if the model is an instance or a real model,
> > it'd be interesting to see how does your approach performs compred to
> > getmaster().
> >
> >
> > Cheers
> > Bernard
> >
> >
> >
> > On Nov 20, 2007 4:27 AM, peter boeykens <peter_b(at)skynet.be> wrote:
> >> > I never thought of checking the instance group. This returns the group
> >> > under the source model, so I guess checking the parent of that group
> >> > will return the source model of the instance. Nice one.
> >> >
> >> > Cheers
> >> > Bernard
> >>
> >>
> >> tried it out and got it to work, something like this:
> >>
> >>  test if its a model with .type
> >>     if it is, find childs and groups,
> >>        if both their counts are at 0,
> >>           find the owners
> >>               for each owner
> >>                    test if its a group
> >>                        if so, test the owner of the group
> >>                                 if its a pass: bingo! we have an
> >> instance.
> >>                                 if it's a model: this is the master
> >> object.
> >>
> >>  its a totally OM way, ran it on a hundred instances in almost no time.
> >>
> >>
> >> ---
> >> 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


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.