direct.showutil.TexMemWatcher

from direct.showutil.TexMemWatcher import TexMemWatcher, TexPlacement, TexRecord

Inheritance diagram

Inheritance diagram of direct.showutil.TexMemWatcher

class TexMemWatcher(gsg=None, limit=None)[source]

Bases: direct.showbase.DirectObject.DirectObject

This class creates a separate graphics window that displays an approximation of the current texture memory, showing the textures that are resident and/or active, and an approximation of the amount of texture memory consumed by each one. It’s intended as a useful tool to help determine where texture memory is being spent.

Although it represents the textures visually in a 2-d space, it doesn’t actually have any idea how textures are physically laid out in memory–but it has to lay them out somehow, so it makes something up. It occasionally rearranges the texture display when it feels it needs to, without regard to what the graphics card is actually doing. This tool can’t be used to research texture memory fragmentation issues.

NextIndex = 1
StatusHeight = 20
__init__(self, gsg=None, limit=None)[source]
cleanup(self)[source]
enterRegion(self, region, buttonName)[source]

the mouse has rolled over a texture.

findAvailableHoles(self, area, w=None, h=None)[source]

Finds a list of available holes, of at least the indicated area. Returns a list of tuples, where each tuple is of the form (area, tp).

If w and h are non-None, this will short-circuit on the first hole it finds that fits w x h, and return just that hole in a singleton list.

findEmptyRuns(self, bm)[source]

Separates a bitmask into a list of (l, r) tuples, corresponding to the empty regions in the row between 0 and self.w.

findHole(self, area, w, h)[source]

Searches for a rectangular hole that is at least area square units big, regardless of its shape, but attempt to find one that comes close to the right shape, at least. If one is found, returns an appropriate TexPlacement; otherwise, returns None.

findHolePieces(self, area)[source]

Returns a list of holes whose net area sums to the given area, or None if there are not enough holes.

findLargestHole(self)[source]
findOverflowHole(self, area, w, h)[source]

Searches for a hole large enough for (w, h), in the overflow space. Since the overflow space is infinite, this will always succeed.

formatSize(self, size)[source]

Returns a size in MB, KB, GB, whatever.

graphicsMemoryLimitChanged(self)[source]
isolateTexture(self, tr)[source]

Isolates the indicated texture onscreen, or None to restore normal mode.

leaveRegion(self, region, buttonName)[source]

the mouse is no longer over a texture.

makeCanvasBackground(self)[source]
mouseClick(self)[source]

Received a mouse-click within the window. This isolates the currently-highlighted texture into a full-window presentation.

placeTexture(self, tr)[source]

Places the texture somewhere on the canvas where it will fit.

reconfigureWindow(self)[source]

Resets everything for a new window size.

repack(self)[source]

Repacks all of the current textures.

setLimit(self, limit=None)[source]

Indicates the texture memory limit. If limit is None or unspecified, the limit is taken from the GSG, if any; or there is no limit.

setRollover(self, tr, pi)[source]

Sets the highlighted texture (due to mouse rollover) to the indicated texture, or None to clear it.

setupCanvas(self)[source]

Creates the “canvas”, which is the checkerboard area where texture memory is laid out. The canvas has its own DisplayRegion.

setupGui(self)[source]

Creates the gui elements and supporting structures.

unplaceTexture(self, tr)[source]

Removes the texture from its place on the canvas.

updateTextures(self, task)[source]

Gets the current list of resident textures and adds new textures or removes old ones from the onscreen display, as necessary.

windowEvent(self, win)[source]
class TexPlacement(l, r, b, t)[source]

Bases: object

__init__(self, l, r, b, t)[source]
clearBitmasks(self, bitmasks)[source]

Clears all of the appropriate bits to indicate this region is available.

hasOverlap(self, bitmasks)[source]

Returns true if there is an overlap with this region and any other region, false otherwise.

intersects(self, other)[source]

Returns True if the placements intersect, False otherwise.

setBitmasks(self, bitmasks)[source]

Sets all of the appropriate bits to indicate this region is taken.

class TexRecord(key, tex, size, active)[source]

Bases: object

__init__(self, key, tex, size, active)[source]
clearCard(self, tmw)[source]
computePlacementSize(self, tmw)[source]
makeCard(self, tmw)[source]
setActive(self, flag)[source]
setSize(self, size)[source]