Object Hierarchy | Related C++ Class: Source
Source
v4.0
Sources are references to data which are instantiated. For
example, a shape source becomes a ShapeClip in the animation mixer when it is
instantiated there. There are several types of sources:
(1) Action animation: stores animation data with a RelativeName to a parameter. For
example, an action animation source, when instantiated, may include
an fcurve driving an object's position in space over time, etc.
Action animation is a specialized kind of Source object called an
ActionSource object--see the ActionSource documentation for more
details.
(2) Shape animation: stores shape data on point clusters relative
to the reference shape in ShapeKeys.
Shape animation is a specialized kind of Source object called an
ActionSource object--see the ActionSource documentation for more
details.
(3) Audio files: audio sources add to the scene content when
instantiated (rather than modifying scene data like action and
shape animation). Audio sources contain references to audio files
(supported formats: *.aiff/.aif, *.aifc, *.avi, *.mov, *.qt, and
*.wav).
(4) Image files: image sources add to the scene content when
instantiated (rather than modifying scene data like action and
shape animation). Image sources contain references to image files
(see the Image object for more
details).
This object represents all sources (for action and shape animation
sources, see ActionSource),
including audio and image sources. To access the existing
underlying sources used to instantiate a clip, use the Clip.Source property.
To create audio and image sources, you can use the ImportAudio and AddImageSource commands which
import or add references to the external source files, and then
return the Source object. For creating action and shape sources via
scripting, see ActionSource.
/* This example illustrates how to retrieve the image file name used for the texture of an object. It also illustrates how to retrieve the x and y resolution of that image. */ var oCube = CreatePrim( "Cube", "MeshSurface", null, null ); ApplyShader( null, null, null, siUnspecified, siLetLocalMaterialsOverlap ); CreateProjection( "cube", siTxtSpherical, siTxtDefaultSpherical, "", "Texture_Projection", null, siRelDefault, "" ); BlendInPresetsInsp( null, null, null, true, siReplaceAndBlendInPreset, null, null, null, null ); var oImageClip = oCube.Material.CurrentImageClip; var oImageSource = oImageClip.Source; LogMessage( "The image filename is " + oImageSource.Parameters("FileName").Value ); LogMessage( "The image x resolution is " + oImageSource.Parameters("XRes").Value ); LogMessage( "The image y resolution is " + oImageSource.Parameters("YRes").Value ); // Expected result: //INFO : The image filename is <factory_location>\rsrc\noIcon.pic //INFO : The image x resolution is 256 //INFO : The image y resolution is 256 |