# Loader

from direct.showbase.Loader import Loader

Load models, textures, sounds, and code.

## Inheritance:

Loader:

## Methods of Loader:

__init__
destroy
load3DTexture
loadCubeMap
loadFont
loadModel
loadModelCopy
loadModelNode
loadModelOnce
loadModelOnceUnder
loadMusic
loadSfx
loadShader
loadTexture
makeNodeNamesUnique
unloadModel
unloadShader
unloadTexture

__init__ def __init__(self, base) Undocumented function.

destroy def destroy(self) Undocumented function.

load3DTexture def load3DTexture(self, texturePattern, readMipmaps=False) texturePattern is a string that contains a sequence of one or more '#' characters, which will be filled in with the sequence number. Returns a 3-D Texture object, suitable for rendering volumetric textures, if successful, or None if not.

loadCubeMap def loadCubeMap(self, texturePattern, readMipmaps=False) texturePattern is a string that contains a sequence of one or more '#' characters, which will be filled in with the sequence number. Returns a six-face cube map Texture object if successful, or None if not.

loadFont def loadFont(self, modelPath, spaceAdvance=None, pointSize=None, pixelsPerUnit=None, scaleFactor=None, textureMargin=None, polyMargin=None, minFilter=None, magFilter=None, anisotropicDegree=None, lineHeight=None) modelPath is a string. This loads a special model as a TextFont object, for rendering text with a TextNode. A font file must be either a special egg file (or bam file) generated with egg-mkfont, or a standard font file (like a TTF file) that is supported by FreeType.

loadModel def loadModel(self, modelPath, fMakeNodeNamesUnique=0, loaderOptions=None) modelPath is a string. Attempt to load a model from given file path, return a nodepath to the model if successful or None otherwise.

loadModelCopy def loadModelCopy(self, modelPath) loadModelCopy(self, string) Attempt to load a model from modelPool, if not present then attempt to load it from disk. Return a nodepath to a copy of the model if successful or None otherwise

loadModelNode def loadModelNode(self, modelPath) modelPath is a string. This is like loadModelOnce in that it loads a model from the modelPool, but it does not then instance it to hidden and it returns a Node instead of a NodePath. This is particularly useful for special models like fonts that you don't care about where they're parented to, and you don't want a NodePath anyway--it prevents accumulation of instances of the font model under hidden. However, if you're loading a font, see loadFont(), below.

loadModelOnce def loadModelOnce(self, modelPath) modelPath is a string. Attempt to load a model from modelPool, if not present then attempt to load it from disk. Return a nodepath to the model if successful or None otherwise

loadModelOnceUnder def loadModelOnceUnder(self, modelPath, underNode) loadModelOnceUnder(self, string, string | node | NodePath) Behaves like loadModelOnce, but also implicitly creates a new node to attach the model under, which helps to differentiate different instances. underNode may be either a node name, or a NodePath or a Node to an already-existing node. This is useful when you want to load a model once several times before parenting each instance somewhere, or when you want to load a model and immediately set a transform on it. But also consider loadModelCopy().

loadMusic def loadMusic(self, name) Undocumented function.

loadSfx def loadSfx(self, name) Undocumented function.

loadShader def loadShader(self, shaderPath) Undocumented function.

loadTexture def loadTexture(self, texturePath, alphaPath=None, readMipmaps=False) texturePath is a string. Attempt to load a texture from the given file path using TexturePool class. Returns None if not found

makeNodeNamesUnique def makeNodeNamesUnique(self, nodePath, nodeCount) Undocumented function.

unloadModel def unloadModel(self, modelPath) modelPath is a string.

unloadShader def unloadShader(self, shaderPath) Undocumented function.

unloadTexture def unloadTexture(self, texture) Removes the previously-loaded texture from the cache, so that when the last reference to it is gone, it will be released. This also means that the next time the same texture is loaded, it will be re-read from disk (and duplicated in texture memory if there are still outstanding references to it). The texture parameter may be the return value of any previous call to loadTexture(), load3DTexture(), or loadCubeMap().