NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

camerabehaviors.py (2642B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\common\lib\camerabehaviors.py
      2 import trinity
      3 import decometaclass
      4 CCA_SET_FREE_LOOK = 0
      5 CCA_SHAKE = 1
      6 CCA_SET_IDLE = 2
      7 CCA_SET_FOVZOOM = 3
      8 DefaultCamera = 'JESSICA'
      9 __cameraBehaviors__ = {}
     10 
     11 def RegisterCamera(oCamera):
     12     sName = oCamera.GetName()
     13     if sName not in __cameraBehaviors__:
     14         __cameraBehaviors__[sName] = oCamera
     15 
     16 
     17 import trinity.camerajessica
     18 
     19 class PythonCamera(decometaclass.WrapBlueClass('trinity.TriCameraPython')):
     20 
     21     def __init__(self):
     22         trinity.TriCameraPython.__init__(self)
     23         self.instancedBehaviors = {}
     24         self.SetCallbackObject(self)
     25 
     26     def GetBehavior(self, sName):
     27         pRes = None
     28         if sName in self.instancedBehaviors:
     29             pRes = self.instancedBehaviors[sName]
     30         if pRes == None and sName in __cameraBehaviors__:
     31             pRes = __cameraBehaviors__[sName]()
     32             self.instancedBehaviors[sName] = pRes
     33         return pRes
     34 
     35     def GetDefaultBehavior(self):
     36         return DefaultCamera
     37 
     38     def HasBehavior(self, sName):
     39         return sName in __cameraBehaviors__
     40 
     41     def GetHookPosition(self):
     42         if self.parent != None:
     43             if hasattr(self.parent, 'vCamearHook'):
     44                 return (self.parent.vCamearHook.x, self.parent.vCamearHook.y, self.parent.vCamearHook.z)
     45             if hasattr(self.parent, 'vLocation'):
     46                 return (self.parent.vLocation.x, self.parent.vLocation.y, self.parent.vLocation.z)
     47             if hasattr(self.parent, 'translation'):
     48                 return (self.parent.translation.x, self.parent.translation.y, self.parent.translation.z)
     49             if hasattr(self.parent, 'position'):
     50                 return (self.parent.position.x, self.parent.position.y, self.parent.position.z)
     51         return (0.0, 0.0, 0.0)
     52 
     53     def GetHookRotation(self):
     54         if self.parent != None:
     55             if hasattr(self.parent, 'qCamearRotation'):
     56                 return (self.parent.qCamearRotation.x,
     57                  self.parent.qCamearRotation.y,
     58                  self.parent.qCamearRotation.z,
     59                  self.parent.qCamearRotation.w)
     60             if hasattr(self.parent, 'qRotation'):
     61                 return (self.parent.qRotation.x,
     62                  self.parent.qRotation.y,
     63                  self.parent.qRotation.z,
     64                  self.parent.qRotation.w)
     65             if hasattr(self.parent, 'rotation'):
     66                 return (self.parent.rotation.x,
     67                  self.parent.rotation.y,
     68                  self.parent.rotation.z,
     69                  self.parent.rotation.w)
     70         return (0.0, 0.0, 0.0, 0.0)