Merge pull request #55 from Toontown-united/master

remove unused extensions directory
This commit is contained in:
rdb 2015-10-09 12:46:42 +02:00
commit 306f7a3ed6
20 changed files with 0 additions and 1558 deletions

View File

@ -1,97 +0,0 @@
"""
CInterval-extensions module: contains methods to extend functionality
of the CInterval class
"""
from direct.directnotify.DirectNotifyGlobal import directNotify
notify = directNotify.newCategory("Interval")
def setT(self, t):
# Overridden from the C++ function to call privPostEvent
# afterward. We do this by renaming the C++ function in
# FFIRename.
self._priv__cSetT(t)
self.privPostEvent()
def play(self, t0 = 0.0, duration = None, scale = 1.0):
self.notify.error("using deprecated CInterval.play() interface")
if duration: # None or 0 implies full length
self.start(t0, t0 + duration, scale)
else:
self.start(t0, -1, scale)
def stop(self):
self.notify.error("using deprecated CInterval.stop() interface")
self.finish()
def setFinalT(self):
self.notify.error("using deprecated CInterval.setFinalT() interface")
self.finish()
def privPostEvent(self):
# Call after calling any of the priv* methods to do any required
# Python finishing steps.
t = self.getT()
if hasattr(self, "setTHooks"):
for func in self.setTHooks:
func(t)
def popupControls(self, tl = None):
"""
Popup control panel for interval.
"""
from direct.showbase.TkGlobal import Toplevel, Frame, Button, LEFT, X, Pmw
import math
from direct.tkwidgets import EntryScale
if tl == None:
tl = Toplevel()
tl.title('Interval Controls')
outerFrame = Frame(tl)
def entryScaleCommand(t, s=self):
s.setT(t)
s.pause()
self.es = es = EntryScale.EntryScale(
outerFrame, text = self.getName(),
min = 0, max = math.floor(self.getDuration() * 100) / 100,
command = entryScaleCommand)
es.set(self.getT(), fCommand = 0)
es.pack(expand = 1, fill = X)
bf = Frame(outerFrame)
# Jump to start and end
def toStart(s=self, es=es):
s.clearToInitial()
s.setT(0)
es.set(0, fCommand = 0)
def toEnd(s=self):
s.setT(s.getDuration())
s.pause()
jumpToStart = Button(bf, text = '<<', command = toStart)
# Stop/play buttons
def doPlay(s=self, es=es):
s.resume(es.get())
stop = Button(bf, text = 'Stop',
command = lambda s=self: s.pause())
play = Button(
bf, text = 'Play',
command = doPlay)
jumpToEnd = Button(bf, text = '>>', command = toEnd)
jumpToStart.pack(side = LEFT, expand = 1, fill = X)
play.pack(side = LEFT, expand = 1, fill = X)
stop.pack(side = LEFT, expand = 1, fill = X)
jumpToEnd.pack(side = LEFT, expand = 1, fill = X)
bf.pack(expand = 1, fill = X)
outerFrame.pack(expand = 1, fill = X)
# Add function to update slider during setT calls
def update(t, es=es):
es.set(t, fCommand = 0)
if not hasattr(self, "setTHooks"):
self.setTHooks = []
self.setTHooks.append(update)
self.setWantsTCallback(1)
# Clear out function on destroy
def onDestroy(e, s=self, u=update):
if u in s.setTHooks:
s.setTHooks.remove(u)
tl.bind('<Destroy>', onDestroy)

View File

@ -1,50 +0,0 @@
def __str__(self):
return self.getStringValue()
def __hash__(self):
raise AttributeError, "ConfigVariables are not immutable."
def ls(self):
from pandac.Notify import Notify
self.write(Notify.out())
def __int__(self):
return int(self.getValue())
def __long__(self):
return long(self.getValue())
def __float__(self):
return float(self.getValue())
def __nonzero__(self):
return bool(self.getValue())
def __oct__(self):
return oct(self.getValue())
def __hex__(self):
return hex(self.getValue())
def __cmp__(self, other):
return self.getValue().__cmp__(other)
def __neg__(self):
return -self.getValue()
def __coerce__(self, other):
return (self.getValue(), other)
def __len__(self):
return self.getNumWords()
def __getitem__(self, n):
if n < 0 or n >= self.getNumWords():
raise IndexError
return self.getWord(n)
def __setitem__(self, n, value):
if n < 0 or n > self.getNumWords():
raise IndexError
self.setWord(n, value)

View File

@ -1,5 +0,0 @@
def __getitem__(self, n):
if n < 0 or n >= self.getNumWords():
raise IndexError
return self.getWord(n)

View File

@ -1,5 +0,0 @@
def __getitem__(self, n):
if n < 0 or n >= self.getNumWords():
raise IndexError
return self.getWord(n)

View File

@ -1,5 +0,0 @@
def __getitem__(self, n):
if n < 0 or n >= self.getNumWords():
raise IndexError
return self.getWord(n)

View File

@ -1,18 +0,0 @@
def __hash__(self):
raise AttributeError, "ConfigVariables are not immutable."
def ls(self):
from pandac.Notify import Notify
self.write(Notify.out())
def __cmp__(self, other):
return list(self).__cmp__(list(other))
def __len__(self):
return self.getNumValues()
def __getitem__(self, n):
if n < 0 or n >= self.getNumUniqueValues():
raise IndexError
return self.getUniqueValue(n)

View File

@ -1,6 +0,0 @@
def __len__(self):
return self.getValue().__len__()
def __getitem__(self, n):
return self.getValue().__getitem__(n)

View File

@ -1,31 +0,0 @@
"""
HTTPChannel-extensions module: contains methods to extend functionality
of the HTTPChannel class
"""
def spawnTask(self, name = None, callback = None, extraArgs = []):
"""Spawns a task to service the download recently requested
via beginGetDocument(), etc., and/or downloadToFile() or
downloadToRam(). If a callback is specified, that function is
called when the download is complete, passing in the extraArgs
given.
Returns the newly-spawned task.
"""
if not name:
name = str(self.getUrl())
from direct.task import Task
task = Task.Task(self.doTask)
task.callback = callback
task.callbackArgs = extraArgs
return taskMgr.add(task, name)
def doTask(self, task):
from direct.task import Task
if self.run():
return Task.cont
if task.callback:
task.callback(*task.callbackArgs)
return Task.done

View File

@ -1,16 +0,0 @@
"""
Mat3-extensions module: contains methods to extend functionality
of the LMatrix3f class.
"""
def __repr__(self):
return '%s(\n%s,\n%s,\n%s)' % (
self.__class__.__name__, self.getRow(0).pPrintValues(), self.getRow(1).pPrintValues(), self.getRow(2).pPrintValues())
def pPrintValues(self):
"""
Pretty print
"""
return "\n%s\n%s\n%s" % (
self.getRow(0).pPrintValues(), self.getRow(1).pPrintValues(), self.getRow(2).pPrintValues())

View File

@ -1,27 +0,0 @@
"""
MouseWatcherRegion-extensions module: contains methods to extend
functionality of the MouseWatcherRegion class
"""
def setRelative(self, np, left, right, bottom, top):
"""setRelation(NodePath np, float left, float right,
float bottom, float top)
Sets the region to represnt the indicated rectangle, relative
to the given NodePath. It is assumed that np represents some
node parented within the render2d hierarchy.
"""
from pandac import Point3
# Get the relative transform to the node.
mat = np.getMat(render2d)
# Use this matrix to transform the corners of the region.
ll = mat.xformPoint(Point3.Point3(left, 0, bottom))
ur = mat.xformPoint(Point3.Point3(right, 0, top))
# Set the frame to the transformed coordinates.
self.setFrame(ll[0], ur[0], ll[2], ur[2])

View File

@ -1,20 +0,0 @@
"""
Node-extensions module: contains methods to extend functionality
of the Node class
"""
def isHidden(self):
"""Determine if a node is hidden. Just pick the first parent,
since this is an ambiguous question for instanced nodes"""
import RenderRelation
import PruneTransition
rrClass = RenderRelation.RenderRelation.getClassType()
if self.getNumParents(rrClass) > 0:
arc = self.getParent(rrClass, 0)
if arc.hasTransition(PruneTransition.PruneTransition.getClassType()):
return 1
else:
return arc.getParent().isHidden()
else:
return 0

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +0,0 @@
"""
NurbsCurveEvaluator-extensions module: contains methods to extend
functionality of the NurbsCurveEvaluator class
"""
def getKnots(self):
"""Returns the knot vector as a Python list of floats"""
knots = []
for i in range(self.getNumKnots()):
knots.append(self.getKnot(i))
return knots
def getVertices(self, relTo = None):
"""Returns the vertices as a Python list of Vec4's, relative
to the indicated space if given."""
verts = []
if relTo:
for i in range(self.getNumVertices()):
verts.append(self.getVertex(i, relTo))
else:
for i in range(self.getNumVertices()):
verts.append(self.getVertex(i))
return verts

View File

@ -1,36 +0,0 @@
"""
NurbsSurfaceEvaluator-extensions module: contains methods to extend
functionality of the NurbsSurfaceEvaluator class
"""
def getUKnots(self):
"""Returns the U knot vector as a Python list of floats"""
knots = []
for i in range(self.getNumUKnots()):
knots.append(self.getUKnot(i))
return knots
def getVKnots(self):
"""Returns the V knot vector as a Python list of floats"""
knots = []
for i in range(self.getNumVKnots()):
knots.append(self.getVKnot(i))
return knots
def getVertices(self, relTo = None):
"""Returns the vertices as a 2-d Python list of Vec4's, relative
to the indicated space if given."""
verts = []
for ui in range(self.getNumUVertices()):
v = []
if relTo:
for vi in range(self.getNumVVertices()):
v.append(self.getVertex(ui, vi, relTo))
else:
for vi in range(self.getNumVVertices()):
v.append(self.getVertex(ui, vi))
verts.append(v)
return verts

View File

@ -1,6 +0,0 @@
def getSystems(self):
l = []
for i in range(self.getNumSystems()):
l.append(self.getSystem(l))
return l

View File

@ -1,3 +0,0 @@
// For now, since we are not installing Python files, this file can
// remain empty.

View File

@ -1,83 +0,0 @@
"""
Contains methods to extend functionality
of the SpriteParticleRenderer class
"""
# Initialize class variables for texture, source file and node for texture and
# node path textures to None. These will be initialized to a hardcoded default
# or whatever the user specifies in his/her Configrc variable the first time they
# are accessed
# Will use instance copy of this in functions below
sourceTextureName = None
sourceFileName = None
sourceNodeName = None
def getSourceTextureName(self):
if self.sourceTextureName == None:
SpriteParticleRenderer.sourceTextureName = base.config.GetString(
'particle-sprite-texture', 'phase_3/maps/feyes.jpg')
# Return instance copy of class variable
return self.sourceTextureName
def setSourceTextureName(self, name):
# Set instance copy of class variable
self.sourceTextureName = name
def setTextureFromFile(self, fileName = None):
if fileName == None:
fileName = self.getSourceTextureName()
else:
self.setSourceTextureName(fileName)
t = loader.loadTexture(fileName)
if (t != None):
self.setTexture(t)
else:
print "Couldn't find rendererSpriteTexture file: %s" % fileName
def getSourceFileName(self):
if self.sourceFileName == None:
SpriteParticleRenderer.sourceFileName = base.config.GetString(
'particle-sprite-model', 'phase_3.5/models/props/suit-particles')
# Return instance copy of class variable
return self.sourceFileName
def setSourceFileName(self, name):
# Set instance copy of class variable
self.sourceFileName = name
def getSourceNodeName(self):
if self.sourceNodeName == None:
SpriteParticleRenderer.sourceNodeName = base.config.GetString(
'particle-sprite-node', '**/fire')
# Return instance copy of class variable
return self.sourceNodeName
def setSourceNodeName(self, name):
# Set instance copy of class variable
self.sourceNodeName = name
def setTextureFromNode(self, modelName = None, nodeName = None):
if modelName == None:
modelName = self.getSourceFileName()
else:
self.setSourceFileName(modelName)
if nodeName == None:
nodeName = self.getSourceNodeName()
else:
self.setSourceNodeName(nodeName)
# Load model and get texture
m = loader.loadModel(modelName)
if (m == None):
print "SpriteParticleRenderer: Couldn't find model: %s!" % modelName
return None
nodeName = self.getSourceNodeName()
np = m.find(nodeName)
if np.isEmpty():
print "SpriteParticleRenderer: Couldn't find node: %s!" % nodeName
m.removeNode()
return None
self.setFromNode(np)
m.removeNode()

View File

@ -1,15 +0,0 @@
"""
VBase3-extensions module: contains methods to extend functionality
of the VBase3 class
"""
def __repr__(self):
return '%s(%s, %s, %s)' % (
self.__class__.__name__, self[0], self[1], self[2])
def pPrintValues(self):
"""
Pretty print
"""
return "% 10.4f, % 10.4f, % 10.4f" % (self[0], self[1], self[2])

View File

@ -1,15 +0,0 @@
"""
VBase4-extensions module: contains methods to extend functionality
of the VBase4 class
"""
def __repr__(self):
return '%s(%s, %s, %s, %s)' % (
self.__class__.__name__, self[0], self[1], self[2], self[3])
def pPrintValues(self):
"""
Pretty print
"""
return '% 10.4f, % 10.4f, % 10.4f, % 10.4f' % (self[0], self[1], self[2], self[3])

View File

@ -1 +0,0 @@
from PandaModules import *