H

HasData (DataRepository)

Description

Verifies if the specified Object, ID or GUID is present in the database. This is used for debugging purposes to find out whether an object is valid or not. Trying to work with an invalid object is a serious problem. In the case of ID or GUID, it may mean that the object has been deleted.

Scripting Syntax

    DataRepository.HasData( Object )

C# Syntax

    Boolean DataRepository.HasData( Object in_varObject );

Parameters

Parameter | Type | Description
Object | Object, String or Integer | Object to test the presence.

Return Value

Boolean

Examples

VBScript Example

    '
    ' This example demonstrates how to test the DataRepository
    ' to test whether an object exists
    '
    NewScene , false
    dim nIdentifier

    ' Create a cone and then test its existence
    set oDatabase = XSIUtils.DataRepository
    set oCone = CreatePrim( "Cone", "MeshSurface" )
    nIdentifier = oDatabase.GetIdentifier( oCone )
    Application.LogMessage oDatabase.HasData( nIdentifier )
    'INFO : True

    ' Remove the cone and test its existence again
    DeleteObj( "Cone" )
    Application.LogMessage oDatabase.HasData( nIdentifier )
    'INFO : False

    ' Restore it and test again
    Undo
    Application.LogMessage oDatabase.HasData( nIdentifier )
    'INFO : True

Autodesk Softimage v7.5