home *** CD-ROM | disk | FTP | other *** search
/ Inventor Labs: Technology / INVENTORLABS_TECHNOLOGY.BIN / pc / files / shared.cst / 00504_Script_movieFrameScript < prev    next >
Text File  |  1997-07-24  |  5KB  |  129 lines

  1. -- MovieFrameScript
  2. --
  3. -- MovieFrameScript
  4. -- When run frequently, provides cursor feedback over the pano movie
  5. -- and handles mouse down and keyboard actions.
  6. -- Call from a looping frame script
  7. -------------------------------------------------------------------------------
  8. on MovieFrameScript pSpriteNum
  9.   global gQTVRInstance, gLastTimeRollover, gOnPC
  10.   if rollover(pSpriteNum) then
  11.     
  12.     -- running this script will set an invisible movie back to visible,
  13.     -- so test for visibility first
  14.     -- note that you can remove this test if you're not doing anything with the "visible" property
  15.     if QTVRGetVisible(gQTVRInstance) then 
  16.       
  17.       -- mac xtra uses "RunningInForeground()" XFCN, but there's nothing on
  18.       -- the win side for that, so we'll just gloss over it on the PC
  19.       if gOnPC then set foregroundFlag = "true"
  20.       else set foregroundFlag = RunningInForeground()
  21.       
  22.       -- Only run mouseOver if there's a movie AND Director is in the foreground
  23.       if IsQTVRMovie(gQTVRInstance) and foregroundFlag = "true" then
  24.         
  25.         -- Result is 0 if you just wandered over the window
  26.         -- without mousing down, if you zoomed in or out without
  27.         -- mousing down, if you used the arrow keys, or if there
  28.         -- was an unhandled event
  29.         put QTVRMouseOver(gQTVRInstance) into tMouseOverResult
  30.         
  31.         if tMouseOverResult <> 0 then
  32.           put item 1 of tMouseOverResult into tAction
  33.           case tAction of
  34.             "jump":
  35.               put item 2 of tMouseOverResult into member "Current Node ID"
  36.             "stil":
  37.               put item 2 of tMouseOverResult into member "Current Hot Spot ID"
  38.             "navg":
  39.               processNavgResult tMouseOverResult
  40.             "misc":
  41.               put item 2 of tMouseOverResult into member "Current Hot Spot ID"
  42.             "undf":
  43.               put item 2 of tMouseOverResult into member "Current Hot Spot ID"
  44.             "pan ":  -- Watch out for that space!
  45.               nothing
  46.           end case
  47.           
  48.           put true into gLastTimeRollover
  49.           
  50.         else if rollover(pSpriteNum) then
  51.           -- There was an arrow key event or some unhandlable event,
  52.           -- but cursor is still over panoramic window
  53.           put true into gLastTimeRollover
  54.           
  55.         else
  56.           -- The cursor is no longer over the panoramic window
  57.           
  58.           -- Set the cursor twice because Director 
  59.           -- doesn't change the cursor if your current cursor command
  60.           -- is the same as the last one.  It doesn't realize of course,
  61.           -- that QTVR has changed the cursor in between.
  62.           
  63.           -- It appears that the cursor command is ignored if the mouse
  64.           -- is not over the stage, so if you move out of the movie window
  65.           -- fast enough and off the stage, the cursor will remain unchanged.
  66.           
  67.           cursor 200
  68.           cursor -1
  69.           put false into gLastTimeRollover
  70.         end if
  71.       end if
  72.     else if gLastTimeRollover then
  73.       -- See comment(s) above
  74.       cursor 200
  75.       cursor -1
  76.       put false into gLastTimeRollover
  77.     end if
  78.  else if gLastTimeRollover then
  79.       -- See comment(s) above
  80.       cursor 200
  81.       cursor -1
  82.       put false into gLastTimeRollover
  83.     end if
  84.   
  85.   if IsQTVRMovie(gQTVRInstance)  then
  86.     QTVRIdle(gQTVRInstance)
  87.   end if
  88.   
  89. end
  90.  
  91.  
  92. -------------------------------------------------------------------------------
  93. -- processNavgResult
  94. --
  95. -- Called from above handler when the result of "QTVRMouseOver" is "navg"
  96. -- Collapses pano to object. Attempts to open object movie in same directory as
  97. -- pano. Zooms object movie. If object can't be opened goes back to pano
  98. -------------------------------------------------------------------------------
  99. on processNavgResult pMouseOverResult
  100.   global gQTVRInstance, gLastPanoMovieData, gPathName, gOldFile, gFileName, gOldNode
  101.   
  102.   put item 2 of pMouseOverResult into tHotSpotID
  103.   put tHotSpotID into member "Current Hot Spot ID"
  104.   
  105.   -- We rely on all navigable objects having their all their properties
  106.   -- correctly authored.  It is unclear what will happen if the properties
  107.   -- aren't set up correctly.
  108.   
  109.   put QTVRGetObjectViewAngles(gQTVRInstance) into tViewAngles
  110.   put QTVRGetHotSpotName(gQTVRInstance) into tFileName
  111.   
  112.   -- stash pano filename & node so we can go back to it
  113.   set gOldFile = gFileName
  114.   set gOldNode = QTVRGetNodeID(gQTVRInstance)
  115.   
  116.   OpenMovie gPathName & ":" & tFileName, 1, "invisible"
  117.   
  118.   if IsQTVRMovie(gQTVRInstance) then
  119.     -- Show the object controls and take us to the right view of the object
  120.     go to frame "Object From Pano"
  121.     SetMovieView item 1 of tViewAngles, item 2 of tViewAngles, 0
  122.   else
  123.     -- Well, we couldn't open the object, so reupdate the panorama
  124.     OpenMovie gOldFile, 1, "visible"
  125.     QTVRUpdate(gQTVRInstance)
  126.   end if
  127. end
  128.  
  129.