home *** CD-ROM | disk | FTP | other *** search
/ Inventor Labs: Technology / INVENTORLABS_TECHNOLOGY.BIN / mac / FILES / SHARED.CST / 00041_Script_rotateBtnObject < prev    next >
Text File  |  1997-07-24  |  4KB  |  118 lines

  1. --P1:Tool1: rotate btn object
  2.  
  3. property pToolRects, pNumOfRects
  4. property pMenuCast
  5. property argClickLocPnt
  6. property pHiliteStartCast
  7. property pHiliteSprite
  8. property pQTVRsteps
  9.  
  10. global gModeManager, gQTVRobj, gActiveQTVRhandler, gActiveFunctionObj
  11. --==============================================================
  12. on mInit me
  13.   
  14.   return (me)
  15.   
  16. end
  17. ----------------------------------------------------------------------------ò
  18. on mSetup me
  19.   
  20.   set pQTVRsteps = [[0,1,0],[-1,1,0],[-1,0,0],[-1,-1,0],[0,-1,0],[1,-1,0],[1,0,0],[1,1,0]]
  21.   
  22. end mSetup
  23. ----------------------------------------------------------------------------ò
  24. on mSetMenuProp me, WhatMenuCast, toolrects, hiliteSprite, ActiveFunctionalty
  25.   
  26.   set pWhatFunctActive = ActiveFunctionalty
  27.   set pMenuCast = WhatMenuCast
  28.   set pToolRects = toolrects
  29.   set pHiliteSprite = hiliteSprite
  30.   set pHiliteStartCast = pMenuCast + 1
  31.   set pNumOfRects = count(pToolRects)
  32.   
  33.   
  34. end mSetMenuProp
  35. ----------------------------------------------------------------------------ò
  36. on mGetToolMenuCast me
  37.   
  38.   return ( pMenuCast )
  39.   
  40. end mGetToolMenuCast
  41. ----------------------------------------------------------------------------ò
  42. on mButtonClicked me
  43.   
  44.   
  45.   set ClickLocPnt = the clickloc
  46.   set whatrect = mGetWhatToolRect( me, ClickLocPnt)
  47.   
  48.   
  49.   if  (whatrect <> 0 ) then
  50.     
  51.     if mGetCurrentMode( gModeManager) = #QTVR then rotateQTVR( me, whatrect, ClickLocPnt )
  52.     else if objectP(gActiveFunctionObj) then mRotate( gActiveFunctionObj, whatrect)
  53.     
  54.   end if
  55.   
  56. end mButtonClicked
  57. ----------------------------------------------------------------------------ò
  58. on mGetWhatToolRect me, argClickedPnt
  59.   
  60.   -- argClickLocPnt -- mystery.... unable to use this varible name as an argument....sound FISHY director
  61.   
  62.   set whatrect = 1
  63.   set found = #FALSE
  64.   repeat while (found = #FALSE)
  65.     if inside(argClickedPnt, getat(pToolRects,whatrect)) then 
  66.       set found = #TRUE
  67.       set the castnum of sprite pHiliteSprite = pHiliteStartCast + whatrect - 1
  68.       updatestage
  69.     else set whatrect = whatrect + 1
  70.     if (whatrect > pNumOfRects) then set found = #NEVER
  71.   end repeat
  72.   
  73.   if (found = #TRUE) then return( whatrect ) 
  74.   else  return( 0 ) 
  75.   
  76.   
  77. end mGetWhatToolRect
  78. ----------------------------------------------------------------------------ò
  79. on rotateQTVR me, whatrect, argClickedPnt
  80.   
  81.   if (whatrect <> 0) then 
  82.     set NewCords = value("[" & mGetQTVRProps( gQTVRobj ) & "]")
  83.     set QTVRstep = getat(pQTVRsteps,whatrect)
  84.     set OverActiveRect = TRUE
  85.     set MouseLocPnt = argClickedPnt
  86.     set QTVRintialStep = QTVRstep * [8,5,0]
  87.     set NewCords = NewCords + QTVRintialStep
  88.     set NewViewStr = string(getat(NewCords,1)) & "," & string(getat(NewCords,2)) & "," & string(getat(NewCords,3))
  89.     mSwingToView( gQTVRobj, NewViewStr,"5" )
  90.     
  91.   else set OverActiveRect = FALSE
  92.   set origHilite = the castnum of sprite pHiliteSprite
  93.   repeat while  the mousedown
  94.     
  95.     set MouseLocPnt = point(the mouseh, the mousev)
  96.     if inside(MouseLocPnt, getat(pToolRects,whatrect)) then
  97.       set the castnum of sprite pHiliteSprite = origHilite
  98.       updatestage
  99.       set NewCords = NewCords + QTVRintialStep
  100.       set NewViewStr = string(getat(NewCords,1)) & "," & string(getat(NewCords,2)) & "," & string(getat(NewCords,3))
  101.       mSwingToView( gQTVRobj, NewViewStr,"5" )
  102.     else 
  103.       set the castnum of sprite pHiliteSprite = 0
  104.       updatestage
  105.       set OverActiveRect = FALSE
  106.     end if
  107.     
  108.   end repeat
  109.   
  110.   set the castnum of sprite pHiliteSprite = 0
  111.   
  112. end rotateQTVR
  113. ----------------------------------------------------------------------------ò
  114.  
  115.  
  116.  
  117.  
  118. ----------------------------------------------------------------------------ò