DataRepository.GetIdentifier

Description

Returns the object identifier, model identifier, GUID, ClassID, or SPDL file of the specifed object.

C# Syntax

Object DataRepository.GetIdentifier( Object in_varObject, siObjectIdentifierType in_idType );

Scripting Syntax

oString = DataRepository.GetIdentifier( Object, [Type] );

Return Value

String or Integer

Parameters

Parameter Type Description
Object Object or String Object on which the information should be retrieved.
Type siObjectIdentifierType Type of identifier to be returned.

Default Value: siObjectIdentifier (object id)

Examples

1. VBScript Example

NewScene , false
set oDatabase = XSIUtils.DataRepository
set oCube = CreatePrim( "Cube", "MeshSurface" )
Application.LogMessage oDatabase.GetIdentifier( oCube )
Application.LogMessage oDatabase.GetIdentifier( oCube, siObjectGUID )
' Select an object out of model and in a model
SelectObj "Views.ViewA.UserCamera.camera,Cube,Scene_Root"
set oSelection = Application.Selection
for each oItem in oSelection
	Application.LogMessage oItem.name & " has ID " & oDatabase.GetIdentifier( oItem , siModelIdentifier )
	Application.LogMessage oItem.name & " has ID " & oDatabase.GetIdentifier( oItem )
next
'INFO : 60
'INFO : {76BD459D-0C6F-4AC6-8489-1F0AD4E31079}
'INFO : Camera has ID -1
'INFO : Camera has ID 97
'INFO : cube has ID 416
'INFO : cube has ID 60
'INFO : Scene_Root has ID 416
'INFO : Scene_Root has ID 416

2. JScript Example

/*
	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

See Also

FindObjects