Browse Source

Updated to support multiple windows

Gyedo Jeon 16 years ago
parent
commit
b40450ccb2
1 changed files with 10 additions and 1 deletions
  1. 10 1
      direct/src/directtools/DirectSession.py

+ 10 - 1
direct/src/directtools/DirectSession.py

@@ -1,4 +1,3 @@
-
 import math
 import math
 import types
 import types
 import string
 import string
@@ -385,6 +384,16 @@ class DirectSession(DirectObject):
             self.ignore(event)
             self.ignore(event)
 
 
     def inputHandler(self, input):
     def inputHandler(self, input):
+        # [gjeon] change current camera dr, iRay, mouseWatcher accordingly to support multiple windows
+        for winCtrl in base.winControls:
+            if winCtrl.mouseWatcher.node().hasMouse():
+                base.direct.cameraControl.setCamera(winCtrl.camera)
+                base.direct.dr = base.direct.drList[base.camList.index(NodePath(winCtrl.camNode))]
+                base.direct.iRay = base.direct.dr.iRay
+                base.mouseWatcher = winCtrl.mouseWatcher
+                base.mouseWatcherNode = winCtrl.mouseWatcher.node()
+                break
+
         # Deal with keyboard and mouse input
         # Deal with keyboard and mouse input
         if input == 'mouse1-up':
         if input == 'mouse1-up':
             self.fMouse1 = 0 # [gjeon] to update alt key information while mouse1 is pressed
             self.fMouse1 = 0 # [gjeon] to update alt key information while mouse1 is pressed