Hi everyone,
I’m creating a script that setup automatically a scene and after it makes the playblast.
For the scene I create a camera, load a sound and place a Image plane with a video. So my problem is that the GUI from maya only updates after the script ends making my “video” Image Plane to stand still the hole playblast time. After the script ends, then the image plane updates his values and sets the Image Number to the current frame.
I really think that this is my problem.
Is there any way to force the GUI refresh?
from maya import cmds
import csv
cmds.workspace( directory='C:/Testing/')
path='C:/Testing/'
csv_path= path + 'Playblast.csv'
#open csv file
with open(csv_path, 'rb') as f:
#values table location values from file
reader = csv.reader(f, delimiter=',')
col_maya = [0]
col_mov = [1]
col_snd = [2]
col_time = [3]
col_plb = [4]
for row in reader:
#getting values
maya_path = list(row[i] for i in col_maya)
mov_path = list(row[i] for i in col_mov)
snd_path = list(row[i] for i in col_snd)
time_path = list(row[i] for i in col_time)
plb_path = list(row[i] for i in col_plb)
#clean values "noise"
var_mov = ', '.join(mov_path)
var_snd = ', '.join(snd_path)
var_time = ', '.join(time_path)
var_plb = ', '.join(plb_path)
#open maya file
cmds.file(new=True, force=True)
cmds.file(maya_path, open=True)
#set sound
cmds.sound(file=var_snd )
#set camera
cameraName = cmds.camera(name="PBcam",horizontalFilmAperture=1.28 , verticalFilmAperture=0.72 , focalLength=80 , fStop=5.6 , focusDistance=5 , shutterAngle=144 , centerOfInterest=165.308)
cmds.move(0,160,200,cameraName)
cmds.lookThru(cameraName)
#set image plane
myImagePlane = cmds.imagePlane( name="PBvideo", qt=True, lookThrough="PBcam1", fileName=var_mov)
cmds.setAttr('PBvideoShape2.useFrameExtension',1)
cmds.setAttr('PBvideoShape2.type',2)
cmds.move(-26,160,0, myImagePlane)
cmds.scale(2,2,0,myImagePlane)
#set playback time
cmds.playbackOptions( minTime='0', maxTime=var_time )
#playblast
cmds.playblast( format = "qt" , cc = 1 ,sound = var_plb[3:], filename = path + var_plb)
#save
cmds.file( save=True, type='mayaAscii' )