' freeze body parts, delete key frames found_ignore_prop = 0 ImportCrosswalkOptionsExist = 0 ExportCrosswalkOptionsExist = 0 delete_keyframes sub delete_keyframes set oProps = ActiveProject.ActiveScene.Root for each prop in oProps.Properties if instr(1, prop.Name, "ignore_Oni_selection_event") = 1 then found_ignore_prop = 1 end if next if found_ignore_prop = 0 then 'create property (must also have content, in this case "yes") oProps.AddProperty( "UserDataBlob", , "ignore_Oni_selection_event" ).value = "yes" else oProps.Properties( "ignore_Oni_selection_event" ).value = "yes" end if for each prop in oProps.Properties if instr(1, prop.Name, "ImportCrosswalkOptions") = 1 then ImportCrosswalkOptionsExist = 1 end if next for each prop in oProps.Properties if instr(1, prop.Name, "ExportCrosswalkOptions") = 1 then ExportCrosswalkOptionsExist = 1 end if next redim body_parts (18) body_parts(0)="pelvis": body_parts(1)="mid" : body_parts(2)="chest" : body_parts(3)="neck" : body_parts(4)="head" body_parts(5)="right_thigh" : body_parts(6)="right_calf" : body_parts(7)="right_foot" body_parts(8)="left_thigh" : body_parts(9)="left_calf" : body_parts(10)="left_foot" body_parts(11)="right_shoulder" : body_parts(12)="right_biceps" : body_parts(13)="right_wrist" : body_parts(14)="right_handfist" body_parts(15)="left_shoulder" : body_parts(16)="left_biceps" : body_parts(17)="left_wrist" : body_parts(18)="left_handfist" redim LastKeyFrames(5) dim firstKeyFrame, lastKeyFrame dim i, j, tmp SetValue( "PlayControl.Current" ), 0 for c=0 to 18 SelectObj body_parts(c) FreezeObj ' error prevention in case no key exist dim objname, xp, yp, zp, xr, yr, zr objname = selection(0).name xp = selection(0).posx.value yp = selection(0).posy.value zp = selection(0).posz.value xr = selection(0).rotx.value yr = selection(0).roty.value zr = selection(0).rotz.value dim saveStr1, saveStr2 Translate , xp, yp, zp, siAbsolute, siGlobal, siObj, siZYX, True, , , , , , , , , 0 Rotate , xr, yr, zr, siRelative, siGlobal, siObj, siXYZ, , , , , , , , 0 saveStr1 = objname & ".kine.local.posx," & _ objname & ".kine.local.posy," & _ objname & ".kine.local.posz" saveStr2 = objname & ".kine.local.rotx," & _ objname & ".kine.local.roty," & _ objname & ".kine.local.rotz" ' got data for frame 0, not let's save it SaveKey saveStr1, 0 SaveKey saveStr2, 0 if cint(selection(0).posx.Source.Keys.Count) > 0 then LastKeyFrames(0) = cint(selection(0).posx.Source.Keys(cint(selection(0).posx.Source.Keys.Count) - 1).Time) end if if cint(selection(0).posy.Source.Keys.Count) > 0 then LastKeyFrames(1) = cint(selection(0).posy.Source.Keys(cint(selection(0).posy.Source.Keys.Count) - 1).Time) end if if cint(selection(0).posz.Source.Keys.Count) > 0 then LastKeyFrames(2) = cint(selection(0).posz.Source.Keys(cint(selection(0).posz.Source.Keys.Count) - 1).Time) end if if cint(selection(0).rotx.Source.Keys.Count) > 0 then LastKeyFrames(3) = cint(selection(0).rotx.Source.Keys(cint(selection(0).rotx.Source.Keys.Count) - 1).Time) end if if cint(selection(0).roty.Source.Keys.Count) > 0 then LastKeyFrames(4) = cint(selection(0).roty.Source.Keys(cint(selection(0).roty.Source.Keys.Count) - 1).Time) end if if cint(selection(0).rotz.Source.Keys.Count) > 0 then LastKeyFrames(5) = cint(selection(0).rotz.Source.Keys(cint(selection(0).rotz.Source.Keys.Count) - 1).Time) end if logmessage "last key at frame: " & LastKeyFrames(0) For i = 0 To 5 For j = 0 To 5 If LastKeyFrames(i) > LastKeyFrames(j) Then tmp = LastKeyFrames(i) LastKeyFrames(i) = LastKeyFrames(j) LastKeyFrames(j) = tmp End If Next Next ' let's be sure we get them all: plus 1 cuz of possible rounding errors lastKeyFrame = cint (LastKeyFrames(0)) + 1 For i = 0 To 5 For j = 0 To 5 If LastKeyFrames(i) < LastKeyFrames(j) Then tmp = LastKeyFrames(i) LastKeyFrames(i) = LastKeyFrames(j) LastKeyFrames(j) = tmp End If Next Next firstKeyFrame = cint (LastKeyFrames(0)) - 1 SelectKeysInTimespan ".kine.local.posx,.kine.local.posy,.kine.local.posz,.kine.local.rotx,.kine.local.roty,.kine.local.rotz", _ siSetKeySelection, firstKeyFrame, lastKeyFrame, siInputParameters DeleteKeys ".kine.local.posx,.kine.local.posy,.kine.local.posz,.kine.local.rotx,.kine.local.roty,.kine.local.rotz", _ firstKeyFrame, lastKeyFrame, , True, siInputParameters next ' make ModTool forget keyframe existed ' save selection as dae, delete objects and reload dae SelectObj body_parts(0) for c=1 to 18 AddToSelection body_parts(c) next ' save as dae, selection only, no extras if ExportCrosswalkOptionsExist = 0 then CreateExportCrosswalkOptions , "ExportCrosswalkOptions" end if SetValue "ExportCrosswalkOptions.Format", 1 SetValue "ExportCrosswalkOptions.ExportSelectionOnly", True SetValue "ExportCrosswalkOptions.ExportXSIExtra", False ' CHB = Character Hierarchy Builder SetValue "ExportCrosswalkOptions.Filename", XSIUtils.ResolvePath("$SI_HOME/") & "Oni_CHB_temp.dae" ExportCrosswalk "ExportCrosswalkOptions" DeleteObj if ImportCrosswalkOptionsExist = 0 then CreateExportCrosswalkOptions , "ImportCrosswalkOptions" end if SetValue "ImportCrosswalkOptions.Filename", XSIUtils.ResolvePath("$SI_HOME/") & "Oni_CHB_temp.dae" ImportCrosswalk "ImportCrosswalkOptions" if found_ignore_prop = 1 then oProps.Properties( "ignore_Oni_selection_event" ).value = "no" end if end sub