/*
Example demonstrating how to determine the Class ID and the SPDL file of an object.
It also demonstrates how to use the Class ID to find all objects of a particular type in the scene.
*/
NewScene( null, false ) ;
GetPrimLight("Point.Preset", "Point", "");
GetPrimLight("Spot.Preset", "Spot", "");
GetPrimLight("Spot.Preset", "Spot", "");
GetPrimLight("Infinite.Preset", "Infinite", "");
// Get information about about one of the lights
var oDataRep = XSIUtils.DataRepository ;
var oLight = Dictionary.GetObject( "Point.light" )
var classID = oDataRep.GetIdentifier( oLight, siObjectCLSID );
// Now that we know the ClassID from one light we can discover all the
// lights in the scene
var oLightsXSICollection = FindObjects( null, classID ) ;
Application.LogMessage( "Info about lights in the scene:" ) ;
for ( var i = 0 ; i < oLightsXSICollection.Count ; i++ )
{
var oLight = oLightsXSICollection.Item(i) ;
classID = oDataRep.GetIdentifier( oLight, 3 );
var objectGuid = oDataRep.GetIdentifier( oLight, siObjectGUID );
var spdlFile = oDataRep.GetIdentifier( oLight, siSpdlFile ) ;
// Each light has a different Object GUID but they
// all share the same SPDL file and Class ID
Application.LogMessage( "Name: " + oLight + "\t\tType: " + oLight.Type ) ;
Application.LogMessage( "ClassID: " + classID ) ;
Application.LogMessage( "Object GUID: " + objectGuid ) ;
Application.LogMessage( "SPDL File: " + spdlFile + "\n" ) ;
}
// Output of this example is similar to the following (SPDL path and Object GUID may differ):
//
//INFO : "Info about lights in the scene:"
//INFO : "Name: Point.light Type: light"
//INFO : "ClassID: {F3705C30-5204-11D0-8298-00A0243E366B}"
//INFO : "Object GUID: {6AB2367F-1714-4F63-9AD8-334EB405F6FB}"
//INFO : "SPDL File: s:\Application\spdl\C3DLightPoint.spdl
//"
//INFO : "Name: Infinite.light Type: light"
//INFO : "ClassID: {F3705C30-5204-11D0-8298-00A0243E366B}"
//INFO : "Object GUID: {BC839168-AB8A-4913-B8DE-801A9CD570C7}"
//INFO : "SPDL File: s:\Application\spdl\C3DLightPoint.spdl
//"
//INFO : "Name: light.light Type: light"
//INFO : "ClassID: {F3705C30-5204-11D0-8298-00A0243E366B}"
//INFO : "Object GUID: {1667B7C6-6347-4FB2-81FC-B91557C9F35D}"
//INFO : "SPDL File: s:\Application\spdl\C3DLightPoint.spdl
//"
//INFO : "Name: Spot1.light Type: light"
//INFO : "ClassID: {F3705C30-5204-11D0-8298-00A0243E366B}"
//INFO : "Object GUID: {B7E88791-0899-407C-9C13-3E426564136D}"
//INFO : "SPDL File: s:\Application\spdl\C3DLightPoint.spdl
//"
//INFO : "Name: Spot.light Type: light"
//INFO : "ClassID: {F3705C30-5204-11D0-8298-00A0243E366B}"
//INFO : "Object GUID: {42171148-C315-4D96-AC79-C423AF977B1F}"
//INFO : "SPDL File: s:\Application\spdl\C3DLightPoint.spdl
|