def test_weak_nodepath_comparison(): from panda3d.core import NodePath, WeakNodePath path = NodePath("node") weak = WeakNodePath(path) assert path == weak assert weak == path assert weak <= path assert path <= weak assert hash(path) == hash(weak) assert weak.get_node_path() == path assert weak.node() == path.node()
def test_weak_nodepath_comparison(): from panda3d.core import NodePath, WeakNodePath path = NodePath("node") weak = WeakNodePath(path) assert path == weak assert weak == path assert weak <= path assert path <= weak assert weak >= path assert path >= weak assert not (path != weak) assert not (weak != path) assert not (weak > path) assert not (path > weak) assert not (weak < path) assert not (path < weak) assert hash(path) == hash(weak) assert weak.get_node_path() == path assert weak.node() == path.node()
def attachSoundToObject(self, sound, object): """ Sound will come from the location of the object it is attached to. If the object is deleted, the sound will automatically be removed. """ # sound is an AudioSound # object is any Panda object with coordinates for known_object in list(self.sound_dict.keys()): if self.sound_dict[known_object].count(sound): # This sound is already attached to something #return 0 # detach sound self.sound_dict[known_object].remove(sound) if len(self.sound_dict[known_object]) == 0: # if there are no other sounds, don't track # the object any more del self.sound_dict[known_object] if object not in self.sound_dict: self.sound_dict[WeakNodePath(object)] = [] self.sound_dict[object].append(sound) return 1