Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
-(void)onInitializationDone
{
    ...    
    [_application BuildBlockLibrary];
}

File: AppDelegate.mmm

Code Block
@interface AppDelegate ()
{
    ...
    NSMutableArray* m_BlockLibrary;
}

-(void)BuildBlockLibrary
{
    // Prepare block library.
    NSString *bundlePath = [[aresDelegate resourceBundle] bundlePath];
    NSString *dwgSamplesPath = [bundlePath stringByAppendingString:@"/Support/Samples/Blocks"];
    NSArray *filePaths = [NSBundle pathsForResourcesOfType:@"dwg" inDirectory:dwgSamplesPath];

    m_BlockLibrary = [NSMutableArray array];
    for ( NSString* drawing in filePaths )
    {
        BlockDefinition* block = [[BlockDefinition alloc] init];
        
        block._blockFilePath = drawing;
        block._blockName = [drawing lastPathComponent];
        block._icon = [[CFxARESInstance instance] getDrawingThumbnail:drawing];
        
        [m_BlockLibrary addObject:block];
    }
}