Changeset 6429 for vmdshow


Ignore:
Timestamp:
Jul 18, 2016, 2:58:39 PM (8 years ago)
Author:
ldelgass
Message:

Sync with mdshowcase

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vmdshow/trunk/vmdserver.tcl

    r6373 r6429  
    442442# ----------------------------------------------------------------------
    443443proc cmd_load { fileList } {
    444     puts stderr "cmd_load fileList=$fileList\n"
    445444    global MolInfo MolNames tmpDir
    446445
     
    457456        set fileList [linsert $fileList 0 "@name:0"]
    458457    }
    459     puts stderr "2. cmd_load fileList=$fileList"
    460458
    461459    set slot 0
    462460    foreach file $fileList {
    463     puts stderr "file=$file\n"
    464461        if {[regexp {^@name:(.+)} $file match name]} {
    465462            set op "new"
     
    589586            }
    590587            set Scenes(@CURRENT) ""
    591             catch {unset Views}
     588            array unset Views
     589            array unset ViewCmds
    592590
    593591            # reset the server properties
     
    614612}
    615613$parser alias scene cmd_scene
     614
     615proc FramesDefview { frameNum matrixNameList matrixValueList } {
     616    global Views
     617    if { ![string is int $frameNum] } {
     618        error "bad frame value \"$frameNum\""
     619    }
     620    set Views($frameNum) [list $matrixNameList $matrixValueList]
     621}
     622
     623proc FramesSetViewCmds { frameNum cmds } {
     624    global ViewCmds
     625    if { ![string is int $frameNum] } {
     626        error "bad frame value \"$frameNum\""
     627    }
     628    set ViewCmds($frameNum) [join $cmds \;]
     629}
    616630
    617631# ----------------------------------------------------------------------
     
    684698        # new epoch? then clean out work queue
    685699        if {$epochValue > $Epoch} {
    686             catch {unset Work}
     700            array unset Work
    687701            set Work(queue) ""
    688702            set Epoch $epochValue
     
    780794      }
    781795      defview {
    782           if {[llength $args] != 3} { error "wrong # args: should be \"defview matrixNameList matrixValueList\"" }
    783           set n [lindex $args 0]
    784           if {![string is int $n]} { error "bad frame value \"$n\"" }
    785           set Views($n) [lrange $args 1 end]
     796          eval FramesDefview $args
     797      }
     798      setcmds {
     799          eval FramesSetViewCmds $args
    786800      }
    787801      max {
     
    804818      }
    805819      default {
    806         error "bad option \"$what\": should be defview, time, rotate, max"
     820        error "bad option \"$what\": should be defview, time, rotate, setcmds, or max"
    807821      }
    808822    }
     
    963977
    964978proc server_send_image {{when -now}} {
    965     global client Epoch Work Views Sendqueue DisplaySize
     979    global client Epoch Work Views ViewCmds Sendqueue DisplaySize
    966980
    967981    if {$when eq "-eventually"} {
     
    10171031            }
    10181032        }
    1019         catch {unset Work($item(num))}
     1033        if { [info exists item(frame)] &&
     1034             [info exists ViewCmds($item(frame))] } {
     1035            if { [catch {
     1036                eval $ViewCmds($item(frame))
     1037            } errs] != 0 }  {
     1038                puts stderr "viewcmd error: $errs"
     1039            }
     1040        }
     1041        array unset Work $item(num)
    10201042        break
    10211043    }
Note: See TracChangeset for help on using the changeset viewer.