mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
direct: Use warnings module for more verbose deprecation prints
Closes #1067 Fixes #669
This commit is contained in:
parent
ff80adc680
commit
2493c0689f
@ -11,7 +11,7 @@ from panda3d.core import Loader as PandaLoader
|
|||||||
from direct.showbase.DirectObject import DirectObject
|
from direct.showbase.DirectObject import DirectObject
|
||||||
from direct.showbase.Loader import Loader
|
from direct.showbase.Loader import Loader
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
|
import warnings
|
||||||
|
|
||||||
class Actor(DirectObject, NodePath):
|
class Actor(DirectObject, NodePath):
|
||||||
"""
|
"""
|
||||||
@ -1652,6 +1652,8 @@ class Actor(DirectObject, NodePath):
|
|||||||
|
|
||||||
This method is deprecated. You should use setBlend() instead.
|
This method is deprecated. You should use setBlend() instead.
|
||||||
"""
|
"""
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("This method is deprecated. You should use setBlend() instead.", DeprecationWarning, stacklevel=2)
|
||||||
self.setBlend(animBlend = True, blendType = blendType, partName = partName)
|
self.setBlend(animBlend = True, blendType = blendType, partName = partName)
|
||||||
|
|
||||||
def disableBlend(self, partName = None):
|
def disableBlend(self, partName = None):
|
||||||
@ -1661,6 +1663,8 @@ class Actor(DirectObject, NodePath):
|
|||||||
|
|
||||||
This method is deprecated. You should use setBlend() instead.
|
This method is deprecated. You should use setBlend() instead.
|
||||||
"""
|
"""
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("This method is deprecated. You should use setBlend() instead.", DeprecationWarning, stacklevel=2)
|
||||||
self.setBlend(animBlend = False, partName = partName)
|
self.setBlend(animBlend = False, partName = partName)
|
||||||
|
|
||||||
def setControlEffect(self, animName, effect,
|
def setControlEffect(self, animName, effect,
|
||||||
|
3
direct/src/dist/FreezeTool.py
vendored
3
direct/src/dist/FreezeTool.py
vendored
@ -12,6 +12,7 @@ import io
|
|||||||
import distutils.sysconfig as sysconf
|
import distutils.sysconfig as sysconf
|
||||||
import zipfile
|
import zipfile
|
||||||
import importlib
|
import importlib
|
||||||
|
import warnings
|
||||||
|
|
||||||
from . import pefile
|
from . import pefile
|
||||||
|
|
||||||
@ -1985,7 +1986,7 @@ class Freezer:
|
|||||||
|
|
||||||
if append_offset:
|
if append_offset:
|
||||||
# This is for legacy deploy-stub.
|
# This is for legacy deploy-stub.
|
||||||
print("WARNING: Could not find blob header. Is deploy-stub outdated?")
|
warnings.warn("Could not find blob header. Is deploy-stub outdated?")
|
||||||
blob += struct.pack('<Q', blob_offset)
|
blob += struct.pack('<Q', blob_offset)
|
||||||
|
|
||||||
with open(target, 'wb') as f:
|
with open(target, 'wb') as f:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from panda3d.direct import CInterval
|
from panda3d.direct import CInterval
|
||||||
from .extension_native_helpers import Dtool_funcToMethod
|
from .extension_native_helpers import Dtool_funcToMethod
|
||||||
from direct.directnotify.DirectNotifyGlobal import directNotify
|
from direct.directnotify.DirectNotifyGlobal import directNotify
|
||||||
|
import warnings
|
||||||
|
|
||||||
CInterval.DtoolClassDict["notify"] = directNotify.newCategory("Interval")
|
CInterval.DtoolClassDict["notify"] = directNotify.newCategory("Interval")
|
||||||
|
|
||||||
@ -18,7 +19,8 @@ del setT
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
def play(self, t0 = 0.0, duration = None, scale = 1.0):
|
def play(self, t0 = 0.0, duration = None, scale = 1.0):
|
||||||
self.notify.error("CInterval.play() is deprecated, use start() instead")
|
if __debug__:
|
||||||
|
warnings.warn("CInterval.play() is deprecated, use start() instead", DeprecationWarning, stacklevel=2)
|
||||||
if duration: # None or 0 implies full length
|
if duration: # None or 0 implies full length
|
||||||
self.start(t0, t0 + duration, scale)
|
self.start(t0, t0 + duration, scale)
|
||||||
else:
|
else:
|
||||||
@ -29,7 +31,8 @@ del play
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.notify.error("CInterval.stop() is deprecated, use finish() instead")
|
if __debug__:
|
||||||
|
warnings.warn("CInterval.stop() is deprecated, use finish() instead", DeprecationWarning, stacklevel=2)
|
||||||
self.finish()
|
self.finish()
|
||||||
|
|
||||||
Dtool_funcToMethod(stop, CInterval)
|
Dtool_funcToMethod(stop, CInterval)
|
||||||
@ -37,7 +40,8 @@ del stop
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
def setFinalT(self):
|
def setFinalT(self):
|
||||||
self.notify.error("CInterval.setFinalT() is deprecated, use finish() instead")
|
if __debug__:
|
||||||
|
warnings.warn("CInterval.setFinalT() is deprecated, use finish() instead", DeprecationWarning, stacklevel=2)
|
||||||
self.finish()
|
self.finish()
|
||||||
|
|
||||||
Dtool_funcToMethod(setFinalT, CInterval)
|
Dtool_funcToMethod(setFinalT, CInterval)
|
||||||
|
@ -10,11 +10,13 @@ of the NodePath class
|
|||||||
|
|
||||||
from panda3d.core import NodePath
|
from panda3d.core import NodePath
|
||||||
from .extension_native_helpers import Dtool_funcToMethod
|
from .extension_native_helpers import Dtool_funcToMethod
|
||||||
|
import warnings
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
def id(self):
|
def id(self):
|
||||||
"""Deprecated. Returns a unique id identifying the NodePath instance"""
|
"""Deprecated. Returns a unique id identifying the NodePath instance"""
|
||||||
print("Warning: NodePath.id() is deprecated. Use hash(NodePath) or NodePath.get_key() instead.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.id() is deprecated. Use hash(NodePath) or NodePath.get_key() instead.", DeprecationWarning, stacklevel=2)
|
||||||
return self.getKey()
|
return self.getKey()
|
||||||
|
|
||||||
Dtool_funcToMethod(id, NodePath)
|
Dtool_funcToMethod(id, NodePath)
|
||||||
@ -22,7 +24,8 @@ del id
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def getChildrenAsList(self):
|
def getChildrenAsList(self):
|
||||||
"""Deprecated. Converts a node path's child NodePathCollection into a list"""
|
"""Deprecated. Converts a node path's child NodePathCollection into a list"""
|
||||||
print("Warning: NodePath.getChildrenAsList() is deprecated. Use get_children() instead.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.getChildrenAsList() is deprecated. Use get_children() instead.", DeprecationWarning, stacklevel=2)
|
||||||
return list(self.getChildren())
|
return list(self.getChildren())
|
||||||
|
|
||||||
Dtool_funcToMethod(getChildrenAsList, NodePath)
|
Dtool_funcToMethod(getChildrenAsList, NodePath)
|
||||||
@ -31,7 +34,8 @@ del getChildrenAsList
|
|||||||
|
|
||||||
def printChildren(self):
|
def printChildren(self):
|
||||||
"""Deprecated. Prints out the children of the bottom node of a node path"""
|
"""Deprecated. Prints out the children of the bottom node of a node path"""
|
||||||
print("Warning: NodePath.printChildren() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.printChildren() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
for child in self.getChildren():
|
for child in self.getChildren():
|
||||||
print(child.getName())
|
print(child.getName())
|
||||||
Dtool_funcToMethod(printChildren, NodePath)
|
Dtool_funcToMethod(printChildren, NodePath)
|
||||||
@ -40,7 +44,8 @@ del printChildren
|
|||||||
|
|
||||||
def removeChildren(self):
|
def removeChildren(self):
|
||||||
"""Deprecated. Deletes the children of the bottom node of a node path"""
|
"""Deprecated. Deletes the children of the bottom node of a node path"""
|
||||||
print("Warning: NodePath.removeChildren() is deprecated. Use get_children().detach() instead.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.removeChildren() is deprecated. Use get_children().detach() instead.", DeprecationWarning, stacklevel=2)
|
||||||
self.getChildren().detach()
|
self.getChildren().detach()
|
||||||
Dtool_funcToMethod(removeChildren, NodePath)
|
Dtool_funcToMethod(removeChildren, NodePath)
|
||||||
del removeChildren
|
del removeChildren
|
||||||
@ -48,7 +53,8 @@ del removeChildren
|
|||||||
|
|
||||||
def toggleVis(self):
|
def toggleVis(self):
|
||||||
"""Deprecated. Toggles visibility of a nodePath"""
|
"""Deprecated. Toggles visibility of a nodePath"""
|
||||||
print("Warning: NodePath.toggleVis() is deprecated. Use is_hidden(), show() and hide() instead.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.toggleVis() is deprecated. Use is_hidden(), show() and hide() instead.", DeprecationWarning, stacklevel=2)
|
||||||
if self.isHidden():
|
if self.isHidden():
|
||||||
self.show()
|
self.show()
|
||||||
return 1
|
return 1
|
||||||
@ -61,7 +67,8 @@ del toggleVis
|
|||||||
|
|
||||||
def showSiblings(self):
|
def showSiblings(self):
|
||||||
"""Deprecated. Show all the siblings of a node path"""
|
"""Deprecated. Show all the siblings of a node path"""
|
||||||
print("Warning: NodePath.showSiblings() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.showSiblings() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
for sib in self.getParent().getChildren():
|
for sib in self.getParent().getChildren():
|
||||||
if sib.node() != self.node():
|
if sib.node() != self.node():
|
||||||
sib.show()
|
sib.show()
|
||||||
@ -71,7 +78,8 @@ del showSiblings
|
|||||||
|
|
||||||
def hideSiblings(self):
|
def hideSiblings(self):
|
||||||
"""Deprecated. Hide all the siblings of a node path"""
|
"""Deprecated. Hide all the siblings of a node path"""
|
||||||
print("Warning: NodePath.hideSiblings() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.hideSiblings() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
for sib in self.getParent().getChildren():
|
for sib in self.getParent().getChildren():
|
||||||
if sib.node() != self.node():
|
if sib.node() != self.node():
|
||||||
sib.hide()
|
sib.hide()
|
||||||
@ -81,7 +89,8 @@ del hideSiblings
|
|||||||
|
|
||||||
def showAllDescendants(self):
|
def showAllDescendants(self):
|
||||||
"""Deprecated. Show the node path and all its children"""
|
"""Deprecated. Show the node path and all its children"""
|
||||||
print("Warning: NodePath.showAllDescendants() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.showAllDescendants() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
self.show()
|
self.show()
|
||||||
for child in self.getChildren():
|
for child in self.getChildren():
|
||||||
child.showAllDescendants()
|
child.showAllDescendants()
|
||||||
@ -91,7 +100,8 @@ del showAllDescendants
|
|||||||
|
|
||||||
def isolate(self):
|
def isolate(self):
|
||||||
"""Deprecated. Show the node path and hide its siblings"""
|
"""Deprecated. Show the node path and hide its siblings"""
|
||||||
print("Warning: NodePath.isolate() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.isolate() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
self.showAllDescendants()
|
self.showAllDescendants()
|
||||||
for sib in self.getParent().getChildren():
|
for sib in self.getParent().getChildren():
|
||||||
if sib.node() != self.node():
|
if sib.node() != self.node():
|
||||||
@ -102,10 +112,10 @@ del isolate
|
|||||||
|
|
||||||
def remove(self):
|
def remove(self):
|
||||||
"""Deprecated. Remove a node path from the scene graph"""
|
"""Deprecated. Remove a node path from the scene graph"""
|
||||||
print("Warning: NodePath.remove() is deprecated. Use remove_node() instead.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.remove() is deprecated. Use remove_node() instead.", DeprecationWarning, stacklevel=2)
|
||||||
# Send message in case anyone needs to do something
|
# Send message in case anyone needs to do something
|
||||||
# before node is deleted
|
# before node is deleted
|
||||||
from direct.showbase.MessengerGlobal import messenger
|
|
||||||
messenger.send('preRemoveNodePath', [self])
|
messenger.send('preRemoveNodePath', [self])
|
||||||
# Remove nodePath
|
# Remove nodePath
|
||||||
self.removeNode()
|
self.removeNode()
|
||||||
@ -115,7 +125,8 @@ del remove
|
|||||||
|
|
||||||
def lsNames(self):
|
def lsNames(self):
|
||||||
"""Deprecated. Walk down a tree and print out the path"""
|
"""Deprecated. Walk down a tree and print out the path"""
|
||||||
print("Warning: NodePath.lsNames() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.lsNames() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
if self.isEmpty():
|
if self.isEmpty():
|
||||||
print("(empty)")
|
print("(empty)")
|
||||||
else:
|
else:
|
||||||
@ -129,7 +140,8 @@ del lsNames
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def lsNamesRecurse(self, indentString=' '):
|
def lsNamesRecurse(self, indentString=' '):
|
||||||
"""Deprecated. Walk down a tree and print out the path"""
|
"""Deprecated. Walk down a tree and print out the path"""
|
||||||
print("Warning: NodePath.lsNamesRecurse() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.lsNamesRecurse() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
for nodePath in self.getChildren():
|
for nodePath in self.getChildren():
|
||||||
type = nodePath.node().getType().getName()
|
type = nodePath.node().getType().getName()
|
||||||
name = nodePath.getName()
|
name = nodePath.getName()
|
||||||
@ -141,7 +153,8 @@ del lsNamesRecurse
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def reverseLsNames(self):
|
def reverseLsNames(self):
|
||||||
"""Deprecated. Walk up a tree and print out the path to the root"""
|
"""Deprecated. Walk up a tree and print out the path to the root"""
|
||||||
print("Warning: NodePath.reverseLsNames() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.reverseLsNames() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
ancestors = list(self.getAncestors())
|
ancestors = list(self.getAncestors())
|
||||||
ancestry = ancestors.reverse()
|
ancestry = ancestors.reverse()
|
||||||
indentString = ""
|
indentString = ""
|
||||||
@ -156,7 +169,8 @@ del reverseLsNames
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def getAncestry(self):
|
def getAncestry(self):
|
||||||
"""Deprecated. Get a list of a node path's ancestors"""
|
"""Deprecated. Get a list of a node path's ancestors"""
|
||||||
print("NodePath.getAncestry() is deprecated. Use get_ancestors() instead.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.getAncestry() is deprecated. Use get_ancestors() instead.", DeprecationWarning, stacklevel=2)
|
||||||
ancestors = list(self.getAncestors())
|
ancestors = list(self.getAncestors())
|
||||||
ancestors.reverse()
|
ancestors.reverse()
|
||||||
return ancestors
|
return ancestors
|
||||||
@ -169,8 +183,8 @@ def pPrintString(self, other = None):
|
|||||||
"""
|
"""
|
||||||
Deprecated. pretty print
|
Deprecated. pretty print
|
||||||
"""
|
"""
|
||||||
print("NodePath.pPrintString() is deprecated.")
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.pPrintString() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
# Normally I would have put the if __debug__ around
|
# Normally I would have put the if __debug__ around
|
||||||
# the entire funciton, the that doesn't seem to work
|
# the entire funciton, the that doesn't seem to work
|
||||||
# with -extensions. Maybe someone will look into
|
# with -extensions. Maybe someone will look into
|
||||||
@ -195,13 +209,15 @@ def pPrintString(self, other = None):
|
|||||||
" 'Scale': (%s),\n" % scale.pPrintValues() +
|
" 'Scale': (%s),\n" % scale.pPrintValues() +
|
||||||
" 'Shear': (%s),\n" % shear.pPrintValues() +
|
" 'Shear': (%s),\n" % shear.pPrintValues() +
|
||||||
"}")
|
"}")
|
||||||
|
|
||||||
Dtool_funcToMethod(pPrintString, NodePath)
|
Dtool_funcToMethod(pPrintString, NodePath)
|
||||||
del pPrintString
|
del pPrintString
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
def printPos(self, other = None, sd = 2):
|
def printPos(self, other = None, sd = 2):
|
||||||
""" Deprecated. Pretty print a node path's pos """
|
""" Deprecated. Pretty print a node path's pos """
|
||||||
print("NodePath.printPos() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.printPos() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
formatString = '%0.' + '%d' % sd + 'f'
|
formatString = '%0.' + '%d' % sd + 'f'
|
||||||
if other:
|
if other:
|
||||||
pos = self.getPos(other)
|
pos = self.getPos(other)
|
||||||
@ -220,7 +236,8 @@ del printPos
|
|||||||
|
|
||||||
def printHpr(self, other = None, sd = 2):
|
def printHpr(self, other = None, sd = 2):
|
||||||
""" Deprecated. Pretty print a node path's hpr """
|
""" Deprecated. Pretty print a node path's hpr """
|
||||||
print("NodePath.printHpr() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.printHpr() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
formatString = '%0.' + '%d' % sd + 'f'
|
formatString = '%0.' + '%d' % sd + 'f'
|
||||||
if other:
|
if other:
|
||||||
hpr = self.getHpr(other)
|
hpr = self.getHpr(other)
|
||||||
@ -239,7 +256,8 @@ del printHpr
|
|||||||
|
|
||||||
def printScale(self, other = None, sd = 2):
|
def printScale(self, other = None, sd = 2):
|
||||||
""" Deprecated. Pretty print a node path's scale """
|
""" Deprecated. Pretty print a node path's scale """
|
||||||
print("NodePath.printScale() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.printScale() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
formatString = '%0.' + '%d' % sd + 'f'
|
formatString = '%0.' + '%d' % sd + 'f'
|
||||||
if other:
|
if other:
|
||||||
scale = self.getScale(other)
|
scale = self.getScale(other)
|
||||||
@ -258,7 +276,8 @@ del printScale
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def printPosHpr(self, other = None, sd = 2):
|
def printPosHpr(self, other = None, sd = 2):
|
||||||
""" Deprecated. Pretty print a node path's pos and, hpr """
|
""" Deprecated. Pretty print a node path's pos and, hpr """
|
||||||
print("NodePath.printPosHpr() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.printPosHpr() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
formatString = '%0.' + '%d' % sd + 'f'
|
formatString = '%0.' + '%d' % sd + 'f'
|
||||||
if other:
|
if other:
|
||||||
pos = self.getPos(other)
|
pos = self.getPos(other)
|
||||||
@ -282,7 +301,8 @@ del printPosHpr
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def printPosHprScale(self, other = None, sd = 2):
|
def printPosHprScale(self, other = None, sd = 2):
|
||||||
""" Deprecated. Pretty print a node path's pos, hpr, and scale """
|
""" Deprecated. Pretty print a node path's pos, hpr, and scale """
|
||||||
print("NodePath.printPosHprScale() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.printPosHprScale() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
formatString = '%0.' + '%d' % sd + 'f'
|
formatString = '%0.' + '%d' % sd + 'f'
|
||||||
if other:
|
if other:
|
||||||
pos = self.getPos(other)
|
pos = self.getPos(other)
|
||||||
@ -312,7 +332,8 @@ del printPosHprScale
|
|||||||
|
|
||||||
def printTransform(self, other = None, sd = 2, fRecursive = 0):
|
def printTransform(self, other = None, sd = 2, fRecursive = 0):
|
||||||
"Deprecated."
|
"Deprecated."
|
||||||
print("NodePath.printTransform() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.printTransform() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
from panda3d.core import Vec3
|
from panda3d.core import Vec3
|
||||||
fmtStr = '%%0.%df' % sd
|
fmtStr = '%%0.%df' % sd
|
||||||
name = self.getName()
|
name = self.getName()
|
||||||
@ -352,18 +373,21 @@ del printTransform
|
|||||||
|
|
||||||
def iPos(self, other = None):
|
def iPos(self, other = None):
|
||||||
""" Deprecated. Set node path's pos to 0, 0, 0 """
|
""" Deprecated. Set node path's pos to 0, 0, 0 """
|
||||||
print("NodePath.iPos() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.iPos() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
if other:
|
if other:
|
||||||
self.setPos(other, 0, 0, 0)
|
self.setPos(other, 0, 0, 0)
|
||||||
else:
|
else:
|
||||||
self.setPos(0, 0, 0)
|
self.setPos(0, 0, 0)
|
||||||
|
|
||||||
Dtool_funcToMethod(iPos, NodePath)
|
Dtool_funcToMethod(iPos, NodePath)
|
||||||
del iPos
|
del iPos
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
def iHpr(self, other = None):
|
def iHpr(self, other = None):
|
||||||
""" Deprecated. Set node path's hpr to 0, 0, 0 """
|
""" Deprecated. Set node path's hpr to 0, 0, 0 """
|
||||||
print("NodePath.iHpr() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.iHpr() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
if other:
|
if other:
|
||||||
self.setHpr(other, 0, 0, 0)
|
self.setHpr(other, 0, 0, 0)
|
||||||
else:
|
else:
|
||||||
@ -374,7 +398,8 @@ del iHpr
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def iScale(self, other = None):
|
def iScale(self, other = None):
|
||||||
""" Deprecated. Set node path's scale to 1, 1, 1 """
|
""" Deprecated. Set node path's scale to 1, 1, 1 """
|
||||||
print("NodePath.iScale() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.iScale() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
if other:
|
if other:
|
||||||
self.setScale(other, 1, 1, 1)
|
self.setScale(other, 1, 1, 1)
|
||||||
else:
|
else:
|
||||||
@ -385,7 +410,8 @@ del iScale
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def iPosHpr(self, other = None):
|
def iPosHpr(self, other = None):
|
||||||
""" Deprecated. Set node path's pos and hpr to 0, 0, 0 """
|
""" Deprecated. Set node path's pos and hpr to 0, 0, 0 """
|
||||||
print("NodePath.iPosHpr() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.iPosHpr() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
if other:
|
if other:
|
||||||
self.setPosHpr(other, 0, 0, 0, 0, 0, 0)
|
self.setPosHpr(other, 0, 0, 0, 0, 0, 0)
|
||||||
else:
|
else:
|
||||||
@ -396,7 +422,8 @@ del iPosHpr
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def iPosHprScale(self, other = None):
|
def iPosHprScale(self, other = None):
|
||||||
""" Deprecated. Set node path's pos and hpr to 0, 0, 0 and scale to 1, 1, 1 """
|
""" Deprecated. Set node path's pos and hpr to 0, 0, 0 and scale to 1, 1, 1 """
|
||||||
print("NodePath.iPosHprScale() is deprecated.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.iPosHprScale() is deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
if other:
|
if other:
|
||||||
self.setPosHprScale(other, 0, 0, 0, 0, 0, 0, 1, 1, 1)
|
self.setPosHprScale(other, 0, 0, 0, 0, 0, 0, 1, 1, 1)
|
||||||
else:
|
else:
|
||||||
@ -461,11 +488,12 @@ def showCS(self, mask = None):
|
|||||||
CameraBitmask) that indicates which particular collision
|
CameraBitmask) that indicates which particular collision
|
||||||
solids should be made visible; otherwise, all of them will be.
|
solids should be made visible; otherwise, all of them will be.
|
||||||
"""
|
"""
|
||||||
print("NodePath.showCS() is deprecated. Use findAllMatches('**/+CollisionNode').show() instead.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.showCS() is deprecated. Use findAllMatches('**/+CollisionNode').show() instead.", DeprecationWarning, stacklevel=2)
|
||||||
npc = self.findAllMatches('**/+CollisionNode')
|
npc = self.findAllMatches('**/+CollisionNode')
|
||||||
for p in range(0, npc.getNumPaths()):
|
for p in range(0, npc.getNumPaths()):
|
||||||
np = npc[p]
|
np = npc[p]
|
||||||
if (mask is None or (np.node().getIntoCollideMask() & mask).getWord()):
|
if (mask == None or (np.node().getIntoCollideMask() & mask).getWord()):
|
||||||
np.show()
|
np.show()
|
||||||
|
|
||||||
Dtool_funcToMethod(showCS, NodePath)
|
Dtool_funcToMethod(showCS, NodePath)
|
||||||
@ -479,11 +507,12 @@ def hideCS(self, mask = None):
|
|||||||
CameraBitmask) that indicates which particular collision
|
CameraBitmask) that indicates which particular collision
|
||||||
solids should be hidden; otherwise, all of them will be.
|
solids should be hidden; otherwise, all of them will be.
|
||||||
"""
|
"""
|
||||||
print("NodePath.hideCS() is deprecated. Use findAllMatches('**/+CollisionNode').hide() instead.")
|
if __debug__:
|
||||||
|
warnings.warn("NodePath.hideCS() is deprecated. Use findAllMatches('**/+CollisionNode').hide() instead.", DeprecationWarning, stacklevel=2)
|
||||||
npc = self.findAllMatches('**/+CollisionNode')
|
npc = self.findAllMatches('**/+CollisionNode')
|
||||||
for p in range(0, npc.getNumPaths()):
|
for p in range(0, npc.getNumPaths()):
|
||||||
np = npc[p]
|
np = npc[p]
|
||||||
if (mask is None or (np.node().getIntoCollideMask() & mask).getWord()):
|
if (mask == None or (np.node().getIntoCollideMask() & mask).getWord()):
|
||||||
np.hide()
|
np.hide()
|
||||||
|
|
||||||
Dtool_funcToMethod(hideCS, NodePath)
|
Dtool_funcToMethod(hideCS, NodePath)
|
||||||
|
@ -4,6 +4,7 @@ Methods to extend functionality of the VBase3 class
|
|||||||
|
|
||||||
from panda3d.core import VBase3
|
from panda3d.core import VBase3
|
||||||
from .extension_native_helpers import Dtool_funcToMethod
|
from .extension_native_helpers import Dtool_funcToMethod
|
||||||
|
import warnings
|
||||||
|
|
||||||
def pPrintValues(self):
|
def pPrintValues(self):
|
||||||
"""
|
"""
|
||||||
@ -17,7 +18,8 @@ def asTuple(self):
|
|||||||
"""
|
"""
|
||||||
Returns the vector as a tuple.
|
Returns the vector as a tuple.
|
||||||
"""
|
"""
|
||||||
print("Warning: VBase3.asTuple() is no longer needed and deprecated. Use the vector directly instead.")
|
if __debug__:
|
||||||
|
warnings.warn("VBase3.asTuple() is no longer needed and deprecated. Use the vector directly instead.", DeprecationWarning, stacklevel=2)
|
||||||
return tuple(self)
|
return tuple(self)
|
||||||
Dtool_funcToMethod(asTuple, VBase3)
|
Dtool_funcToMethod(asTuple, VBase3)
|
||||||
del asTuple
|
del asTuple
|
||||||
|
@ -4,6 +4,7 @@ Methods to extend functionality of the VBase4 class
|
|||||||
|
|
||||||
from panda3d.core import VBase4
|
from panda3d.core import VBase4
|
||||||
from .extension_native_helpers import Dtool_funcToMethod
|
from .extension_native_helpers import Dtool_funcToMethod
|
||||||
|
import warnings
|
||||||
|
|
||||||
def pPrintValues(self):
|
def pPrintValues(self):
|
||||||
"""
|
"""
|
||||||
@ -17,7 +18,8 @@ def asTuple(self):
|
|||||||
"""
|
"""
|
||||||
Returns the vector as a tuple.
|
Returns the vector as a tuple.
|
||||||
"""
|
"""
|
||||||
print("Warning: VBase4.asTuple() is no longer needed and deprecated. Use the vector directly instead.")
|
if __debug__:
|
||||||
|
warnings.warn("VBase4.asTuple() is no longer needed and deprecated. Use the vector directly instead.", DeprecationWarning, stacklevel=2)
|
||||||
return tuple(self)
|
return tuple(self)
|
||||||
Dtool_funcToMethod(asTuple, VBase4)
|
Dtool_funcToMethod(asTuple, VBase4)
|
||||||
del asTuple
|
del asTuple
|
||||||
|
@ -8,6 +8,7 @@ __all__ = ['OnscreenText', 'Plain', 'ScreenTitle', 'ScreenPrompt', 'NameConfirm'
|
|||||||
|
|
||||||
from panda3d.core import *
|
from panda3d.core import *
|
||||||
from . import DirectGuiGlobals as DGG
|
from . import DirectGuiGlobals as DGG
|
||||||
|
import warnings
|
||||||
|
|
||||||
## These are the styles of text we might commonly see. They set the
|
## These are the styles of text we might commonly see. They set the
|
||||||
## overall appearance of the text according to one of a number of
|
## overall appearance of the text according to one of a number of
|
||||||
@ -304,6 +305,8 @@ class OnscreenText(NodePath):
|
|||||||
.. deprecated:: 1.11.0
|
.. deprecated:: 1.11.0
|
||||||
Use `.setTextX()` method instead.
|
Use `.setTextX()` method instead.
|
||||||
"""
|
"""
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("Use `.setTextX()` method instead.", DeprecationWarning, stacklevel=2)
|
||||||
self.setTextPos(x, self.__pos[1])
|
self.setTextPos(x, self.__pos[1])
|
||||||
|
|
||||||
def setTextY(self, y):
|
def setTextY(self, y):
|
||||||
@ -317,6 +320,8 @@ class OnscreenText(NodePath):
|
|||||||
.. deprecated:: 1.11.0
|
.. deprecated:: 1.11.0
|
||||||
Use `.setTextY()` method instead.
|
Use `.setTextY()` method instead.
|
||||||
"""
|
"""
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("Use `.setTextY()` method instead.", DeprecationWarning, stacklevel=2)
|
||||||
self.setTextPos(self.__pos[0], y)
|
self.setTextPos(self.__pos[0], y)
|
||||||
|
|
||||||
def setTextPos(self, x, y=None):
|
def setTextPos(self, x, y=None):
|
||||||
@ -346,6 +351,8 @@ class OnscreenText(NodePath):
|
|||||||
.. deprecated:: 1.11.0
|
.. deprecated:: 1.11.0
|
||||||
Use `.setTextPos()` method or `.text_pos` property instead.
|
Use `.setTextPos()` method or `.text_pos` property instead.
|
||||||
"""
|
"""
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("Use `.setTextPos()` method or `.text_pos` property instead.", DeprecationWarning, stacklevel=2)
|
||||||
self.__pos = (x, y)
|
self.__pos = (x, y)
|
||||||
self.updateTransformMat()
|
self.updateTransformMat()
|
||||||
|
|
||||||
@ -354,6 +361,8 @@ class OnscreenText(NodePath):
|
|||||||
.. deprecated:: 1.11.0
|
.. deprecated:: 1.11.0
|
||||||
Use `.getTextPos()` method or `.text_pos` property instead.
|
Use `.getTextPos()` method or `.text_pos` property instead.
|
||||||
"""
|
"""
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("Use `.getTextPos()` method or `.text_pos` property instead.", DeprecationWarning, stacklevel=2)
|
||||||
return self.__pos
|
return self.__pos
|
||||||
|
|
||||||
pos = property(getPos)
|
pos = property(getPos)
|
||||||
@ -379,6 +388,8 @@ class OnscreenText(NodePath):
|
|||||||
.. deprecated:: 1.11.0
|
.. deprecated:: 1.11.0
|
||||||
Use ``setTextR(-roll)`` instead (note the negated sign).
|
Use ``setTextR(-roll)`` instead (note the negated sign).
|
||||||
"""
|
"""
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("Use ``setTextR(-roll)`` instead (note the negated sign).", DeprecationWarning, stacklevel=2)
|
||||||
self.__roll = roll
|
self.__roll = roll
|
||||||
self.updateTransformMat()
|
self.updateTransformMat()
|
||||||
|
|
||||||
@ -387,6 +398,8 @@ class OnscreenText(NodePath):
|
|||||||
.. deprecated:: 1.11.0
|
.. deprecated:: 1.11.0
|
||||||
Use ``-getTextR()`` instead (note the negated sign).
|
Use ``-getTextR()`` instead (note the negated sign).
|
||||||
"""
|
"""
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("Use ``-getTextR()`` instead (note the negated sign).", DeprecationWarning, stacklevel=2)
|
||||||
return self.__roll
|
return self.__roll
|
||||||
|
|
||||||
roll = property(getRoll, setRoll)
|
roll = property(getRoll, setRoll)
|
||||||
@ -424,7 +437,8 @@ class OnscreenText(NodePath):
|
|||||||
.. deprecated:: 1.11.0
|
.. deprecated:: 1.11.0
|
||||||
Use `.setTextScale()` method or `.text_scale` property instead.
|
Use `.setTextScale()` method or `.text_scale` property instead.
|
||||||
"""
|
"""
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("Use `.setTextScale()` method or `.text_scale` property instead.", DeprecationWarning, stacklevel=2)
|
||||||
if sy is None:
|
if sy is None:
|
||||||
if isinstance(sx, tuple):
|
if isinstance(sx, tuple):
|
||||||
self.__scale = sx
|
self.__scale = sx
|
||||||
@ -439,6 +453,8 @@ class OnscreenText(NodePath):
|
|||||||
.. deprecated:: 1.11.0
|
.. deprecated:: 1.11.0
|
||||||
Use `.getTextScale()` method or `.text_scale` property instead.
|
Use `.getTextScale()` method or `.text_scale` property instead.
|
||||||
"""
|
"""
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("Use `.getTextScale()` method or `.text_scale` property instead.", DeprecationWarning, stacklevel=2)
|
||||||
return self.__scale
|
return self.__scale
|
||||||
|
|
||||||
scale = property(getScale, setScale)
|
scale = property(getScale, setScale)
|
||||||
|
@ -4,6 +4,7 @@ from direct.task import Task
|
|||||||
from direct.task.TaskManagerGlobal import taskMgr
|
from direct.task.TaskManagerGlobal import taskMgr
|
||||||
from direct.showbase.DirectObject import DirectObject
|
from direct.showbase.DirectObject import DirectObject
|
||||||
from direct.directnotify.DirectNotifyGlobal import directNotify
|
from direct.directnotify.DirectNotifyGlobal import directNotify
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
def remove_task():
|
def remove_task():
|
||||||
@ -11,7 +12,8 @@ def remove_task():
|
|||||||
total_motion_trails = len(MotionTrail.motion_trail_list)
|
total_motion_trails = len(MotionTrail.motion_trail_list)
|
||||||
|
|
||||||
if total_motion_trails > 0:
|
if total_motion_trails > 0:
|
||||||
print("warning: %d motion trails still exist when motion trail task is removed" %(total_motion_trails))
|
if __debug__:
|
||||||
|
warnings.warn("%d motion trails still exist when motion trail task is removed" % (total_motion_trails), RuntimeWarning, stacklevel=2)
|
||||||
|
|
||||||
MotionTrail.motion_trail_list = []
|
MotionTrail.motion_trail_list = []
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ from direct.showbase.PhysicsManagerGlobal import *
|
|||||||
|
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
import sys
|
import sys
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
class ForceGroup(DirectObject):
|
class ForceGroup(DirectObject):
|
||||||
@ -61,7 +62,7 @@ class ForceGroup(DirectObject):
|
|||||||
|
|
||||||
# Get/set
|
# Get/set
|
||||||
def getName(self):
|
def getName(self):
|
||||||
"""Deprecated: access .name directly instead."""
|
warnings.warn("Deprecated: access .name directly instead.", DeprecationWarning, stacklevel=2)
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
def getNode(self):
|
def getNode(self):
|
||||||
|
@ -12,7 +12,8 @@ the AppRunner at startup.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
print('AppRunner has been removed and AppRunnerGlobal has been deprecated')
|
import warnings
|
||||||
|
warnings.warn("AppRunner has been removed and AppRunnerGlobal has been deprecated.", DeprecationWarning, stacklevel=2)
|
||||||
|
|
||||||
#: Contains the global :class:`~.AppRunner.AppRunner` instance, or None
|
#: Contains the global :class:`~.AppRunner.AppRunner` instance, or None
|
||||||
#: if this application was not run from the runtime environment.
|
#: if this application was not run from the runtime environment.
|
||||||
|
@ -4,21 +4,30 @@ __all__ = []
|
|||||||
|
|
||||||
from panda3d.core import (ConfigFlags, ConfigVariableBool, ConfigVariableInt,
|
from panda3d.core import (ConfigFlags, ConfigVariableBool, ConfigVariableInt,
|
||||||
ConfigVariableDouble, ConfigVariableString)
|
ConfigVariableDouble, ConfigVariableString)
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
def GetBool(sym, default=False):
|
def GetBool(sym, default=False):
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("This is deprecated. Use ConfigVariableBool instead", DeprecationWarning, stacklevel=2)
|
||||||
return ConfigVariableBool(sym, default, "DConfig", ConfigFlags.F_dconfig).value
|
return ConfigVariableBool(sym, default, "DConfig", ConfigFlags.F_dconfig).value
|
||||||
|
|
||||||
|
|
||||||
def GetInt(sym, default=0):
|
def GetInt(sym, default=0):
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("This is deprecated. Use ConfigVariableInt instead", DeprecationWarning, stacklevel=2)
|
||||||
return ConfigVariableInt(sym, default, "DConfig", ConfigFlags.F_dconfig).value
|
return ConfigVariableInt(sym, default, "DConfig", ConfigFlags.F_dconfig).value
|
||||||
|
|
||||||
|
|
||||||
def GetDouble(sym, default=0.0):
|
def GetDouble(sym, default=0.0):
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("This is deprecated. Use ConfigVariableDouble instead", DeprecationWarning, stacklevel=2)
|
||||||
return ConfigVariableDouble(sym, default, "DConfig", ConfigFlags.F_dconfig).value
|
return ConfigVariableDouble(sym, default, "DConfig", ConfigFlags.F_dconfig).value
|
||||||
|
|
||||||
|
|
||||||
def GetString(sym, default=""):
|
def GetString(sym, default=""):
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("This is deprecated. Use ConfigVariableString instead", DeprecationWarning, stacklevel=2)
|
||||||
return ConfigVariableString(sym, default, "DConfig", ConfigFlags.F_dconfig).value
|
return ConfigVariableString(sym, default, "DConfig", ConfigFlags.F_dconfig).value
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ from panda3d.core import *
|
|||||||
from panda3d.core import Loader as PandaLoader
|
from panda3d.core import Loader as PandaLoader
|
||||||
from direct.directnotify.DirectNotifyGlobal import *
|
from direct.directnotify.DirectNotifyGlobal import *
|
||||||
from direct.showbase.DirectObject import DirectObject
|
from direct.showbase.DirectObject import DirectObject
|
||||||
|
import warnings
|
||||||
|
|
||||||
# You can specify a phaseChecker callback to check
|
# You can specify a phaseChecker callback to check
|
||||||
# a modelPath to see if it is being loaded in the correct
|
# a modelPath to see if it is being loaded in the correct
|
||||||
@ -295,7 +296,8 @@ class Loader(DirectObject):
|
|||||||
called after cancelRequest() has been performed.
|
called after cancelRequest() has been performed.
|
||||||
|
|
||||||
This is now deprecated: call cb.cancel() instead. """
|
This is now deprecated: call cb.cancel() instead. """
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("This is now deprecated: call cb.cancel() instead.", DeprecationWarning, stacklevel=2)
|
||||||
cb.cancel()
|
cb.cancel()
|
||||||
|
|
||||||
def isRequestPending(self, cb):
|
def isRequestPending(self, cb):
|
||||||
@ -304,7 +306,8 @@ class Loader(DirectObject):
|
|||||||
been cancelled.
|
been cancelled.
|
||||||
|
|
||||||
This is now deprecated: call cb.done() instead. """
|
This is now deprecated: call cb.done() instead. """
|
||||||
|
if __debug__:
|
||||||
|
warnings.warn("This is now deprecated: call cb.done() instead.", DeprecationWarning, stacklevel=2)
|
||||||
return bool(cb.requests)
|
return bool(cb.requests)
|
||||||
|
|
||||||
def loadModelOnce(self, modelPath):
|
def loadModelOnce(self, modelPath):
|
||||||
@ -315,7 +318,8 @@ class Loader(DirectObject):
|
|||||||
then attempt to load it from disk. Return a nodepath to
|
then attempt to load it from disk. Return a nodepath to
|
||||||
the model if successful or None otherwise
|
the model if successful or None otherwise
|
||||||
"""
|
"""
|
||||||
Loader.notify.info("loader.loadModelOnce() is deprecated; use loader.loadModel() instead.")
|
if __debug__:
|
||||||
|
warnings.warn("loader.loadModelOnce() is deprecated; use loader.loadModel() instead.", DeprecationWarning, stacklevel=2)
|
||||||
|
|
||||||
return self.loadModel(modelPath, noCache = False)
|
return self.loadModel(modelPath, noCache = False)
|
||||||
|
|
||||||
@ -326,7 +330,8 @@ class Loader(DirectObject):
|
|||||||
then attempt to load it from disk. Return a nodepath to
|
then attempt to load it from disk. Return a nodepath to
|
||||||
a copy of the model if successful or None otherwise
|
a copy of the model if successful or None otherwise
|
||||||
"""
|
"""
|
||||||
Loader.notify.info("loader.loadModelCopy() is deprecated; use loader.loadModel() instead.")
|
if __debug__:
|
||||||
|
warnings.warn("loader.loadModelCopy() is deprecated; use loader.loadModel() instead.", DeprecationWarning, stacklevel=2)
|
||||||
|
|
||||||
return self.loadModel(modelPath, loaderOptions = loaderOptions, noCache = False)
|
return self.loadModel(modelPath, loaderOptions = loaderOptions, noCache = False)
|
||||||
|
|
||||||
@ -344,7 +349,8 @@ class Loader(DirectObject):
|
|||||||
|
|
||||||
However, if you're loading a font, see loadFont(), below.
|
However, if you're loading a font, see loadFont(), below.
|
||||||
"""
|
"""
|
||||||
Loader.notify.info("loader.loadModelNode() is deprecated; use loader.loadModel() instead.")
|
if __debug__:
|
||||||
|
warnings.warn("loader.loadModelNode() is deprecated; use loader.loadModel() instead.", DeprecationWarning, stacklevel=2)
|
||||||
|
|
||||||
model = self.loadModel(modelPath, noCache = False)
|
model = self.loadModel(modelPath, noCache = False)
|
||||||
if model is not None:
|
if model is not None:
|
||||||
|
@ -72,6 +72,7 @@ if __debug__:
|
|||||||
from direct.showbase import GarbageReport
|
from direct.showbase import GarbageReport
|
||||||
from direct.directutil import DeltaProfiler
|
from direct.directutil import DeltaProfiler
|
||||||
from . import OnScreenDebug
|
from . import OnScreenDebug
|
||||||
|
import warnings
|
||||||
|
|
||||||
@atexit.register
|
@atexit.register
|
||||||
def exitfunc():
|
def exitfunc():
|
||||||
@ -2034,7 +2035,8 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
"""
|
"""
|
||||||
:deprecated: Use `.Loader.Loader.loadSfx()` instead.
|
:deprecated: Use `.Loader.Loader.loadSfx()` instead.
|
||||||
"""
|
"""
|
||||||
assert self.notify.warning("base.loadSfx is deprecated, use base.loader.loadSfx instead.")
|
if __debug__:
|
||||||
|
warnings.warn("base.loadSfx is deprecated, use base.loader.loadSfx instead.", DeprecationWarning, stacklevel=2)
|
||||||
return self.loader.loadSfx(name)
|
return self.loader.loadSfx(name)
|
||||||
|
|
||||||
# This function should only be in the loader but is here for
|
# This function should only be in the loader but is here for
|
||||||
@ -2044,7 +2046,8 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
"""
|
"""
|
||||||
:deprecated: Use `.Loader.Loader.loadMusic()` instead.
|
:deprecated: Use `.Loader.Loader.loadMusic()` instead.
|
||||||
"""
|
"""
|
||||||
assert self.notify.warning("base.loadMusic is deprecated, use base.loader.loadMusic instead.")
|
if __debug__:
|
||||||
|
warnings.warn("base.loadMusic is deprecated, use base.loader.loadMusic instead.", DeprecationWarning, stacklevel=2)
|
||||||
return self.loader.loadMusic(name)
|
return self.loader.loadMusic(name)
|
||||||
|
|
||||||
def playSfx(
|
def playSfx(
|
||||||
|
@ -19,6 +19,7 @@ from panda3d.core import VirtualFileSystem, Notify, ClockObject, PandaSystem
|
|||||||
from panda3d.core import ConfigPageManager, ConfigVariableManager
|
from panda3d.core import ConfigPageManager, ConfigVariableManager
|
||||||
from panda3d.core import NodePath, PGTop
|
from panda3d.core import NodePath, PGTop
|
||||||
from . import DConfig as config
|
from . import DConfig as config
|
||||||
|
import warnings
|
||||||
|
|
||||||
__dev__ = config.GetBool('want-dev', __debug__)
|
__dev__ = config.GetBool('want-dev', __debug__)
|
||||||
|
|
||||||
@ -63,7 +64,8 @@ directNotify.setDconfigLevels()
|
|||||||
|
|
||||||
def run():
|
def run():
|
||||||
"""Deprecated alias for :meth:`base.run() <.ShowBase.run>`."""
|
"""Deprecated alias for :meth:`base.run() <.ShowBase.run>`."""
|
||||||
assert ShowBase.notify.warning("run() is deprecated, use base.run() instead")
|
if __debug__:
|
||||||
|
warnings.warn("run() is deprecated, use base.run() instead", DeprecationWarning, stacklevel=2)
|
||||||
base.run()
|
base.run()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user