Re: Model nulls 2 nulls

Date : Fri, 15 Jul 2005 11:40:26 +0200
To : <XSI(at)Softimage.COM>
From : "Sandy Sutherland" <sandy(at)refinery.co.za>
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


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.