sure thing, here it is (I am not
attaching it, instead copying the code, because google blocks vb
scripts as attachments.)
Also please note that it is very old and was written in a hurry.
If I were to rewrite this, I would write that with python with
optimization wherever possible.
<code>
'-----------------------------------------------------------------------------------------
'................................................
'...............FBX Exporter.....................
'................................................
'................Alok Gandhi ....................
'................................................
'Scene Preparation for exporting to FBX Format
'Please Save your original scene before running this code as this
will
'delete absolutely everything except the Geo and Export Nulls for
the FBX
'-----------------------------------------------------------------------------------------
'-----------------------------------------------------------------------------------------
'Declaring Variables
'-----------------------------------------------------------------------------------------
Dim str, oNullList, oGeo, PickedElement, ButtonPressed,
ModifierPressed, oStart, oEnd
Dim oWeights, nWeights, tempWeights, srcObj, aweights, env
Dim env2, modelName, oDelList, nullCount
'------------------------------------------------------------------------------------------
'Initializing Variables
'------------------------------------------------------------------------------------------
DeselectAll
Set oRoot = ActiveProject.ActiveScene.Root
str = "FBX_null"
modelName = ""
Set oNullList = GetValue("SelectionList")
Set oDelList = GetValue("SelectionList")
nullCount = 0
'----------------------------------------------------------------------------------------
'Getting Information from User
'----------------------------------------------------------------------------------------
MsgBox "Please Pick the Geo of the Character"
call PickElement( "polygon_mesh", "Select Geo", "Select Geo",_
PickedElement, ButtonPressed, ModifierPressed)
if ButtonPressed <> 0 Then
set oGeo = PickedElement
end if
oStart = InputBox("Start Frame number to Plot Animation
from.")
oEnd = InputBox("End Frame number to Plot Animation up to.")
'-----------------------------------------------------------------------------------------
'Making list of Envelop existing Deformers
'-----------------------------------------------------------------------------------------
Set env = oGeo.Envelopes(0)
Set oSelection = env.Deformers
'-----------------------------------------------------------------------------------------
'Taking a Snapshot of Existing Weight Envelopes
'-----------------------------------------------------------------------------------------
aWeights = env.Weights.Array
'----------------------------------------------------------------------------------------
'Making nulls and contraining them to Existing Deformers and
Adding them to a list
'----------------------------------------------------------------------------------------
For Each item In oSelection
if item.type <> "eff" then
nullCount = nullcount+1
set onull = GetPrim ("null",str & nullcount)
SIApplyCns "Position",
onull.name, item.model &
"." &
item.name
SIApplyCns "Orientation",
onull.name, item.model &
"." &
item.name
oNullList.Add onull
end if
Next
'---------------------------------------------------------------------------------------
'Applying new Nulls as deformers and resetting the envelope
'---------------------------------------------------------------------------------------
FreezeObj env
For each nullitem in oNullList
ApplyFlexEnv oGeo.model & "." & oGeo.name
&";"&
nullitem.name, , 2
Next
set env02 = oGeo.Envelopes(0)
env02.Weights.Array = aWeights
'----------------------------------------------------------------------------------------
'Plotting Animation on the new Nulls
'----------------------------------------------------------------------------------------
For Each item In oNullList
Set onullObj = item
PlotAndApplyAction, onullObj & "/kine.local.pos" ,
"plot",oStart ,_
oEnd, , 20, 3, , , ,True , True, True
PlotAndApplyAction, onullObj & "/kine.local.ori" ,
"plot",oStart ,_
oEnd, , 20, 3, , , ,True , True, True
DeleteObj "Mixer"
RemoveAllCns onullObj
Next
'---------------------------------------------------------------------------------------
'Scene Cleanup
'---------------------------------------------------------------------------------------
modelName =
oGeo.model.name
If
oGeo.model.name <> oRoot.name then
CopyPaste oGeo.FullName, , "Scene_Root", 1
end if
oGeo.Name = "FBX_Geo"
set oDelList = oRoot.FindChildren( ,,, False)
For each item in oDelList
if item.type <> "CameraRoot" then
if item <> oGeo then
for each nullobject in oNullList
if nullobject = item then
flag = True
end if
next
if flag = False then
DeleteObj "B:" & item
end if
end if
end if
Next
</code>