Quintiq file version 2.0
#parent: #root
Method GoToEntity (Lib3DS_Entity entity) id:Method_ApplicationLib3DSpace_GoToEntity
{
  #keys: '[138112.0.824528912]'
  Body:
  [*
    if( isnull( DataHolderEntityStack.Data() ) )
    {
      DataHolderEntityStack.Data( construct( structured[ Lib3DS_Entity ] ) );
      ValueHolderStackPointer.Data( 0 );
    }
    
    stacksize := DataHolderEntityStack.Data().Size();
    stackpointer := ValueHolderStackPointer.Data();
    
    if( stacksize = 0
        or ( stackpointer < stacksize
             and entity <> DataHolderEntityStack.Data().Element( stackpointer ) ) )
    {
      if( stackpointer < stacksize - 1 )
      {
        DataHolderEntityStack.Data().Delete( stackpointer + 1, stacksize - 1 );
      }
      
      DataHolderEntityStack.Data().Add( entity );
      ValueHolderStackPointer.Data( DataHolderEntityStack.Data().Size() - 1 );
      
      DataHolderActiveEntity.Data( entity );
    }
  *]
}
