def make_all(): #make the whole movie global views global frames global models #first get total number of frames ftot = 0 i = 0 setcommand = "" for nframes in frames[:-1]: ftot += nframes if models.has_key(i): setcommand += " " + models[i] + " " else: setcommand += " 1 x%i" % nframes i += 1 #initialize movie #cmd.mset("1 x%i" % ftot) #cmd.mset("1 x50 1 -30 30 x20") cmd.mset( setcommand ) #loop through views start_view = views[0][:] i = 0 first_frame = 1 for view in views[1:]: end_view = view[:] if settings.has_key(i): movs.animate_transition( start_view, end_view, frames[i], first_frame, settings[i] ) elif fades.has_key(i): movs.animate_transition( start_view, end_view, frames[i], first_frame, fades[i] ) else: movs.animate_transition( start_view, end_view, frames[i], first_frame ) #add an action if actions.has_key(i): mdo_cmd = actions[i]#+";set_view ("+str( views[i] )+")" print mdo_cmd cmd.mdo(first_frame, mdo_cmd) first_frame += frames[i] i += 1 start_view = end_view[:] cmd.frame(1)
def make_all(): #make the whole movie global views global frames global models #first get total number of frames ftot = 0 setcommand = "" for i, nframes in enumerate(frames[:-1]): ftot += nframes if i in models: setcommand += " " + models[i] + " " else: setcommand += " 1 x%i" % nframes #initialize movie #cmd.mset("1 x%i" % ftot) #cmd.mset("1 x50 1 -30 30 x20") cmd.mset(setcommand) #loop through views start_view = views[0][:] first_frame = 1 for i, view in enumerate(views[1:]): end_view = view[:] if i in settings: movs.animate_transition(start_view, end_view, frames[i], first_frame, settings[i]) elif i in fades: movs.animate_transition(start_view, end_view, frames[i], first_frame, fades[i]) else: movs.animate_transition(start_view, end_view, frames[i], first_frame) #add an action if i in actions: mdo_cmd = actions[i] #+";set_view ("+str( views[i] )+")" print mdo_cmd cmd.mdo(first_frame, mdo_cmd) first_frame += frames[i] start_view = end_view[:] cmd.frame(1)
def make_all(): # make the whole movie global views global frames global models # first get total number of frames ftot = 0 setcommand = "" for i, nframes in enumerate(frames[:-1]): ftot += nframes if i in models: setcommand += " " + models[i] + " " else: setcommand += " 1 x%i" % nframes # initialize movie # cmd.mset("1 x%i" % ftot) # cmd.mset("1 x50 1 -30 30 x20") cmd.mset(setcommand) # loop through views start_view = views[0][:] first_frame = 1 for i, view in enumerate(views[1:]): end_view = view[:] if i in settings: movs.animate_transition(start_view, end_view, frames[i], first_frame, settings[i]) elif i in fades: movs.animate_transition(start_view, end_view, frames[i], first_frame, fades[i]) else: movs.animate_transition(start_view, end_view, frames[i], first_frame) # add an action if i in actions: mdo_cmd = actions[i] # +";set_view ("+str( views[i] )+")" print mdo_cmd cmd.mdo(first_frame, mdo_cmd) first_frame += frames[i] start_view = end_view[:] cmd.frame(1)
def show_transition(start_index=0, end_index=0): #show the transition from the current view to the next view global frames global views global cur_index global actions global models if( start_index == 0 and end_index == 0 ): if cur_index >= len(views)-1: print "Current view is last in sequence." return start_index=cur_index end_index=cur_index+1 else: start_index = int(start_index) end_index = int(end_index) ftot = 0 setcommand = "" i = start_index for nframes in frames[start_index:end_index]: #ftot += nframes if models.has_key(i): setcommand += " " + models[i] + " " else: setcommand += " 1 x%i" % nframes i += 1 # cmd.mset("1 x%i" % ftot) cmd.mset( setcommand ) start_frame = 1 #first do all actions that happen up to this point to make sure #things look the way they should first_action = "" for i in range( 0, start_index ): if actions.has_key(i): first_action += actions[i] + ';' #print "Executing %s from actions %d" % (actions[i],i) #cmd.do( actions[i] ) if settings.has_key(i): settingName, selection, startVal, endVal = settings[i] action = "set %s, %f, %s;" % (settingName, endVal, selection) first_action += action #print "Executing %s from settings %d" % (action,i) #cmd.do( action ) if fades.has_key(i): startVisSelection, endVisSelection, sticksOnly = fades[i] action = "set stick_transparency, 0, %s; set stick_transparency, 1, %s;" % (endVisSelection, startVisSelection) first_action += action #print "Executing %s from fades %d" % (action, i) #cmd.do( action ) for i in range( start_index, end_index ): if settings.has_key(i): movs.animate_transition( views[i], views[i+1], frames[i], start_frame, settings[i] ) elif fades.has_key(i): movs.animate_transition( views[i], views[i+1], frames[i], start_frame, fades[i] ) else: movs.animate_transition( views[i], views[i+1], frames[i], start_frame ) #add an action if start_frame == 1: mdo_cmd = first_action if actions.has_key(i): mdo_cmd += actions[i]+";" #mdo_cmd += "set_view("+str(views[i])+")" print mdo_cmd cmd.mdo(start_frame, mdo_cmd) elif actions.has_key(i): mdo_cmd = actions[i]+";set_view("+str(views[i])+")" cmd.mdo(start_frame, mdo_cmd) #print mdo_cmd start_frame += frames[i] cmd.frame(1) cmd.mplay()
def show_transition(start_index=0, end_index=0): #show the transition from the current view to the next view global frames global views global cur_index global actions global models if start_index == 0 and end_index == 0: if cur_index >= len(views) - 1: print "Current view is last in sequence." return start_index = cur_index end_index = cur_index + 1 else: start_index = int(start_index) end_index = int(end_index) ftot = 0 setcommand = "" i = start_index for nframes in frames[start_index:end_index]: #ftot += nframes if i in models: setcommand += " " + models[i] + " " else: setcommand += " 1 x%i" % nframes i += 1 # cmd.mset("1 x%i" % ftot) cmd.mset(setcommand) start_frame = 1 #first do all actions that happen up to this point to make sure #things look the way they should first_action = "" for i in range(start_index): if i in actions: first_action += actions[i] + ';' #print "Executing %s from actions %d" % (actions[i],i) #cmd.do( actions[i] ) if i in settings: settingName, selection, startVal, endVal = settings[i] action = "set %s, %f, %s;" % (settingName, endVal, selection) first_action += action #print "Executing %s from settings %d" % (action,i) #cmd.do( action ) if i in fades: startVisSelection, endVisSelection, sticksOnly = fades[i] action = "set stick_transparency, 0, %s; set stick_transparency, 1, %s;" % ( endVisSelection, startVisSelection) first_action += action #print "Executing %s from fades %d" % (action, i) #cmd.do( action ) for i in range(start_index, end_index): if i in settings: movs.animate_transition(views[i], views[i + 1], frames[i], start_frame, settings[i]) elif i in fades: movs.animate_transition(views[i], views[i + 1], frames[i], start_frame, fades[i]) else: movs.animate_transition(views[i], views[i + 1], frames[i], start_frame) #add an action if start_frame == 1: mdo_cmd = first_action if i in actions: mdo_cmd += actions[i] + ";" #mdo_cmd += "set_view("+str(views[i])+")" print mdo_cmd cmd.mdo(start_frame, mdo_cmd) elif i in actions: mdo_cmd = actions[i] + ";set_view(" + str(views[i]) + ")" cmd.mdo(start_frame, mdo_cmd) #print mdo_cmd start_frame += frames[i] cmd.frame(1) cmd.mplay()