mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
*** empty log message ***
This commit is contained in:
parent
bcf0396051
commit
ffee6d457b
@ -114,8 +114,7 @@ class DirectCameraControl(PandaObject):
|
|||||||
# Spawn the new task
|
# Spawn the new task
|
||||||
t = Task.Task(self.XZTranslateOrHPanYZoomTask)
|
t = Task.Task(self.XZTranslateOrHPanYZoomTask)
|
||||||
# For HPanYZoom
|
# For HPanYZoom
|
||||||
coaDist = Vec3(self.coaMarker.getPos(direct.camera)).length()
|
t.zoomSF = Vec3(self.coaMarker.getPos(direct.camera)).length()
|
||||||
t.zoomSF = (coaDist / direct.dr.near)
|
|
||||||
taskMgr.spawnTaskNamed(t, 'manipulateCamera')
|
taskMgr.spawnTaskNamed(t, 'manipulateCamera')
|
||||||
|
|
||||||
def spawnXZTranslateOrHPPan(self):
|
def spawnXZTranslateOrHPPan(self):
|
||||||
@ -136,8 +135,7 @@ class DirectCameraControl(PandaObject):
|
|||||||
taskMgr.removeTasksNamed('manipulateCamera')
|
taskMgr.removeTasksNamed('manipulateCamera')
|
||||||
# Spawn new task
|
# Spawn new task
|
||||||
t = Task.Task(self.HPanYZoomTask)
|
t = Task.Task(self.HPanYZoomTask)
|
||||||
coaDist = Vec3(self.coaMarker.getPos(direct.camera)).length()
|
t.zoomSF = Vec3(self.coaMarker.getPos(direct.camera)).length()
|
||||||
t.zoomSF = (coaDist / direct.dr.near)
|
|
||||||
taskMgr.spawnTaskNamed(t, 'manipulateCamera')
|
taskMgr.spawnTaskNamed(t, 'manipulateCamera')
|
||||||
|
|
||||||
def spawnHPPan(self):
|
def spawnHPPan(self):
|
||||||
@ -182,7 +180,7 @@ class DirectCameraControl(PandaObject):
|
|||||||
moveDir.normalize()
|
moveDir.normalize()
|
||||||
else:
|
else:
|
||||||
moveDir = Vec3(Y_AXIS)
|
moveDir = Vec3(Y_AXIS)
|
||||||
moveDir.assign(moveDir * (-2.0 * direct.dr.mouseDeltaY *
|
moveDir.assign(moveDir * (-1.0 * direct.dr.mouseDeltaY *
|
||||||
state.zoomSF))
|
state.zoomSF))
|
||||||
if direct.dr.mouseDeltaY > 0.0:
|
if direct.dr.mouseDeltaY > 0.0:
|
||||||
moveDir.setY(moveDir[1] * 1.0)
|
moveDir.setY(moveDir[1] * 1.0)
|
||||||
|
@ -25,14 +25,15 @@ class DirectEntry(DirectFrame):
|
|||||||
# Define type of DirectGuiWidget
|
# Define type of DirectGuiWidget
|
||||||
('pgFunc', PGEntry, None),
|
('pgFunc', PGEntry, None),
|
||||||
('numStates', 3, None),
|
('numStates', 3, None),
|
||||||
('font', getDefaultFont(), self.setFont),
|
|
||||||
('width', 10, self.setup),
|
('width', 10, self.setup),
|
||||||
('numLines', 5, self.setup),
|
('numLines', 5, self.setup),
|
||||||
('focus', 0, self.setFocus),
|
('focus', 0, self.setFocus),
|
||||||
|
# Text used for the PGEntry text node
|
||||||
|
# NOTE: This overrides the DirectFrame text option
|
||||||
('initialText', '', INITOPT),
|
('initialText', '', INITOPT),
|
||||||
# Command to be called on hitting Enter
|
# Command to be called on hitting Enter
|
||||||
('command', None, None),
|
('command', None, None),
|
||||||
('extraArgs', [], None),
|
('extraArgs', [], None),
|
||||||
# Sounds to be used for button events
|
# Sounds to be used for button events
|
||||||
('rolloverSound', getDefaultRolloverSound(), self.setRolloverSound),
|
('rolloverSound', getDefaultRolloverSound(), self.setRolloverSound),
|
||||||
)
|
)
|
||||||
@ -42,21 +43,46 @@ class DirectEntry(DirectFrame):
|
|||||||
# Initialize superclasses
|
# Initialize superclasses
|
||||||
DirectFrame.__init__(self, parent)
|
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
|
# Bind command function
|
||||||
self.bind(ACCEPT, self.commandFunc)
|
self.bind(ACCEPT, self.commandFunc)
|
||||||
|
|
||||||
# Call option initialization functions
|
# Call option initialization functions
|
||||||
self.initialiseoptions(DirectEntry)
|
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']:
|
if self['initialText']:
|
||||||
self.guiItem.setText(self['initialText'])
|
self.set(self['initialText'])
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
self.node().setup(self['width'], self['numLines'])
|
self.node().setup(self['width'], self['numLines'])
|
||||||
|
|
||||||
def setFont(self):
|
def setFont(self):
|
||||||
self.guiItem.getTextNode().setFont(self['font'])
|
self.onscreenText.setFont(self['font'])
|
||||||
|
|
||||||
def setFocus(self):
|
def setFocus(self):
|
||||||
PGEntry.setFocus(self.guiItem, self['focus'])
|
PGEntry.setFocus(self.guiItem, self['focus'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user