*** empty log message ***

This commit is contained in:
Mark Mine 2001-08-23 18:28:03 +00:00
parent bcf0396051
commit ffee6d457b
2 changed files with 35 additions and 11 deletions

View File

@ -114,8 +114,7 @@ class DirectCameraControl(PandaObject):
# Spawn the new task
t = Task.Task(self.XZTranslateOrHPanYZoomTask)
# For HPanYZoom
coaDist = Vec3(self.coaMarker.getPos(direct.camera)).length()
t.zoomSF = (coaDist / direct.dr.near)
t.zoomSF = Vec3(self.coaMarker.getPos(direct.camera)).length()
taskMgr.spawnTaskNamed(t, 'manipulateCamera')
def spawnXZTranslateOrHPPan(self):
@ -136,8 +135,7 @@ class DirectCameraControl(PandaObject):
taskMgr.removeTasksNamed('manipulateCamera')
# Spawn new task
t = Task.Task(self.HPanYZoomTask)
coaDist = Vec3(self.coaMarker.getPos(direct.camera)).length()
t.zoomSF = (coaDist / direct.dr.near)
t.zoomSF = Vec3(self.coaMarker.getPos(direct.camera)).length()
taskMgr.spawnTaskNamed(t, 'manipulateCamera')
def spawnHPPan(self):
@ -182,7 +180,7 @@ class DirectCameraControl(PandaObject):
moveDir.normalize()
else:
moveDir = Vec3(Y_AXIS)
moveDir.assign(moveDir * (-2.0 * direct.dr.mouseDeltaY *
moveDir.assign(moveDir * (-1.0 * direct.dr.mouseDeltaY *
state.zoomSF))
if direct.dr.mouseDeltaY > 0.0:
moveDir.setY(moveDir[1] * 1.0)

View File

@ -25,10 +25,11 @@ class DirectEntry(DirectFrame):
# Define type of DirectGuiWidget
('pgFunc', PGEntry, None),
('numStates', 3, None),
('font', getDefaultFont(), self.setFont),
('width', 10, self.setup),
('numLines', 5, self.setup),
('focus', 0, self.setFocus),
# Text used for the PGEntry text node
# NOTE: This overrides the DirectFrame text option
('initialText', '', INITOPT),
# Command to be called on hitting Enter
('command', None, None),
@ -42,21 +43,46 @@ class DirectEntry(DirectFrame):
# Initialize superclasses
DirectFrame.__init__(self, parent)
# Create Text Node Component
self.onscreenText = self.createcomponent(
'text', (), None,
OnscreenText.OnscreenText,
(), parent = hidden,
# Pass in empty text to avoid extra work, since its really
# The PGEntry which will use the TextNode to generate geometry
text = '',
# PGEntry assumes left alignment
align = TMALIGNLEFT,
font = getDefaultFont(),
scale = 1,
# Don't get rid of the text node
mayChange = 1)
# We want to keep this sucker frozen since its not
# in the scene graph
self.onscreenText.freeze()
# We can also get rid of the node path since we're just using the
# onscreenText as an easy way to access a text node as a component
self.onscreenText.removeNode()
# Bind command function
self.bind(ACCEPT, self.commandFunc)
# Call option initialization functions
self.initialiseoptions(DirectEntry)
# Update entry if init text specified
# Update TextNodes for each state
for i in range(self['numStates']):
self.guiItem.setTextDef(i, self.onscreenText.textNode)
# Update initial text
if self['initialText']:
self.guiItem.setText(self['initialText'])
self.set(self['initialText'])
def setup(self):
self.node().setup(self['width'], self['numLines'])
def setFont(self):
self.guiItem.getTextNode().setFont(self['font'])
self.onscreenText.setFont(self['font'])
def setFocus(self):
PGEntry.setFocus(self.guiItem, self['focus'])