Object Hierarchy | Related C++ Class: Mixer
Mixer
v4.0
This object represents the Animation Mixer, which is nested
directly under the Model. The Mixer object
is a ClipContainer and so provides
access to the standard elements of a mixer: its Tracks, Transitions,
Clips, and ClipRelations.
You can check if an object has a mixer by calling the Model.HasMixer method. If it doesn't, you
can create one with the Model.AddMixer method.
The Mixer stores all of the Model's
high-level animation and audio clips, so when you call its base
property ClipContainer.Clips, you get a
collection of clips only on the current model (there is no
recursion). If any of these are compound clips, none of its
contents are returned, just the top level.
/*
This example demonstrates how to find all sources in the scene when there
are several levels of models all with their own sources. Something to note
is that only ActionSources are returned from the Model.
*/
NewScene( null, false );
// Set up the scene (details are at the bottom of this example)
var m1 = ActiveSceneRoot.AddModel(); m1.Name = "Larry"
var m2 = m1.AddModel(); m2.Name = "Curly"
var m3 = m2.AddModel(); m3.Name = "Moe"
CreateModelSource( ActiveSceneRoot );
CreateImageSource(m1);
CreateShapeAction(m2);
CreateAudioSource(m3);
// Start with the top level model (the Scene_Root) and the use the Models property
// to search recursively. Since all action sources are stored under the model, once
// we've visited each model, we will have found each source in the scene.
LogMessage( "RecursiveModelSearch results: " + RecursiveModelSearch(ActiveSceneRoot) );
// Expected Results:
// INFO : MODEL: Scene_Root
// INFO : MODEL: Larry
// INFO : MODEL: Curly
// INFO : MODEL: Moe
// INFO : MODEL: Biped_Skeleton_Generated
// INFO : RecursiveModelSearch results: Curly.Mixer.ShapeKey,Curly.Mixer.Shape_ClusterClip_source,Curly.Mixer.ShapeKey1,Curly.Mixer.ShapeKey2
function RecursiveModelSearch( in_model )
{
LogMessage( "MODEL: " + in_model.FullName );
// Start with the top-level model
// Get a comma-delimited string of all sources found under this model
var foundsrcs = ( in_model.Sources ) ? in_model.Sources.GetAsText() : "";
// For every model nested within this scene, check it for sources
var mdl = new Enumerator( in_model.Models(true) );
for ( ; ! mdl.atEnd(); mdl.moveNext() ) {
LogMessage( "MODEL: " + mdl.item().FullName );
var results = in_model.Sources;
if ( results ) {
foundsrcs += "," + mdl.item().Sources.GetAsText();
}
}
// Correct any instances of a double or leading/trailing commas which may have
// occurred when reading a model with no sources
foundsrcs = foundsrcs.replace( /,,/g, "," );
foundsrcs = foundsrcs.replace( /^,/, "" );
foundsrcs = foundsrcs.replace( /,$/, "" );
// Return the string, which can be used by the caller to set an XSICollection,
// populate a combo box, etc.
return foundsrcs;
}
// This is an handy function to have around if you're going to create an action
// source or clip on a parameter that is in a nested model (ie., not directly
// under the Scene_Root) because AddClip will force a mapping template if your
// parameter is not relative.
function GetRelativeNameForTarget( in_param )
{
var mdlname = in_param.Model.FullName;
if ( mdlname == "Scene_Root" ) {
return in_param.FullName;
} else {
var tmp = in_param.FullName;
var re = new RegExp( mdlname + ".", "i" );
return tmp.replace( re, "" );
}
}
// Helper functions to create & instantiate sources
function CreateShapeAction( in_model )
{
var obj = in_model.AddGeometry( "Cone", "MeshSurface" );
var target = obj + ".pnt[0,2,5,8,11,14,17,20,23]"
SetSelFilter( "Vertex" );
SelectGeometryComponents( target );
Translate( null, 0, -2, 0, siAbsolute, siPivot, siObj, siY, null,
null, null, null, null, null, null, null, null, 1 );
var clip = SaveShapeKey( target, null, null, 1, null, null, null,
null, siShapeObjectReferenceMode );
Translate( null, 0, -1, 0, siAbsolute, siPivot, siObj, siY, null,
null, null, null, null, null, null, null, null, 1 );
SaveShapeKey( target, null, null, 36, null, null, null, null,
siShapeObjectReferenceMode );
Translate( null, 0, 0, 0, siAbsolute, siPivot, siObj, siY, null,
null, null, null, null, null, null, null, null, 1 );
SaveShapeKey( target, null, null, 67, null, null, null, null,
siShapeObjectReferenceMode );
}
function CreateAudioSource( in_model )
{
var mixmaster = ( in_model.HasMixer() ) ? in_model.Mixer : in_model.AddMixer();
var aud_track = AddTrack( in_model, mixmaster, 2 );
var aud_path = XSIUtils.BuildPath(
Application.InstallationPath(siFactoryPath),
"Data", "XSI_SAMPLES", "Audio", "Torefaction.wav"
);
var aud_src = ImportAudio( in_model, aud_path );
AddAudioClip( in_model, aud_src, mixmaster, aud_track, 22 );
}
function CreateImageSource( in_model )
{
var cube = in_model.AddGeometry( "Cube", "MeshSurface" );
SelectObj( cube );
ApplyShader( null, null, null, siUnspecified, siLetLocalMaterialsOverlap );
CreateProjection( cube, siTxtSpherical, siTxtDefaultSpherical, "", "Texture_Projection", null, siRelDefault, "" );
BlendInTextureLayers( "Image", cube, 1, false, siReplaceAndBlendInPreset, true, true, false, false);
}
function CreateModelSource()
{
ImportModel( "S:\\Data\\XSI_SAMPLES\\Models\\Biped_Skeleton_Generated.emdl", null, true,
null, null, null, null );
}
|
#
# This example demonstrates how to access every clip in the specified model.
# In this case there are two clips in different models and only the top
# model has been queried, so only the constraint action will be returned
#
def FindClipsUnderModel( in_model ) :
# First make sure we have a mixer
if in_model.HasMixer()==0 :
return ""
mixer = in_model.Mixer
# We will return a comma-delimited string of all sources found
foundclips = ""
Application.LogMessage( "\n\tSearching " + mixer.FullName + " for clips...", c.siComment );
if mixer.Clips.Count > 0 :
for clip in mixer.Clips :
Application.LogMessage( "\t" + clip.FullName + " is a " + ClassName(clip) + "/" + clip.Type, c.siComment )
if foundclips == "" :
foundclips = foundclips + clip.FullName
else :
foundclips = foundclips + "," + clip.FullName
else :
Application.LogMessage( "\tNo sources found on " + mixer.FullName, c.siComment )
return foundclips
# Helper function to strip off model name for FullNames
def GetRelativeNameForTarget( in_param ) :
mdlname = in_param.Model.FullName
if mdlname == "Scene_Root" :
return in_param.FullName
else :
tmp = in_param.FullName
return tmp.replace( mdlname + ".", "" )
# Helper function to create constraint-based action
def CreateConstraintAction( in_model ) :
# Build Orientation Constraint to null from cylinder
a = in_model.AddNull()
Application.SelectObj(a)
Application.Translate("", 5.5173674053756, 2.96222253259053,
-0.296222253259053, c.siRelative, c.siView, c.siObj,
c.siXYZ, "", "", "", "", "", "", "", "", "", 1)
b = in_model.AddGeometry("Cylinder", "MeshSurface" )
Application.SetUserPref( "SI3D_CONSTRAINT_COMPENSATION_MODE", 1)
Application.ApplyCns( "Orientation", b, a, 1 )
Application.SetUserPref( "SI3D_CONSTRAINT_COMPENSATION_MODE", 0 )
# Relative names (needed for AddClip under a nested model)
relB = GetRelativeNameForTarget( b )
# Make it into an Action (constraints are always on global Kinematics)
# Get list of parameters to mark
params = relB + "*/.kine.global.ori.euler"
Application.StoreAction( in_model, params, 4,
"StoredAnimCnsAction", 1, 1, 100, 0, 0, 1, 1 )
# Helper function to create fcurve-based action
def CreateFCurveAction( in_model ) :
obj = in_model.AddNull()
# Set FCurves on the null's scaling
keys = [ 5, 1.2, 20, 1.7, 45, 2.0, 90, 2.5 ]
obj.sclx.AddFCurve2( keys )
keyfactor = 0.66
posfactor = 0.54
i=0
while i < len(keys) :
keys[i] = keys[i] + keyfactor
keys[i+1] = keys[i+1] * posfactor
i = i + 2
obj.scly.AddFCurve2( keys )
keyfactor = 0.27
posfactor = 0.44
while i < len(keys) :
keys[i] = keys[i] - keyfactor
keys[i+1] = keys[i+1] * posfactor
i = i + 2
obj.sclz.AddFCurve2( keys )
# Get list of parameters to mark
params = obj.sclx.FullName + "," + obj.scly.FullName + "," + obj.sclz.FullName
# Make the FCurves into an Action
src = Application.StoreAction( in_model, params, 2, "StoredAnimFCrvAction" )
clip = Application.AddClip( in_model, src )
# Add some clip effects to it
toclip = clip.Name + ".ActionClip"
rtn = Application.GetMappingRule( toclip, 0 )
fromclip = rtn.Value( "From" )
Application.SetMappingRule( toclip, fromclip, "this+5", 1 )
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# MAIN
#
Application.NewScene( "", 0)
from win32com.client import constants as c
# Set up some animation action nested inside models (see bottom for functions)
CreateFCurveAction( Application.ActiveSceneRoot )
m1 = Application.ActiveSceneRoot.AddModel()
m1.Name = "Sunshine"
CreateConstraintAction( m1 )
# Get a collection of clips under every model
results = FindClipsUnderModel( Application.ActiveSceneRoot )
if results != "" :
cliplist = XSIFactory.CreateActiveXObject( "XSI.Collection" )
cliplist.AddItems( results )
# Print out list
for clip in cliplist :
Application.LogMessage( clip.Name + " is a " + clip.Type )
# Expected results:
#
# Searching Mixer for clips...
# Mixer.Mixer_Anim_Track.StoredAnimFCrvAction_Clip is a Clip/mixeranimclip
#INFO : StoredAnimFCrvAction_Clip is a mixeranimclip
|
'
' This example demonstrates how to crawl through the Mixer to try and extract
' all the interesting pieces of data, through clips, sources, tracks, etc.
'
NewScene , false
' Set up some clips in the mixer
CreateStaticAction( ActiveSceneRoot )
CreateShapeAction( ActiveSceneRoot )
CreateAudioSource( ActiveSceneRoot )
' Traverse the mixer, finding as much info as we can
ReadMixerContents ActiveSceneRoot.Mixer
sub ReadMixerContents( in_mixer )
LogMessage vbTab & "Reading " & in_mixer.FullName & " in ReadMixerContents()"
' CLIPS
LogMessage vbTab & vbTab & "Found " & in_mixer.Clips.Count & " clip(s)."
ReadClipsFromContainer in_mixer
' TRACKS
LogMessage vbTab & vbTab & "Found " & in_mixer.Tracks.Count & " track(s)."
for each trk in in_mixer.Tracks
' TRACKS::CLIPS
ReadClipsFromContainer trk
next
' TRANSITIONS
LogMessage vbTab & vbTab & "Found " & in_mixer.Transitions.Count & " transition(s)."
for each trns in in_mixer.Transitions
LogMessage vbTab & vbTab & vbTab & "Found the " & trns.FullName & _
" transition which starts at frame " & trns.StartClip & _
" and ends at frame " & trns.EndClip
next
' NESTED RELATIONS
LogMessage vbTab & vbTab & "Found " & in_mixer.NestedRelations.Count & " nested relation(s)."
if in_mixer.NestedRelations.Count > 0 then
ReadRelations in_mixer.NestedRelations
end if
end sub
sub ReadClipsFromContainer( in_can )
LogMessage vbTab & "Reading " & in_can.FullName & " in ReadClipsFromContainer()"
for each clp in in_can.Clips
' MAPPEDITEMS
if clp.Type <> siClipAudioType then
if TypeName(clp.MappedItems) <> "Nothing" then
LogMessage vbTab & vbTab & "Found " & clp.MappedItems.Count & " mapped items(s)"
for each mapping in clp.MappedItems
LogMessage vbTab & vbTab & vbTab & mapping.FullName & ": " & ClassName(mapping)
' MAPPEDITEMS::CLIPEFFECTITEM
ReadClipEffectItem mapping.ClipEffectItem
next
end if
end if
' TIMECONTROL
if TypeName(clp.TimeControl) <> "Nothing" then
LogMessage vbTab & vbTab & "Found this clip's time control: " & clp.TimeControl.FullName
set tc = clp.TimeControl
LogMessage vbTab & vbTab & vbTab & "Scaling Factor: " & tc.Scale
LogMessage vbTab & vbTab & vbTab & "Start Offset: " & tc.StartOffset
LogMessage vbTab & vbTab & vbTab & "First Frame: " & tc.ClipIn
LogMessage vbTab & vbTab & vbTab & "Last Frame: " & tc.ClipOut
LogMessage vbTab & vbTab & vbTab & "siTimeControlExtrapolationType before this clip: " _
& tc.ExtrapolationBeforeType & " (" & tc.ExtrapolationBeforeValue & ")"
LogMessage vbTab & vbTab & vbTab & "siTimeControlExtrapolationType after this clip: " _
& tc.ExtrapolationAfterType & " (" & tc.ExtrapolationAfterValue & ")"
else
LogMessage vbTab & "TimeControl is not available on this clip."
end if
' SOURCE
LogMessage vbTab & vbTab & "Found this clip's source: " & clp.Source.FullName & "(" & ClassName(clp.Source) & ")"
' EFFECT
if TypeName(clp.Effect) <> "Nothing" then
LogMessage vbTab & vbTab & "Found this clip's effect: " & clp.Effect.FullName
ReadClipEffect clp.Effect
end if
' RELATIONS
LogMessage vbTab & vbTab & "Found " & clp.Relations.Count & " relation(s) on this clip."
ReadRelations clp.Relations
next
end sub
sub ReadClipEffect( in_clpeff )
LogMessage vbTab & "Reading " & in_clpeff.FullName & " in ReadClipEffect()"
' CLIPEFFECTITEMS
LogMessage vbTab & vbTab & "Found " & in_clpeff.Items.Count & " clip effect item(s)"
for each thing in in_clpeff.Items
ReadClipEffectItem thing
next
' VARIABLES
LogMessage vbTab & vbTab & "Found " & in_clpeff.Variables.Count & " variables(s)"
if in_clpeff.Variables.Count > 0 then
for each var in in_clpeff.Variables
LogMessage vbTab & vbTab & vbTab & "Found this variable on the clip effect: " & var.FullName
next
end if
' TIMEREFERENCE
if TypeName(in_clpeff.TimeReference) <> "Nothing" then
dim trparams
if in_clpeff.TimeReference then
trparams = "spans over extrapolation (siExtrapolatedClip)"
else
trparams = "repeats itself over time (siOriginalClip)"
end if
LogMessage vbTab & vbTab & "Found this time reference indicating that this clip effect item: " & trparams
else
LogMessage vbTab & vbTab & "No time reference found on the clip effect"
end if
' POSEEFFECT
if TypeName(in_clpeff.PoseEffect) <> "Nothing" then
LogMessage vbTab & vbTab & "Found this pose effect property on the clip effect: " _
& in_clpeff.PoseEffect.FullName & " containing " _
& in_clpeff.PoseEffect.Parameters.Count & " parameters...."
set peparams = in_clpeff.PoseEffect.Parameters
for each p in peparams
LogMessage vbTab & vbTab & vbTab & "Found this parameter on the pose effect property: " & p.FullName
next
else
LogMessage vbTab & vbTab & "No pose effect property found on the clip effect"
end if
' ISACTIVE
LogMessage vbTab & vbTab & "Is this clip effect active? -- " & in_clpeff.IsActive
' ISPOSEEFFECTACTIVE
LogMessage vbTab & vbTab & "Is the pose effect on this clip effect active? -- " & in_clpeff.IsPoseEffectActive
end sub
sub ReadRelations( in_rels )
LogMessage vbTab & "Reading " & in_rels.GetAsText() & " in ReadRelations()"
for each rel in in_rels
LogMessage vbTab & vbTab & vbTab & "Master: " & in_rels(r).MasterClip
LogMessage vbTab & vbTab & vbTab & "Slave: " & in_rels(r).SlaveClip
next
end sub
sub ReadClipEffectItem( in_clpeffitm )
LogMessage vbTab & vbTab & "Reading " & in_clpeffitm.FullName & " in ReadClipEffectItem()"
LogMessage vbTab & vbTab & vbTab & "Value of " & in_clpeffitm.Parameter.FullName & " = " & in_clpeffitm.Parameter.Value
dim str
if in_clpeffitm.Expression = "" then
str = "(no expression)"
else
str = in_clpeffitm.Expression
end if
LogMessage vbTab & vbTab & vbTab & "Value of ClipEffectItem.Expression = " & str
end sub
' Expected Results:
'INFO : Reading Mixer in ReadMixerContents()
'INFO : Found 2 clip(s).
'INFO : Reading Mixer in ReadClipsFromContainer()
'INFO : Found 1 mapped items(s)
'INFO : MappedItem: MappedItem
'INFO : Reading in ReadClipEffectItem()
'INFO : Value of Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.param = 0
'INFO : Value of ClipEffectItem.Expression = (no expression)
'INFO : Found this clip's time control: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.timectrl
'INFO : Scaling Factor: 1
'INFO : Start Offset: 1
'INFO : First Frame: 1
'INFO : Last Frame: 100
'INFO : siTimeControlExtrapolationType before this clip: 0 (0)
'INFO : siTimeControlExtrapolationType after this clip: 0 (0)
'INFO : Found this clip's source: Mixer.Shape_ClusterClip_source(ActionSource)
'INFO : Found this clip's effect:
'INFO : Reading in ReadClipEffect()
'INFO : Found 1 clip effect item(s)
'INFO : Reading in ReadClipEffectItem()
'INFO : Value of Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.param = 0
'INFO : Value of ClipEffectItem.Expression = (no expression)
'INFO : Found 0 variables(s)
'INFO : Found this time reference indicating that this clip effect item: spans over extrapolation (siExtrapolatedClip)
'INFO : Found this pose effect property on the clip effect: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState containing 9 parameters....
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.sclx
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.scly
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.sclz
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.posx
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.posy
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.posz
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.orix
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.oriy
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.oriz
'INFO : Is this clip effect active? -- True
'INFO : Is the pose effect on this clip effect active? -- False
'INFO : Found 0 relation(s) on this clip.
'INFO : Reading in ReadRelations()
'INFO : Found this clip's time control: Mixer.Mixer_Audio_Track.Clip.timectrl
'INFO : Scaling Factor: 1
'INFO : Start Offset: 22
'INFO : First Frame: 1
'INFO : Last Frame: 6.87475789516606
'INFO : siTimeControlExtrapolationType before this clip: 0 (0)
'INFO : siTimeControlExtrapolationType after this clip: 0 (0)
'INFO : Found this clip's source: Sources.NEWALERT_WAV(Source)
'INFO : Found 0 relation(s) on this clip.
'INFO : Reading in ReadRelations()
'INFO : Found 2 track(s).
'INFO : Reading Mixer.Mixer_Shape_Track in ReadClipsFromContainer()
'INFO : Found 1 mapped items(s)
'INFO : MappedItem: MappedItem
'INFO : Reading in ReadClipEffectItem()
'INFO : Value of Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.param = 0
'INFO : Value of ClipEffectItem.Expression = (no expression)
'INFO : Found this clip's time control: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.timectrl
'INFO : Scaling Factor: 1
'INFO : Start Offset: 1
'INFO : First Frame: 1
'INFO : Last Frame: 100
'INFO : siTimeControlExtrapolationType before this clip: 0 (0)
'INFO : siTimeControlExtrapolationType after this clip: 0 (0)
'INFO : Found this clip's source: Mixer.Shape_ClusterClip_source(ActionSource)
'INFO : Found this clip's effect:
'INFO : Reading in ReadClipEffect()
'INFO : Found 1 clip effect item(s)
'INFO : Reading in ReadClipEffectItem()
'INFO : Value of Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.param = 0
'INFO : Value of ClipEffectItem.Expression = (no expression)
'INFO : Found 0 variables(s)
'INFO : Found this time reference indicating that this clip effect item: spans over extrapolation (siExtrapolatedClip)
'INFO : Found this pose effect property on the clip effect: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState containing 9 parameters....
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.sclx
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.scly
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.sclz
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.posx
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.posy
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.posz
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.orix
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.oriy
'INFO : Found this parameter on the pose effect property: Mixer.Mixer_Shape_Track.Shape_ClusterClip.actionclip.StaticKineState.oriz
'INFO : Is this clip effect active? -- True
'INFO : Is the pose effect on this clip effect active? -- False
'INFO : Found 0 relation(s) on this clip.
'INFO : Reading in ReadRelations()
'INFO : Reading Mixer.Mixer_Audio_Track in ReadClipsFromContainer()
'INFO : Found this clip's time control: Mixer.Mixer_Audio_Track.Clip.timectrl
'INFO : Scaling Factor: 1
'INFO : Start Offset: 22
'INFO : First Frame: 1
'INFO : Last Frame: 6.87475789516606
'INFO : siTimeControlExtrapolationType before this clip: 0 (0)
'INFO : siTimeControlExtrapolationType after this clip: 0 (0)
'INFO : Found this clip's source: Sources.NEWALERT_WAV(Source)
'INFO : Found 0 relation(s) on this clip.
'INFO : Reading in ReadRelations()
'INFO : Found 0 transition(s).
'INFO : Found 0 nested relation(s).
' Helper routines to create the sources
sub CreateStaticAction( in_model )
set obj = in_model.AddGeometry( "Cone", "MeshSurface" )
targets = Array( obj.rotx.FullName, obj.roty.FullName, obj.rotz.FullName )
statics = Array( 22.5, 90, 45 )
actives = Array( true, true, true )
in_model.AddActionSource "StoredAnimStaticAction", targets, statics, actives
end sub
sub CreateShapeAction( in_model )
set obj = in_model.AddGeometry( "Cone", "MeshSurface" )
target = obj & ".pnt[0,2,5,8,11,14,17,20,23]"
SetSelFilter "Vertex"
SelectGeometryComponents target
Translate , 0, -2, 0, siAbsolute, siPivot, siObj, siY, , , , , , , , , , 1
set clip = SaveShapeKey( target, , , 1, , , , , siShapeObjectReferenceMode )
target = clip.Source.SourceItems(0).Target
Translate , 0, -1, 0, siAbsolute, siPivot, siObj, siY, , , , , , , , , , 1
SaveShapeKey target, , , 36, , , , , siShapeObjectReferenceMode
Translate , 0, 0, 0, siAbsolute, siPivot, siObj, siY, , , , , , , , , , 1
SaveShapeKey target, , , 67, , , , , siShapeObjectReferenceMode
end sub
sub CreateAudioSource( in_model )
if in_model.HasMixer() then
set mixmaster = in_model.Mixer
else
set mixmaster = in_model.AddMixer()
end if
set aud_track = AddTrack( in_model, mixmaster, 2 )
var aud_src_path = XSIUtils.BuildPath( Application.InstallationPath( siFactoryPath ), "Data", "XSI_SAMPLES", "Audio", "Torefaction.wav" );
var aud_src = ImportAudio( mdl, aud_src_path );
AddAudioClip in_model, aud_src, mixmaster, aud_track, 22
end sub
|