home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 90 / CD Actual 90.iso / Software3D / K-3D / k3d-0.4.2.1 / scripts / render_test.javascript < prev    next >
Encoding:
Text File  |  2004-07-23  |  878 b   |  32 lines

  1. //javascript
  2.  
  3. /// Boilerplate to determine which document to modify ...
  4. function FindDocument(ScriptName)
  5. {
  6.     if(Document)
  7.             return Document;
  8.     else
  9.             {
  10.                     if(Application.Documents.length == 1)
  11.                             return Application.Documents[0];
  12.                     else if(Application.Documents.length == 0)
  13.                             Application.UI.ErrorMessage("You must have an open document to run this script!", ScriptName + ":");
  14.                     else
  15.                             Application.UI.ErrorMessage("Not sure which document to use ... try using the desired document's Document Window > Tools > Play Script.", ScriptName + ":");
  16.             }
  17.             
  18.     return null;
  19. }
  20.  
  21. document = FindDocument("rendertest");
  22. if(document)
  23.     {
  24.         camera = document.Object("Camera");
  25.         if(camera)
  26.             camera.RenderPreview();
  27.         else
  28.             Application.UI.ErrorMessage("Couldn't find object named \"Camera\" to preview", "render_test.javascript");
  29.     }
  30.  
  31.  
  32.