#!/usr/bin/env python

import vtk

###INTERIM CODE FOR PRODUCING A 360 degree spin movie
def exportScene(the_frame_parent):
    
    filename = './images/test_obj'
    
    ren = the_frame_parent.ren
    widget = the_frame_parent.widget
    window = ren.GetRenderWindow()
    
    writer = vtk.vtkOBJExporter()
    writer.SetRenderWindow(window)
    writer.SetFilePrefix(filename)
    writer.Write()
    
    
    print 'saved main window to %04d.tif sucessfully' %i



def importScene(the_frame_parent):
        
    filename = './images/test_obj.obj'
    
    ren = the_frame_parent.ren
    widget = the_frame_parent.widget
    window = ren.GetRenderWindow()
    
    reader = vtk.vtkOBJReader()
    reader.SetFileName(filename)

    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInput(reader.GetOutput())
    
    actor = vtk.vtkActor()
    actor.SetMapper(mapper)
    
    ren.AddActor(actor)
    
    print 'saved main window to %04d.tif sucessfully' %i