mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
changes from Jason Pratt to support running epydoc--don't do stuff on module import
This commit is contained in:
parent
d4ba21fc11
commit
468fb19220
@ -4,7 +4,7 @@ from direct.showbase.ShowBaseGlobal import *
|
|||||||
#from PythonUtil import *
|
#from PythonUtil import *
|
||||||
#from IntervalGlobal import *
|
#from IntervalGlobal import *
|
||||||
|
|
||||||
from otp.avatar import Avatar
|
#from otp.avatar import Avatar
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
#import GhostWalker
|
#import GhostWalker
|
||||||
#import GravityWalker
|
#import GravityWalker
|
||||||
|
@ -308,7 +308,7 @@ class FSM(DirectObject.DirectObject):
|
|||||||
# request) not listed in defaultTransitions and not
|
# request) not listed in defaultTransitions and not
|
||||||
# handled by an earlier filter.
|
# handled by an earlier filter.
|
||||||
if request[0] in string.uppercase:
|
if request[0] in string.uppercase:
|
||||||
raise RequestedDenied, request
|
raise RequestDenied, request
|
||||||
|
|
||||||
# In either case, we quietly ignore unhandled command
|
# In either case, we quietly ignore unhandled command
|
||||||
# (lowercase) requests.
|
# (lowercase) requests.
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
from direct.showbase.ShowBaseGlobal import *
|
|
||||||
from DirectGui import *
|
|
||||||
from whrandom import *
|
|
||||||
|
|
||||||
# EXAMPLE CODE
|
if __name__ == "__main__":
|
||||||
# Load a model
|
from direct.directbase import DirectStart
|
||||||
smiley = loader.loadModel('models/misc/smiley')
|
from DirectGui import *
|
||||||
|
from whrandom import *
|
||||||
|
|
||||||
# Here we specify the button's command
|
# EXAMPLE CODE
|
||||||
def dummyCmd(index):
|
# Load a model
|
||||||
|
smiley = loader.loadModel('models/misc/smiley')
|
||||||
|
|
||||||
|
# Here we specify the button's command
|
||||||
|
def dummyCmd(index):
|
||||||
print 'Button %d POW!!!!' % index
|
print 'Button %d POW!!!!' % index
|
||||||
|
|
||||||
# Define some commands to bind to enter, exit and click events
|
# Define some commands to bind to enter, exit and click events
|
||||||
def shrink(db):
|
def shrink(db):
|
||||||
db['text2_text'] = 'Hi!'
|
db['text2_text'] = 'Hi!'
|
||||||
taskMgr.remove('shrink')
|
taskMgr.remove('shrink')
|
||||||
taskMgr.remove('expand')
|
taskMgr.remove('expand')
|
||||||
@ -21,7 +23,7 @@ def shrink(db):
|
|||||||
rolloverSmiley.lerpScale(.1,.1,.1, 1.0, blendType = 'easeInOut',
|
rolloverSmiley.lerpScale(.1,.1,.1, 1.0, blendType = 'easeInOut',
|
||||||
task = 'shrink')
|
task = 'shrink')
|
||||||
|
|
||||||
def expand(db):
|
def expand(db):
|
||||||
db['text0_text'] = 'Bye!'
|
db['text0_text'] = 'Bye!'
|
||||||
taskMgr.remove('shrink')
|
taskMgr.remove('shrink')
|
||||||
taskMgr.remove('expand')
|
taskMgr.remove('expand')
|
||||||
@ -30,7 +32,7 @@ def expand(db):
|
|||||||
task = 'expand')
|
task = 'expand')
|
||||||
db.component('geom2').clearColor()
|
db.component('geom2').clearColor()
|
||||||
|
|
||||||
def ouch(db):
|
def ouch(db):
|
||||||
taskMgr.remove('shrink')
|
taskMgr.remove('shrink')
|
||||||
taskMgr.remove('expand')
|
taskMgr.remove('expand')
|
||||||
taskMgr.remove('runAway')
|
taskMgr.remove('runAway')
|
||||||
@ -43,14 +45,14 @@ def ouch(db):
|
|||||||
db.lerpPos(Point3(newX, 0, newZ), 1.0, task = 'runAway',
|
db.lerpPos(Point3(newX, 0, newZ), 1.0, task = 'runAway',
|
||||||
blendType = 'easeOut')
|
blendType = 'easeOut')
|
||||||
|
|
||||||
dl = DirectFrame(image = 'models/maps/noise.rgb')
|
dl = DirectFrame(image = 'models/maps/noise.rgb')
|
||||||
dl.setScale(.5)
|
dl.setScale(.5)
|
||||||
|
|
||||||
# Create a button with a background image, smiley as a geometry element,
|
# Create a button with a background image, smiley as a geometry element,
|
||||||
# and a text overlay, set a different text for the four button states:
|
# and a text overlay, set a different text for the four button states:
|
||||||
# (normal, press, rollover, and disabled), set scale = .15, and relief raised
|
# (normal, press, rollover, and disabled), set scale = .15, and relief raised
|
||||||
dbArray = []
|
dbArray = []
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
db = DirectButton(parent = dl,
|
db = DirectButton(parent = dl,
|
||||||
image = 'models/maps/noise.rgb',
|
image = 'models/maps/noise.rgb',
|
||||||
geom = smiley,
|
geom = smiley,
|
||||||
@ -82,13 +84,13 @@ for i in range(10):
|
|||||||
# To get rid of button and clear out hooks call:
|
# To get rid of button and clear out hooks call:
|
||||||
# db.destroy()
|
# db.destroy()
|
||||||
|
|
||||||
# DIRECT ENTRY EXAMPLE
|
# DIRECT ENTRY EXAMPLE
|
||||||
def printEntryText(text):
|
def printEntryText(text):
|
||||||
print 'Text:', text
|
print 'Text:', text
|
||||||
|
|
||||||
# Here we create an entry, and specify everything up front
|
# Here we create an entry, and specify everything up front
|
||||||
# CALL de1.get() and de1.set('new text') to get and set entry contents
|
# CALL de1.get() and de1.set('new text') to get and set entry contents
|
||||||
de1 = DirectEntry(initialText = 'Hello, how are you?',
|
de1 = DirectEntry(initialText = 'Hello, how are you?',
|
||||||
image = 'models/maps/noise.rgb',
|
image = 'models/maps/noise.rgb',
|
||||||
image_pos = (4.55, 0, -2.55),
|
image_pos = (4.55, 0, -2.55),
|
||||||
image_scale = (5.5, 1, 4),
|
image_scale = (5.5, 1, 4),
|
||||||
@ -98,36 +100,37 @@ de1 = DirectEntry(initialText = 'Hello, how are you?',
|
|||||||
cursorKeys = 1,
|
cursorKeys = 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
# DIRECT DIALOG EXAMPLE
|
# DIRECT DIALOG EXAMPLE
|
||||||
def printDialogValue(value):
|
def printDialogValue(value):
|
||||||
print 'Value:', value
|
print 'Value:', value
|
||||||
|
|
||||||
simpleDialog = YesNoDialog(text = 'Simple',
|
simpleDialog = YesNoDialog(text = 'Simple',
|
||||||
command = printDialogValue)
|
command = printDialogValue)
|
||||||
|
|
||||||
customValues = YesNoDialog(text = 'Not Quite So Simple',
|
customValues = YesNoDialog(text = 'Not Quite So Simple',
|
||||||
buttonValueList = ['Yes', 'No'],
|
buttonValueList = ['Yes', 'No'],
|
||||||
command = printDialogValue)
|
command = printDialogValue)
|
||||||
|
|
||||||
|
|
||||||
fancyDialog = YesNoDialog(text = 'Testing Direct Dialog',
|
fancyDialog = YesNoDialog(text = 'Testing Direct Dialog',
|
||||||
geom = smiley,
|
geom = smiley,
|
||||||
geom_scale = .1,
|
geom_scale = .1,
|
||||||
geom_pos = (-0.3,0,0),
|
geom_pos = (-0.3,0,0),
|
||||||
command = printDialogValue)
|
command = printDialogValue)
|
||||||
|
|
||||||
customDialog = DirectDialog(text = 'Pick a number',
|
customDialog = DirectDialog(text = 'Pick a number',
|
||||||
buttonTextList = map(str, range(10)),
|
buttonTextList = map(str, range(10)),
|
||||||
buttonValueList = range(10),
|
buttonValueList = range(10),
|
||||||
command = printDialogValue)
|
command = printDialogValue)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# NOTE: There are some utility functions which help you get size
|
# NOTE: There are some utility functions which help you get size
|
||||||
# of a direct gui widget. These can be used to position and scale an
|
# of a direct gui widget. These can be used to position and scale an
|
||||||
# image after you've created the entry. scale = (width/2, 1, height/2)
|
# image after you've created the entry. scale = (width/2, 1, height/2)
|
||||||
print 'BOUNDS:', de1.getBounds()
|
print 'BOUNDS:', de1.getBounds()
|
||||||
print 'WIDTH:', de1.getWidth()
|
print 'WIDTH:', de1.getWidth()
|
||||||
print 'HEIGHT:', de1.getHeight()
|
print 'HEIGHT:', de1.getHeight()
|
||||||
print 'CENTER:', de1.getCenter()
|
print 'CENTER:', de1.getCenter()
|
||||||
|
|
||||||
|
run()
|
||||||
|
@ -1,109 +1,111 @@
|
|||||||
from pandac.PandaModules import *
|
|
||||||
from direct.showbase.ShowBaseGlobal import *
|
|
||||||
from IntervalGlobal import *
|
|
||||||
from direct.actor.Actor import *
|
|
||||||
|
|
||||||
from direct.directutil import Mopath
|
if __name__ == "__main__":
|
||||||
|
from direct.directbase import DirectStart
|
||||||
|
from pandac.PandaModules import *
|
||||||
|
from IntervalGlobal import *
|
||||||
|
from direct.actor.Actor import *
|
||||||
|
|
||||||
boat = loader.loadModel('models/misc/smiley')
|
from direct.directutil import Mopath
|
||||||
boat.reparentTo(render)
|
|
||||||
|
|
||||||
donald = Actor()
|
boat = loader.loadModel('models/misc/smiley')
|
||||||
donald.loadModel("phase_6/models/char/donald-wheel-1000")
|
boat.reparentTo(render)
|
||||||
donald.loadAnims({"steer":"phase_6/models/char/donald-wheel-wheel"})
|
|
||||||
donald.reparentTo(boat)
|
|
||||||
|
|
||||||
dock = loader.loadModel('models/misc/smiley')
|
donald = Actor()
|
||||||
dock.reparentTo(render)
|
donald.loadModel("phase_6/models/char/donald-wheel-1000")
|
||||||
|
donald.loadAnims({"steer":"phase_6/models/char/donald-wheel-wheel"})
|
||||||
|
donald.reparentTo(boat)
|
||||||
|
|
||||||
sound = loader.loadSfx('phase_6/audio/sfx/SZ_DD_waterlap.mp3')
|
dock = loader.loadModel('models/misc/smiley')
|
||||||
foghorn = loader.loadSfx('phase_6/audio/sfx/SZ_DD_foghorn.mp3')
|
dock.reparentTo(render)
|
||||||
|
|
||||||
mp = Mopath.Mopath()
|
sound = loader.loadSfx('phase_6/audio/sfx/SZ_DD_waterlap.mp3')
|
||||||
mp.loadFile(Filename('phase_6/paths/dd-e-w'))
|
foghorn = loader.loadSfx('phase_6/audio/sfx/SZ_DD_foghorn.mp3')
|
||||||
|
|
||||||
# Set up the boat
|
mp = Mopath.Mopath()
|
||||||
boatMopath = MopathInterval(mp, boat, 'boatpath')
|
mp.loadFile(Filename('phase_6/paths/dd-e-w'))
|
||||||
boatTrack = Track([boatMopath], 'boattrack')
|
|
||||||
BOAT_START = boatTrack.getIntervalStartTime('boatpath')
|
|
||||||
BOAT_END = boatTrack.getIntervalEndTime('boatpath')
|
|
||||||
|
|
||||||
# This will create an anim interval that is posed every frame
|
# Set up the boat
|
||||||
donaldSteerInterval = ActorInterval(donald, 'steer')
|
boatMopath = MopathInterval(mp, boat, 'boatpath')
|
||||||
# This will create an anim interval that is started at t = 0 and then
|
boatTrack = Track([boatMopath], 'boattrack')
|
||||||
# loops for 10 seconds
|
BOAT_START = boatTrack.getIntervalStartTime('boatpath')
|
||||||
donaldLoopInterval = ActorInterval(donald, 'steer', loop=1, duration = 10.0)
|
BOAT_END = boatTrack.getIntervalEndTime('boatpath')
|
||||||
donaldSteerTrack = Track([donaldSteerInterval, donaldLoopInterval],
|
|
||||||
|
# This will create an anim interval that is posed every frame
|
||||||
|
donaldSteerInterval = ActorInterval(donald, 'steer')
|
||||||
|
# This will create an anim interval that is started at t = 0 and then
|
||||||
|
# loops for 10 seconds
|
||||||
|
donaldLoopInterval = ActorInterval(donald, 'steer', loop=1, duration = 10.0)
|
||||||
|
donaldSteerTrack = Track([donaldSteerInterval, donaldLoopInterval],
|
||||||
name = 'steerTrack')
|
name = 'steerTrack')
|
||||||
|
|
||||||
# Make the dock lerp up so that it's up when the boat reaches the end of
|
# Make the dock lerp up so that it's up when the boat reaches the end of
|
||||||
# its mopath
|
# its mopath
|
||||||
dockLerp = LerpPosHprInterval(dock, 5.0,
|
dockLerp = LerpPosHprInterval(dock, 5.0,
|
||||||
pos=Point3(0, 0, -5),
|
pos=Point3(0, 0, -5),
|
||||||
hpr=Vec3(0, 0, 0),
|
hpr=Vec3(0, 0, 0),
|
||||||
name='dock-lerp')
|
name='dock-lerp')
|
||||||
# We need the dock's state to be defined before the lerp
|
# We need the dock's state to be defined before the lerp
|
||||||
dockPos = PosHprInterval(dock, dock.getPos(), dock.getHpr(), 1.0, 'dockpos')
|
dockPos = PosHprInterval(dock, dock.getPos(), dock.getHpr(), 1.0, 'dockpos')
|
||||||
dockUpTime = BOAT_END - dockLerp.getDuration()
|
dockUpTime = BOAT_END - dockLerp.getDuration()
|
||||||
hpr2 = Vec3(90.0, 90.0, 90.0)
|
hpr2 = Vec3(90.0, 90.0, 90.0)
|
||||||
dockLerp2 = LerpHprInterval(dock, 3.0, hpr2, name='hpr-lerp')
|
dockLerp2 = LerpHprInterval(dock, 3.0, hpr2, name='hpr-lerp')
|
||||||
dockTrack = Track([dockLerp2, dockPos, dockLerp], 'docktrack')
|
dockTrack = Track([dockLerp2, dockPos, dockLerp], 'docktrack')
|
||||||
dockTrack.setIntervalStartTime('dock-lerp', dockUpTime)
|
dockTrack.setIntervalStartTime('dock-lerp', dockUpTime)
|
||||||
dockTrack.setIntervalStartTime('hpr-lerp', BOAT_START)
|
dockTrack.setIntervalStartTime('hpr-lerp', BOAT_START)
|
||||||
|
|
||||||
# Start the water sound 5 seconds after the boat starts moving
|
# Start the water sound 5 seconds after the boat starts moving
|
||||||
waterStartTime = BOAT_START + 5.0
|
waterStartTime = BOAT_START + 5.0
|
||||||
waterSound = SoundInterval(sound, name='watersound')
|
waterSound = SoundInterval(sound, name='watersound')
|
||||||
soundTrack = Track([waterSound], 'soundtrack')
|
soundTrack = Track([waterSound], 'soundtrack')
|
||||||
soundTrack.setIntervalStartTime('watersound', waterStartTime)
|
soundTrack.setIntervalStartTime('watersound', waterStartTime)
|
||||||
|
|
||||||
# Throw an event when the water track ends
|
# Throw an event when the water track ends
|
||||||
eventTime = soundTrack.getIntervalEndTime('watersound')
|
eventTime = soundTrack.getIntervalEndTime('watersound')
|
||||||
waterDone = EventInterval('water-is-done')
|
waterDone = EventInterval('water-is-done')
|
||||||
waterEventTrack = Track([waterDone])
|
waterEventTrack = Track([waterDone])
|
||||||
waterEventTrack.setIntervalStartTime('water-is-done', eventTime)
|
waterEventTrack.setIntervalStartTime('water-is-done', eventTime)
|
||||||
|
|
||||||
def handleWaterDone():
|
def handleWaterDone():
|
||||||
print 'water is done'
|
print 'water is done'
|
||||||
|
|
||||||
# Interval can handle its own event
|
# Interval can handle its own event
|
||||||
messenger.accept('water-is-done', waterDone, handleWaterDone)
|
messenger.accept('water-is-done', waterDone, handleWaterDone)
|
||||||
|
|
||||||
foghornStartTime = BOAT_START + 4.0
|
foghornStartTime = BOAT_START + 4.0
|
||||||
foghornSound = SoundInterval(foghorn, name='foghorn')
|
foghornSound = SoundInterval(foghorn, name='foghorn')
|
||||||
soundTrack2 = Track([(foghornStartTime, foghornSound)], 'soundtrack2')
|
soundTrack2 = Track([(foghornStartTime, foghornSound)], 'soundtrack2')
|
||||||
|
|
||||||
mtrack = MultiTrack([boatTrack, dockTrack, soundTrack, soundTrack2, waterEventTrack,
|
mtrack = MultiTrack([boatTrack, dockTrack, soundTrack, soundTrack2, waterEventTrack,
|
||||||
donaldSteerTrack])
|
donaldSteerTrack])
|
||||||
# Print out MultiTrack parameters
|
# Print out MultiTrack parameters
|
||||||
print(mtrack)
|
print(mtrack)
|
||||||
|
|
||||||
### Using lambdas and functions ###
|
### Using lambdas and functions ###
|
||||||
# Using a lambda
|
# Using a lambda
|
||||||
i1 = FunctionInterval(lambda: base.transitions.fadeOut())
|
i1 = FunctionInterval(lambda: base.transitions.fadeOut())
|
||||||
i2 = FunctionInterval(lambda: base.transitions.fadeIn())
|
i2 = FunctionInterval(lambda: base.transitions.fadeIn())
|
||||||
|
|
||||||
def caughtIt():
|
def caughtIt():
|
||||||
print 'Caught here-is-an-event'
|
print 'Caught here-is-an-event'
|
||||||
|
|
||||||
class DummyAcceptor(DirectObject):
|
class DummyAcceptor(DirectObject):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
da = DummyAcceptor()
|
da = DummyAcceptor()
|
||||||
i3 = AcceptInterval(da, 'here-is-an-event', caughtIt)
|
i3 = AcceptInterval(da, 'here-is-an-event', caughtIt)
|
||||||
|
|
||||||
i4 = EventInterval('here-is-an-event')
|
i4 = EventInterval('here-is-an-event')
|
||||||
|
|
||||||
i5 = IgnoreInterval(da, 'here-is-an-event')
|
i5 = IgnoreInterval(da, 'here-is-an-event')
|
||||||
|
|
||||||
# Using a function
|
# Using a function
|
||||||
def printDone():
|
def printDone():
|
||||||
print 'done'
|
print 'done'
|
||||||
|
|
||||||
i6 = FunctionInterval(printDone)
|
i6 = FunctionInterval(printDone)
|
||||||
|
|
||||||
# Create track
|
# Create track
|
||||||
t1 = Track([
|
t1 = Track([
|
||||||
# Fade out
|
# Fade out
|
||||||
(0.0, i1),
|
(0.0, i1),
|
||||||
# Fade in
|
# Fade in
|
||||||
@ -119,55 +121,55 @@ t1 = Track([
|
|||||||
# Print done
|
# Print done
|
||||||
(8.0, i6)], name = 'demo')
|
(8.0, i6)], name = 'demo')
|
||||||
|
|
||||||
print(t1)
|
print(t1)
|
||||||
|
|
||||||
### Specifying interval start times during track construction ###
|
### Specifying interval start times during track construction ###
|
||||||
# Interval start time can be specified relative to three different points:
|
# Interval start time can be specified relative to three different points:
|
||||||
# PREVIOUS_END
|
# PREVIOUS_END
|
||||||
# PREVIOUS_START
|
# PREVIOUS_START
|
||||||
# TRACK_START
|
# TRACK_START
|
||||||
|
|
||||||
startTime = 0.0
|
startTime = 0.0
|
||||||
def printStart():
|
def printStart():
|
||||||
global startTime
|
global startTime
|
||||||
startTime = globalClock.getFrameTime()
|
startTime = globalClock.getFrameTime()
|
||||||
print 'Start'
|
print 'Start'
|
||||||
|
|
||||||
def printPreviousStart():
|
def printPreviousStart():
|
||||||
global startTime
|
global startTime
|
||||||
currTime = globalClock.getFrameTime()
|
currTime = globalClock.getFrameTime()
|
||||||
print 'PREVIOUS_END %0.2f' % (currTime - startTime)
|
print 'PREVIOUS_END %0.2f' % (currTime - startTime)
|
||||||
|
|
||||||
def printPreviousEnd():
|
def printPreviousEnd():
|
||||||
global startTime
|
global startTime
|
||||||
currTime = globalClock.getFrameTime()
|
currTime = globalClock.getFrameTime()
|
||||||
print 'PREVIOUS_END %0.2f' % (currTime - startTime)
|
print 'PREVIOUS_END %0.2f' % (currTime - startTime)
|
||||||
|
|
||||||
def printTrackStart():
|
def printTrackStart():
|
||||||
global startTime
|
global startTime
|
||||||
currTime = globalClock.getFrameTime()
|
currTime = globalClock.getFrameTime()
|
||||||
print 'TRACK_START %0.2f' % (currTime - startTime)
|
print 'TRACK_START %0.2f' % (currTime - startTime)
|
||||||
|
|
||||||
def printArguments(a,b,c):
|
def printArguments(a,b,c):
|
||||||
print 'My args were %d, %d, %d' % (a,b,c)
|
print 'My args were %d, %d, %d' % (a,b,c)
|
||||||
|
|
||||||
i1 = FunctionInterval(printStart)
|
i1 = FunctionInterval(printStart)
|
||||||
# Just to take time
|
# Just to take time
|
||||||
i2 = LerpPosInterval(camera, 2.0, Point3(0,10,5))
|
i2 = LerpPosInterval(camera, 2.0, Point3(0,10,5))
|
||||||
# This will be relative to end of camera move
|
# This will be relative to end of camera move
|
||||||
i3 = FunctionInterval(printPreviousEnd)
|
i3 = FunctionInterval(printPreviousEnd)
|
||||||
# Just to take time
|
# Just to take time
|
||||||
i4 = LerpPosInterval(camera, 2.0, Point3(0,0,5))
|
i4 = LerpPosInterval(camera, 2.0, Point3(0,0,5))
|
||||||
# This will be relative to the start of the camera move
|
# This will be relative to the start of the camera move
|
||||||
i5 = FunctionInterval(printPreviousStart)
|
i5 = FunctionInterval(printPreviousStart)
|
||||||
# This will be relative to track start
|
# This will be relative to track start
|
||||||
i6 = FunctionInterval(printTrackStart)
|
i6 = FunctionInterval(printTrackStart)
|
||||||
# This will print some arguments
|
# This will print some arguments
|
||||||
# This will be relative to track start
|
# This will be relative to track start
|
||||||
i7 = FunctionInterval(printArguments, extraArgs = [1,10,100])
|
i7 = FunctionInterval(printArguments, extraArgs = [1,10,100])
|
||||||
# Create the track, if you don't specify offset type in tuple it defaults to
|
# Create the track, if you don't specify offset type in tuple it defaults to
|
||||||
# relative to TRACK_START (first entry below)
|
# relative to TRACK_START (first entry below)
|
||||||
t2 = Track([(0.0, i1), # i1 start at t = 0, duration = 0.0
|
t2 = Track([(0.0, i1), # i1 start at t = 0, duration = 0.0
|
||||||
(1.0, i2, TRACK_START), # i2 start at t = 1, duration = 2.0
|
(1.0, i2, TRACK_START), # i2 start at t = 1, duration = 2.0
|
||||||
(2.0, i3, PREVIOUS_END), # i3 start at t = 5, duration = 0.0
|
(2.0, i3, PREVIOUS_END), # i3 start at t = 5, duration = 0.0
|
||||||
(1.0, i4, PREVIOUS_END), # i4 start at t = 6, duration = 2.0
|
(1.0, i4, PREVIOUS_END), # i4 start at t = 6, duration = 2.0
|
||||||
@ -176,15 +178,15 @@ t2 = Track([(0.0, i1), # i1 start at t = 0, duration = 0.0
|
|||||||
(12.0, i7)], # i7 start at t = 12, duration = 0.0
|
(12.0, i7)], # i7 start at t = 12, duration = 0.0
|
||||||
name = 'startTimeDemo')
|
name = 'startTimeDemo')
|
||||||
|
|
||||||
print(t2)
|
print(t2)
|
||||||
|
|
||||||
# Play tracks
|
# Play tracks
|
||||||
# mtrack.play()
|
# mtrack.play()
|
||||||
# t1.play()
|
# t1.play()
|
||||||
# t2.play()
|
# t2.play()
|
||||||
|
|
||||||
|
|
||||||
def test(n):
|
def test(n):
|
||||||
lerps = []
|
lerps = []
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
lerps.append(LerpPosHprInterval(dock, 5.0,
|
lerps.append(LerpPosHprInterval(dock, 5.0,
|
||||||
@ -198,4 +200,5 @@ def test(n):
|
|||||||
mt = MultiTrack([t])
|
mt = MultiTrack([t])
|
||||||
# return mt
|
# return mt
|
||||||
|
|
||||||
|
test(5)
|
||||||
|
run()
|
||||||
|
@ -2,10 +2,10 @@ from pandac.PandaModules import *
|
|||||||
from direct.directbase.DirectStart import *
|
from direct.directbase.DirectStart import *
|
||||||
from IntervalGlobal import *
|
from IntervalGlobal import *
|
||||||
|
|
||||||
smiley = loader.loadModel('models/misc/smiley')
|
|
||||||
smiley.reparentTo(render)
|
|
||||||
|
|
||||||
def doTest():
|
def doTest():
|
||||||
|
smiley = loader.loadModel('models/misc/smiley')
|
||||||
|
smiley.reparentTo(render)
|
||||||
|
|
||||||
pi = ProjectileInterval(smiley, startPos=Point3(0,0,0),
|
pi = ProjectileInterval(smiley, startPos=Point3(0,0,0),
|
||||||
endZ = -10, wayPoint=Point3(10,0,0),
|
endZ = -10, wayPoint=Point3(10,0,0),
|
||||||
timeToWayPoint=3)
|
timeToWayPoint=3)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from direct.directbase.TestStart import *
|
from pandac.PandaModules import *
|
||||||
from direct.particles import ParticleEffect
|
from direct.particles import ParticleEffect
|
||||||
from direct.particles import Particles
|
from direct.particles import Particles
|
||||||
from direct.particles import ForceGroup
|
from direct.particles import ForceGroup
|
||||||
@ -45,8 +45,10 @@ class ParticleFloorTest(NodePath):
|
|||||||
def start(self):
|
def start(self):
|
||||||
self.f.enable()
|
self.f.enable()
|
||||||
|
|
||||||
pt=ParticleFloorTest()
|
if __name__ == "__main__":
|
||||||
pt.reparentTo(render)
|
from direct.directbase.TestStart import *
|
||||||
pt.start()
|
pt=ParticleFloorTest()
|
||||||
camera.setY(-10.0)
|
pt.reparentTo(render)
|
||||||
run()
|
pt.start()
|
||||||
|
camera.setY(-10.0)
|
||||||
|
run()
|
||||||
|
@ -1,24 +1,33 @@
|
|||||||
from direct.directbase.TestStart import *
|
|
||||||
|
|
||||||
from pandac.LinearVectorForce import LinearVectorForce
|
if __name__ == "__main__":
|
||||||
from pandac.Vec3 import Vec3
|
from direct.directbase.TestStart import *
|
||||||
import ParticleEffect
|
|
||||||
from direct.tkpanels import ParticlePanel
|
|
||||||
import ForceGroup
|
|
||||||
|
|
||||||
# Showbase
|
from pandac.LinearVectorForce import LinearVectorForce
|
||||||
base.enableParticles()
|
from pandac.Vec3 import Vec3
|
||||||
|
import ParticleEffect
|
||||||
|
from direct.tkpanels import ParticlePanel
|
||||||
|
import Particles
|
||||||
|
import ForceGroup
|
||||||
|
|
||||||
# ForceGroup
|
# Showbase
|
||||||
fg = ForceGroup.ForceGroup()
|
base.enableParticles()
|
||||||
gravity = LinearVectorForce(Vec3(0.0, 0.0, -10.0))
|
|
||||||
fg.addForce(gravity)
|
|
||||||
|
|
||||||
# Particle effect
|
# ForceGroup
|
||||||
pe = ParticleEffect.ParticleEffect('particle-fx')
|
fg = ForceGroup.ForceGroup()
|
||||||
pe.reparentTo(render)
|
gravity = LinearVectorForce(Vec3(0.0, 0.0, -10.0))
|
||||||
#pe.setPos(0.0, 5.0, 4.0)
|
fg.addForce(gravity)
|
||||||
pe.addForceGroup(fg)
|
|
||||||
|
|
||||||
# Particle Panel
|
# Particles
|
||||||
pp = ParticlePanel.ParticlePanel(pe)
|
p = Particles.Particles()
|
||||||
|
|
||||||
|
# Particle effect
|
||||||
|
pe = ParticleEffect.ParticleEffect('particle-fx')
|
||||||
|
pe.reparentTo(render)
|
||||||
|
#pe.setPos(0.0, 5.0, 4.0)
|
||||||
|
pe.addForceGroup(fg)
|
||||||
|
pe.addParticles(p)
|
||||||
|
|
||||||
|
# Particle Panel
|
||||||
|
pp = ParticlePanel.ParticlePanel(pe)
|
||||||
|
|
||||||
|
run()
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
from direct.directbase.ThreeUpStart import *
|
|
||||||
|
|
||||||
class FallTest(NodePath):
|
class FallTest(NodePath):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -77,8 +76,10 @@ class FallTest(NodePath):
|
|||||||
#self.actorNode.getPhysicsObject().resetPosition(self.avatarNodePath.getPos())
|
#self.actorNode.getPhysicsObject().resetPosition(self.avatarNodePath.getPos())
|
||||||
#self.actorNode.updateTransform()
|
#self.actorNode.updateTransform()
|
||||||
|
|
||||||
test=FallTest()
|
if __name__ == "__main__":
|
||||||
test.reparentTo(render)
|
from direct.directbase.ThreeUpStart import *
|
||||||
test.setup()
|
test=FallTest()
|
||||||
camera.setY(-10.0)
|
test.reparentTo(render)
|
||||||
run()
|
test.setup()
|
||||||
|
camera.setY(-10.0)
|
||||||
|
run()
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
from direct.directbase.ThreeUpStart import *
|
|
||||||
|
|
||||||
class RotationTest(NodePath):
|
class RotationTest(NodePath):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -87,8 +86,10 @@ class RotationTest(NodePath):
|
|||||||
#self.actorNode.getPhysicsObject().resetPosition(self.avatarNodePath.getPos())
|
#self.actorNode.getPhysicsObject().resetPosition(self.avatarNodePath.getPos())
|
||||||
#self.actorNode.updateTransform()
|
#self.actorNode.updateTransform()
|
||||||
|
|
||||||
test=RotationTest()
|
if __name__ == "__main__":
|
||||||
test.reparentTo(render)
|
from direct.directbase.ThreeUpStart import *
|
||||||
test.setup()
|
test=RotationTest()
|
||||||
camera.setY(-10.0)
|
test.reparentTo(render)
|
||||||
run()
|
test.setup()
|
||||||
|
camera.setY(-10.0)
|
||||||
|
run()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import MkWrap
|
#import MkWrap
|
||||||
import imputil
|
import imputil
|
||||||
import strop
|
import strop
|
||||||
import zlib
|
import zlib
|
||||||
|
@ -5,18 +5,19 @@ import pandaSqueezeTool
|
|||||||
|
|
||||||
# Assumption: We will be squeezing the files from the current directory or the -d directory.
|
# Assumption: We will be squeezing the files from the current directory or the -d directory.
|
||||||
|
|
||||||
try:
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
opts, pargs = getopt.getopt(sys.argv[1:], 'Od:')
|
opts, pargs = getopt.getopt(sys.argv[1:], 'Od:')
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
# User passed in a bad option, print the error and the help, then exit
|
# User passed in a bad option, print the error and the help, then exit
|
||||||
print e
|
print e
|
||||||
print 'Usage: pass in -O for optimized'
|
print 'Usage: pass in -O for optimized'
|
||||||
print ' pass in -d directory'
|
print ' pass in -d directory'
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
fOptimized = 0
|
fOptimized = 0
|
||||||
# Store the option values into our variables
|
# Store the option values into our variables
|
||||||
for opt in opts:
|
for opt in opts:
|
||||||
flag, value = opt
|
flag, value = opt
|
||||||
if (flag == '-O'):
|
if (flag == '-O'):
|
||||||
fOptimized = 1
|
fOptimized = 1
|
||||||
@ -24,7 +25,7 @@ for opt in opts:
|
|||||||
elif (flag == '-d'):
|
elif (flag == '-d'):
|
||||||
os.chdir(value)
|
os.chdir(value)
|
||||||
|
|
||||||
def getSqueezeableFiles():
|
def getSqueezeableFiles():
|
||||||
fileList = os.listdir(".")
|
fileList = os.listdir(".")
|
||||||
newFileList = []
|
newFileList = []
|
||||||
if fOptimized:
|
if fOptimized:
|
||||||
@ -37,7 +38,7 @@ def getSqueezeableFiles():
|
|||||||
newFileList.append(i)
|
newFileList.append(i)
|
||||||
return newFileList
|
return newFileList
|
||||||
|
|
||||||
def squeezePandaFiles():
|
def squeezePandaFiles():
|
||||||
l = getSqueezeableFiles()
|
l = getSqueezeableFiles()
|
||||||
pandaSqueezeTool.squeeze("PandaModules", "PandaModulesUnsqueezed", l)
|
pandaSqueezeTool.squeeze("PandaModules", "PandaModulesUnsqueezed", l)
|
||||||
|
|
||||||
@ -49,4 +50,4 @@ def squeezePandaFiles():
|
|||||||
os.unlink(i)
|
os.unlink(i)
|
||||||
|
|
||||||
|
|
||||||
squeezePandaFiles()
|
squeezePandaFiles()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user