I didn't mean that to sound like a put-down, Sandy. Sorry if it did, it was
just an observation meant to point out the difference between OM and command
scripting when dealing with large numbers of objects.
I did some comparison timings:
I removed the section from your script that copied the child nodes over, for
a fair comparison with mine which doesn't do that, and timed it:
2:26 for 1024 models on a Pentium M 1.7
My script:
1:15.
However, you script creates the nulls in the scene root, mine doesn't, so I
timed how long it took to d&d the nulls back into the parent the models came
from. That took 2:00. So, I figure your script, in real worls terms, took
4:26 against the 1:15 of mine.
I figure I could reduce the time of my script to between 50% and 60% of it's
current time if I could figure out an OM method for deleting.
Bernard, I couldn't find your script on your website. If you give me a
pointer I'll do a comparison timing on that too.
> -----Original Message-----
> From: owner-xsi(at)Softimage.COM
> [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Sandy Sutherland
> Sent: 15 July 2005 12:33
> To: XSI(at)Softimage.COM
> Subject: Re: Model nulls 2 nulls
>
> it is slowish, but it works OK - MM also creates Model Nulls,
> sometimes I change over 1000 - takes a minute or so!
>
> S.
>
> ----- Original Message -----
> From: "kim aldis" <kim(at)aldis.org.uk>
> To: <XSI(at)Softimage.COM>
> Sent: Friday, July 15, 2005 12:48 PM
> Subject: RE: Model nulls 2 nulls
>
>
> > That'll be as slow as hell, Sandy. All those set/getvalues.
> Better to
> > just copy the transform over.
> >
> > > -----Original Message-----
> > > From: owner-xsi(at)Softimage.COM
> > > [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Sandy Sutherland
> > > Sent: 15 July 2005 10:40
> > > To: XSI(at)Softimage.COM
> > > Subject: Re: Model nulls 2 nulls
> > >
> > > Yes:
> > >
> > >
> > > 'JModel2Null
> > > 'javier(at)internarte.com
> > > 'Some Imports bring hierarchies into XSI as Models
> instead of Null
> > > Parents 'This script replaces the Models for Nulls keeping
> > > hierarchy, position,rotation and scale.
> > > 'Use: select all models you want cleaned up as nulls and run
> > > '*************************************************************
> > > **************
> > > *****
> > > option Explicit
> > >
> > >
> > >
> > > dim oSel, oItem, oChild, oChildren, oObj, oNul, index dim
> > > oRoot,oNewKids,oPar,oName,oXpos,oYpos,oZpos,oXscl,oYscl,oZscl,
> > > oXRot,oYRot,oZ
> > > rot
> > >
> > > Set oRoot = ActiveProject.ActiveScene.Root
> > >
> > > set oSel = CreateObject("XSI.Collection") 'collection of Initial
> > > Selection
> > >
> > > oSel.additems selection
> > > FOR index = 0 to oSel.Count -1
> > > set oItem = oSel(index)
> > > oName = oItem.Name
> > > if oItem.type = "#model" then
> > > oXpos = GetValue (oItem &".kine.global.pos.posx")
> > > oYpos = GetValue (oItem &".kine.global.pos.posy")
> > > oZpos = GetValue (oItem &".kine.global.pos.posz")
> > >
> > > oXscl = GetValue (oItem &".kine.global.scl.sclx")
> > > oYscl = GetValue (oItem &".kine.global.scl.scly")
> > > oZscl = GetValue (oItem &".kine.global.scl.sclz")
> > >
> > > oXrot = GetValue (oItem &".kine.global.rotx")
> > > oYrot = GetValue (oItem &".kine.global.roty")
> > > oZrot = GetValue (oItem &".kine.global.rotz")
> > > set oPar = oItem.parent
> > > GetPrim "Null", oName&"_m2n"
> > > set oNul = selection(0)
> > > setvalue oNul &".kine.global.pos.posx", oXpos
> > > setvalue oNul &".kine.global.pos.posy", oYpos
> > > setvalue oNul &".kine.global.pos.posz", oZpos
> > > setvalue oNul &".kine.global.rotx", oXrot
> > > setvalue oNul &".kine.global.roty", oYrot
> > > setvalue oNul &".kine.global.rotz", oZrot
> > > setvalue oNul &".kine.global.scl.sclx", oXscl
> > > setvalue oNul &".kine.global.scl.scly", oYscl
> > > setvalue oNul &".kine.global.scl.sclz", oZscl
> > > set oNewKids = CreateObject("XSI.Collection")
> > >
> > > set oChildren = oItem.findchildren
> > >
> > > for each oChild in oChildren
> > > set oPar = oChild.parent
> > > if oPar = oItem then
> > > oNewKids.add oChild
> > > logmessage oChild
> > > end if
> > > oNul.addChild oNewKids
> > >
> > > NEXT
> > > deleteobj oItem
> > > end if
> > > DeselectAll
> > >
> > > NEXT
> > >
> > > ----- Original Message -----
> > > From: "Stefan Andersson" <sanders3d(at)gmail.com>
> > > To: <XSI(at)Softimage.COM>
> > > Sent: Friday, July 15, 2005 11:18 AM
> > > Subject: Model nulls 2 nulls
> > >
> > >
> > > > Anyone has a script that converts Model nulls to regular nulls?
> > > >
> > > > regards
> > > > stefan andersson
> > > >
> > > >
> > > > --
> > > > http://www.sanders3d.com/
> > > >
> > > > ---
> > > > 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