Difference between revisions of "Scene"

From PyMOLWiki
Jump to navigation Jump to search
m
Line 22: Line 22:
  
 
===EXAMPLES===
 
===EXAMPLES===
 +
Simple Examples.
 +
<source lang="python">
 
   scene F1, store
 
   scene F1, store
 
   scene F2, store, This view shows you the critical hydrogen bond.
 
   scene F2, store, This view shows you the critical hydrogen bond.
Line 27: Line 29:
 
   scene F1
 
   scene F1
 
   scene F2
 
   scene F2
 +
</source>
 +
 +
This example shows how to use scenes in a movie!
 +
<source lang="python">
 +
# SUMMARY
 +
#
 +
 +
# This script demonstrates one way of creating a movie from scenes.
 +
# It assumes that we have three scenes, each running for 10 seconds
 +
# (300 frames apiece) including 2-second transitions.
 +
 +
# 1) Load or create content for three scenes (this could just as easily
 +
#    come from a session file).
 +
 +
load $TUT/1hpv.pdb
 +
util.cbc
 +
turn x,180
 +
orient
 +
as cartoon
 +
scene 001, store
 +
 +
show sticks, organic
 +
orient organic
 +
scene 002, store
 +
 +
hide cartoon
 +
show lines, byres organic expand 5
 +
turn x,45
 +
turn y,45
 +
scene 003, store
 +
 +
# 2) Specify a 30-second movie -- state 1, 900 frames at 30 frames per second.
 +
 +
mset 1 x900
 +
 +
# 3) Program scene matrices as movie views at appopriate frames
 +
#    and also add y-axis rocking between scenes.
 +
 +
scene 001, animate=0
 +
mview store, 1
 +
mview store, 240
 +
 +
turn y,-30
 +
mview store, 70
 +
turn y,60
 +
mview store, 170
 +
 +
scene 002, animate=0
 +
mview store, 300
 +
mview store, 540
 +
 +
turn y,-30
 +
mview store, 370
 +
turn y,60
 +
mview store, 470
 +
 +
scene 003, animate=0
 +
mview store, 600
 +
mview store, 840
 +
 +
turn y,-30
 +
mview store, 670
 +
turn y,60
 +
mview store, 770
 +
 +
# 4) Now interpolate the movie camera.
 +
 +
mview interpolate
 +
mview smooth
 +
mview smooth
 +
 +
# 5) Activate scene content at the appropriate movie frames.
 +
 +
mdo 1: scene 001, view=0, quiet=1
 +
mdo 240: scene 002, view=0, quiet=1
 +
mdo 540: scene 003, view=0, quiet=1
 +
mdo 840: scene 001, view=0, quiet=1
 +
 +
# 6) Force frame 1 content to load.
 +
 +
rewind
 +
 +
# 6) And play the movie.
 +
 +
mplay
 +
</source>
 +
 +
*Courtesy of Warren DeLano.
 +
 +
 +
  
 
===NOTES===
 
===NOTES===

Revision as of 16:12, 21 October 2006

DESCRIPTION

scene makes it possible to save and restore multiple scenes scene within a single session. A scene consists of the view, all object activity information, all atom-wise visibility, color, representations, and the global frame index.

USAGE

  scene key [,action [,message [ ,view [,color [,active [,rep [,frame]]]]]]]
  scene *

  key can be any string
  action should be 'store' or 'recall' (default: 'recall')

  view: 1 or 0 controls whether the view is stored
  color: 1 or 0 controls whether colors are stored
  active: 1 or 0 controls whether activity is stored
  rep: 1 or 0 controls whether the representations are stored
  frame: 1 or 0 controls whether the frame is stored

PYMOL API

cmd.scene(string key,string action,string-or-list message,int view,
             int color, int active, int rep, int frame)

EXAMPLES

Simple Examples.

   scene F1, store
   scene F2, store, This view shows you the critical hydrogen bond.
 
   scene F1
   scene F2

This example shows how to use scenes in a movie!

# SUMMARY
#

# This script demonstrates one way of creating a movie from scenes.
# It assumes that we have three scenes, each running for 10 seconds
# (300 frames apiece) including 2-second transitions.

# 1) Load or create content for three scenes (this could just as easily
#    come from a session file).

load $TUT/1hpv.pdb
util.cbc
turn x,180
orient
as cartoon
scene 001, store

show sticks, organic
orient organic
scene 002, store

hide cartoon
show lines, byres organic expand 5
turn x,45
turn y,45
scene 003, store

# 2) Specify a 30-second movie -- state 1, 900 frames at 30 frames per second.

mset 1 x900

# 3) Program scene matrices as movie views at appopriate frames
#    and also add y-axis rocking between scenes.

scene 001, animate=0
mview store, 1
mview store, 240

turn y,-30
mview store, 70
turn y,60
mview store, 170

scene 002, animate=0
mview store, 300
mview store, 540

turn y,-30
mview store, 370
turn y,60
mview store, 470

scene 003, animate=0
mview store, 600
mview store, 840

turn y,-30
mview store, 670
turn y,60
mview store, 770

# 4) Now interpolate the movie camera.

mview interpolate
mview smooth
mview smooth

# 5) Activate scene content at the appropriate movie frames.
 
mdo 1: scene 001, view=0, quiet=1
mdo 240: scene 002, view=0, quiet=1
mdo 540: scene 003, view=0, quiet=1
mdo 840: scene 001, view=0, quiet=1

# 6) Force frame 1 content to load.

rewind

# 6) And play the movie.

mplay
  • Courtesy of Warren DeLano.



NOTES

Scenes F1 through F12 are automatically bound to function keys provided that "set_key" hasn't been used to redefine the behaviour of the respective key.

SEE ALSO

Cmd view, Cmd set_view, Cmd get_view

DEVELOPMENT TO DO

Add support for save/restore of a certain global and object-and-state specific settings, such as: state, surface_color, ribbon_color, stick_color, transparency, sphere_transparency, etc. This would probably best be done by defining a class of "scene" settings which are treated in this manner. The current workaround is to create separate objects which are enabled/disabled differentially.