mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
Remove old TTI nametag files
This commit is contained in:
parent
9420973986
commit
7ef9d669b5
3 changed files with 0 additions and 167 deletions
|
@ -1,120 +0,0 @@
|
|||
from direct.fsm.FSM import FSM
|
||||
from direct.showbase.DirectObject import DirectObject
|
||||
from panda3d.core import PandaNode, PGButton, NodePath, MouseWatcherRegion
|
||||
|
||||
|
||||
class Clickable(FSM, PandaNode, DirectObject):
|
||||
def __init__(self, name):
|
||||
FSM.__init__(self, name)
|
||||
PandaNode.__init__(self, name)
|
||||
DirectObject.__init__(self)
|
||||
|
||||
self.active = True
|
||||
|
||||
self.lastClickState = PGButton.SReady
|
||||
self.clickState = PGButton.SReady
|
||||
|
||||
self.__hovering = False
|
||||
|
||||
self.clickEvent = ''
|
||||
self.clickExtraArgs = []
|
||||
|
||||
self.contents = NodePath.anyPath(self).attachNewNode('contents')
|
||||
|
||||
# Create a MouseWatcherRegion:
|
||||
self.regionName = self.getUniqueName() + '-region'
|
||||
self.region = MouseWatcherRegion(self.regionName, 0, 0, 0, 0)
|
||||
base.mouseWatcherNode.addRegion(self.region)
|
||||
|
||||
# Accept the mouse events:
|
||||
enterPattern = base.mouseWatcherNode.getEnterPattern()
|
||||
leavePattern = base.mouseWatcherNode.getLeavePattern()
|
||||
buttonDownPattern = base.mouseWatcherNode.getButtonDownPattern()
|
||||
buttonUpPattern = base.mouseWatcherNode.getButtonUpPattern()
|
||||
self.accept(enterPattern.replace('%r', self.regionName), self.__handleMouseEnter)
|
||||
self.accept(leavePattern.replace('%r', self.regionName), self.__handleMouseLeave)
|
||||
self.accept(buttonDownPattern.replace('%r', self.regionName), self.__handleMouseDown)
|
||||
self.accept(buttonUpPattern.replace('%r', self.regionName), self.__handleMouseUp)
|
||||
|
||||
def destroy(self):
|
||||
self.ignoreAll()
|
||||
|
||||
if self.region is not None:
|
||||
base.mouseWatcherNode.removeRegion(self.region)
|
||||
self.region = None
|
||||
|
||||
if self.contents is not None:
|
||||
self.contents.removeNode()
|
||||
self.contents = None
|
||||
|
||||
def getUniqueName(self):
|
||||
return 'Clickable-' + str(id(self))
|
||||
|
||||
def setActive(self, active):
|
||||
self.active = active
|
||||
|
||||
def getActive(self):
|
||||
return self.active
|
||||
|
||||
def isClickable(self):
|
||||
return self.active
|
||||
|
||||
def isHovering(self):
|
||||
return self.__hovering
|
||||
|
||||
def setClickState(self, clickState):
|
||||
self.lastClickState = self.clickState
|
||||
self.clickState = clickState
|
||||
|
||||
if self.clickState == PGButton.SReady:
|
||||
self.request('Ready')
|
||||
elif self.clickState == PGButton.SDepressed:
|
||||
self.request('Depressed')
|
||||
elif self.clickState == PGButton.SRollover:
|
||||
self.request('Rollover')
|
||||
elif self.clickState == PGButton.SInactive:
|
||||
self.request('Inactive')
|
||||
|
||||
def getClickState(self):
|
||||
return self.clickState
|
||||
|
||||
def enterReady(self):
|
||||
pass
|
||||
|
||||
def enterDepressed(self):
|
||||
pass
|
||||
|
||||
def exitDepressed(self):
|
||||
if self.isClickable():
|
||||
messenger.send(self.clickEvent, self.clickExtraArgs)
|
||||
|
||||
def enterRollover(self):
|
||||
pass
|
||||
|
||||
def enterInactive(self):
|
||||
pass
|
||||
|
||||
def setClickEvent(self, event, extraArgs=[]):
|
||||
self.clickEvent = event
|
||||
self.clickExtraArgs = extraArgs
|
||||
|
||||
def setClickRegionFrame(self, left, right, bottom, top):
|
||||
self.region.setFrame(left, right, bottom, top)
|
||||
|
||||
def __handleMouseEnter(self, region, button):
|
||||
self.__hovering = True
|
||||
self.setClickState(PGButton.SRollover)
|
||||
|
||||
def __handleMouseLeave(self, region, button):
|
||||
self.__hovering = False
|
||||
if self.clickState != PGButton.SDepressed:
|
||||
self.setClickState(PGButton.SReady)
|
||||
|
||||
def __handleMouseDown(self, region, button):
|
||||
self.setClickState(PGButton.SDepressed)
|
||||
|
||||
def __handleMouseUp(self, region, button):
|
||||
if self.__hovering:
|
||||
self.setClickState(PGButton.SRollover)
|
||||
else:
|
||||
self.setClickState(PGButton.SReady)
|
|
@ -1,13 +0,0 @@
|
|||
from panda3d.core import Point3
|
||||
|
||||
from toontown.toontowngui.Clickable import Clickable
|
||||
|
||||
|
||||
class Clickable2d(Clickable):
|
||||
def setClickRegionFrame(self, left, right, bottom, top):
|
||||
mat = self.contents.getNetTransform().getMat()
|
||||
|
||||
left, _, top = mat.xformPoint(Point3(left, 0, top))
|
||||
right, _, bottom = mat.xformPoint(Point3(right, 0, bottom))
|
||||
|
||||
self.region.setFrame(left, right, bottom, top)
|
|
@ -1,34 +0,0 @@
|
|||
from panda3d.core import Quat, Point3, Point2
|
||||
|
||||
from toontown.toontowngui.Clickable import Clickable
|
||||
|
||||
|
||||
class Clickable3d(Clickable):
|
||||
def setClickRegionFrame(self, left, right, bottom, top):
|
||||
transform = self.contents.getNetTransform()
|
||||
|
||||
# We use the inverse of the cam transform so that it will not be
|
||||
# applied to the frame points twice:
|
||||
camTransform = base.cam.getNetTransform().getInverse()
|
||||
|
||||
# Compose the inverse of the cam transform and our node's transform:
|
||||
transform = camTransform.compose(transform)
|
||||
|
||||
# Discard its rotational components:
|
||||
transform.setQuat(Quat())
|
||||
|
||||
# Transform the frame points into cam space:
|
||||
mat = transform.getMat()
|
||||
camSpaceTopLeft = mat.xformPoint(Point3(left, 0, top))
|
||||
camSpaceBottomRight = mat.xformPoint(Point3(right, 0, bottom))
|
||||
|
||||
# Project into screen space:
|
||||
screenSpaceTopLeft = Point2()
|
||||
screenSpaceBottomRight = Point2()
|
||||
base.camLens.project(Point3(camSpaceTopLeft), screenSpaceTopLeft)
|
||||
base.camLens.project(Point3(camSpaceBottomRight), screenSpaceBottomRight)
|
||||
|
||||
left, top = screenSpaceTopLeft
|
||||
right, bottom = screenSpaceBottomRight
|
||||
|
||||
self.region.setFrame(left, right, bottom, top)
|
Loading…
Reference in a new issue