XSIProject GetScenes


Applies to: all versions up to and including v7.0

The Project::GetScenes is not implemented, here is a JScript implementation that returns the scenes as a JScript array of scene file paths.

var project = Application.ActiveProject; 
    
var aScenes = XSIProject_Scenes(project); 
  
Application.Logmessage( "scenes found = " + aScenes.length ); 
  
function XSIProject_Scenes_VistFolder(folder, result) 
{ 
    var eFiles = new Enumerator( folder.Files ); 
  
    for ( ; ! eFiles.atEnd(); eFiles.moveNext() ) 
    { 
        var file = eFiles.item(); 
        
        if (file.type == "XSI Scene file") 
            result.push(file.path) 
    } 
  
    var eSubFolders = new Enumerator( folder.SubFolders ); 
  
    for ( ; ! eSubFolders .atEnd(); eSubFolders .moveNext() ) 
    { 
        var subfolder  = eSubFolders .item(); 
        XSIProject_Scenes_VistFolder(subfolder , result); 
    } 
  
} 
  
function XSIProject_Scenes(project) 
{ 
    var result = new Array(); 
    
    var fso = XSIFactory.CreateObject("Scripting.FileSystemObject"); 
  
    XSIProject_Scenes_VistFolder(fso.GetFolder(XSIUtils.BuildPath(project.Path, "Scenes")), result); 
    
    return result; 
} 

This page was last modified 02:04, 18 Sep 2009.
This page has been accessed 4723 times.

© Copyright 2009 Autodesk Inc. All Rights Reserved. Privacy Policy | Legal Notices and Trademarks | Report Piracy