Browse Source

formatting

Dave Schuyler 20 years ago
parent
commit
1e5469d22f

+ 0 - 2
direct/src/distributed/RelatedObjectMgr.py

@@ -6,7 +6,6 @@ from direct.directnotify import DirectNotifyGlobal
 
 
 class RelatedObjectMgr(DirectObject.DirectObject):
 class RelatedObjectMgr(DirectObject.DirectObject):
     """
     """
-
     This class manages a relationship between DistributedObjects that
     This class manages a relationship between DistributedObjects that
     know about each other, and are expected to be generated together.
     know about each other, and are expected to be generated together.
     Ideally, we should be able to guarantee the ordering of the
     Ideally, we should be able to guarantee the ordering of the
@@ -25,7 +24,6 @@ class RelatedObjectMgr(DirectObject.DirectObject):
     already exists), the associated callback will be called.  There is
     already exists), the associated callback will be called.  There is
     also a timeout callback in case the object never appears.
     also a timeout callback in case the object never appears.
     """
     """
-
     notify = DirectNotifyGlobal.directNotify.newCategory('RelatedObjectMgr')
     notify = DirectNotifyGlobal.directNotify.newCategory('RelatedObjectMgr')
 
 
     doLaterSequence = 1
     doLaterSequence = 1

+ 4 - 2
direct/src/interval/SoundInterval.py

@@ -73,7 +73,8 @@ class SoundInterval(Interval.Interval):
         if (t1 < 0.1):
         if (t1 < 0.1):
             t1 = 0.0
             t1 = 0.0
         if t1 < self.soundDuration:
         if t1 < self.soundDuration:
-            base.sfxPlayer.playSfx(self.sound, self.fLoop, 1, self.volume, t1, self.node)
+            base.sfxPlayer.playSfx(
+                self.sound, self.fLoop, 1, self.volume, t1, self.node)
         self.state = CInterval.SStarted
         self.state = CInterval.SStarted
         self.currT = t
         self.currT = t
 
 
@@ -82,7 +83,8 @@ class SoundInterval(Interval.Interval):
             # Restarting from a pause.
             # Restarting from a pause.
             t1 = t + self.startTime
             t1 = t + self.startTime
             if t1 < self.soundDuration:
             if t1 < self.soundDuration:
-                base.sfxPlayer.playSfx(self.sound, self.fLoop, 1, self.volume, t1, self.node)
+                base.sfxPlayer.playSfx(
+                    self.sound, self.fLoop, 1, self.volume, t1, self.node)
         self.state = CInterval.SStarted
         self.state = CInterval.SStarted
         self.currT = t
         self.currT = t
 
 

+ 5 - 2
direct/src/showbase/SfxPlayer.py

@@ -53,7 +53,9 @@ class SfxPlayer:
                 #print d, volume
                 #print d, volume
         return volume
         return volume
 
 
-    def playSfx(self, sfx, looping = 0, interrupt = 1, volume = None, time = 0.0, node=None):
+    def playSfx(
+            self, sfx, looping = 0, interrupt = 1, volume = None,
+            time = 0.0, node=None):
         if sfx:
         if sfx:
             # If we have either a node or a volume, we need to adjust the sfx
             # If we have either a node or a volume, we need to adjust the sfx
             # The volume passed in multiplies the distance base volume
             # The volume passed in multiplies the distance base volume
@@ -66,7 +68,8 @@ class SfxPlayer:
                     finalVolume *= volume
                     finalVolume *= volume
                 sfx.setVolume(finalVolume)
                 sfx.setVolume(finalVolume)
 
 
-            # dont start over if it's already playing, unless "interrupt" was specified
+            # dont start over if it's already playing, unless
+            # "interrupt" was specified
             if interrupt or (sfx.status() != AudioSound.PLAYING):
             if interrupt or (sfx.status() != AudioSound.PLAYING):
                 sfx.setTime(time)
                 sfx.setTime(time)
                 sfx.setLoop(looping)
                 sfx.setLoop(looping)

+ 41 - 25
direct/src/showbase/ShowBase.py

@@ -329,7 +329,8 @@ class ShowBase(DirectObject.DirectObject):
                 "Your Config.prc file must name at least one valid panda display\n"
                 "Your Config.prc file must name at least one valid panda display\n"
                 "library via load-display or aux-display.")
                 "library via load-display or aux-display.")
 
 
-        self.notify.info("Default graphics pipe is %s (%s)." % (self.pipe.getInterfaceName(), self.pipe.getType().getName()))
+        self.notify.info("Default graphics pipe is %s (%s)." % (
+            self.pipe.getInterfaceName(), self.pipe.getType().getName()))
         self.pipeList.append(self.pipe)
         self.pipeList.append(self.pipe)
 
 
     def makeAllPipes(self):
     def makeAllPipes(self):
@@ -362,10 +363,12 @@ class ShowBase(DirectObject.DirectObject):
             if not already:
             if not already:
                 pipe = selection.makePipe(pipeType)
                 pipe = selection.makePipe(pipeType)
                 if pipe:
                 if pipe:
-                    self.notify.info("Got aux graphics pipe %s (%s)." % (pipe.getInterfaceName(), pipe.getType().getName()))
+                    self.notify.info("Got aux graphics pipe %s (%s)." % (
+                        pipe.getInterfaceName(), pipe.getType().getName()))
                     self.pipeList.append(pipe)
                     self.pipeList.append(pipe)
                 else:
                 else:
-                    self.notify.info("Could not make graphics pipe %s." % (pipeType.getName()))
+                    self.notify.info("Could not make graphics pipe %s." % (
+                        pipeType.getName()))
 
 
     def openWindow(self, props = None, pipe = None, gsg = None,
     def openWindow(self, props = None, pipe = None, gsg = None,
                    type = None, name = None, scene = None,
                    type = None, name = None, scene = None,
@@ -506,7 +509,8 @@ class ShowBase(DirectObject.DirectObject):
                     self.closeWindow(self.win)
                     self.closeWindow(self.win)
 
 
         if self.win == None:
         if self.win == None:
-            self.notify.warning("Unable to open '%s' window." % (self.windowType))
+            self.notify.warning("Unable to open '%s' window." % (
+                self.windowType))
             if self.requireWindow:
             if self.requireWindow:
                 # Unless require-window is set to false, it is an
                 # Unless require-window is set to false, it is an
                 # error not to open a window.
                 # error not to open a window.
@@ -568,7 +572,8 @@ class ShowBase(DirectObject.DirectObject):
                 self.win.setClearDepthActive(oldClearDepthActive)
                 self.win.setClearDepthActive(oldClearDepthActive)
                 self.win.setClearDepth(oldClearDepth)
                 self.win.setClearDepth(oldClearDepth)
 
 
-            self.setFrameRateMeter(self.config.GetBool('show-frame-rate-meter', 0))
+            self.setFrameRateMeter(self.config.GetBool(
+                'show-frame-rate-meter', 0))
 
 
         return success
         return success
 
 
@@ -607,9 +612,10 @@ class ShowBase(DirectObject.DirectObject):
 
 
     def setupWindowControls(self):
     def setupWindowControls(self):
         if not self.winControls:
         if not self.winControls:
-            winCtrl = WindowControls(self.win, mouseWatcher=self.mouseWatcher,
-                                     cam=self.camera, cam2d=self.camera2d,
-                                     mouseKeyboard = self.dataRoot.find("**/*"))
+            winCtrl = WindowControls(
+                self.win, mouseWatcher=self.mouseWatcher,
+                cam=self.camera, cam2d=self.camera2d,
+                mouseKeyboard = self.dataRoot.find("**/*"))
             self.winControls.append(winCtrl)
             self.winControls.append(winCtrl)
 
 
 
 
@@ -937,7 +943,8 @@ class ShowBase(DirectObject.DirectObject):
             # mouse activity.
             # mouse activity.
             mw = self.buttonThrowers[0].getParent()
             mw = self.buttonThrowers[0].getParent()
             mouseRecorder = MouseRecorder('mouse')
             mouseRecorder = MouseRecorder('mouse')
-            self.recorder.addRecorder('mouse', mouseRecorder.upcastToRecorderBase())
+            self.recorder.addRecorder(
+                'mouse', mouseRecorder.upcastToRecorderBase())
             np = mw.getParent().attachNewNode(mouseRecorder)
             np = mw.getParent().attachNewNode(mouseRecorder)
             mw.reparentTo(np)
             mw.reparentTo(np)
 
 
@@ -1045,8 +1052,8 @@ class ShowBase(DirectObject.DirectObject):
             PStatClient.connect()
             PStatClient.connect()
 
 
     def addSfxManager(self, extraSfxManager):
     def addSfxManager(self, extraSfxManager):
-        # keep a list of sfx manager objects to apply settings to, since there may be others
-        # in addition to the one we create here
+        # keep a list of sfx manager objects to apply settings to,
+        # since there may be others in addition to the one we create here
         self.sfxManagerList.append(extraSfxManager)
         self.sfxManagerList.append(extraSfxManager)
         newSfxManagerIsValid = (extraSfxManager!=None) and extraSfxManager.isValid()
         newSfxManagerIsValid = (extraSfxManager!=None) and extraSfxManager.isValid()
         self.sfxManagerIsValidList.append(newSfxManagerIsValid)
         self.sfxManagerIsValidList.append(newSfxManagerIsValid)
@@ -1066,8 +1073,9 @@ class ShowBase(DirectObject.DirectObject):
             self.musicManager.setConcurrentSoundLimit(1)
             self.musicManager.setConcurrentSoundLimit(1)
             self.musicManager.setActive(self.musicActive)
             self.musicManager.setActive(self.musicActive)
 
 
-    # enableMusic/enableSoundEffects are meant to be called in response to a user request
-    # so sfxActive/musicActive represent how things *should* be, regardless of App/OS/HW state
+    # enableMusic/enableSoundEffects are meant to be called in response
+    # to a user request so sfxActive/musicActive represent how things
+    # *should* be, regardless of App/OS/HW state
     def enableMusic(self, bEnableMusic):
     def enableMusic(self, bEnableMusic):
         # dont setActive(1) if no audiofocus
         # dont setActive(1) if no audiofocus
         if self.AppHasAudioFocus and self.musicManagerIsValid:
         if self.AppHasAudioFocus and self.musicManagerIsValid:
@@ -1093,9 +1101,10 @@ class ShowBase(DirectObject.DirectObject):
         else:
         else:
             self.notify.debug("Disabling sound effects")
             self.notify.debug("Disabling sound effects")
 
 
-    # enable/disableAllAudio allow a programmable global override-off for current audio settings.
-    # they're meant to be called when app loses audio focus (switched out), so we can turn off sound
-    # without affecting internal sfxActive/musicActive sound settings, so things
+    # enable/disableAllAudio allow a programmable global override-off
+    # for current audio settings.  they're meant to be called when app
+    # loses audio focus (switched out), so we can turn off sound without
+    # affecting internal sfxActive/musicActive sound settings, so things
     # come back ok when the app is switched back to
     # come back ok when the app is switched back to
 
 
     def disableAllAudio(self):
     def disableAllAudio(self):
@@ -1124,7 +1133,9 @@ class ShowBase(DirectObject.DirectObject):
     def loadMusic(self, name):
     def loadMusic(self, name):
         return self.loader.loadMusic(name)
         return self.loader.loadMusic(name)
 
 
-    def playSfx(self, sfx, looping = 0, interrupt = 1, volume = None, time = 0.0, node = None):
+    def playSfx(
+            self, sfx, looping = 0, interrupt = 1, volume = None,
+            time = 0.0, node = None):
         # This goes through a special player for potential localization
         # This goes through a special player for potential localization
         return self.sfxPlayer.playSfx(sfx, looping, interrupt, volume, time, node)
         return self.sfxPlayer.playSfx(sfx, looping, interrupt, volume, time, node)
 
 
@@ -1133,7 +1144,8 @@ class ShowBase(DirectObject.DirectObject):
             if volume != None:
             if volume != None:
                 music.setVolume(volume)
                 music.setVolume(volume)
 
 
-            # if interrupt was set to 0, start over even if it's already playing
+            # if interrupt was set to 0, start over even if it's
+            # already playing
             if interrupt or (music.status() != AudioSound.PLAYING):
             if interrupt or (music.status() != AudioSound.PLAYING):
                 music.setTime(time)
                 music.setTime(time)
                 music.setLoop(looping)
                 music.setLoop(looping)
@@ -1218,7 +1230,8 @@ class ShowBase(DirectObject.DirectObject):
     def restart(self):
     def restart(self):
         self.shutdown()
         self.shutdown()
         # resetPrevTransform goes at the very beginning of the frame.
         # resetPrevTransform goes at the very beginning of the frame.
-        self.taskMgr.add(self.resetPrevTransform, 'resetPrevTransform', priority = -51)
+        self.taskMgr.add(
+            self.resetPrevTransform, 'resetPrevTransform', priority = -51)
         # give the dataLoop task a reasonably "early" priority,
         # give the dataLoop task a reasonably "early" priority,
         # so that it will get run before most tasks
         # so that it will get run before most tasks
         self.taskMgr.add(self.dataLoop, 'dataLoop', priority = -50)
         self.taskMgr.add(self.dataLoop, 'dataLoop', priority = -50)
@@ -1231,7 +1244,8 @@ class ShowBase(DirectObject.DirectObject):
         self.taskMgr.add(self.collisionLoop, 'collisionLoop', priority = 30)
         self.taskMgr.add(self.collisionLoop, 'collisionLoop', priority = 30)
         # do the shadowCollisionLoop after the collisionLoop and
         # do the shadowCollisionLoop after the collisionLoop and
         # befor the igLoop:
         # befor the igLoop:
-        self.taskMgr.add(self.shadowCollisionLoop, 'shadowCollisionLoop', priority = 45)
+        self.taskMgr.add(
+            self.shadowCollisionLoop, 'shadowCollisionLoop', priority = 45)
         # give the igLoop task a reasonably "late" priority,
         # give the igLoop task a reasonably "late" priority,
         # so that it will get run after most tasks
         # so that it will get run after most tasks
         self.taskMgr.add(self.igLoop, 'igLoop', priority = 50)
         self.taskMgr.add(self.igLoop, 'igLoop', priority = 50)
@@ -1632,8 +1646,8 @@ class ShowBase(DirectObject.DirectObject):
                       camera = None, size = 256,
                       camera = None, size = 256,
                       cameraMask = BitMask32.allOn(),
                       cameraMask = BitMask32.allOn(),
                       numVertices = 1000):
                       numVertices = 1000):
-
-        """ This works much like saveCubeMap(), and uses the graphics
+        """
+        This works much like saveCubeMap(), and uses the graphics
         API's hardware cube-mapping ability to get a 360-degree view
         API's hardware cube-mapping ability to get a 360-degree view
         of the world.  But then it converts the six cube map faces
         of the world.  But then it converts the six cube map faces
         into a single fisheye texture, suitable for applying as a
         into a single fisheye texture, suitable for applying as a
@@ -1642,8 +1656,8 @@ class ShowBase(DirectObject.DirectObject):
         For eye-relative static environment maps, sphere maps are
         For eye-relative static environment maps, sphere maps are
         often preferable to cube maps because they require only a
         often preferable to cube maps because they require only a
         single texture and because they are supported on a broader
         single texture and because they are supported on a broader
-        range of hardware.  """
-
+        range of hardware.
+        """
         if source == None:
         if source == None:
             source = base.win
             source = base.win
 
 
@@ -1796,7 +1810,9 @@ class ShowBase(DirectObject.DirectObject):
 
 
 # A class to encapsulate information necessary for multiwindow support.
 # A class to encapsulate information necessary for multiwindow support.
 class WindowControls:
 class WindowControls:
-    def __init__(self, win, cam=None, cam2d=None, mouseWatcher=None, mouseKeyboard=None, closeCmd=lambda : 0):
+    def __init__(
+            self, win, cam=None, cam2d=None, mouseWatcher=None,
+            mouseKeyboard=None, closeCmd=lambda: 0):
         self.win = win
         self.win = win
         self.camera = cam
         self.camera = cam
         self.camera2d = cam2d
         self.camera2d = cam2d

+ 5 - 1
panda/src/linmath/lquaternion_src.cxx

@@ -157,7 +157,11 @@ get_hpr(CoordinateSystem cs) const {
   FLOATNAME(LVecBase3) hpr;
   FLOATNAME(LVecBase3) hpr;
 
 
   if (cs == CS_zup_right) {
   if (cs == CS_zup_right) {
-    FLOATTYPE N = (_v.data[0] * _v.data[0]) + (_v.data[1] * _v.data[1]) + (_v.data[2] * _v.data[2]) + (_v.data[3] * _v.data[3]);
+    FLOATTYPE N =
+        (_v.data[0] * _v.data[0]) +
+        (_v.data[1] * _v.data[1]) +
+        (_v.data[2] * _v.data[2]) +
+        (_v.data[3] * _v.data[3]);
     FLOATTYPE s = (N == 0.0f) ? 0.0f : (2.0f / N);
     FLOATTYPE s = (N == 0.0f) ? 0.0f : (2.0f / N);
     FLOATTYPE xs, ys, zs, wx, wy, wz, xx, xy, xz, yy, yz, zz, c1, c2, c3, c4;
     FLOATTYPE xs, ys, zs, wx, wy, wz, xx, xy, xz, yy, yz, zz, c1, c2, c3, c4;
     FLOATTYPE cr, sr, cp, sp, ch, sh;
     FLOATTYPE cr, sr, cp, sp, ch, sh;

+ 1 - 3
panda/src/physics/angularEulerIntegrator.cxx

@@ -143,11 +143,9 @@ child_integrate(Physical *physical,
 
 
     // here's the trick.  we've been accumulating these forces as vectors
     // here's the trick.  we've been accumulating these forces as vectors
     // and treating them as vectors, but now we're going to treat them as pure
     // and treating them as vectors, but now we're going to treat them as pure
-    // imaginary quaternions where r = 0.  This vector NOW represents the
+    // imaginary quaternions where r = 0.  This vector now represents the
     // imaginary vector formed by (i, j, k).
     // imaginary vector formed by (i, j, k).
-
     float len = rot_vec.length();
     float len = rot_vec.length();
-
     if (len) {
     if (len) {
       LVector3f normalized_rot_vec = rot_vec;
       LVector3f normalized_rot_vec = rot_vec;
       normalized_rot_vec *= 1.0f / len;
       normalized_rot_vec *= 1.0f / len;