mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-19 13:15:00 -04:00
*** empty log message ***
This commit is contained in:
parent
0fa8e3bd71
commit
7296ae3a75
@ -282,6 +282,28 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
side = LEFT, expand = 1)
|
side = LEFT, expand = 1)
|
||||||
widget['font'] = (('MSSansSerif', 12, 'bold'))
|
widget['font'] = (('MSSansSerif', 12, 'bold'))
|
||||||
frame.pack(fill = X, expand = 1)
|
frame.pack(fill = X, expand = 1)
|
||||||
|
|
||||||
|
# Record button
|
||||||
|
frame = Frame(playbackFrame)
|
||||||
|
widget = self.createCheckbutton(
|
||||||
|
frame, 'Recording', 'Record',
|
||||||
|
'On: path is being recorded', self.toggleRecord, 0,
|
||||||
|
side = LEFT, fill = BOTH, expand = 1)
|
||||||
|
widget.configure(foreground = 'Red', relief = RAISED, borderwidth = 2,
|
||||||
|
anchor = CENTER, width = 16)
|
||||||
|
widget = self.createButton(frame, 'Recording', 'Add Key Frame',
|
||||||
|
'Add Keyframe To Current Path',
|
||||||
|
self.addKeyframe,
|
||||||
|
side = LEFT, expand = 1)
|
||||||
|
widget.configure(state = 'disabled')
|
||||||
|
widget = self.createCheckbutton(
|
||||||
|
frame, 'Refine Page', 'Refining Path',
|
||||||
|
('On: Next record session refines current path ' +
|
||||||
|
'Off: Next record session records a new path'),
|
||||||
|
self.toggleRefine, 0,
|
||||||
|
side = LEFT, expand = 0)
|
||||||
|
frame.pack(expand = 1, fill = X)
|
||||||
|
|
||||||
playbackFrame.pack(fill = X, pady = 2)
|
playbackFrame.pack(fill = X, pady = 2)
|
||||||
|
|
||||||
# Create notebook pages
|
# Create notebook pages
|
||||||
@ -295,15 +317,15 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
## RECORD PAGE ##
|
## RECORD PAGE ##
|
||||||
recordFrame = Frame(self.recordPage, relief = SUNKEN,
|
recordFrame = Frame(self.recordPage, relief = SUNKEN,
|
||||||
borderwidth = 2)
|
borderwidth = 2)
|
||||||
label = Label(recordFrame, text = 'RECORD PATH',
|
label = Label(recordFrame, text = 'RECORDING OPTIONS',
|
||||||
font=('MSSansSerif', 12, 'bold'))
|
font=('MSSansSerif', 12, 'bold'))
|
||||||
label.pack(fill = X)
|
label.pack(fill = X)
|
||||||
# Recording Buttons
|
# Recording Buttons
|
||||||
# Record node path
|
# Record node path
|
||||||
self.gridFrame = Frame(recordFrame)
|
frame = Frame(recordFrame)
|
||||||
self.recNodePathMenu = Pmw.ComboBox(
|
self.recNodePathMenu = Pmw.ComboBox(
|
||||||
self.gridFrame, labelpos = W, label_text = 'Record Node Path:',
|
frame, labelpos = W, label_text = 'Record Node Path:',
|
||||||
entry_width = 20,
|
label_width = 16, label_anchor = W, entry_width = 20,
|
||||||
selectioncommand = self.selectRecordNodePathNamed,
|
selectioncommand = self.selectRecordNodePathNamed,
|
||||||
scrolledlist_items = self.recNodePathNames)
|
scrolledlist_items = self.recNodePathNames)
|
||||||
self.recNodePathMenu.selectitem('camera')
|
self.recNodePathMenu.selectitem('camera')
|
||||||
@ -311,81 +333,65 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
self.recNodePathMenu.component('entryfield_entry'))
|
self.recNodePathMenu.component('entryfield_entry'))
|
||||||
self.recNodePathMenuBG = (
|
self.recNodePathMenuBG = (
|
||||||
self.recNodePathMenuEntry.configure('background')[3])
|
self.recNodePathMenuEntry.configure('background')[3])
|
||||||
self.recNodePathMenu.grid(row = 0, col = 0, sticky = NSEW)
|
|
||||||
self.bind(self.recNodePathMenu,
|
self.bind(self.recNodePathMenu,
|
||||||
'Select node path to track when recording a new curve')
|
'Select node path to track when recording a new curve')
|
||||||
|
self.recNodePathMenu.pack(side = LEFT, expand = 0)
|
||||||
|
frame.pack(expand = 1, fill = X)
|
||||||
|
|
||||||
|
# Hooks
|
||||||
|
frame = Frame(recordFrame)
|
||||||
|
widget = self.createLabeledEntry(
|
||||||
|
frame, 'Recording', 'Record Hook',
|
||||||
|
'Hook used to start/stop recording',
|
||||||
|
initialValue = self.startStopHook,
|
||||||
|
command = self.setStartStopHook)[0]
|
||||||
|
label = self.getWidget('Recording', 'Record Hook-Label')
|
||||||
|
label.configure(width = 16, anchor = W)
|
||||||
|
self.setStartStopHook()
|
||||||
|
widget = self.createLabeledEntry(
|
||||||
|
frame, 'Recording', 'Keyframe Hook',
|
||||||
|
'Hook used to add a new keyframe',
|
||||||
|
initialValue = self.keyframeHook,
|
||||||
|
command = self.setKeyframeHook)[0]
|
||||||
|
label = self.getWidget('Recording', 'Keyframe Hook-Label')
|
||||||
|
label.configure(width = 16, anchor = W)
|
||||||
|
self.setKeyframeHook()
|
||||||
|
frame.pack(expand = 1, fill = X)
|
||||||
|
# PreRecordFunc
|
||||||
|
frame = Frame(recordFrame)
|
||||||
|
widget = self.createLabeledEntry(
|
||||||
|
frame, 'Recording', 'Pre Record Func',
|
||||||
|
'Function called before recording each point',
|
||||||
|
command = self.setPreRecordFunc)[0]
|
||||||
|
label = self.getWidget('Recording', 'Pre Record Func-Label')
|
||||||
|
label.configure(width = 16, anchor = W)
|
||||||
|
self.createCheckbutton(frame, 'Recording', 'PRF Active',
|
||||||
|
'On: Pre Record Func enabled',
|
||||||
|
None, 0,
|
||||||
|
side = LEFT, fill = BOTH, expand = 0)
|
||||||
|
frame.pack(expand = 1, fill = X)
|
||||||
|
|
||||||
# Record type
|
# Record type
|
||||||
|
frame = Frame(recordFrame)
|
||||||
self.recordType = StringVar()
|
self.recordType = StringVar()
|
||||||
self.recordType.set('Continuous')
|
self.recordType.set('Continuous')
|
||||||
widget = self.createRadiobutton(
|
widget = self.createRadiobutton(
|
||||||
self.gridFrame, 'left',
|
frame, 'left',
|
||||||
'Recording', 'Continuous Recording',
|
'Recording', 'Continuous Recording',
|
||||||
('New point added to curve fitter every frame'),
|
('New point added to curve fitter every frame'),
|
||||||
self.recordType, 'Continuous', self.setRecordType,
|
self.recordType, 'Continuous', self.setRecordType,
|
||||||
expand = 1)
|
expand = 1)
|
||||||
widget['anchor'] = 'center'
|
widget['anchor'] = 'center'
|
||||||
widget.pack_forget()
|
|
||||||
widget.grid(row = 1, col = 0, sticky = NSEW)
|
|
||||||
widget = self.createRadiobutton(
|
widget = self.createRadiobutton(
|
||||||
self.gridFrame, 'left',
|
frame, 'left',
|
||||||
'Recording', 'Keyframe Recording',
|
'Recording', 'Keyframe Recording',
|
||||||
('Add new point to curve fitter by pressing keyframe button'),
|
('Add new point to curve fitter by pressing keyframe button'),
|
||||||
self.recordType, 'Keyframe', self.setRecordType,
|
self.recordType, 'Keyframe', self.setRecordType,
|
||||||
expand = 1)
|
expand = 1)
|
||||||
widget['anchor'] = 'center'
|
widget['anchor'] = 'center'
|
||||||
widget.pack_forget()
|
frame.pack(expand = 1, fill = X)
|
||||||
widget.grid(row = 1, col = 1, sticky = NSEW)
|
|
||||||
# Record button
|
|
||||||
widget = self.createCheckbutton(
|
|
||||||
self.gridFrame, 'Recording', 'Recording Path',
|
|
||||||
'On: path is being recorded', self.toggleRecord, 0,
|
|
||||||
side = LEFT, fill = BOTH, expand = 1)
|
|
||||||
widget.pack_forget()
|
|
||||||
widget.grid(row=2, column=0, sticky = NSEW)
|
|
||||||
widget.configure(foreground = 'Red', relief = RAISED, borderwidth = 2,
|
|
||||||
anchor = CENTER, width = 10)
|
|
||||||
widget = self.createButton(self.gridFrame, 'Recording', 'Add Key Frame',
|
|
||||||
'Add Keyframe To Current Path',
|
|
||||||
self.addKeyframe,
|
|
||||||
side = LEFT, expand = 1)
|
|
||||||
widget.configure(state = 'disabled', width = 24)
|
|
||||||
widget.pack_forget()
|
|
||||||
widget.grid(row=2, column=1, sticky = NSEW)
|
|
||||||
# Keyframe button
|
|
||||||
# Hook
|
|
||||||
widget = self.createLabeledEntry(
|
|
||||||
self.gridFrame, 'Recording', 'Record Hook',
|
|
||||||
'Hook used to start/stop recording',
|
|
||||||
initialValue = self.startStopHook,
|
|
||||||
command = self.setStartStopHook)[0]
|
|
||||||
self.setStartStopHook()
|
|
||||||
widget.pack_forget()
|
|
||||||
widget.grid(row=3, column=0, sticky = NSEW)
|
|
||||||
widget = self.createLabeledEntry(
|
|
||||||
self.gridFrame, 'Recording', 'Keyframe Hook',
|
|
||||||
'Hook used to add a new keyframe',
|
|
||||||
initialValue = self.keyframeHook,
|
|
||||||
command = self.setKeyframeHook)[0]
|
|
||||||
self.setKeyframeHook()
|
|
||||||
widget.pack_forget()
|
|
||||||
widget.grid(row=3, column=1, sticky = NSEW)
|
|
||||||
# PreRecordFunc
|
|
||||||
frame = Frame(self.gridFrame)
|
|
||||||
widget = self.createLabeledEntry(
|
|
||||||
frame, 'Recording', 'Pre Record Func',
|
|
||||||
'Function called before recording each point',
|
|
||||||
command = self.setPreRecordFunc)[0]
|
|
||||||
self.createCheckbutton(frame, 'Recording', 'PRF Active',
|
|
||||||
'On: Pre Record Func enabled',
|
|
||||||
None, 0,
|
|
||||||
side = LEFT, fill = BOTH, expand = 0)
|
|
||||||
frame.grid(row=4, column=0, columnspan = 2, sticky = NSEW)
|
|
||||||
|
|
||||||
# Pack gridFrame
|
# Pack record frame
|
||||||
self.gridFrame.pack(fill = X, expand = 1)
|
|
||||||
|
|
||||||
# This gets the widgets to spread out
|
|
||||||
self.gridFrame.grid_columnconfigure(1,weight = 1)
|
|
||||||
recordFrame.pack(fill = X, pady = 2)
|
recordFrame.pack(fill = X, pady = 2)
|
||||||
|
|
||||||
## RESAMPLE PAGE
|
## RESAMPLE PAGE
|
||||||
@ -430,15 +436,6 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
font=('MSSansSerif', 12, 'bold'))
|
font=('MSSansSerif', 12, 'bold'))
|
||||||
label.pack(fill = X)
|
label.pack(fill = X)
|
||||||
|
|
||||||
frame = Frame(refineFrame)
|
|
||||||
widget = self.createCheckbutton(
|
|
||||||
frame, 'Refine Page', 'Refining Path',
|
|
||||||
('On: Next record session refines current path ' +
|
|
||||||
'Off: Next record session records a new path'),
|
|
||||||
self.toggleRefine, 0,
|
|
||||||
side = LEFT, expand = 0)
|
|
||||||
frame.pack(expand = 1, fill = X)
|
|
||||||
|
|
||||||
widget = self.createEntryScale(refineFrame,
|
widget = self.createEntryScale(refineFrame,
|
||||||
'Refine Page', 'Refine From',
|
'Refine Page', 'Refine From',
|
||||||
'Begin time of refine pass',
|
'Begin time of refine pass',
|
||||||
@ -625,14 +622,14 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
|
|
||||||
def toggleRecordVar(self):
|
def toggleRecordVar(self):
|
||||||
# Get recording variable
|
# Get recording variable
|
||||||
v = self.getVariable('Recording', 'Recording Path')
|
v = self.getVariable('Recording', 'Record')
|
||||||
# Toggle it
|
# Toggle it
|
||||||
v.set(1 - v.get())
|
v.set(1 - v.get())
|
||||||
# Call the command
|
# Call the command
|
||||||
self.toggleRecord()
|
self.toggleRecord()
|
||||||
|
|
||||||
def toggleRecord(self):
|
def toggleRecord(self):
|
||||||
if self.getVariable('Recording', 'Recording Path').get():
|
if self.getVariable('Recording', 'Record').get():
|
||||||
# Kill old task
|
# Kill old task
|
||||||
taskMgr.removeTasksNamed(self['name'] + '-recordTask')
|
taskMgr.removeTasksNamed(self['name'] + '-recordTask')
|
||||||
# Reset curve fitters
|
# Reset curve fitters
|
||||||
@ -670,7 +667,8 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
# Add hook
|
# Add hook
|
||||||
self.acceptKeyframeHook()
|
self.acceptKeyframeHook()
|
||||||
# Record first point
|
# Record first point
|
||||||
self.startPos = self['nodePath'].getPos(self.nodePathParent)
|
self.startPos = Point3(
|
||||||
|
self['nodePath'].getPos(self.nodePathParent))
|
||||||
self.recordPoint(0.0)
|
self.recordPoint(0.0)
|
||||||
|
|
||||||
# Don't want to change record modes
|
# Don't want to change record modes
|
||||||
@ -684,7 +682,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
taskMgr.removeTasksNamed(self['name'] + '-recordTask')
|
taskMgr.removeTasksNamed(self['name'] + '-recordTask')
|
||||||
else:
|
else:
|
||||||
# Add last point
|
# Add last point
|
||||||
self.addKeyframe()
|
self.addKeyframe(0)
|
||||||
# Ignore hook
|
# Ignore hook
|
||||||
self.ignoreKeyframeHook()
|
self.ignoreKeyframeHook()
|
||||||
if self.fRefine:
|
if self.fRefine:
|
||||||
@ -713,7 +711,13 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
self.recordPoint(time)
|
self.recordPoint(time)
|
||||||
return Task.cont
|
return Task.cont
|
||||||
|
|
||||||
def addKeyframe(self):
|
def addKeyframe(self, fToggleRecord = 1):
|
||||||
|
# Make sure we're in a recording mode!
|
||||||
|
if (fToggleRecord &
|
||||||
|
(not self.getVariable('Recording', 'Record').get())):
|
||||||
|
# This will automatically add the first point
|
||||||
|
self.toggleRecordVar()
|
||||||
|
else:
|
||||||
time = (self.refineStart +
|
time = (self.refineStart +
|
||||||
(Vec3(self['nodePath'].getPos(self.nodePathParent) -
|
(Vec3(self['nodePath'].getPos(self.nodePathParent) -
|
||||||
self.startPos).length()))
|
self.startPos).length()))
|
||||||
@ -1036,8 +1040,14 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
# Get new data points based on given curve
|
# Get new data points based on given curve
|
||||||
self.xyzCurveFitter.sample(
|
self.xyzCurveFitter.sample(
|
||||||
self.xyzNurbsCurve, self.numSamples, self.fEven)
|
self.xyzNurbsCurve, self.numSamples, self.fEven)
|
||||||
self.hprCurveFitter.sample(
|
# Now resample the hprNurbsCurve at the same times
|
||||||
self.hprNurbsCurve, self.numSamples, self.fEven)
|
self.hprCurveFitter.reset()
|
||||||
|
hpr = Point3(0)
|
||||||
|
for i in range(self.xyzCurveFitter.getNumSamples()):
|
||||||
|
self.hprNurbsCurve.getPoint(
|
||||||
|
self.xyzCurveFitter.getSampleT(i), hpr)
|
||||||
|
self.hprCurveFitter.addPoint(Point3(hpr))
|
||||||
|
# Now recompute curves
|
||||||
self.computeCurves()
|
self.computeCurves()
|
||||||
# Get new point set based on newly created curve
|
# Get new point set based on newly created curve
|
||||||
self.createNewPointSet()
|
self.createNewPointSet()
|
||||||
|
@ -724,7 +724,7 @@ class ParticlePanel(AppShell):
|
|||||||
|
|
||||||
def createEntryScale(self, parent, category, text, balloonHelp,
|
def createEntryScale(self, parent, category, text, balloonHelp,
|
||||||
command = None, min = 0.0, max = 1.0,
|
command = None, min = 0.0, max = 1.0,
|
||||||
resolution = None, **kw):
|
resolution = 0.001, **kw):
|
||||||
kw['text'] = text
|
kw['text'] = text
|
||||||
kw['min'] = min
|
kw['min'] = min
|
||||||
kw['max'] = max
|
kw['max'] = max
|
||||||
|
Loading…
x
Reference in New Issue
Block a user