mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 15:53:55 -04:00
Audio3DManager: fix regression with setSoundVelocityAuto()
This commit is contained in:
parent
6e730a2e95
commit
2da791b9fb
@ -2,7 +2,7 @@
|
||||
|
||||
__all__ = ['Audio3DManager']
|
||||
|
||||
from panda3d.core import Vec3, VBase3, WeakNodePath
|
||||
from panda3d.core import Vec3, VBase3, WeakNodePath, ClockObject
|
||||
from direct.task.TaskManagerGlobal import Task, taskMgr
|
||||
#
|
||||
class Audio3DManager:
|
||||
@ -141,14 +141,22 @@ class Audio3DManager:
|
||||
"""
|
||||
Get the velocity of the sound.
|
||||
"""
|
||||
if (sound in self.vel_dict):
|
||||
if sound in self.vel_dict:
|
||||
vel = self.vel_dict[sound]
|
||||
if (vel!=None):
|
||||
if vel is not None:
|
||||
return vel
|
||||
else:
|
||||
for known_object in list(self.sound_dict.keys()):
|
||||
if self.sound_dict[known_object].count(sound):
|
||||
return known_object.getPosDelta(self.root)/globalClock.getDt()
|
||||
|
||||
for known_object in list(self.sound_dict.keys()):
|
||||
if self.sound_dict[known_object].count(sound):
|
||||
node_path = known_object.getNodePath()
|
||||
if not node_path:
|
||||
# The node has been deleted.
|
||||
del self.sound_dict[known_object]
|
||||
continue
|
||||
|
||||
clock = ClockObject.getGlobalClock()
|
||||
return node_path.getPosDelta(self.root) / clock.getDt()
|
||||
|
||||
return VBase3(0, 0, 0)
|
||||
|
||||
def setListenerVelocity(self, velocity):
|
||||
@ -176,10 +184,11 @@ class Audio3DManager:
|
||||
"""
|
||||
Get the velocity of the listener.
|
||||
"""
|
||||
if (self.listener_vel!=None):
|
||||
if self.listener_vel is not None:
|
||||
return self.listener_vel
|
||||
elif (self.listener_target!=None):
|
||||
return self.listener_target.getPosDelta(self.root)/globalClock.getDt()
|
||||
elif self.listener_target is not None:
|
||||
clock = ClockObject.getGlobalClock()
|
||||
return self.listener_target.getPosDelta(self.root) / clock.getDt()
|
||||
else:
|
||||
return VBase3(0, 0, 0)
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
------------------------ RELEASE 1.10.1 -----------------------
|
||||
|
||||
* Fix regression with Audio3DManager.setSoundVelocityAuto()
|
||||
* Audio3DManager accepts tuple in setSoundVelocity/setListenerVelocity
|
||||
|
||||
------------------------ RELEASE 1.10.0 -----------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user