Merge branch 'master' into input-overhaul

This commit is contained in:
rdb 2018-08-26 19:03:21 +02:00
commit 1d6c3f6486
278 changed files with 7552 additions and 3471 deletions

1
.gitignore vendored
View File

@ -59,3 +59,4 @@ __pycache__/
# Test tool cache directories
.tox/
.cache/
.pytest_cache/

View File

@ -51,4 +51,4 @@ notifications:
on_success: change
on_failure: always
use_notice: true
skip_join: true
skip_join: false

View File

@ -36,7 +36,7 @@ class MetadataPanel(AppShell,Pmw.MegaWidget):
def appInit(self):
print "Metadata Panel"
print("Metadata Panel")
def createInterface(self):
interior = self.interior()

View File

@ -6,8 +6,16 @@ from direct.tkwidgets.AppShell import AppShell
from direct.tkwidgets.VectorWidgets import ColorEntry
from direct.showbase.TkGlobal import spawnTkLoop
import seSceneGraphExplorer
from Tkinter import Frame, IntVar, Checkbutton, Toplevel
import Pmw, Tkinter
import Pmw, sys
if sys.version_info >= (3, 0):
from tkinter import Frame, IntVar, Checkbutton, Toplevel
import tkinter
else:
from Tkinter import Frame, IntVar, Checkbutton, Toplevel
import Tkinter as tkinter
class sideWindow(AppShell):
#################################################################
@ -65,7 +73,7 @@ class sideWindow(AppShell):
self.parent.resizable(False,False) ## Disable the ability to resize for this Window.
def appInit(self):
print '----SideWindow is Initialized!!'
print('----SideWindow is Initialized!!')
def createInterface(self):
# The interior of the toplevel panel
@ -73,7 +81,7 @@ class sideWindow(AppShell):
mainFrame = Frame(interior)
## Creat NoteBook
self.notebookFrame = Pmw.NoteBook(mainFrame)
self.notebookFrame.pack(fill=Tkinter.BOTH,expand=1)
self.notebookFrame.pack(fill=tkinter.BOTH,expand=1)
sgePage = self.notebookFrame.add('Tree Graph')
envPage = self.notebookFrame.add('World Setting')
self.notebookFrame['raisecommand'] = self.updateInfo
@ -83,7 +91,7 @@ class sideWindow(AppShell):
sgePage, nodePath = render,
scrolledCanvas_hull_width = 270,
scrolledCanvas_hull_height = 570)
self.SGE.pack(fill = Tkinter.BOTH, expand = 0)
self.SGE.pack(fill = tkinter.BOTH, expand = 0)
## World Setting Page
envPage = Frame(envPage)
@ -95,8 +103,8 @@ class sideWindow(AppShell):
text = 'Enable Lighting',
variable = self.LightingVar,
command = self.toggleLights)
self.LightingButton.pack(side=Tkinter.LEFT, expand=False)
pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
self.LightingButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.CollisionVar = IntVar()
@ -106,8 +114,8 @@ class sideWindow(AppShell):
text = 'Show Collision Object',
variable = self.CollisionVar,
command = self.showCollision)
self.CollisionButton.pack(side=Tkinter.LEFT, expand=False)
pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
self.CollisionButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.ParticleVar = IntVar()
@ -117,8 +125,8 @@ class sideWindow(AppShell):
text = 'Show Particle Dummy',
variable = self.ParticleVar,
command = self.enableParticle)
self.ParticleButton.pack(side=Tkinter.LEFT, expand=False)
pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
self.ParticleButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.baseUseDriveVar = IntVar()
@ -128,8 +136,8 @@ class sideWindow(AppShell):
text = 'Enable base.usedrive',
variable = self.baseUseDriveVar,
command = self.enablebaseUseDrive)
self.baseUseDriveButton.pack(side=Tkinter.LEFT, expand=False)
pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
self.baseUseDriveButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.backfaceVar = IntVar()
@ -139,8 +147,8 @@ class sideWindow(AppShell):
text = 'Enable BackFace',
variable = self.backfaceVar,
command = self.toggleBackface)
self.backfaceButton.pack(side=Tkinter.LEFT, expand=False)
pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
self.backfaceButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.textureVar = IntVar()
@ -150,8 +158,8 @@ class sideWindow(AppShell):
text = 'Enable Texture',
variable = self.textureVar,
command = self.toggleTexture)
self.textureButton.pack(side=Tkinter.LEFT, expand=False)
pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
self.textureButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.wireframeVar = IntVar()
@ -161,8 +169,8 @@ class sideWindow(AppShell):
text = 'Enable Wireframe',
variable = self.wireframeVar,
command = self.toggleWireframe)
self.wireframeButton.pack(side=Tkinter.LEFT, expand=False)
pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
self.wireframeButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.gridVar = IntVar()
@ -172,8 +180,8 @@ class sideWindow(AppShell):
text = 'Enable Grid',
variable = self.gridVar,
command = self.toggleGrid)
self.gridButton.pack(side=Tkinter.LEFT, expand=False)
pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
self.gridButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.widgetVisVar = IntVar()
@ -183,8 +191,8 @@ class sideWindow(AppShell):
text = 'Enable WidgetVisible',
variable = self.widgetVisVar,
command = self.togglewidgetVis)
self.widgetVisButton.pack(side=Tkinter.LEFT, expand=False)
pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
self.widgetVisButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.enableAutoCameraVar = IntVar()
@ -194,17 +202,17 @@ class sideWindow(AppShell):
text = 'Enable Auto Camera Movement for Loading Objects',
variable = self.enableAutoCameraVar,
command = self.toggleAutoCamera)
self.enableAutoCameraButton.pack(side=Tkinter.LEFT, expand=False)
pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
self.enableAutoCameraButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.backgroundColor = ColorEntry(
pageFrame, text = 'BG Color', value=self.worldColor)
self.backgroundColor['command'] = self.setBackgroundColorVec
self.backgroundColor['resetValue'] = [0,0,0,0]
self.backgroundColor.pack(side=Tkinter.LEFT, expand=False)
self.backgroundColor.pack(side=tkinter.LEFT, expand=False)
self.bind(self.backgroundColor, 'Set background color')
pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
envPage.pack(expand=False)
@ -320,11 +328,11 @@ class sideWindow(AppShell):
#
#################################################################
if self.enableBaseUseDrive==0:
print 'Enabled'
print('Enabled')
base.useDrive()
self.enableBaseUseDrive = 1
else:
print 'disabled'
print('disabled')
#base.useTrackball()
base.disableMouse()
self.enableBaseUseDrive = 0

View File

@ -9,9 +9,8 @@ from seColorEntry import *
from direct.tkwidgets import VectorWidgets
from direct.tkwidgets import Floater
from direct.tkwidgets import Slider
from Tkinter import *
import string, math, types
from pandac.PandaModules import *
from panda3d.core import *
class collisionWindow(AppShell):
@ -195,7 +194,7 @@ class collisionWindow(AppShell):
# put the object into a CollisionNode and attach it to the target nodePath
#################################################################
collisionObject = None
print self.objType
print(self.objType)
if self.objType=='collisionPolygon':
pointA = Point3(float(self.widgetDict['PolygonPoint A'][0]._entry.get()),
float(self.widgetDict['PolygonPoint A'][1]._entry.get()),
@ -236,7 +235,7 @@ class collisionWindow(AppShell):
float(self.widgetDict['RayDirection'][1]._entry.get()),
float(self.widgetDict['RayDirection'][2]._entry.get()))
print vector, point
print(vector, point)
collisionObject = CollisionRay()
collisionObject.setOrigin(point)

View File

@ -4,8 +4,14 @@
#################################################################
from direct.tkwidgets.AppShell import AppShell
from Tkinter import Frame, Label, Button
import string, Pmw, Tkinter
import sys, Pmw
if sys.version_info >= (3, 0):
from tkinter import Frame, Label, Button
import tkinter
else:
from Tkinter import Frame, Label, Button
import Tkinter as tkinter
# Define the Category
KEYBOARD = 'Keyboard-'
@ -75,11 +81,11 @@ class controllerWindow(AppShell):
self.cotrollerTypeEntry = self.createcomponent(
'Controller Type', (), None,
Pmw.ComboBox, (frame,),
labelpos = Tkinter.W, label_text='Controller Type:', entry_width = 20,entry_state = Tkinter.DISABLED,
labelpos = tkinter.W, label_text='Controller Type:', entry_width = 20,entry_state = tkinter.DISABLED,
selectioncommand = self.setControllerType,
scrolledlist_items = self.controllerList)
self.cotrollerTypeEntry.pack(side=Tkinter.LEFT)
frame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=False, pady = 3)
self.cotrollerTypeEntry.pack(side=tkinter.LEFT)
frame.pack(side=tkinter.TOP, fill=tkinter.X, expand=False, pady = 3)
self.cotrollerTypeEntry.selectitem('Keyboard', setentry=True)
self.inputZone = Pmw.Group(mainFrame, tag_pyclass = None)
@ -102,7 +108,7 @@ class controllerWindow(AppShell):
keyboardPage = self.objNotebook.add('Keyboard')
tarckerPage = self.objNotebook.add('Tracker')
self.objNotebook.selectpage('Keyboard')
self.objNotebook.pack(side = Tkinter.TOP, fill='both',expand=False)
self.objNotebook.pack(side = tkinter.TOP, fill='both',expand=False)
# Put this here so it isn't called right away
self.objNotebook['raisecommand'] = self.updateControlInfo
@ -113,11 +119,11 @@ class controllerWindow(AppShell):
widget = self.createcomponent(
'Target Type', (), None,
Pmw.ComboBox, (Interior,),
labelpos = Tkinter.W, label_text='Target Object:', entry_width = 20, entry_state = Tkinter.DISABLED,
labelpos = tkinter.W, label_text='Target Object:', entry_width = 20, entry_state = tkinter.DISABLED,
selectioncommand = self.setTargetObj,
scrolledlist_items = self.listOfObj)
widget.pack(side=Tkinter.LEFT, padx=3)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 5)
widget.pack(side=tkinter.LEFT, padx=3)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 5)
widget.selectitem(self.nameOfNode, setentry=True)
self.widgetsDict[KEYBOARD+'ObjList'] = widget
@ -126,411 +132,411 @@ class controllerWindow(AppShell):
settingFrame = inputZone.interior()
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Assign a Key For:').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True,pady = 6 )
widget = Label(Interior, text = 'Assign a Key For:').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True,pady = 6 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Forward :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Forward :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Forward key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyForward'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyForward'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Forward Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedForward'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedForward'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Backward :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Backward :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Backward key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyBackward'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyBackward'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Backward Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedBackward'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedBackward'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Right :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Right :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Right key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyRight'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyRight'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Right Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedRight'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedRight'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Left :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Left :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Left key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyLeft'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyLeft'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Left Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedLeft'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedLeft'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Up :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Up :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Up key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyUp'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyUp'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Up Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedUp'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedUp'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Down :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Down :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Down key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyDown'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyDown'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Down Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedDown'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedDown'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Turn Right:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Turn Right:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Turn Right key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyTurnRight'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyTurnRight'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Turn Right Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedTurnRight'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedTurnRight'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Turn Left :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Turn Left :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Turn Left key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyTurnLeft'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyTurnLeft'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Turn Left Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedTurnLeft'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedTurnLeft'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Turn UP :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Turn UP :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Turn UP key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyTurnUp'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyTurnUp'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Turn UP Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedTurnUp'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedTurnUp'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Turn Down :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Turn Down :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Turn Down key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyTurnDown'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyTurnDown'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Turn Down Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedTurnDown'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedTurnDown'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Roll Right:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Roll Right:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Roll Right key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyRollRight'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyRollRight'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Roll Right Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedRollRight'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedRollRight'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Roll Left :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Roll Left :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Roll Left key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyRollLeft'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyRollLeft'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Roll Left Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedRollLeft'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedRollLeft'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Scale UP :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Scale UP :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale UP key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyScaleUp'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyScaleUp'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale UP Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedScaleUp'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedScaleUp'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Scale Down:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Scale Down:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale Down key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyScaleDown'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyScaleDown'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale Down Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedScaleDown'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedScaleDown'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Scale X UP :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Scale X UP :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale X UP key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyScaleXUp'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyScaleXUp'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale X UP Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedScaleXUp'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedScaleXUp'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Scale X Down:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Scale X Down:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale X Down key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyScaleXDown'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyScaleXDown'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale Down X Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedScaleXDown'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedScaleXDown'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Scale Y UP :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Scale Y UP :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale Y UP key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyScaleYUp'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyScaleYUp'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale Y UP Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedScaleYUp'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedScaleYUp'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Scale Y Down:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Scale Y Down:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale Y Down key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyScaleYDown'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyScaleYDown'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale Down XY Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedScaleYDown'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedScaleYDown'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Scale Z UP :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Scale Z UP :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale Z UP key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyScaleZUp'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyScaleZUp'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale Z UP Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedScaleZUp'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedScaleZUp'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
Interior = Frame(settingFrame)
widget = Label(Interior, text = 'Scale Z Down:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = 'Scale Z Down:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale Z Down key', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardMapDict['KeyScaleZDown'],
labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Key :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'KeyScaleZDown'] = widget
widget = Label(Interior, text = ' ').pack(side=Tkinter.LEFT, expand = False)
widget = Label(Interior, text = ' ').pack(side=tkinter.LEFT, expand = False)
widget = self.createcomponent(
'Scale Down Z Speed', (), None,
Pmw.EntryField, (Interior,),
value = self.keyboardSpeedDict['SpeedScaleZDown'],
labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=Tkinter.LEFT, expand = False)
labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
widget.pack(side=tkinter.LEFT, expand = False)
self.widgetsDict[KEYBOARD+'SpeedScaleZDown'] = widget
widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
assignFrame.pack(side=Tkinter.TOP, expand=True, fill = Tkinter.X)
keyboardPage.pack(side=Tkinter.TOP, expand=True, fill = Tkinter.X)
assignFrame.pack(side=tkinter.TOP, expand=True, fill = tkinter.X)
keyboardPage.pack(side=tkinter.TOP, expand=True, fill = tkinter.X)
####################################################################
####################################################################
@ -539,12 +545,12 @@ class controllerWindow(AppShell):
####################################################################
# Pack the mainFrame
frame = Frame(mainFrame)
widget = Button(frame, text='OK', width = 13, command=self.ok_press).pack(side=Tkinter.RIGHT)
widget = Button(frame, text='Enable Control', width = 13, command=self.enableControl).pack(side=Tkinter.LEFT)
widget = Button(frame, text='Disable Control', width = 13, command=self.disableControl).pack(side=Tkinter.LEFT)
widget = Button(frame, text='Save & Keep', width = 13, command=self.saveKeepControl).pack(side=Tkinter.LEFT)
frame.pack(side = Tkinter.BOTTOM, expand=1, fill = Tkinter.X)
mainFrame.pack(expand=1, fill = Tkinter.BOTH)
widget = Button(frame, text='OK', width = 13, command=self.ok_press).pack(side=tkinter.RIGHT)
widget = Button(frame, text='Enable Control', width = 13, command=self.enableControl).pack(side=tkinter.LEFT)
widget = Button(frame, text='Disable Control', width = 13, command=self.disableControl).pack(side=tkinter.LEFT)
widget = Button(frame, text='Save & Keep', width = 13, command=self.saveKeepControl).pack(side=tkinter.LEFT)
frame.pack(side = tkinter.BOTTOM, expand=1, fill = tkinter.X)
mainFrame.pack(expand=1, fill = tkinter.BOTH)
def onDestroy(self, event):
# Check if user wish to keep the control after the window closed.
@ -688,7 +694,7 @@ class controllerWindow(AppShell):
self.keyboardMapDict[index] = self.widgetsDict['Keyboard-'+index].getvalue()
for index in self.keyboardSpeedDict:
self.keyboardSpeedDict[index] = float(self.widgetsDict['Keyboard-'+index].getvalue())
print self.nodePath
print(self.nodePath)
messenger.send('ControlW_saveSetting', ['Keyboard', [self.nodePath, self.keyboardMapDict, self.keyboardSpeedDict]])
return

View File

@ -2,13 +2,15 @@
# TK and PMW INTERFACE MODULES#
###############################
from direct.showbase.TkGlobal import*
from tkFileDialog import *
import Pmw
import tkFileDialog
import tkMessageBox
from direct.tkwidgets import Dial
from direct.tkwidgets import Floater
if sys.version_info >= (3, 0):
from tkinter.filedialog import askopenfilename
else:
from tkFileDialog import askopenfilename
#############################
# Scene Editor Python Files #
@ -154,7 +156,7 @@ class dataHolder:
self.ActorNum=0
self.theScene=None
messenger.send('SGE_Update Explorer',[render])
print 'Scene should be cleaned up!'
print('Scene should be cleaned up!')
def removeObj(self, nodePath):
#################################################################
@ -169,7 +171,7 @@ class dataHolder:
childrenList = nodePath.getChildren()
if self.ModelDic.has_key(name):
if name in self.ModelDic:
del self.ModelDic[name]
del self.ModelRefDic[name]
if len(childrenList) != 0:
@ -178,7 +180,7 @@ class dataHolder:
nodePath.removeNode()
self.ModelNum -= 1
pass
elif self.ActorDic.has_key(name):
elif name in self.ActorDic:
del self.ActorDic[name]
del self.ActorRefDic[name]
if len(childrenList) != 0:
@ -187,14 +189,14 @@ class dataHolder:
nodePath.removeNode()
self.ActorNum -= 1
pass
elif self.collisionDict.has_key(name):
elif name in self.collisionDict:
del self.collisionDict[name]
if len(childrenList) != 0:
for node in childrenList:
self.removeObj(node)
nodePath.removeNode()
pass
elif self.dummyDict.has_key(name):
elif name in self.dummyDict:
del self.dummyDict[name]
if len(childrenList) != 0:
for node in childrenList:
@ -207,12 +209,12 @@ class dataHolder:
self.removeObj(node)
list = self.lightManager.delete(name)
return list
elif self.particleNodes.has_key(name):
elif name in self.particleNodes:
self.particleNodes[name].removeNode()
del self.particleNodes[name]
del self.particleDict[name]
else:
print 'You cannot remove this NodePath'
print('You cannot remove this NodePath')
return
messenger.send('SGE_Update Explorer',[render])
@ -237,15 +239,15 @@ class dataHolder:
cHpr = hpr
cScale = scale
parent = nodePath.getParent()
if self.ActorDic.has_key(name):
if name in self.ActorDic:
holder = self.ActorDic
holderRef = self.ActorRefDic
isModel = False
elif self.ModelDic.has_key(name):
elif name in self.ModelDic:
holder = self.ModelDic
holderRef = self.ModelRefDic
else:
print '---- DataHolder: Target Obj is not a legal object could be duplicate!'
print('---- DataHolder: Target Obj is not a legal object could be duplicate!')
return
FilePath = holderRef[name]
@ -356,7 +358,7 @@ class dataHolder:
# This funciton will return True if there is an Actor in the scene named "name"
# and will return False if not.
###########################################################################
return self.ActorDic.has_key(name)
return name in self.ActorDic
def getActor(self, name):
###########################################################################
@ -366,7 +368,7 @@ class dataHolder:
if self.isActor(name):
return self.ActorDic[name]
else:
print '----No Actor named: ', name
print('----No Actor named: ', name)
return None
def getModel(self, name):
@ -377,7 +379,7 @@ class dataHolder:
if self.isModel(name):
return self.ModelDic[name]
else:
print '----No Model named: ', name
print('----No Model named: ', name)
return None
def isModel(self, name):
@ -386,7 +388,7 @@ class dataHolder:
# This funciton will return True if there is a Model in the scene named "name"
# and will return False if not.
###########################################################################
return self.ModelDic.has_key(name)
return name in self.ModelDic
def loadAnimation(self,name, Dic):
###########################################################################
@ -406,7 +408,7 @@ class dataHolder:
messenger.send('DataH_loadFinish'+name)
return
else:
print '------ Error when loading animation for Actor: ', name
print('------ Error when loading animation for Actor: ', name)
def removeAnimation(self, name, anim):
###########################################################################
@ -527,7 +529,7 @@ class dataHolder:
self.ActorDic[nName]= self.ActorDic[oName]
self.ActorRefDic[nName]= self.ActorRefDic[oName]
self.ActorDic[nName].setName(nName)
if self.blendAnimDict.has_key(oName):
if oName in self.blendAnimDict:
self.blendAnimDict[nName] = self.blendAnimDict[oName]
del self.blendAnimDict[oName]
del self.ActorDic[oName]
@ -540,16 +542,16 @@ class dataHolder:
del self.ModelRefDic[oName]
elif self.lightManager.isLight(oName):
list, lightNode = self.lightManager.rename(oName, nName)
elif self.dummyDict.has_key(oName):
elif oName in self.dummyDict:
self.dummyDict[nName]= self.dummyDict[oName]
self.dummyDict[nName].setName(nName)
del self.dummyDict[oName]
elif self.collisionDict.has_key(oName):
elif oName in self.collisionDict:
self.collisionDict[nName]= self.collisionDict[oName]
self.collisionDict[nName].setName(nName)
del self.collisionDict[oName]
elif self.particleNodes.has_key(oName):
elif oName in self.particleNodes:
self.particleNodes[nName]= self.particleNodes[oName]
self.particleDict[nName]= self.particleDict[oName]
self.particleDict[nName].setName(nName)
@ -557,9 +559,9 @@ class dataHolder:
del self.particleNodes[oName]
del self.particleDict[oName]
else:
print '----Error: This Object is not allowed to this function!'
print('----Error: This Object is not allowed to this function!')
if self.curveDict.has_key(oName):
if oName in self.curveDict:
self.curveDict[nName] = self.curveDict[oName]
del self.curveDict[oName]
@ -578,11 +580,11 @@ class dataHolder:
return True
elif self.lightManager.isLight(name):
return True
elif self.dummyDict.has_key(name):
elif name in self.dummyDict:
return True
elif self.collisionDict.has_key(name):
elif name in self.collisionDict:
return True
elif self.particleNodes.has_key(name):
elif name in self.particleNodes:
return True
elif (name == 'render')or(name == 'SEditor')or(name == 'Lights')or(name == 'camera'):
return True
@ -596,7 +598,7 @@ class dataHolder:
# using the node name as a reference to assosiate a list which contains all curves related to that node.
###########################################################################
name = node.getName()
if self.curveDict.has_key(name):
if name in self.curveDict:
self.curveDict[name].append(curveCollection)
return
else:
@ -612,7 +614,7 @@ class dataHolder:
# If the input node has not been bindedwith any curve, it will return None.
###########################################################################
name = nodePath.getName()
if self.curveDict.has_key(name):
if name in self.curveDict:
return self.curveDict[name]
else:
return None
@ -626,7 +628,7 @@ class dataHolder:
# This message will be caught by Property Window for this node.
###########################################################################
name =nodePath.getName()
if self.curveDict.has_key(name):
if name in self.curveDict:
index = None
for curve in self.curveDict[name]:
if curve.getCurve(0).getName() == curveName:
@ -677,12 +679,12 @@ class dataHolder:
elif self.isLight(name):
type = 'Light'
info['lightNode'] = self.lightManager.getLightNode(name)
elif self.dummyDict.has_key(name):
elif name in self.dummyDict:
type = 'dummy'
elif self.collisionDict.has_key(name):
elif name in self.collisionDict:
type = 'collisionNode'
info['collisionNode'] = self.collisionDict[name]
if self.curveDict.has_key(name):
if name in self.curveDict:
info['curveList'] = self.getCurveList(nodePath)
return type, info
@ -794,7 +796,7 @@ class dataHolder:
# The formate of thsi dictionary is
# {"name of Blend Animation" : ["Animation A, Animation B, Effect(Float, 0~1)"]}
###########################################################################
if self.blendAnimDict.has_key(name):
if name in self.blendAnimDict:
return self.blendAnimDict[name]
else:
return {}
@ -808,8 +810,8 @@ class dataHolder:
# Also, if this blend is the first blend animation that the target actor has,
# this function will add a "Blending" tag on this actor which is "True".
###########################################################################
if self.blendAnimDict.has_key(actorName):
if self.blendAnimDict[actorName].has_key(blendName):
if actorName in self.blendAnimDict:
if blendName in self.blendAnimDict[actorName]:
### replace the original setting
self.blendAnimDict[actorName][blendName][0] = animNameA
self.blendAnimDict[actorName][blendName][1] = animNameB
@ -832,7 +834,7 @@ class dataHolder:
# it will also rewrite the data to the newest one.
###########################################################################
self.removeBlendAnim(actorName,oName)
print self.blendAnimDict
print(self.blendAnimDict)
return self.saveBlendAnim(actorName, nName, animNameA, animNameB, effect)
def removeBlendAnim(self, actorName, blendName):
@ -844,8 +846,8 @@ class dataHolder:
# Also, it will check that there is any blended animation remained for this actor,
# If none, this function will clear the "Blending" tag of this object.
###########################################################################
if self.blendAnimDict.has_key(actorName):
if self.blendAnimDict[actorName].has_key(blendName):
if actorName in self.blendAnimDict:
if blendName in self.blendAnimDict[actorName]:
### replace the original setting
del self.blendAnimDict[actorName][blendName]
if len(self.blendAnimDict[actorName])==0:
@ -876,15 +878,15 @@ class dataHolder:
###########################################################################
if name == 'camera':
return camera
elif self.ModelDic.has_key(name):
elif name in self.ModelDic:
return self.ModelDic[name]
elif self.ActorDic.has_key(name):
elif name in self.ActorDic:
return self.ActorDic[name]
elif self.collisionDict.has_key(name):
elif name in self.collisionDict:
return self.collisionDict[name]
elif self.dummyDict.has_key(name):
elif name in self.dummyDict:
return self.dummyDict[name]
elif self.particleNodes.has_key(name):
elif name in self.particleNodes:
return self.particleNodes[name]
elif self.lightManager.isLight(name):
return self.lightManager.getLightNode(name)
@ -935,13 +937,13 @@ class dataHolder:
###########################################################################
### Ask for a filename
OpenFilename = tkFileDialog.askopenfilename(filetypes = [("PY","py")],title = "Load Scene")
OpenFilename = askopenfilename(filetypes = [("PY","py")],title = "Load Scene")
if(not OpenFilename):
return None
f=Filename.fromOsSpecific(OpenFilename)
fileName=f.getBasenameWoExtension()
dirName=f.getFullpathWoExtension()
print "DATAHOLDER::" + dirName
print("DATAHOLDER::" + dirName)
############################################################################
# Append the path to this file to our sys path where python looks for modules
# We do this so that we can use "import" on our saved scene code and execute it
@ -976,7 +978,7 @@ class dataHolder:
self.ActorDic[actor]=self.Scene.ActorDic[actor]
#self.ActorRefDic[actor]=self.Scene.ActorRefDic[actor] # Old way of doing absolute paths
self.ActorRefDic[actor]=Filename(dirName + "/" + self.Scene.ActorRefDic[actor]) # Relative Paths
if(self.Scene.blendAnimDict.has_key(str(actor))):
if(str(actor) in self.Scene.blendAnimDict):
self.blendAnimDict[actor]=self.Scene.blendAnimDict[actor]
self.ActorNum=self.ActorNum+1
@ -1006,7 +1008,7 @@ class dataHolder:
atten=alight.getAttenuation()
self.lightManager.create('spot',alight.getColor(),alight.getSpecularColor(),thenode.getPos(),thenode.getHpr(),atten.getX(),atten.getY(),atten.getZ(),alight.getExponent(),name=alight.getName(),tag=thenode.getTag("Metadata"))
else:
print 'Invalid light type'
print('Invalid light type')
############################################################################
# Populate Dummy related Dictionaries

View File

@ -45,7 +45,7 @@ class duplicateWindow(AppShell):
self.parent.resizable(False,False) ## Disable the ability to resize for this Window.
def appInit(self):
print '----SideWindow is Initialized!!'
print('----SideWindow is Initialized!!')
def createInterface(self):
# The interior of the toplevel panel
@ -122,7 +122,7 @@ class duplicateWindow(AppShell):
# This message will be caught by sceneEditor.
#################################################################
if not self.allEntryValid():
print '---- Duplication Window: Invalid value!!'
print('---- Duplication Window: Invalid value!!')
return
x = self.move_x.getvalue()
y = self.move_y.getvalue()

View File

@ -7,9 +7,16 @@ from direct.tkwidgets.AppShell import AppShell
from seColorEntry import *
from direct.tkwidgets.VectorWidgets import Vector3Entry
from direct.tkwidgets.Slider import Slider
from Tkinter import Frame, Button, Menubutton, Menu
import string, math, types, Pmw, Tkinter
from pandac.PandaModules import *
import sys, math, types, Pmw
from panda3d.core import *
if sys.version_info >= (3, 0):
from tkinter import Frame, Button, Menubutton, Menu
import tkinter
else:
from Tkinter import Frame, Button, Menubutton, Menu
import Tkinter as tkinter
class lightingPanel(AppShell):
#################################################################
@ -51,25 +58,25 @@ class lightingPanel(AppShell):
mainFrame = Frame(interior)
self.listZone = Pmw.Group(mainFrame,tag_pyclass = None)
self.listZone.pack(expand=0, fill=Tkinter.X,padx=3,pady=3)
self.listZone.pack(expand=0, fill=tkinter.X,padx=3,pady=3)
listFrame = self.listZone.interior()
self.lightEntry = self.createcomponent(
'Lights List', (), None,
Pmw.ComboBox, (listFrame,),label_text='Light :',
labelpos = Tkinter.W, entry_width = 25, selectioncommand = self.selectLight,
labelpos = tkinter.W, entry_width = 25, selectioncommand = self.selectLight,
scrolledlist_items = self.lightList)
self.lightEntry.pack(side=Tkinter.LEFT)
self.lightEntry.pack(side=tkinter.LEFT)
self.renameButton = self.createcomponent(
'Rename Light', (), None,
Button, (listFrame,),
text = ' Rename ',
command = self.renameLight)
self.renameButton.pack(side=Tkinter.LEFT)
self.renameButton.pack(side=tkinter.LEFT)
self.addLighZone = Pmw.Group(listFrame,tag_pyclass = None)
self.addLighZone.pack(side=Tkinter.LEFT)
self.addLighZone.pack(side=tkinter.LEFT)
insideFrame = self.addLighZone.interior()
self.lightsButton = Menubutton(insideFrame, text = 'Add light',borderwidth = 3,
activebackground = '#909090')
@ -91,13 +98,13 @@ class lightingPanel(AppShell):
Button, (listFrame,),
text = ' Delete ',
command = self.deleteLight)
self.deleteButton.pack(side=Tkinter.LEFT)
self.deleteButton.pack(side=tkinter.LEFT)
self.lightColor = seColorEntry(
mainFrame, text = 'Light Color', value=self.lightColor)
self.lightColor['command'] = self.setLightingColorVec
self.lightColor['resetValue'] = [0.3*255,0.3*255,0.3*255,0]
self.lightColor.pack(fill=Tkinter.X,expand=0)
self.lightColor.pack(fill=tkinter.X,expand=0)
self.bind(self.lightColor, 'Set light color')
# Notebook pages for light specific controls
@ -114,27 +121,27 @@ class lightingPanel(AppShell):
self.dSpecularColor = seColorEntry(
directionalPage, text = 'Specular Color')
self.dSpecularColor['command'] = self.setSpecularColor
self.dSpecularColor.pack(fill = Tkinter.X, expand = 0)
self.dSpecularColor.pack(fill = tkinter.X, expand = 0)
self.bind(self.dSpecularColor,
'Set directional light specular color')
self.dPosition = Vector3Entry(
directionalPage, text = 'Position')
self.dPosition['command'] = self.setPosition
self.dPosition['resetValue'] = [0,0,0,0]
self.dPosition.pack(fill = Tkinter.X, expand = 0)
self.dPosition.pack(fill = tkinter.X, expand = 0)
self.bind(self.dPosition, 'Set directional light position')
self.dOrientation = Vector3Entry(
directionalPage, text = 'Orientation')
self.dOrientation['command'] = self.setOrientation
self.dOrientation['resetValue'] = [0,0,0,0]
self.dOrientation.pack(fill = Tkinter.X, expand = 0)
self.dOrientation.pack(fill = tkinter.X, expand = 0)
self.bind(self.dOrientation, 'Set directional light orientation')
# Point light controls
self.pSpecularColor = seColorEntry(
pointPage, text = 'Specular Color')
self.pSpecularColor['command'] = self.setSpecularColor
self.pSpecularColor.pack(fill = Tkinter.X, expand = 0)
self.pSpecularColor.pack(fill = tkinter.X, expand = 0)
self.bind(self.pSpecularColor,
'Set point light specular color')
@ -142,7 +149,7 @@ class lightingPanel(AppShell):
pointPage, text = 'Position')
self.pPosition['command'] = self.setPosition
self.pPosition['resetValue'] = [0,0,0,0]
self.pPosition.pack(fill = Tkinter.X, expand = 0)
self.pPosition.pack(fill = tkinter.X, expand = 0)
self.bind(self.pPosition, 'Set point light position')
self.pConstantAttenuation = Slider(
@ -152,7 +159,7 @@ class lightingPanel(AppShell):
resolution = 0.01,
value = 1.0)
self.pConstantAttenuation['command'] = self.setConstantAttenuation
self.pConstantAttenuation.pack(fill = Tkinter.X, expand = 0)
self.pConstantAttenuation.pack(fill = tkinter.X, expand = 0)
self.bind(self.pConstantAttenuation,
'Set point light constant attenuation')
@ -163,7 +170,7 @@ class lightingPanel(AppShell):
resolution = 0.01,
value = 0.0)
self.pLinearAttenuation['command'] = self.setLinearAttenuation
self.pLinearAttenuation.pack(fill = Tkinter.X, expand = 0)
self.pLinearAttenuation.pack(fill = tkinter.X, expand = 0)
self.bind(self.pLinearAttenuation,
'Set point light linear attenuation')
@ -174,7 +181,7 @@ class lightingPanel(AppShell):
resolution = 0.01,
value = 0.0)
self.pQuadraticAttenuation['command'] = self.setQuadraticAttenuation
self.pQuadraticAttenuation.pack(fill = Tkinter.X, expand = 0)
self.pQuadraticAttenuation.pack(fill = tkinter.X, expand = 0)
self.bind(self.pQuadraticAttenuation,
'Set point light quadratic attenuation')
@ -182,7 +189,7 @@ class lightingPanel(AppShell):
self.sSpecularColor = seColorEntry(
spotPage, text = 'Specular Color')
self.sSpecularColor['command'] = self.setSpecularColor
self.sSpecularColor.pack(fill = Tkinter.X, expand = 0)
self.sSpecularColor.pack(fill = tkinter.X, expand = 0)
self.bind(self.sSpecularColor,
'Set spot light specular color')
@ -193,7 +200,7 @@ class lightingPanel(AppShell):
resolution = 0.01,
value = 1.0)
self.sConstantAttenuation['command'] = self.setConstantAttenuation
self.sConstantAttenuation.pack(fill = Tkinter.X, expand = 0)
self.sConstantAttenuation.pack(fill = tkinter.X, expand = 0)
self.bind(self.sConstantAttenuation,
'Set spot light constant attenuation')
@ -204,7 +211,7 @@ class lightingPanel(AppShell):
resolution = 0.01,
value = 0.0)
self.sLinearAttenuation['command'] = self.setLinearAttenuation
self.sLinearAttenuation.pack(fill = Tkinter.X, expand = 0)
self.sLinearAttenuation.pack(fill = tkinter.X, expand = 0)
self.bind(self.sLinearAttenuation,
'Set spot light linear attenuation')
@ -215,7 +222,7 @@ class lightingPanel(AppShell):
resolution = 0.01,
value = 0.0)
self.sQuadraticAttenuation['command'] = self.setQuadraticAttenuation
self.sQuadraticAttenuation.pack(fill = Tkinter.X, expand = 0)
self.sQuadraticAttenuation.pack(fill = tkinter.X, expand = 0)
self.bind(self.sQuadraticAttenuation,
'Set spot light quadratic attenuation')
@ -226,16 +233,16 @@ class lightingPanel(AppShell):
resolution = 0.01,
value = 0.0)
self.sExponent['command'] = self.setExponent
self.sExponent.pack(fill = Tkinter.X, expand = 0)
self.sExponent.pack(fill = tkinter.X, expand = 0)
self.bind(self.sExponent,
'Set spot light exponent')
# MRM: Add frustum controls
self.lightNotebook.setnaturalsize()
self.lightNotebook.pack(expand = 1, fill = Tkinter.BOTH)
self.lightNotebook.pack(expand = 1, fill = tkinter.BOTH)
mainFrame.pack(expand=1, fill = Tkinter.BOTH)
mainFrame.pack(expand=1, fill = tkinter.BOTH)
def onDestroy(self, event):
messenger.send('LP_close')

View File

@ -11,8 +11,7 @@ from direct.tkwidgets import Floater
from direct.tkwidgets import Dial
from direct.tkwidgets import Slider
from direct.tkwidgets import VectorWidgets
from pandac.PandaModules import *
from Tkinter import *
from panda3d.core import *
import Pmw
class propertyWindow(AppShell,Pmw.MegaWidget):
@ -108,7 +107,7 @@ class propertyWindow(AppShell,Pmw.MegaWidget):
self.curveFrame = None
#### If nodePath has been binded with any curves
if self.info.has_key('curveList'):
if 'curveList' in self.info:
self.createCurveFrame(self.contentFrame)
## Set all stuff done
@ -271,7 +270,7 @@ class propertyWindow(AppShell,Pmw.MegaWidget):
# And, it will set the call back function to setNodeColorVec()
#################################################################
color = self.nodePath.getColor()
print color
print(color)
self.nodeColor = VectorWidgets.ColorEntry(
contentFrame, text = 'Node Color', value=[color.getX()*255,
color.getY()*255,
@ -725,7 +724,7 @@ class propertyWindow(AppShell,Pmw.MegaWidget):
# But, not directly removed be this function.
# This function will send out a message to notice dataHolder to remove this animation
#################################################################
print anim
print(anim)
widget = self.widgetsDict[anim]
self.accept('animRemovedFromNode',self.redrawAnimProperty)
messenger.send('PW_removeAnimFromNode',[self.name, anim])

View File

@ -9,10 +9,8 @@
from direct.showbase.ShowBaseGlobal import *
from direct.interval.IntervalGlobal import *
from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import *
from panda3d.core import *
import math
#Manakel 2/12/2005: replace from pandac import by from pandac.PandaModules import
from pandac.PandaModules import MouseWatcher
class ViewPort:
@ -506,7 +504,7 @@ class QuadView(DirectObject):
ansY=-1.0+y2
self.xy=[ansX,ansY]
print "Sent X:%f Sent Y:%f"%(ansX,ansY)
print("Sent X:%f Sent Y:%f"%(ansX,ansY))
#SEditor.iRay.pick(render,self.xy)
SEditor.manipulationControl.manipulationStop(self.xy)
#print "MouseX " + str(base.mouseWatcherNode.getMouseX()) + "MouseY " + str(base.mouseWatcherNode.getMouseY()) + "\n"
@ -550,28 +548,28 @@ class QuadView(DirectObject):
dr.setDimensions(0.5,1,0,0.5)
def setLeft(self):
print "LEFT"
print("LEFT")
self.CurrentQuad=3
self.ChangeBaseDR()
self.Left.setCam()
#self.Left.setDR(self.mouseWatcherNode)
def setTop(self):
print "TOP"
print("TOP")
self.CurrentQuad=2
self.ChangeBaseDR()
self.Top.setCam()
#self.Top.setDR(self.mouseWatcherNode)
def setPerspective(self):
print "PERSPECTIVE"
print("PERSPECTIVE")
self.CurrentQuad=4
self.ChangeBaseDR()
self.Perspective.setCam()
#self.Perspective.setDR(self.mouseWatcherNode)
def setFront(self):
print "FRONT"
print("FRONT")
self.CurrentQuad=1
self.ChangeBaseDR()
self.Front.setCam()

View File

@ -3,11 +3,19 @@ import sys
try: import _tkinter
except: sys.exit("Please install python module 'Tkinter'")
import direct
from direct.directbase.DirectStart import*
from direct.showbase.ShowBase import ShowBase
ShowBase()
from direct.showbase.TkGlobal import spawnTkLoop
from Tkinter import *
from tkFileDialog import *
if sys.version_info >= (3, 0):
from tkinter import *
from tkinter.filedialog import *
else:
from Tkinter import *
from tkFileDialog import *
from direct.directtools.DirectGlobals import *
from direct.tkwidgets.AppShell import*
@ -251,7 +259,10 @@ class myLevelEditor(AppShell):
for event in self.actionEvents:
self.accept(event[0], event[1], extraArgs = event[2:])
camera.toggleVis()
if camera.is_hidden():
camera.show()
else:
camera.hide()
self.selectNode(base.camera) ## Initially, we select camera as the first node...
def appInit(self):
@ -386,31 +397,31 @@ class myLevelEditor(AppShell):
self.showAbout()
return
elif buttonIndex==12:
print "You haven't defined the function for this Button, Number %d."%buttonIndex
print("You haven't defined the function for this Button, Number %d."%buttonIndex)
return
elif buttonIndex==13:
print "You haven't defined the function for this Button, Number %d."%buttonIndex
print("You haven't defined the function for this Button, Number %d."%buttonIndex)
return
elif buttonIndex==14:
print "You haven't defined the function for this Button, Number %d."%buttonIndex
print("You haven't defined the function for this Button, Number %d."%buttonIndex)
return
elif buttonIndex==15:
print "You haven't defined the function for this Button, Number %d."%buttonIndex
print("You haven't defined the function for this Button, Number %d."%buttonIndex)
return
elif buttonIndex==16:
print "Your scene will be eliminated within five seconds, Save your world!!!, Number %d."%buttonIndex
print("Your scene will be eliminated within five seconds, Save your world!!!, Number %d."%buttonIndex)
return
elif buttonIndex==17:
print "You haven't defined the function for this Button, Number %d."%buttonIndex
print("You haven't defined the function for this Button, Number %d."%buttonIndex)
return
elif buttonIndex==18:
print "You haven't defined the function for this Button, Number %d."%buttonIndex
print("You haven't defined the function for this Button, Number %d."%buttonIndex)
return
elif buttonIndex==19:
print "You haven't defined the function for this Button, Number %d."%buttonIndex
print("You haven't defined the function for this Button, Number %d."%buttonIndex)
return
elif buttonIndex==20:
print "You haven't defined the function for this Button, Number %d."%buttonIndex
print("You haven't defined the function for this Button, Number %d."%buttonIndex)
return
return
@ -666,17 +677,17 @@ class myLevelEditor(AppShell):
#################################################################
type, info = AllScene.getInfoOfThisNode(nodePath)
name = nodePath.getName()
if not self.propertyWindow.has_key(name):
if name not in self.propertyWindow:
self.propertyWindow[name] = propertyWindow(nodePath, type,info )
pass
def closePropertyWindow(self, name):
if self.propertyWindow.has_key(name):
if name in self.propertyWindow:
del self.propertyWindow[name]
return
def openMetadataPanel(self,nodePath=None):
print nodePath
print(nodePath)
self.MetadataPanel=MetadataPanel(nodePath)
pass
@ -685,7 +696,7 @@ class myLevelEditor(AppShell):
# duplicate(self, nodePath = None)
# This function will be called when user try to open the duplication window
#################################################################
print '----Duplication!!'
print('----Duplication!!')
if nodePath != None:
self.duplicateWindow = duplicateWindow(nodePath = nodePath)
pass
@ -791,8 +802,8 @@ class myLevelEditor(AppShell):
#################################################################
name = nodePath.getName()
if AllScene.isActor(name):
if self.animPanel.has_key(name):
print '---- You already have an animation panel for this Actor!'
if name in self.animPanel:
print('---- You already have an animation panel for this Actor!')
return
else:
Actor = AllScene.getActor(name)
@ -842,9 +853,9 @@ class myLevelEditor(AppShell):
# Let us actually remove the scene from sys modules... this is done because every scene is loaded as a module
# And if we reload a scene python wont reload since its already in sys.modules... and hence we delete it
# If there is ever a garbage colleciton bug..this might be a point to look at
if sys.modules.has_key(currentModName):
if currentModName in sys.modules:
del sys.modules[currentModName]
print sys.getrefcount(AllScene.theScene)
print(sys.getrefcount(AllScene.theScene))
del AllScene.theScene
else:
AllScene.resetAll()
@ -872,9 +883,9 @@ class myLevelEditor(AppShell):
# Let us actually remove the scene from sys modules... this is done because every scene is loaded as a module
# And if we reload a scene python wont reload since its already in sys.modules... and hence we delete it
# If there is ever a garbage colleciton bug..this might be a point to look at
if sys.modules.has_key(currentModName):
if currentModName in sys.modules:
del sys.modules[currentModName]
print sys.getrefcount(AllScene.theScene)
print(sys.getrefcount(AllScene.theScene))
del AllScene.theScene
else:
AllScene.resetAll()
@ -886,7 +897,7 @@ class myLevelEditor(AppShell):
thefile=Filename(self.CurrentFileName)
thedir=thefile.getFullpathWoExtension()
print "SCENE EDITOR::" + thedir
print("SCENE EDITOR::" + thedir)
self.CurrentDirName=thedir
if self.CurrentFileName != None:
self.parent.title('Scene Editor - '+ Filename.fromOsSpecific(self.CurrentFileName).getBasenameWoExtension())
@ -934,7 +945,7 @@ class myLevelEditor(AppShell):
theScene.writeBamFile(fileName)
else:
render.writeBamFile(fileName+".bad")
print " Scenegraph saved as :" +str(fileName)
print(" Scenegraph saved as :" +str(fileName))
def loadFromBam(self):
fileName = tkFileDialog.askopenfilename(filetypes = [("BAM",".bam")],title = "Load Scenegraph from Bam file")
@ -959,7 +970,7 @@ class myLevelEditor(AppShell):
###############################################################################
# !!!!! See if a module exists by this name... if it does you cannot use this filename !!!!!
###############################################################################
if(sys.modules.has_key(fCheck.getBasenameWoExtension())):
if(fCheck.getBasenameWoExtension() in sys.modules):
tkMessageBox.showwarning(
"Save file",
"Cannot save with this name because there is a system module with the same name. Please resave as something else."
@ -993,7 +1004,7 @@ class myLevelEditor(AppShell):
if modelFilename:
self.makeDirty()
if not AllScene.loadModel(modelFilename, Filename.fromOsSpecific(modelFilename)):
print '----Error! No Such Model File!'
print('----Error! No Such Model File!')
pass
def loadActor(self):
@ -1016,12 +1027,12 @@ class myLevelEditor(AppShell):
if ActorFilename:
self.makeDirty()
if not AllScene.loadActor(ActorFilename, Filename.fromOsSpecific(ActorFilename)):
print '----Error! No Such Model File!'
print('----Error! No Such Model File!')
pass
def importScene(self):
self.makeDirty()
print '----God bless you Please Import!'
print('----God bless you Please Import!')
pass
@ -1495,7 +1506,7 @@ class myLevelEditor(AppShell):
return
def animPanelClose(self, name):
if self.animPanel.has_key(name):
if name in self.animPanel:
del self.animPanel[name]
return
@ -1508,8 +1519,8 @@ class myLevelEditor(AppShell):
################################################################
name = nodePath.getName()
if AllScene.isActor(name):
if self.animBlendPanel.has_key(name):
print '---- You already have an Blend Animation Panel for this Actor!'
if name in self.animBlendPanel:
print('---- You already have an Blend Animation Panel for this Actor!')
return
else:
Actor = AllScene.getActor(name)
@ -1554,7 +1565,7 @@ class myLevelEditor(AppShell):
# This function will be called when Blend panel has been closed.
# Here we will reset the reference dictionary so it can be open again.
################################################################
if self.animBlendPanel.has_key(name):
if name in self.animBlendPanel:
del self.animBlendPanel[name]
return
@ -1613,7 +1624,7 @@ class myLevelEditor(AppShell):
def openAlignPanel(self, nodePath=None):
name = nodePath.getName()
if not self.alignPanelDict.has_key(name):
if name not in self.alignPanelDict:
list = AllScene.getAllObjNameAsList()
if name in list:
list.remove(name)
@ -1623,7 +1634,7 @@ class myLevelEditor(AppShell):
return
def closeAlignPanel(self, name=None):
if self.alignPanelDict.has_key(name):
if name in self.alignPanelDict:
del self.alignPanelDict[name]
def alignObject(self, nodePath, name, list):
@ -1705,4 +1716,4 @@ class myLevelEditor(AppShell):
editor = myLevelEditor(parent = base.tkRoot)
run()
base.run()

View File

@ -5,12 +5,16 @@
# Import Tkinter, Pmw, and the floater code from this directory tree.
from direct.tkwidgets.AppShell import *
from direct.showbase.TkGlobal import *
from tkSimpleDialog import askfloat
import string
import math
import types
from direct.task import Task
if sys.version_info >= (3, 0):
from tkinter.simpledialog import askfloat
else:
from tkSimpleDialog import askfloat
FRAMES = 0
SECONDS = 1
@ -112,7 +116,7 @@ class AnimPanel(AppShell):
self.playRateEntry.selectitem('1.0')
### Loop checkbox
Label(actorFrame, text= "Loop:", font=('MSSansSerif', 12)).place(x=420,y=05,anchor=NW)
Label(actorFrame, text= "Loop:", font=('MSSansSerif', 12)).place(x=420,y=5,anchor=NW)
self.loopVar = IntVar()
self.loopVar.set(0)
@ -250,7 +254,7 @@ class AnimPanel(AppShell):
self['animList'] = self['actor'].getAnimNames()
animL = self['actor'].getAnimNames()
self.AnimEntry.setlist(animL)
print '-----',animL
print('-----',animL)
return
def loadAnimation(self):
@ -278,7 +282,7 @@ class AnimPanel(AppShell):
taskMgr.add(self.playTask, self.id + '_UpdateTask')
self.stopButton.config(state=NORMAL)
else:
print '----Illegal Animaion name!!', self.animName
print('----Illegal Animaion name!!', self.animName)
return
def playTask(self, task):
@ -591,7 +595,7 @@ class LoadAnimPanel(AppShell):
else:
self.animList.append(name)
self.AnimName_1.setlist(self.animList)
print self.animDic
print(self.animDic)
return
def ok_press(self):

View File

@ -5,12 +5,16 @@
# Import Tkinter, Pmw, and the floater code from this directory tree.
from direct.tkwidgets.AppShell import *
from direct.showbase.TkGlobal import *
from tkSimpleDialog import askfloat
import string
import math
import types
from direct.task import Task
if sys.version_info >= (3, 0):
from tkinter.simpledialog import askfloat
else:
from tkSimpleDialog import askfloat
FRAMES = 0
SECONDS = 1
@ -304,7 +308,7 @@ class BlendAnimPanel(AppShell):
taskMgr.add(self.playTask, self.id + '_UpdateTask')
self.stopButton.config(state=NORMAL)
else:
print '----Illegal Animaion name!!', self.animNameA + ', '+ self.animNameB
print('----Illegal Animaion name!!', self.animNameA + ', '+ self.animNameB)
return
def playTask(self, task):
@ -348,7 +352,7 @@ class BlendAnimPanel(AppShell):
# setAnimation(self, animation, AB = 'a')
# see play(self)
#################################################################
print 'OK!!!'
print('OK!!!')
if AB == 'a':
if self.animNameA != None:
self['actor'].setControlEffect(self.animNameA, 1.0, 'modelRoot','lodRoot')
@ -519,7 +523,7 @@ class BlendAnimPanel(AppShell):
# then this function will set Animation A to "a" and animation B
# to "b" and set the ratio slider to "c" position.
#################################################################
if self.blendDict.has_key(name):
if name in self.blendDict:
self.currentBlendName = name
animA = self.blendDict[name][0]
animB = self.blendDict[name][1]
@ -544,7 +548,7 @@ class BlendAnimPanel(AppShell):
self.blendDict.clear()
del self.blendDict
self.blendDict = dict.copy()
print self.blendDict
print(self.blendDict)
if len(self.blendDict)>0:
self.blendList = self.blendDict.keys()
else:

View File

@ -55,14 +55,14 @@ class DirectCameraControl(DirectObject):
['n', self.pickNextCOA],
['u', self.orbitUprightCam],
['shift-u', self.uprightCam],
[`1`, self.spawnMoveToView, 1],
[`2`, self.spawnMoveToView, 2],
[`3`, self.spawnMoveToView, 3],
[`4`, self.spawnMoveToView, 4],
[`5`, self.spawnMoveToView, 5],
[`6`, self.spawnMoveToView, 6],
[`7`, self.spawnMoveToView, 7],
[`8`, self.spawnMoveToView, 8],
['1', self.spawnMoveToView, 1],
['2', self.spawnMoveToView, 2],
['3', self.spawnMoveToView, 3],
['4', self.spawnMoveToView, 4],
['5', self.spawnMoveToView, 5],
['6', self.spawnMoveToView, 6],
['7', self.spawnMoveToView, 7],
['8', self.spawnMoveToView, 8],
['9', self.swingCamAboutWidget, -90.0, t],
['0', self.swingCamAboutWidget, 90.0, t],
['`', self.removeManipulateCameraTask],
@ -351,7 +351,7 @@ class DirectCameraControl(DirectObject):
# MRM: Would be nice to be able to control this
# At least display it
dist = pow(10.0, self.nullHitPointCount)
SEditor.message('COA Distance: ' + `dist`)
SEditor.message('COA Distance: ' + repr(dist))
coa.set(0,dist,0)
# Compute COA Dist
coaDist = Vec3(coa - ZERO_POINT).length()
@ -392,8 +392,7 @@ class DirectCameraControl(DirectObject):
sf = 0.1
self.coaMarker.setScale(sf)
# Lerp color to fade out
self.coaMarker.lerpColor(VBase4(1,0,0,1), VBase4(1,0,0,0), 3.0,
task = 'fadeAway')
self.coaMarker.colorInterval(3.0, VBase4(1, 0, 0, 0), name='fadeAway').start()
def homeCam(self):
# Record undo point

View File

@ -12,9 +12,15 @@
from direct.tkwidgets import Valuator
from direct.tkwidgets import Floater
from direct.tkwidgets import Slider
import string, Pmw, Tkinter, tkColorChooser
import sys, Pmw
from direct.tkwidgets.VectorWidgets import VectorEntry
if sys.version_info >= (3, 0):
from tkinter.colorchooser import askcolor
else:
from tkColorChooser import askcolor
class seColorEntry(VectorEntry):
def __init__(self, parent = None, **kw):
# Initialize options for the class (overriding some superclass options)
@ -41,7 +47,7 @@ class seColorEntry(VectorEntry):
def popupColorPicker(self):
# Can pass in current color with: color = (255, 0, 0)
color = tkColorChooser.askcolor(
color = askcolor(
parent = self.interior(),
# Initialize it to current color
initialcolor = tuple(self.get()[:3]))[0]

View File

@ -3,7 +3,7 @@
# This code saves the scene out as python code... the scene is stored in the various dictionaries in "dataHolder.py" ...the class "AllScene"
#
####################################################################################################################################################
from pandac.PandaModules import *
from panda3d.core import *
from direct.showbase.ShowBaseGlobal import *
import os
@ -42,7 +42,7 @@ class FileSaver:
i1=" " # indentation
i2=i1+i1 # double indentation
out_file = open(filename,"w")
print "dirname:" + dirname
print("dirname:" + dirname)
if( not os.path.isdir(dirname)):
os.mkdir(dirname)
savepathname=Filename(filename)
@ -176,7 +176,7 @@ class FileSaver:
newtexpathF=Filename(newtexpath)
newtexpathSpecific=newtexpathF.toOsSpecific()
print "TEXTURE SAVER:: copying" + oldtexpath + " to " + newtexpathSpecific
print("TEXTURE SAVER:: copying" + oldtexpath + " to " + newtexpathSpecific)
if(oldtexpath != newtexpathSpecific):
shutil.copyfile(oldtexpath,newtexpathSpecific)
@ -187,7 +187,7 @@ class FileSaver:
# Copy the file over to the relative directory
oldModelpath=AllScene.ModelRefDic[model].toOsSpecific()
print "FILESAVER:: copying from " + AllScene.ModelRefDic[model].toOsSpecific() + "to" + newpathSpecific
print("FILESAVER:: copying from " + AllScene.ModelRefDic[model].toOsSpecific() + "to" + newpathSpecific)
if(oldModelpath!=newpathSpecific):
shutil.copyfile(oldModelpath,newpathSpecific)
@ -197,7 +197,7 @@ class FileSaver:
etc=EggTextureCollection()
etc.extractTextures(e)
for index in range(len(fnamelist)):
print fnamelist[index]
print(fnamelist[index])
tex=etc.findFilename(Filename(fnamelist[index]))
fn=Filename(tex.getFilename())
fn.setDirname("")
@ -305,14 +305,14 @@ class FileSaver:
newtexpath=dirname + "/" + texfilename.getBasename()
newtexpathF=Filename(newtexpath)
newtexpathSpecific=newtexpathF.toOsSpecific()
print "TEXTURE SAVER:: copying" + oldtexpath + " to " + newtexpathSpecific
print("TEXTURE SAVER:: copying" + oldtexpath + " to " + newtexpathSpecific)
if(oldtexpath != newtexpathSpecific):
shutil.copyfile(oldtexpath,newtexpathSpecific)
# Copy the file over to the relative directory
oldActorpath=AllScene.ActorRefDic[actor].toOsSpecific()
print "FILESAVER:: copying from " + AllScene.ActorRefDic[actor].toOsSpecific() + "to" + newpathSpecific
print("FILESAVER:: copying from " + AllScene.ActorRefDic[actor].toOsSpecific() + "to" + newpathSpecific)
if(oldActorpath!=newpathSpecific):
shutil.copyfile(oldActorpath,newpathSpecific)
@ -322,7 +322,7 @@ class FileSaver:
etc=EggTextureCollection()
etc.extractTextures(e)
for index in range(len(actorfnamelist)):
print actorfnamelist[index]
print(actorfnamelist[index])
tex=etc.findFilename(Filename(actorfnamelist[index]))
fn=Filename(tex.getFilename())
fn.setDirname("")
@ -362,12 +362,12 @@ class FileSaver:
#out_file.write(i2+ "self."+ actorS + ".loadAnims(" + str(ActorAnimations) +")\n") # Old way with absolute paths
#Manakel 2/12/2004: solve the not empty but not defined animation case
if not animation is None:
print "ACTOR ANIMATIONS:" + ActorAnimations[animation]
print("ACTOR ANIMATIONS:" + ActorAnimations[animation])
oldAnimPath=Filename(ActorAnimations[animation])
oldAnim=oldAnimPath.toOsSpecific()
dirOS=Filename(dirname)
newAnim=dirOS.toOsSpecific() + "\\" + oldAnimPath.getBasename()
print "ACTOR ANIM SAVER:: Comparing" + oldAnim +"and" + newAnim
print("ACTOR ANIM SAVER:: Comparing" + oldAnim +"and" + newAnim)
if(oldAnim!=newAnim):
shutil.copyfile(oldAnim,newAnim)
newAnimF=Filename.fromOsSpecific(newAnim)
@ -379,16 +379,16 @@ class FileSaver:
out_file.write(i2+ i1+"self."+ actorS + ".loadAnims(" + str(ActorAnimations) +")\n") # Now with new relative paths
out_file.write(i2+"else:\n")
theloadAnimString=str(ActorAnimationsInvoke)# We hack the "self.executionpath" part into the dictionary as a variable using string replace
print "LOAD ANIM STRING BEFORE" + theloadAnimString
print("LOAD ANIM STRING BEFORE" + theloadAnimString)
theloadAnimString=theloadAnimString.replace('\'self.executionpath +','self.executionpath + \'')
print "LOAD ANIM STRING AFTER" + theloadAnimString
print("LOAD ANIM STRING AFTER" + theloadAnimString)
out_file.write(i2+ i1+"self."+ actorS + ".loadAnims(" + theloadAnimString +")\n") # Now with new relative paths based on editor invocation
out_file.write(i2+ "self.ActorDic[\'" + actorS + "\']=self." + AllScene.ActorDic[actor].getName()+"\n")
#out_file.write(i2+ "self.ActorRefDic[\'" + actorS + "\']=Filename(\'"+AllScene.ActorRefDic[actor].getFullpath() +"\')\n") # Old way with absolute paths
out_file.write(i2+ "self.ActorRefDic[\'" + actorS + "\']=\'"+ AllScene.ActorRefDic[actor].getBasename() +"\'\n")# Relative paths
out_file.write(i2+ "self.ActorDic[\'"+ actorS + "\'].setName(\'"+ actorS +"\')\n")
if(AllScene.blendAnimDict.has_key(actor)): # Check if a dictionary of blended animations exists
if(actor in AllScene.blendAnimDict): # Check if a dictionary of blended animations exists
out_file.write(i2+ "self.blendAnimDict[\"" + actorS +"\"]=" + str(AllScene.blendAnimDict[actor]) + "\n")
@ -458,7 +458,7 @@ class FileSaver:
pass
else:
print "Invalid Collision Node: " + nodetype
print("Invalid Collision Node: " + nodetype)
out_file.write("\n")
@ -653,7 +653,7 @@ class FileSaver:
if(parent=="render" or parent=="camera"):
out_file.write(i2+ "self."+ modelS + ".reparentTo(" + parent + ")\n")
else:
if(AllScene.particleDict.has_key(parent)):
if(parent in AllScene.particleDict):
out_file.write(i2+ "self."+ modelS + ".reparentTo(self." + parent + ".getEffect())\n")
else:
out_file.write(i2+ "self."+ modelS + ".reparentTo(self." + parent + ")\n")
@ -666,7 +666,7 @@ class FileSaver:
if(parent=="render" or parent=="camera"):
out_file.write(i2+ "self."+ dummyS + ".reparentTo(" + parent + ")\n")
else:
if(AllScene.particleDict.has_key(parent)):
if(parent in AllScene.particleDict):
out_file.write(i2+ "self."+ dummyS + ".reparentTo(self." + parent + ".getEffect())\n")
else:
out_file.write(i2+ "self."+ dummyS + ".reparentTo(self." + parent + ")\n")
@ -680,7 +680,7 @@ class FileSaver:
if(parent=="render" or parent=="camera"):
out_file.write(i2+ "self."+ actorS + ".reparentTo(" + parent + ")\n")
else:
if(AllScene.particleDict.has_key(parent)):
if(parent in AllScene.particleDict):
out_file.write(i2+ "self."+ actorS + ".reparentTo(self." + parent + ".getEffect())\n")
else:
out_file.write(i2+ "self."+ actorS + ".reparentTo(self." + parent + ")\n")
@ -698,7 +698,7 @@ class FileSaver:
out_file.write(i2+"self.collisionDict[\"" + collnodeS + "\"]="+ parentname + ".attachNewNode(self." + collnodeS + "_Node)\n")
else:
#Manakel 2/12/2005: parent replaced by parent Name but why Parent name in partice and parent for other objects?
if(AllScene.particleDict.has_key(parentname)):
if(parentname in AllScene.particleDict):
out_file.write(i2+"self.collisionDict[\"" + collnodeS + "\"]=self."+ parentname + "getEffect().attachNewNode(self." + collnodeS + "_Node)\n")
else:
out_file.write(i2+"self.collisionDict[\"" + collnodeS + "\"]=self."+ parentname + ".attachNewNode(self." + collnodeS + "_Node)\n")

View File

@ -1,8 +1,6 @@
from pandac.PandaModules import *
from panda3d.core import *
from direct.showbase.DirectObject import DirectObject
from direct.showbase.PhysicsManagerGlobal import *
#Manakel 2/12/2005: replace from pandac import by from pandac.PandaModules import
from pandac.PandaModules import ForceNode
from direct.directnotify import DirectNotifyGlobal
import sys

View File

@ -12,7 +12,7 @@
#
#################################################################
from pandac.PandaModules import *
from panda3d.core import *
from direct.directtools.DirectGlobals import *
from direct.directtools.DirectUtil import *
import math
@ -41,10 +41,10 @@ class LineNodePath(NodePath):
ls.setColor(colorVec)
def moveTo( self, *_args ):
apply( self.lineSegs.moveTo, _args )
self.lineSegs.moveTo(*_args)
def drawTo( self, *_args ):
apply( self.lineSegs.drawTo, _args )
self.lineSegs.drawTo(*_args)
def create( self, frameAccurate = 0 ):
self.lineSegs.create( self.lineNode, frameAccurate )
@ -60,13 +60,13 @@ class LineNodePath(NodePath):
self.lineSegs.setThickness( thickness )
def setColor( self, *_args ):
apply( self.lineSegs.setColor, _args )
self.lineSegs.setColor(*_args)
def setVertex( self, *_args):
apply( self.lineSegs.setVertex, _args )
self.lineSegs.setVertex(*_args)
def setVertexColor( self, vertex, *_args ):
apply( self.lineSegs.setVertexColor, (vertex,) + _args )
self.lineSegs.setVertexColor(*(vertex,) + _args)
def getCurrentPosition( self ):
return self.lineSegs.getCurrentPosition()
@ -132,9 +132,9 @@ class LineNodePath(NodePath):
Given a list of lists of points, draw a separate line for each list
"""
for pointList in lineList:
apply(self.moveTo, pointList[0])
self.moveTo(*pointList[0])
for point in pointList[1:]:
apply(self.drawTo, point)
self.drawTo(*point)
##
## Given a point in space, and a direction, find the point of intersection

View File

@ -3,9 +3,8 @@
# Written by Yi-Hong Lin, yihhongl@andrew.cmu.edu, 2004
#################################################################
from direct.showbase.DirectObject import *
from string import lower
from direct.directtools import DirectUtil
from pandac.PandaModules import *
from panda3d.core import *
import string
@ -341,7 +340,7 @@ class seLightManager(NodePath):
if type == 'ambient':
self.ambientCount += 1
if(name=='DEFAULT_NAME'):
light = AmbientLight('ambient_' + `self.ambientCount`)
light = AmbientLight('ambient_' + repr(self.ambientCount))
else:
light = AmbientLight(name)
@ -350,7 +349,7 @@ class seLightManager(NodePath):
elif type == 'directional':
self.directionalCount += 1
if(name=='DEFAULT_NAME'):
light = DirectionalLight('directional_' + `self.directionalCount`)
light = DirectionalLight('directional_' + repr(self.directionalCount))
else:
light = DirectionalLight(name)
@ -360,7 +359,7 @@ class seLightManager(NodePath):
elif type == 'point':
self.pointCount += 1
if(name=='DEFAULT_NAME'):
light = PointLight('point_' + `self.pointCount`)
light = PointLight('point_' + repr(self.pointCount))
else:
light = PointLight(name)
@ -371,7 +370,7 @@ class seLightManager(NodePath):
elif type == 'spot':
self.spotCount += 1
if(name=='DEFAULT_NAME'):
light = Spotlight('spot_' + `self.spotCount`)
light = Spotlight('spot_' + repr(self.spotCount))
else:
light = Spotlight(name)
@ -382,7 +381,7 @@ class seLightManager(NodePath):
light.setAttenuation(Vec3(constant, linear, quadratic))
light.setExponent(exponent)
else:
print 'Invalid light type'
print('Invalid light type')
return None
# Create the seLight objects and put the light object we just created into it.
@ -411,7 +410,7 @@ class seLightManager(NodePath):
# Attention!!
# only Spotlight obj nneds to be specified a lens node first. i.e. setLens() first!
#################################################################
type = lower(light.getType().getName())
type = light.getType().getName().lower()
specularColor = VBase4(1)
position = Point3(0,0,0)
@ -451,7 +450,7 @@ class seLightManager(NodePath):
quadratic = Attenuation.getZ()
exponent = light.getExponent()
else:
print 'Invalid light type'
print('Invalid light type')
return None
lightNode = seLight(light,self,type,
@ -508,7 +507,7 @@ class seLightManager(NodePath):
# isLight(self.name)
# Use a string as a index to check if there existing a light named "name"
#################################################################
return self.lightDict.has_key(name)
return name in self.lightDict
def rename(self,oName,nName):
#################################################################
@ -523,7 +522,7 @@ class seLightManager(NodePath):
del self.lightDict[oName]
return self.lightDict.keys(),lightNode
else:
print '----Light Mnager: No such Light!'
print('----Light Mnager: No such Light!')
def getLightNodeList(self):
#################################################################

View File

@ -520,7 +520,7 @@ class ObjectHandles(NodePath,DirectObject):
# To avoid recreating a vec every frame
self.hitPt = Vec3(0)
# Get a handle on the components
self.xHandles = self.find('**/X')
self.xHandles = self.find('**/ohScalingNode')
self.xPostGroup = self.xHandles.find('**/x-post-group')
self.xPostCollision = self.xHandles.find('**/x-post')
self.xRingGroup = self.xHandles.find('**/x-ring-group')

View File

@ -25,10 +25,17 @@ from direct.tkwidgets.Slider import Slider
from direct.tkwidgets.EntryScale import EntryScale
from direct.tkwidgets.VectorWidgets import Vector2Entry, Vector3Entry
from direct.tkwidgets.VectorWidgets import ColorEntry
from Tkinter import Button, Frame, Radiobutton, Checkbutton, Label
from Tkinter import StringVar, BooleanVar, Entry, Scale
import os, string, Tkinter, Pmw
import __builtin__
import os, string, sys, Pmw
if sys.version_info >= (3, 0):
from tkinter import Button, Frame, Radiobutton, Checkbutton, Label
from tkinter import StringVar, BooleanVar, Entry, Scale
import tkinter
else:
from Tkinter import Button, Frame, Radiobutton, Checkbutton, Label
from Tkinter import StringVar, BooleanVar, Entry, Scale
import Tkinter as tkinter
PRF_UTILITIES = [
'lambda: camera.lookAt(render)',
@ -123,7 +130,7 @@ class MopathRecorder(AppShell, DirectObject):
self.postPoints = []
self.pointSetDict = {}
self.pointSetCount = 0
self.pointSetName = self.name + '-ps-' + `self.pointSetCount`
self.pointSetName = self.name + '-ps-' + repr(self.pointSetCount)
# User callback to call before recording point
self.samplingMode = 'Continuous'
self.preRecordFunc = None
@ -233,7 +240,7 @@ class MopathRecorder(AppShell, DirectObject):
self.undoButton['state'] = 'normal'
else:
self.undoButton['state'] = 'disabled'
self.undoButton.pack(side = Tkinter.LEFT, expand = 0)
self.undoButton.pack(side = tkinter.LEFT, expand = 0)
self.bind(self.undoButton, 'Undo last operation')
self.redoButton = Button(self.menuFrame, text = 'Redo',
@ -242,19 +249,19 @@ class MopathRecorder(AppShell, DirectObject):
self.redoButton['state'] = 'normal'
else:
self.redoButton['state'] = 'disabled'
self.redoButton.pack(side = Tkinter.LEFT, expand = 0)
self.redoButton.pack(side = tkinter.LEFT, expand = 0)
self.bind(self.redoButton, 'Redo last operation')
# Record button
mainFrame = Frame(interior, relief = Tkinter.SUNKEN, borderwidth = 2)
mainFrame = Frame(interior, relief = tkinter.SUNKEN, borderwidth = 2)
frame = Frame(mainFrame)
# Active node path
# Button to select active node path
widget = self.createButton(frame, 'Recording', 'Node Path:',
'Select Active Mopath Node Path',
lambda s = self: SEditor.select(s.nodePath),
side = Tkinter.LEFT, expand = 0)
widget['relief'] = Tkinter.FLAT
side = tkinter.LEFT, expand = 0)
widget['relief'] = tkinter.FLAT
self.nodePathMenu = Pmw.ComboBox(
frame, entry_width = 20,
selectioncommand = self.selectNodePathNamed,
@ -264,7 +271,7 @@ class MopathRecorder(AppShell, DirectObject):
self.nodePathMenu.component('entryfield_entry'))
self.nodePathMenuBG = (
self.nodePathMenuEntry.configure('background')[3])
self.nodePathMenu.pack(side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
self.nodePathMenu.pack(side = tkinter.LEFT, fill = tkinter.X, expand = 1)
self.bind(self.nodePathMenu,
'Select active node path used for recording and playback')
# Recording type
@ -285,81 +292,81 @@ class MopathRecorder(AppShell, DirectObject):
'Recording', 'Extend',
('Next record session extends existing path'),
self.recordingType, 'Extend', expand = 0)
frame.pack(fill = Tkinter.X, expand = 1)
frame.pack(fill = tkinter.X, expand = 1)
frame = Frame(mainFrame)
widget = self.createCheckbutton(
frame, 'Recording', 'Record',
'On: path is being recorded', self.toggleRecord, 0,
side = Tkinter.LEFT, fill = Tkinter.BOTH, expand = 1)
widget.configure(foreground = 'Red', relief = Tkinter.RAISED, borderwidth = 2,
anchor = Tkinter.CENTER, width = 16)
side = tkinter.LEFT, fill = tkinter.BOTH, expand = 1)
widget.configure(foreground = 'Red', relief = tkinter.RAISED, borderwidth = 2,
anchor = tkinter.CENTER, width = 16)
widget = self.createButton(frame, 'Recording', 'Add Keyframe',
'Add Keyframe To Current Path',
self.addKeyframe,
side = Tkinter.LEFT, expand = 1)
side = tkinter.LEFT, expand = 1)
widget = self.createButton(frame, 'Recording', 'Bind Path to Node',
'Bind Motion Path to selected Object',
self.bindMotionPathToNode,
side = Tkinter.LEFT, expand = 1)
side = tkinter.LEFT, expand = 1)
frame.pack(fill = Tkinter.X, expand = 1)
frame.pack(fill = tkinter.X, expand = 1)
mainFrame.pack(expand = 1, fill = Tkinter.X, pady = 3)
mainFrame.pack(expand = 1, fill = tkinter.X, pady = 3)
# Playback controls
playbackFrame = Frame(interior, relief = Tkinter.SUNKEN,
playbackFrame = Frame(interior, relief = tkinter.SUNKEN,
borderwidth = 2)
Label(playbackFrame, text = 'PLAYBACK CONTROLS',
font=('MSSansSerif', 12, 'bold')).pack(fill = Tkinter.X)
font=('MSSansSerif', 12, 'bold')).pack(fill = tkinter.X)
# Main playback control slider
widget = self.createEntryScale(
playbackFrame, 'Playback', 'Time', 'Set current playback time',
resolution = 0.01, command = self.playbackGoTo, side = Tkinter.TOP)
widget.component('hull')['relief'] = Tkinter.RIDGE
resolution = 0.01, command = self.playbackGoTo, side = tkinter.TOP)
widget.component('hull')['relief'] = tkinter.RIDGE
# Kill playback task if drag slider
widget['preCallback'] = self.stopPlayback
# Jam duration entry into entry scale
self.createLabeledEntry(widget.labelFrame, 'Resample', 'Path Duration',
'Set total curve duration',
command = self.setPathDuration,
side = Tkinter.LEFT, expand = 0)
side = tkinter.LEFT, expand = 0)
# Start stop buttons
frame = Frame(playbackFrame)
widget = self.createButton(frame, 'Playback', '<<',
'Jump to start of playback',
self.jumpToStartOfPlayback,
side = Tkinter.LEFT, expand = 1)
side = tkinter.LEFT, expand = 1)
widget['font'] = (('MSSansSerif', 12, 'bold'))
widget = self.createCheckbutton(frame, 'Playback', 'Play',
'Start/Stop playback',
self.startStopPlayback, 0,
side = Tkinter.LEFT, fill = Tkinter.BOTH, expand = 1)
side = tkinter.LEFT, fill = tkinter.BOTH, expand = 1)
widget.configure(anchor = 'center', justify = 'center',
relief = Tkinter.RAISED, font = ('MSSansSerif', 12, 'bold'))
relief = tkinter.RAISED, font = ('MSSansSerif', 12, 'bold'))
widget = self.createButton(frame, 'Playback', '>>',
'Jump to end of playback',
self.jumpToEndOfPlayback,
side = Tkinter.LEFT, expand = 1)
side = tkinter.LEFT, expand = 1)
widget['font'] = (('MSSansSerif', 12, 'bold'))
self.createCheckbutton(frame, 'Playback', 'Loop',
'On: loop playback',
self.setLoopPlayback, self.loopPlayback,
side = Tkinter.LEFT, fill = Tkinter.BOTH, expand = 0)
frame.pack(fill = Tkinter.X, expand = 1)
side = tkinter.LEFT, fill = tkinter.BOTH, expand = 0)
frame.pack(fill = tkinter.X, expand = 1)
# Speed control
frame = Frame(playbackFrame)
widget = Button(frame, text = 'PB Speed Vernier', relief = Tkinter.FLAT,
widget = Button(frame, text = 'PB Speed Vernier', relief = tkinter.FLAT,
command = lambda s = self: s.setSpeedScale(1.0))
widget.pack(side = Tkinter.LEFT, expand = 0)
widget.pack(side = tkinter.LEFT, expand = 0)
self.speedScale = Scale(frame, from_ = -1, to = 1,
resolution = 0.01, showvalue = 0,
width = 10, orient = 'horizontal',
command = self.setPlaybackSF)
self.speedScale.pack(side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
self.speedScale.pack(side = tkinter.LEFT, fill = tkinter.X, expand = 1)
self.speedVar = StringVar()
self.speedVar.set("0.00")
self.speedEntry = Entry(frame, textvariable = self.speedVar,
@ -368,14 +375,14 @@ class MopathRecorder(AppShell, DirectObject):
'<Return>',
lambda e = None, s = self: s.setSpeedScale(
string.atof(s.speedVar.get())))
self.speedEntry.pack(side = Tkinter.LEFT, expand = 0)
frame.pack(fill = Tkinter.X, expand = 1)
self.speedEntry.pack(side = tkinter.LEFT, expand = 0)
frame.pack(fill = tkinter.X, expand = 1)
playbackFrame.pack(fill = Tkinter.X, pady = 2)
playbackFrame.pack(fill = tkinter.X, pady = 2)
# Create notebook pages
self.mainNotebook = Pmw.NoteBook(interior)
self.mainNotebook.pack(fill = Tkinter.BOTH, expand = 1)
self.mainNotebook.pack(fill = tkinter.BOTH, expand = 1)
self.resamplePage = self.mainNotebook.add('Resample')
self.refinePage = self.mainNotebook.add('Refine')
self.extendPage = self.mainNotebook.add('Extend')
@ -386,35 +393,35 @@ class MopathRecorder(AppShell, DirectObject):
## RESAMPLE PAGE
label = Label(self.resamplePage, text = 'RESAMPLE CURVE',
font=('MSSansSerif', 12, 'bold'))
label.pack(fill = Tkinter.X)
label.pack(fill = tkinter.X)
# Resample
resampleFrame = Frame(
self.resamplePage, relief = Tkinter.SUNKEN, borderwidth = 2)
self.resamplePage, relief = tkinter.SUNKEN, borderwidth = 2)
label = Label(resampleFrame, text = 'RESAMPLE CURVE',
font=('MSSansSerif', 12, 'bold')).pack()
widget = self.createSlider(
resampleFrame, 'Resample', 'Num. Samples',
'Number of samples in resampled curve',
resolution = 1, min = 2, max = 1000, command = self.setNumSamples)
widget.component('hull')['relief'] = Tkinter.RIDGE
widget.component('hull')['relief'] = tkinter.RIDGE
widget['postCallback'] = self.sampleCurve
frame = Frame(resampleFrame)
self.createButton(
frame, 'Resample', 'Make Even',
'Apply timewarp so resulting path has constant velocity',
self.makeEven, side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
self.makeEven, side = tkinter.LEFT, fill = tkinter.X, expand = 1)
self.createButton(
frame, 'Resample', 'Face Forward',
'Compute HPR so resulting hpr curve faces along xyz tangent',
self.faceForward, side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
frame.pack(fill = Tkinter.X, expand = 0)
resampleFrame.pack(fill = Tkinter.X, expand = 0, pady = 2)
self.faceForward, side = tkinter.LEFT, fill = tkinter.X, expand = 1)
frame.pack(fill = tkinter.X, expand = 0)
resampleFrame.pack(fill = tkinter.X, expand = 0, pady = 2)
# Desample
desampleFrame = Frame(
self.resamplePage, relief = Tkinter.SUNKEN, borderwidth = 2)
self.resamplePage, relief = tkinter.SUNKEN, borderwidth = 2)
Label(desampleFrame, text = 'DESAMPLE CURVE',
font=('MSSansSerif', 12, 'bold')).pack()
widget = self.createSlider(
@ -422,16 +429,16 @@ class MopathRecorder(AppShell, DirectObject):
'Specify number of points to skip between samples',
min = 1, max = 100, resolution = 1,
command = self.setDesampleFrequency)
widget.component('hull')['relief'] = Tkinter.RIDGE
widget.component('hull')['relief'] = tkinter.RIDGE
widget['postCallback'] = self.desampleCurve
desampleFrame.pack(fill = Tkinter.X, expand = 0, pady = 2)
desampleFrame.pack(fill = tkinter.X, expand = 0, pady = 2)
## REFINE PAGE ##
refineFrame = Frame(self.refinePage, relief = Tkinter.SUNKEN,
refineFrame = Frame(self.refinePage, relief = tkinter.SUNKEN,
borderwidth = 2)
label = Label(refineFrame, text = 'REFINE CURVE',
font=('MSSansSerif', 12, 'bold'))
label.pack(fill = Tkinter.X)
label.pack(fill = tkinter.X)
widget = self.createSlider(refineFrame,
'Refine Page', 'Refine From',
@ -460,14 +467,14 @@ class MopathRecorder(AppShell, DirectObject):
command = self.setRefineStop)
widget['preCallback'] = self.setRefineMode
widget['postCallback'] = self.getPostPoints
refineFrame.pack(fill = Tkinter.X)
refineFrame.pack(fill = tkinter.X)
## EXTEND PAGE ##
extendFrame = Frame(self.extendPage, relief = Tkinter.SUNKEN,
extendFrame = Frame(self.extendPage, relief = tkinter.SUNKEN,
borderwidth = 2)
label = Label(extendFrame, text = 'EXTEND CURVE',
font=('MSSansSerif', 12, 'bold'))
label.pack(fill = Tkinter.X)
label.pack(fill = tkinter.X)
widget = self.createSlider(extendFrame,
'Extend Page', 'Extend From',
@ -483,14 +490,14 @@ class MopathRecorder(AppShell, DirectObject):
resolution = 0.01,
command = self.setControlStart)
widget['preCallback'] = self.setExtendMode
extendFrame.pack(fill = Tkinter.X)
extendFrame.pack(fill = tkinter.X)
## CROP PAGE ##
cropFrame = Frame(self.cropPage, relief = Tkinter.SUNKEN,
cropFrame = Frame(self.cropPage, relief = tkinter.SUNKEN,
borderwidth = 2)
label = Label(cropFrame, text = 'CROP CURVE',
font=('MSSansSerif', 12, 'bold'))
label.pack(fill = Tkinter.X)
label.pack(fill = tkinter.X)
widget = self.createSlider(
cropFrame,
@ -508,11 +515,11 @@ class MopathRecorder(AppShell, DirectObject):
self.createButton(cropFrame, 'Crop Page', 'Crop Curve',
'Crop curve to specified from to times',
self.cropCurve, fill = Tkinter.NONE)
cropFrame.pack(fill = Tkinter.X)
self.cropCurve, fill = tkinter.NONE)
cropFrame.pack(fill = tkinter.X)
## DRAW PAGE ##
drawFrame = Frame(self.drawPage, relief = Tkinter.SUNKEN,
drawFrame = Frame(self.drawPage, relief = tkinter.SUNKEN,
borderwidth = 2)
self.sf = Pmw.ScrolledFrame(self.drawPage, horizflex = 'elastic')
@ -521,57 +528,57 @@ class MopathRecorder(AppShell, DirectObject):
label = Label(sfFrame, text = 'CURVE RENDERING STYLE',
font=('MSSansSerif', 12, 'bold'))
label.pack(fill = Tkinter.X)
label.pack(fill = tkinter.X)
frame = Frame(sfFrame)
Label(frame, text = 'SHOW:').pack(side = Tkinter.LEFT, expand = 0)
Label(frame, text = 'SHOW:').pack(side = tkinter.LEFT, expand = 0)
widget = self.createCheckbutton(
frame, 'Style', 'Path',
'On: path is visible', self.setPathVis, 1,
side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
side = tkinter.LEFT, fill = tkinter.X, expand = 1)
widget = self.createCheckbutton(
frame, 'Style', 'Knots',
'On: path knots are visible', self.setKnotVis, 1,
side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
side = tkinter.LEFT, fill = tkinter.X, expand = 1)
widget = self.createCheckbutton(
frame, 'Style', 'CVs',
'On: path CVs are visible', self.setCvVis, 0,
side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
side = tkinter.LEFT, fill = tkinter.X, expand = 1)
widget = self.createCheckbutton(
frame, 'Style', 'Hull',
'On: path hull is visible', self.setHullVis, 0,
side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
side = tkinter.LEFT, fill = tkinter.X, expand = 1)
widget = self.createCheckbutton(
frame, 'Style', 'Trace',
'On: record is visible', self.setTraceVis, 0,
side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
side = tkinter.LEFT, fill = tkinter.X, expand = 1)
widget = self.createCheckbutton(
frame, 'Style', 'Marker',
'On: playback marker is visible', self.setMarkerVis, 0,
side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
frame.pack(fill = Tkinter.X, expand = 1)
side = tkinter.LEFT, fill = tkinter.X, expand = 1)
frame.pack(fill = tkinter.X, expand = 1)
# Sliders
widget = self.createSlider(
sfFrame, 'Style', 'Num Segs',
'Set number of segments used to approximate each parametric unit',
min = 1.0, max = 400, resolution = 1.0,
value = 40,
command = self.setNumSegs, side = Tkinter.TOP)
widget.component('hull')['relief'] = Tkinter.RIDGE
command = self.setNumSegs, side = tkinter.TOP)
widget.component('hull')['relief'] = tkinter.RIDGE
widget = self.createSlider(
sfFrame, 'Style', 'Num Ticks',
'Set number of tick marks drawn for each unit of time',
min = 0.0, max = 10.0, resolution = 1.0,
value = 0.0,
command = self.setNumTicks, side = Tkinter.TOP)
widget.component('hull')['relief'] = Tkinter.RIDGE
command = self.setNumTicks, side = tkinter.TOP)
widget.component('hull')['relief'] = tkinter.RIDGE
widget = self.createSlider(
sfFrame, 'Style', 'Tick Scale',
'Set visible size of time tick marks',
min = 0.01, max = 100.0, resolution = 0.01,
value = 5.0,
command = self.setTickScale, side = Tkinter.TOP)
widget.component('hull')['relief'] = Tkinter.RIDGE
command = self.setTickScale, side = tkinter.TOP)
widget.component('hull')['relief'] = tkinter.RIDGE
self.createColorEntry(
sfFrame, 'Style', 'Path Color',
'Color of curve',
@ -598,14 +605,14 @@ class MopathRecorder(AppShell, DirectObject):
command = self.setHullColor,
value = [255.0,128.0,128.0,255.0])
#drawFrame.pack(fill = Tkinter.X)
#drawFrame.pack(fill = tkinter.X)
## OPTIONS PAGE ##
optionsFrame = Frame(self.optionsPage, relief = Tkinter.SUNKEN,
optionsFrame = Frame(self.optionsPage, relief = tkinter.SUNKEN,
borderwidth = 2)
label = Label(optionsFrame, text = 'RECORDING OPTIONS',
font=('MSSansSerif', 12, 'bold'))
label.pack(fill = Tkinter.X)
label.pack(fill = tkinter.X)
# Hooks
frame = Frame(optionsFrame)
widget = self.createLabeledEntry(
@ -614,7 +621,7 @@ class MopathRecorder(AppShell, DirectObject):
value = self.startStopHook,
command = self.setStartStopHook)[0]
label = self.getWidget('Recording', 'Record Hook-Label')
label.configure(width = 16, anchor = Tkinter.W)
label.configure(width = 16, anchor = tkinter.W)
self.setStartStopHook()
widget = self.createLabeledEntry(
frame, 'Recording', 'Keyframe Hook',
@ -622,9 +629,9 @@ class MopathRecorder(AppShell, DirectObject):
value = self.keyframeHook,
command = self.setKeyframeHook)[0]
label = self.getWidget('Recording', 'Keyframe Hook-Label')
label.configure(width = 16, anchor = Tkinter.W)
label.configure(width = 16, anchor = tkinter.W)
self.setKeyframeHook()
frame.pack(expand = 1, fill = Tkinter.X)
frame.pack(expand = 1, fill = tkinter.X)
# PreRecordFunc
frame = Frame(optionsFrame)
widget = self.createComboBox(
@ -632,17 +639,17 @@ class MopathRecorder(AppShell, DirectObject):
'Function called before sampling each point',
PRF_UTILITIES, self.setPreRecordFunc,
history = 1, expand = 1)
widget.configure(label_width = 16, label_anchor = Tkinter.W)
widget.configure(label_width = 16, label_anchor = tkinter.W)
widget.configure(entryfield_entry_state = 'normal')
# Initialize preRecordFunc
self.preRecordFunc = eval(PRF_UTILITIES[0])
self.createCheckbutton(frame, 'Recording', 'PRF Active',
'On: Pre Record Func enabled',
None, 0,
side = Tkinter.LEFT, fill = Tkinter.BOTH, expand = 0)
frame.pack(expand = 1, fill = Tkinter.X)
side = tkinter.LEFT, fill = tkinter.BOTH, expand = 0)
frame.pack(expand = 1, fill = tkinter.X)
# Pack record frame
optionsFrame.pack(fill = Tkinter.X, pady = 2)
optionsFrame.pack(fill = tkinter.X, pady = 2)
self.mainNotebook.setnaturalsize()
@ -682,16 +689,16 @@ class MopathRecorder(AppShell, DirectObject):
marker if subnode selected
"""
taskMgr.remove(self.name + '-curveEditTask')
print nodePath.id()
if nodePath.id() in self.playbackMarkerIds:
print(nodePath.get_key())
if nodePath.get_key() in self.playbackMarkerIds:
SEditor.select(self.playbackMarker)
elif nodePath.id() in self.tangentMarkerIds:
elif nodePath.get_key() in self.tangentMarkerIds:
SEditor.select(self.tangentMarker)
elif nodePath.id() == self.playbackMarker.id():
elif nodePath.get_key() == self.playbackMarker.get_key():
self.tangentGroup.show()
taskMgr.add(self.curveEditTask,
self.name + '-curveEditTask')
elif nodePath.id() == self.tangentMarker.id():
elif nodePath.get_key() == self.tangentMarker.get_key():
self.tangentGroup.show()
taskMgr.add(self.curveEditTask,
self.name + '-curveEditTask')
@ -699,7 +706,7 @@ class MopathRecorder(AppShell, DirectObject):
self.tangentGroup.hide()
def getChildIds(self, nodePath):
ids = [nodePath.id()]
ids = [nodePath.get_key()]
kids = nodePath.getChildren()
for kid in kids:
ids += self.getChildIds(kid)
@ -710,14 +717,14 @@ class MopathRecorder(AppShell, DirectObject):
Hook called upon deselection of a node path used to select playback
marker if subnode selected
"""
if ((nodePath.id() == self.playbackMarker.id()) or
(nodePath.id() == self.tangentMarker.id())):
if ((nodePath.get_key() == self.playbackMarker.get_key()) or
(nodePath.get_key() == self.tangentMarker.get_key())):
self.tangentGroup.hide()
def curveEditTask(self,state):
if self.curveCollection != None:
# Update curve position
if self.manipulandumId == self.playbackMarker.id():
if self.manipulandumId == self.playbackMarker.get_key():
# Show playback marker
self.playbackMarker.getChild(0).show()
pos = Point3(0)
@ -731,7 +738,7 @@ class MopathRecorder(AppShell, DirectObject):
# Note: this calls recompute on the curves
self.nurbsCurveDrawer.draw()
# Update tangent
if self.manipulandumId == self.tangentMarker.id():
if self.manipulandumId == self.tangentMarker.get_key():
# If manipulating marker, update tangent
# Hide playback marker
self.playbackMarker.getChild(0).hide()
@ -766,10 +773,10 @@ class MopathRecorder(AppShell, DirectObject):
def manipulateObjectStartHook(self):
self.manipulandumId = None
if SEditor.selected.last:
if SEditor.selected.last.id() == self.playbackMarker.id():
self.manipulandumId = self.playbackMarker.id()
elif SEditor.selected.last.id() == self.tangentMarker.id():
self.manipulandumId = self.tangentMarker.id()
if SEditor.selected.last.get_key() == self.playbackMarker.get_key():
self.manipulandumId = self.playbackMarker.get_key()
elif SEditor.selected.last.get_key() == self.tangentMarker.get_key():
self.manipulandumId = self.tangentMarker.get_key()
def manipulateObjectCleanupHook(self):
# Clear flag
@ -799,7 +806,7 @@ class MopathRecorder(AppShell, DirectObject):
def createNewPointSet(self, curveName = None):
if curveName == None:
self.pointSetName = self.name + '-ps-' + `self.pointSetCount`
self.pointSetName = self.name + '-ps-' + repr(self.pointSetCount)
else:
self.pointSetName = curveName
# Update dictionary and record pointer to new point set
@ -1137,7 +1144,7 @@ class MopathRecorder(AppShell, DirectObject):
def computeCurves(self):
# Check to make sure curve fitters have points
if (self.curveFitter.getNumSamples() == 0):
print 'MopathRecorder.computeCurves: Must define curve first'
print('MopathRecorder.computeCurves: Must define curve first')
return
# Create curves
# XYZ
@ -1282,8 +1289,8 @@ class MopathRecorder(AppShell, DirectObject):
dictName = name
else:
# Generate a unique name for the dict
dictName = name # + '-' + `nodePath.id()`
if not dict.has_key(dictName):
dictName = name # + '-' + repr(nodePath.get_key())
if dictName not in dict:
# Update combo box to include new item
names.append(dictName)
listbox = menu.component('scrolledlist')
@ -1386,7 +1393,7 @@ class MopathRecorder(AppShell, DirectObject):
def desampleCurve(self):
if (self.curveFitter.getNumSamples() == 0):
print 'MopathRecorder.desampleCurve: Must define curve first'
print('MopathRecorder.desampleCurve: Must define curve first')
return
# NOTE: This is destructive, points will be deleted from curve fitter
self.curveFitter.desample(self.desampleFrequency)
@ -1400,7 +1407,7 @@ class MopathRecorder(AppShell, DirectObject):
def sampleCurve(self, fCompute = 1, curveName = None):
if self.curveCollection == None:
print 'MopathRecorder.sampleCurve: Must define curve first'
print('MopathRecorder.sampleCurve: Must define curve first')
return
# Reset curve fitters
self.curveFitter.reset()
@ -1617,7 +1624,7 @@ class MopathRecorder(AppShell, DirectObject):
def cropCurve(self):
if self.pointSet == None:
print 'Empty Point Set'
print('Empty Point Set')
return
# Keep handle on old points
oldPoints = self.pointSet
@ -1653,15 +1660,15 @@ class MopathRecorder(AppShell, DirectObject):
# Use first directory in model path
mPath = getModelPath()
if mPath.getNumDirectories() > 0:
if `mPath.getDirectory(0)` == '.':
if repr(mPath.getDirectory(0)) == '.':
path = '.'
else:
path = mPath.getDirectory(0).toOsSpecific()
else:
path = '.'
if not os.path.isdir(path):
print 'MopathRecorder Info: Empty Model Path!'
print 'Using current directory'
print('MopathRecorder Info: Empty Model Path!')
print('Using current directory')
path = '.'
mopathFilename = askopenfilename(
defaultextension = '.egg',
@ -1692,15 +1699,15 @@ class MopathRecorder(AppShell, DirectObject):
# Use first directory in model path
mPath = getModelPath()
if mPath.getNumDirectories() > 0:
if `mPath.getDirectory(0)` == '.':
if repr(mPath.getDirectory(0)) == '.':
path = '.'
else:
path = mPath.getDirectory(0).toOsSpecific()
else:
path = '.'
if not os.path.isdir(path):
print 'MopathRecorder Info: Empty Model Path!'
print 'Using current directory'
print('MopathRecorder Info: Empty Model Path!')
print('Using current directory')
path = '.'
mopathFilename = asksaveasfilename(
defaultextension = '.egg',
@ -1734,28 +1741,28 @@ class MopathRecorder(AppShell, DirectObject):
def createLabeledEntry(self, parent, category, text, balloonHelp,
value = '', command = None,
relief = 'sunken', side = Tkinter.LEFT,
relief = 'sunken', side = tkinter.LEFT,
expand = 1, width = 12):
frame = Frame(parent)
variable = StringVar()
variable.set(value)
label = Label(frame, text = text)
label.pack(side = Tkinter.LEFT, fill = Tkinter.X)
label.pack(side = tkinter.LEFT, fill = tkinter.X)
self.bind(label, balloonHelp)
self.widgetDict[category + '-' + text + '-Label'] = label
entry = Entry(frame, width = width, relief = relief,
textvariable = variable)
entry.pack(side = Tkinter.LEFT, fill = Tkinter.X, expand = expand)
entry.pack(side = tkinter.LEFT, fill = tkinter.X, expand = expand)
self.bind(entry, balloonHelp)
self.widgetDict[category + '-' + text] = entry
self.variableDict[category + '-' + text] = variable
if command:
entry.bind('<Return>', command)
frame.pack(side = side, fill = Tkinter.X, expand = expand)
frame.pack(side = side, fill = tkinter.X, expand = expand)
return (frame, label, entry)
def createButton(self, parent, category, text, balloonHelp, command,
side = 'top', expand = 0, fill = Tkinter.X):
side = 'top', expand = 0, fill = tkinter.X):
widget = Button(parent, text = text)
# Do this after the widget so command isn't called on creation
widget['command'] = command
@ -1766,10 +1773,10 @@ class MopathRecorder(AppShell, DirectObject):
def createCheckbutton(self, parent, category, text,
balloonHelp, command, initialState,
side = 'top', fill = Tkinter.X, expand = 0):
side = 'top', fill = tkinter.X, expand = 0):
bool = BooleanVar()
bool.set(initialState)
widget = Checkbutton(parent, text = text, anchor = Tkinter.W,
widget = Checkbutton(parent, text = text, anchor = tkinter.W,
variable = bool)
# Do this after the widget so command isn't called on creation
widget['command'] = command
@ -1781,8 +1788,8 @@ class MopathRecorder(AppShell, DirectObject):
def createRadiobutton(self, parent, side, category, text,
balloonHelp, variable, value,
command = None, fill = Tkinter.X, expand = 0):
widget = Radiobutton(parent, text = text, anchor = Tkinter.W,
command = None, fill = tkinter.X, expand = 0):
widget = Radiobutton(parent, text = text, anchor = tkinter.W,
variable = variable, value = value)
# Do this after the widget so command isn't called on creation
widget['command'] = command
@ -1798,10 +1805,10 @@ class MopathRecorder(AppShell, DirectObject):
kw['min'] = min
kw['maxVelocity'] = maxVelocity
kw['resolution'] = resolution
widget = apply(Floater, (parent,), kw)
widget = Floater(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = Tkinter.X)
widget.pack(fill = tkinter.X)
self.bind(widget, balloonHelp)
self.widgetDict[category + '-' + text] = widget
return widget
@ -1809,10 +1816,10 @@ class MopathRecorder(AppShell, DirectObject):
def createAngleDial(self, parent, category, text, balloonHelp,
command = None, **kw):
kw['text'] = text
widget = apply(AngleDial,(parent,), kw)
widget = AngleDial(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = Tkinter.X)
widget.pack(fill = tkinter.X)
self.bind(widget, balloonHelp)
self.widgetDict[category + '-' + text] = widget
return widget
@ -1820,13 +1827,13 @@ class MopathRecorder(AppShell, DirectObject):
def createSlider(self, parent, category, text, balloonHelp,
command = None, min = 0.0, max = 1.0,
resolution = None,
side = Tkinter.TOP, fill = Tkinter.X, expand = 1, **kw):
side = tkinter.TOP, fill = tkinter.X, expand = 1, **kw):
kw['text'] = text
kw['min'] = min
kw['max'] = max
kw['resolution'] = resolution
#widget = apply(EntryScale, (parent,), kw)
widget = apply(Slider, (parent,), kw)
widget = Slider(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(side = side, fill = fill, expand = expand)
@ -1837,12 +1844,12 @@ class MopathRecorder(AppShell, DirectObject):
def createEntryScale(self, parent, category, text, balloonHelp,
command = None, min = 0.0, max = 1.0,
resolution = None,
side = Tkinter.TOP, fill = Tkinter.X, expand = 1, **kw):
side = tkinter.TOP, fill = tkinter.X, expand = 1, **kw):
kw['text'] = text
kw['min'] = min
kw['max'] = max
kw['resolution'] = resolution
widget = apply(EntryScale, (parent,), kw)
widget = EntryScale(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(side = side, fill = fill, expand = expand)
@ -1854,10 +1861,10 @@ class MopathRecorder(AppShell, DirectObject):
command = None, **kw):
# Set label's text
kw['text'] = text
widget = apply(Vector2Entry, (parent,), kw)
widget = Vector2Entry(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = Tkinter.X)
widget.pack(fill = tkinter.X)
self.bind(widget, balloonHelp)
self.widgetDict[category + '-' + text] = widget
return widget
@ -1866,10 +1873,10 @@ class MopathRecorder(AppShell, DirectObject):
command = None, **kw):
# Set label's text
kw['text'] = text
widget = apply(Vector3Entry, (parent,), kw)
widget = Vector3Entry(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = Tkinter.X)
widget.pack(fill = tkinter.X)
self.bind(widget, balloonHelp)
self.widgetDict[category + '-' + text] = widget
return widget
@ -1878,10 +1885,10 @@ class MopathRecorder(AppShell, DirectObject):
command = None, **kw):
# Set label's text
kw['text'] = text
widget = apply(ColorEntry, (parent,) ,kw)
widget = ColorEntry(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = Tkinter.X)
widget.pack(fill = tkinter.X)
self.bind(widget, balloonHelp)
self.widgetDict[category + '-' + text] = widget
return widget
@ -1891,13 +1898,13 @@ class MopathRecorder(AppShell, DirectObject):
optionVar = StringVar()
if len(items) > 0:
optionVar.set(items[0])
widget = Pmw.OptionMenu(parent, labelpos = Tkinter.W, label_text = text,
widget = Pmw.OptionMenu(parent, labelpos = tkinter.W, label_text = text,
label_width = 12, menu_tearoff = 1,
menubutton_textvariable = optionVar,
items = items)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = Tkinter.X)
widget.pack(fill = tkinter.X)
self.bind(widget.component('menubutton'), balloonHelp)
self.widgetDict[category + '-' + text] = widget
self.variableDict[category + '-' + text] = optionVar
@ -1905,9 +1912,9 @@ class MopathRecorder(AppShell, DirectObject):
def createComboBox(self, parent, category, text, balloonHelp,
items, command, history = 0,
side = Tkinter.LEFT, expand = 0, fill = Tkinter.X):
side = tkinter.LEFT, expand = 0, fill = tkinter.X):
widget = Pmw.ComboBox(parent,
labelpos = Tkinter.W,
labelpos = tkinter.W,
label_text = text,
label_anchor = 'e',
label_width = 12,
@ -1959,14 +1966,14 @@ class MopathRecorder(AppShell, DirectObject):
def bindMotionPathToNode(self):
if self.curveCollection == None:
print '----Error: you need to select or create a curve first!'
print('----Error: you need to select or create a curve first!')
return
self.accept('MP_checkName', self.bindMotionPath)
self.askName = namePathPanel(MopathRecorder.count)
return
def bindMotionPath(self,name=None,test=None):
print test
print(test)
self.ignore('MP_checkName')
del self.askName
self.curveCollection.getCurve(0).setName(name)
@ -1993,7 +2000,7 @@ class MopathRecorder(AppShell, DirectObject):
If the list is not None, it will put the vurve back into the curve list.
else, do nothing.
'''
print curveList
print(curveList)
self.ignore('curveListFor'+self.name)
if curveList != None:
for collection in curveList:
@ -2037,8 +2044,8 @@ class namePathPanel(AppShell):
dataFrame = Frame(mainFrame)
label = Label(dataFrame, text='This name will be used as a reference for this Path.',font=('MSSansSerif', 10))
label.pack(side = Tkinter.TOP, expand = 0, fill = Tkinter.X)
dataFrame.pack(side = Tkinter.TOP, expand = 0, fill = Tkinter.X, padx=5, pady=10)
label.pack(side = tkinter.TOP, expand = 0, fill = tkinter.X)
dataFrame.pack(side = tkinter.TOP, expand = 0, fill = tkinter.X, padx=5, pady=10)
dataFrame = Frame(mainFrame)
self.inputZone = Pmw.EntryField(dataFrame, labelpos='w', label_text = 'Name Selected Path: ',
@ -2046,14 +2053,14 @@ class namePathPanel(AppShell):
label_font=('MSSansSerif', 10),
validate = None,
entry_width = 20)
self.inputZone.pack(side = Tkinter.LEFT, fill=Tkinter.X,expand=0)
self.inputZone.pack(side = tkinter.LEFT, fill=tkinter.X,expand=0)
self.button_ok = Button(dataFrame, text="OK", command=self.ok_press,width=10)
self.button_ok.pack(fill=Tkinter.X,expand=0,side=Tkinter.LEFT, padx = 3)
self.button_ok.pack(fill=tkinter.X,expand=0,side=tkinter.LEFT, padx = 3)
dataFrame.pack(side = Tkinter.TOP, expand = 0, fill = Tkinter.X, padx=10, pady=10)
dataFrame.pack(side = tkinter.TOP, expand = 0, fill = tkinter.X, padx=10, pady=10)
mainFrame.pack(expand = 1, fill = Tkinter.BOTH)
mainFrame.pack(expand = 1, fill = tkinter.BOTH)

View File

@ -1,4 +1,4 @@
from pandac.PandaModules import *
from panda3d.core import *
import seParticles
import seForceGroup
from direct.directnotify import DirectNotifyGlobal
@ -209,9 +209,9 @@ class ParticleEffect(NodePath):
"""loadConfig(filename)"""
#try:
# if vfs:
print vfs.readFile(filename)
exec vfs.readFile(filename)
print "Particle Effect Reading using VFS"
print(vfs.readFile(filename))
exec(vfs.readFile(filename))
print("Particle Effect Reading using VFS")
# else:
# execfile(filename.toOsSpecific())
# print "Shouldnt be wrong"

View File

@ -2,9 +2,7 @@
# Import Tkinter, Pmw, and the floater code from this directory tree.
from direct.tkwidgets.AppShell import AppShell
from tkFileDialog import *
from tkSimpleDialog import askstring
import os, Pmw, Tkinter
import os, Pmw, sys
from direct.tkwidgets.Dial import AngleDial
from direct.tkwidgets.Floater import Floater
from direct.tkwidgets.Slider import Slider
@ -15,6 +13,15 @@ import seForceGroup
import seParticles
import seParticleEffect
if sys.version_info >= (3, 0):
from tkinter.filedialog import *
from tkinter.simpledialog import askstring
else:
from tkFileDialog import *
from tkSimpleDialog import askstring
class ParticlePanel(AppShell):
# Override class variables
appname = 'Particle Panel'
@ -774,7 +781,7 @@ class ParticlePanel(AppShell):
kw['min'] = min
kw['resolution'] = resolution
kw['numDigits'] = numDigits
widget = apply(Floater, (parent,), kw)
widget = Floater(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = X)
@ -786,7 +793,7 @@ class ParticlePanel(AppShell):
command = None, **kw):
kw['text'] = text
kw['style'] = 'mini'
widget = apply(AngleDial,(parent,), kw)
widget = AngleDial(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = X)
@ -801,7 +808,7 @@ class ParticlePanel(AppShell):
kw['min'] = min
kw['max'] = max
kw['resolution'] = resolution
widget = apply(Slider, (parent,), kw)
widget = Slider(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = X)
@ -813,7 +820,7 @@ class ParticlePanel(AppShell):
command = None, **kw):
# Set label's text
kw['text'] = text
widget = apply(Vector2Entry, (parent,), kw)
widget = Vector2Entry(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = X)
@ -825,7 +832,7 @@ class ParticlePanel(AppShell):
command = None, **kw):
# Set label's text
kw['text'] = text
widget = apply(Vector3Entry, (parent,), kw)
widget = Vector3Entry(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = X)
@ -837,7 +844,7 @@ class ParticlePanel(AppShell):
command = None, **kw):
# Set label's text
kw['text'] = text
widget = apply(ColorEntry, (parent,) ,kw)
widget = ColorEntry(parent, **kw)
# Do this after the widget so command isn't called on creation
widget['command'] = command
widget.pack(fill = X)
@ -992,7 +999,7 @@ class ParticlePanel(AppShell):
self.mainNotebook.selectpage('System')
self.updateInfo('System')
else:
print 'ParticlePanel: No effect named ' + name
print('ParticlePanel: No effect named ' + name)
def toggleEffect(self, effect, var):
if var.get():
@ -1041,15 +1048,15 @@ class ParticlePanel(AppShell):
# Find path to particle directory
pPath = getParticlePath()
if pPath.getNumDirectories() > 0:
if `pPath.getDirectory(0)` == '.':
if repr(pPath.getDirectory(0)) == '.':
path = '.'
else:
path = pPath.getDirectory(0).toOsSpecific()
else:
path = '.'
if not os.path.isdir(path):
print 'ParticlePanel Warning: Invalid default DNA directory!'
print 'Using current directory'
print('ParticlePanel Warning: Invalid default DNA directory!')
print('Using current directory')
path = '.'
particleFilename = askopenfilename(
defaultextension = '.ptf',
@ -1070,15 +1077,15 @@ class ParticlePanel(AppShell):
# Find path to particle directory
pPath = getParticlePath()
if pPath.getNumDirectories() > 0:
if `pPath.getDirectory(0)` == '.':
if repr(pPath.getDirectory(0)) == '.':
path = '.'
else:
path = pPath.getDirectory(0).toOsSpecific()
else:
path = '.'
if not os.path.isdir(path):
print 'ParticlePanel Warning: Invalid default DNA directory!'
print 'Using current directory'
print('ParticlePanel Warning: Invalid default DNA directory!')
print('Using current directory')
path = '.'
particleFilename = asksaveasfilename(
defaultextension = '.ptf',
@ -1654,7 +1661,7 @@ class ParticlePanel(AppShell):
def setRendererSpriteNonAnimatedTheta(self, theta):
self.particles.renderer.setNonanimatedTheta(theta)
def setRendererSpriteBlendMethod(self, blendMethod):
print blendMethod
print(blendMethod)
if blendMethod == 'PP_NO_BLEND':
bMethod = BaseParticleRenderer.PPNOBLEND
elif blendMethod == 'PP_BLEND_LINEAR':
@ -1863,7 +1870,7 @@ class ParticlePanel(AppShell):
count, force):
def setVec(vec, f = force):
f.setVector(vec[0], vec[1], vec[2])
forceName = 'Vector Force-' + `count`
forceName = 'Vector Force-' + repr(count)
frame = self.createForceFrame(forcePage, forceName, force)
self.createLinearForceWidgets(frame, pageName, forceName, force)
vec = force.getLocalVector()
@ -1875,7 +1882,7 @@ class ParticlePanel(AppShell):
def createLinearRandomForceWidget(self, forcePage, pageName, count,
force, type):
forceName = type + ' Force-' + `count`
forceName = type + ' Force-' + repr(count)
frame = self.createForceFrame(forcePage, forceName, force)
self.createLinearForceWidgets(frame, pageName, forceName, force)
self.createForceActiveWidget(frame, pageName, forceName, force)
@ -1884,7 +1891,7 @@ class ParticlePanel(AppShell):
count, force):
def setCoef(coef, f = force):
f.setCoef(coef)
forceName = 'Friction Force-' + `count`
forceName = 'Friction Force-' + repr(count)
frame = self.createForceFrame(forcePage, forceName, force)
self.createLinearForceWidgets(frame, pageName, forceName, force)
self.createFloater(frame, pageName, forceName + ' Coef',
@ -1895,7 +1902,7 @@ class ParticlePanel(AppShell):
def createLinearCylinderVortexForceWidget(self, forcePage, pageName,
count, force):
forceName = 'Vortex Force-' + `count`
forceName = 'Vortex Force-' + repr(count)
def setCoef(coef, f = force):
f.setCoef(coef)
def setLength(length, f = force):
@ -1934,7 +1941,7 @@ class ParticlePanel(AppShell):
f.setForceCenter(Point3(vec[0], vec[1], vec[2]))
def setRadius(radius, f = force):
f.setRadius(radius)
forceName = type + ' Force-' + `count`
forceName = type + ' Force-' + repr(count)
frame = self.createForceFrame(forcePage, forceName, force)
self.createLinearForceWidgets(frame, pageName, forceName, force)
var = self.createOptionMenu(

View File

@ -1,28 +1,8 @@
from pandac.PandaModules import *
from panda3d.core import *
from panda3d.physics import *
from direct.particles.ParticleManagerGlobal import *
from direct.showbase.PhysicsManagerGlobal import *
#Manakel 2/12/2005: replace from pandac import by from pandac.PandaModules import
from pandac.PandaModules import ParticleSystem
from pandac.PandaModules import BaseParticleFactory
from pandac.PandaModules import PointParticleFactory
from pandac.PandaModules import ZSpinParticleFactory
#import OrientedParticleFactory
from pandac.PandaModules import BaseParticleRenderer
from pandac.PandaModules import PointParticleRenderer
from pandac.PandaModules import LineParticleRenderer
from pandac.PandaModules import GeomParticleRenderer
from pandac.PandaModules import SparkleParticleRenderer
from pandac.PandaModules import SpriteParticleRenderer
from pandac.PandaModules import BaseParticleEmitter
from pandac.PandaModules import BoxEmitter
from pandac.PandaModules import DiscEmitter
from pandac.PandaModules import LineEmitter
from pandac.PandaModules import PointEmitter
from pandac.PandaModules import RectangleEmitter
from pandac.PandaModules import RingEmitter
from pandac.PandaModules import SphereSurfaceEmitter
from pandac.PandaModules import SphereVolumeEmitter
from pandac.PandaModules import TangentRingEmitter
import string
import os
from direct.directnotify import DirectNotifyGlobal
@ -113,7 +93,7 @@ class Particles(ParticleSystem):
elif (type == "OrientedParticleFactory"):
self.factory = OrientedParticleFactory.OrientedParticleFactory()
else:
print "unknown factory type: %s" % type
print("unknown factory type: %s" % type)
return None
self.factory.setLifespanBase(0.5)
ParticleSystem.ParticleSystem.setFactory(self, self.factory)
@ -152,7 +132,7 @@ class Particles(ParticleSystem):
# See sourceFileName and sourceNodeName in SpriteParticleRenderer-extensions.py
self.renderer.setTextureFromNode()
else:
print "unknown renderer type: %s" % type
print("unknown renderer type: %s" % type)
return None
ParticleSystem.ParticleSystem.setRenderer(self, self.renderer)
@ -183,7 +163,7 @@ class Particles(ParticleSystem):
elif (type == "TangentRingEmitter"):
self.emitter = TangentRingEmitter.TangentRingEmitter()
else:
print "unknown emitter type: %s" % type
print("unknown emitter type: %s" % type)
return None
ParticleSystem.ParticleSystem.setEmitter(self, self.emitter)

View File

@ -5,9 +5,16 @@ from direct.directtools.DirectGlobals import *
from direct.tkwidgets.AppShell import AppShell
from direct.tkwidgets.Dial import AngleDial
from direct.tkwidgets.Floater import Floater
from Tkinter import Button, Menubutton, Menu, StringVar
from pandac.PandaModules import *
import Tkinter, Pmw
from panda3d.core import *
import sys, Pmw
if sys.version_info >= (3, 0):
from tkinter import Button, Menubutton, Menu, StringVar
import tkinter
else:
from Tkinter import Button, Menubutton, Menu, StringVar
import Tkinter as tkinter
"""
TODO:
Task to monitor pose
@ -84,7 +91,7 @@ class Placer(AppShell):
def createInterface(self):
# The interior of the toplevel panel
interior = self.interior()
interior['relief'] = Tkinter.FLAT
interior['relief'] = tkinter.FLAT
# Add placer commands to menubar
self.menuBar.addmenu('Placer', 'Placer Panel Operations')
self.menuBar.addmenuitem('Placer', 'command',
@ -113,7 +120,7 @@ class Placer(AppShell):
# Get a handle to the menu frame
menuFrame = self.menuFrame
self.nodePathMenu = Pmw.ComboBox(
menuFrame, labelpos = Tkinter.W, label_text = 'Node Path:',
menuFrame, labelpos = tkinter.W, label_text = 'Node Path:',
entry_width = 20,
selectioncommand = self.selectNodePathNamed,
scrolledlist_items = self.nodePathNames)
@ -168,7 +175,7 @@ class Placer(AppShell):
tag_text = 'Position',
tag_font=('MSSansSerif', 14),
tag_activebackground = '#909090',
ring_relief = Tkinter.RIDGE)
ring_relief = tkinter.RIDGE)
posMenubutton = posGroup.component('tag')
self.bind(posMenubutton, 'Position menu operations')
posMenu = Menu(posMenubutton, tearoff = 0)
@ -182,7 +189,7 @@ class Placer(AppShell):
# Create the dials
self.posX = self.createcomponent('posX', (), None,
Floater, (posInterior,),
text = 'X', relief = Tkinter.FLAT,
text = 'X', relief = tkinter.FLAT,
value = 0.0,
label_foreground = 'Red')
self.posX['commandData'] = ['x']
@ -193,7 +200,7 @@ class Placer(AppShell):
self.posY = self.createcomponent('posY', (), None,
Floater, (posInterior,),
text = 'Y', relief = Tkinter.FLAT,
text = 'Y', relief = tkinter.FLAT,
value = 0.0,
label_foreground = '#00A000')
self.posY['commandData'] = ['y']
@ -204,7 +211,7 @@ class Placer(AppShell):
self.posZ = self.createcomponent('posZ', (), None,
Floater, (posInterior,),
text = 'Z', relief = Tkinter.FLAT,
text = 'Z', relief = tkinter.FLAT,
value = 0.0,
label_foreground = 'Blue')
self.posZ['commandData'] = ['z']
@ -219,7 +226,7 @@ class Placer(AppShell):
tag_text = 'Orientation',
tag_font=('MSSansSerif', 14),
tag_activebackground = '#909090',
ring_relief = Tkinter.RIDGE)
ring_relief = tkinter.RIDGE)
hprMenubutton = hprGroup.component('tag')
self.bind(hprMenubutton, 'Orientation menu operations')
hprMenu = Menu(hprMenubutton, tearoff = 0)
@ -234,7 +241,7 @@ class Placer(AppShell):
AngleDial, (hprInterior,),
style = 'mini',
text = 'H', value = 0.0,
relief = Tkinter.FLAT,
relief = tkinter.FLAT,
label_foreground = 'blue')
self.hprH['commandData'] = ['h']
self.hprH['preCallback'] = self.xformStart
@ -246,7 +253,7 @@ class Placer(AppShell):
AngleDial, (hprInterior,),
style = 'mini',
text = 'P', value = 0.0,
relief = Tkinter.FLAT,
relief = tkinter.FLAT,
label_foreground = 'red')
self.hprP['commandData'] = ['p']
self.hprP['preCallback'] = self.xformStart
@ -258,7 +265,7 @@ class Placer(AppShell):
AngleDial, (hprInterior,),
style = 'mini',
text = 'R', value = 0.0,
relief = Tkinter.FLAT,
relief = tkinter.FLAT,
label_foreground = '#00A000')
self.hprR['commandData'] = ['r']
self.hprR['preCallback'] = self.xformStart
@ -276,7 +283,7 @@ class Placer(AppShell):
tag_pyclass = Menubutton,
tag_font=('MSSansSerif', 14),
tag_activebackground = '#909090',
ring_relief = Tkinter.RIDGE)
ring_relief = tkinter.RIDGE)
self.scaleMenubutton = scaleGroup.component('tag')
self.bind(self.scaleMenubutton, 'Scale menu operations')
self.scaleMenubutton['textvariable'] = self.scalingMode
@ -302,7 +309,7 @@ class Placer(AppShell):
self.scaleX = self.createcomponent('scaleX', (), None,
Floater, (scaleInterior,),
text = 'X Scale',
relief = Tkinter.FLAT,
relief = tkinter.FLAT,
min = 0.0001, value = 1.0,
resetValue = 1.0,
label_foreground = 'Red')
@ -315,7 +322,7 @@ class Placer(AppShell):
self.scaleY = self.createcomponent('scaleY', (), None,
Floater, (scaleInterior,),
text = 'Y Scale',
relief = Tkinter.FLAT,
relief = tkinter.FLAT,
min = 0.0001, value = 1.0,
resetValue = 1.0,
label_foreground = '#00A000')
@ -328,7 +335,7 @@ class Placer(AppShell):
self.scaleZ = self.createcomponent('scaleZ', (), None,
Floater, (scaleInterior,),
text = 'Z Scale',
relief = Tkinter.FLAT,
relief = tkinter.FLAT,
min = 0.0001, value = 1.0,
resetValue = 1.0,
label_foreground = 'Blue')
@ -428,7 +435,7 @@ class Placer(AppShell):
background = self.nodePathMenuBG)
# Check to see if node path and ref node path are the same
if ((self.refCS != None) and
(self.refCS.id() == self['nodePath'].id())):
(self.refCS.get_key() == self['nodePath'].get_key())):
# Yes they are, use temp CS as ref
# This calls updatePlacer
self.setReferenceNodePath(self.tempCS)
@ -473,7 +480,7 @@ class Placer(AppShell):
listbox = self.refNodePathMenu.component('scrolledlist')
listbox.setlist(self.refNodePathNames)
# Check to see if node path and ref node path are the same
if (nodePath != None) and (nodePath.id() == self['nodePath'].id()):
if (nodePath != None) and (nodePath.get_key() == self['nodePath'].get_key()):
# Yes they are, use temp CS and update listbox accordingly
nodePath = self.tempCS
self.refNodePathMenu.selectitem('parent')
@ -508,8 +515,8 @@ class Placer(AppShell):
dictName = name
else:
# Generate a unique name for the dict
dictName = name + '-' + `nodePath.id()`
if not dict.has_key(dictName):
dictName = name + '-' + repr(nodePath.get_key())
if dictName not in dict:
# Update combo box to include new item
names.append(dictName)
listbox = menu.component('scrolledlist')
@ -769,12 +776,12 @@ class Placer(AppShell):
posString = '%.2f, %.2f, %.2f' % (pos[0], pos[1], pos[2])
hprString = '%.2f, %.2f, %.2f' % (hpr[0], hpr[1], hpr[2])
scaleString = '%.2f, %.2f, %.2f' % (scale[0], scale[1], scale[2])
print 'NodePath: %s' % name
print 'Pos: %s' % posString
print 'Hpr: %s' % hprString
print 'Scale: %s' % scaleString
print ('%s.setPosHprScale(%s, %s, %s)' %
(name, posString, hprString, scaleString))
print('NodePath: %s' % name)
print('Pos: %s' % posString)
print('Hpr: %s' % hprString)
print('Scale: %s' % scaleString)
print(('%s.setPosHprScale(%s, %s, %s)' %
(name, posString, hprString, scaleString)))
def onDestroy(self, event):
# Remove hooks

View File

@ -9,9 +9,16 @@
#
#################################################################
from direct.showbase.DirectObject import DirectObject
from Tkinter import IntVar, Frame, Label
from seTree import TreeNode, TreeItem
import Pmw, Tkinter
import Pmw, sys
if sys.version_info >= (3, 0):
from tkinter import IntVar, Frame, Label
import tkinter
else:
from Tkinter import IntVar, Frame, Label
import Tkinter as tkinter
# changing these strings requires changing sceneEditor.py SGE_ strs too!
# This list of items will be showed on the pop out window when user right click on
@ -57,7 +64,7 @@ class seSceneGraphExplorer(Pmw.MegaWidget, DirectObject):
# Setup up container
interior = self.interior()
interior.configure(relief = Tkinter.GROOVE, borderwidth = 2)
interior.configure(relief = tkinter.GROOVE, borderwidth = 2)
# Create a label and an entry
self._scrolledCanvas = self.createcomponent(
@ -69,7 +76,7 @@ class seSceneGraphExplorer(Pmw.MegaWidget, DirectObject):
self._canvas = self._scrolledCanvas.component('canvas')
self._canvas['scrollregion'] = ('0i', '0i', '2i', '4i')
self._scrolledCanvas.resizescrollregion()
self._scrolledCanvas.pack(padx = 3, pady = 3, expand=1, fill = Tkinter.BOTH)
self._scrolledCanvas.pack(padx = 3, pady = 3, expand=1, fill = tkinter.BOTH)
self._canvas.bind('<ButtonPress-2>', self.mouse2Down)
self._canvas.bind('<B2-Motion>', self.mouse2Motion)
@ -91,8 +98,8 @@ class seSceneGraphExplorer(Pmw.MegaWidget, DirectObject):
(), None,
Label, (interior,),
text = 'Active Reparent Target: ',
anchor = Tkinter.W, justify = Tkinter.LEFT)
self._label.pack(fill = Tkinter.X)
anchor = tkinter.W, justify = tkinter.LEFT)
self._label.pack(fill = tkinter.X)
# Add update parent label
def updateLabel(nodePath = None, s = self):
@ -141,11 +148,11 @@ class seSceneGraphExplorer(Pmw.MegaWidget, DirectObject):
self._node.deselecttree()
def selectNodePath(self,nodePath, callBack=True):
item = self._node.find(nodePath.id())
item = self._node.find(nodePath.get_key())
if item!= None:
item.select(callBack)
else:
print '----SGE: Error Selection'
print('----SGE: Error Selection')
class SceneGraphExplorerItem(TreeItem):
@ -164,7 +171,7 @@ class SceneGraphExplorerItem(TreeItem):
return name
def GetKey(self):
return self.nodePath.id()
return self.nodePath.get_key()
def IsEditable(self):
# All nodes' names can be edited nowadays.

View File

@ -11,7 +11,7 @@
# (If we do change original directools, it will force user has to install the latest version of OUR Panda)
#
#################################################################
from pandac.PandaModules import GeomNode
from panda3d.core import GeomNode
from direct.directtools.DirectGlobals import *
from direct.directtools.DirectUtil import *
from seGeometry import *
@ -70,7 +70,7 @@ class SelectedNodePaths(DirectObject):
""" Select the specified node path. Multiselect as required """
# Do nothing if nothing selected
if not nodePath:
print 'Nothing selected!!'
print('Nothing selected!!')
return None
# Reset selected objects and highlight if multiSelect is false
@ -78,7 +78,7 @@ class SelectedNodePaths(DirectObject):
self.deselectAll()
# Get this pointer
id = nodePath.id()
id = nodePath.get_key()
# First see if its already in the selected dictionary
dnp = self.getSelectedDict(id)
# If so, we're done
@ -96,7 +96,7 @@ class SelectedNodePaths(DirectObject):
# Show its bounding box
dnp.highlight()
# Add it to the selected dictionary
self.selectedDict[dnp.id()] = dnp
self.selectedDict[dnp.get_key()] = dnp
# And update last
__builtins__["last"] = self.last = dnp
return dnp
@ -104,7 +104,7 @@ class SelectedNodePaths(DirectObject):
def deselect(self, nodePath):
""" Deselect the specified node path """
# Get this pointer
id = nodePath.id()
id = nodePath.get_key()
# See if it is in the selected dictionary
dnp = self.getSelectedDict(id)
if dnp:
@ -124,7 +124,7 @@ class SelectedNodePaths(DirectObject):
Return a list of all selected node paths. No verification of
connectivity is performed on the members of the list
"""
return self.selectedDict.values()[:]
return list(self.selectedDict.values())
def __getitem__(self,index):
return self.getSelectedAsList()[index]
@ -141,7 +141,7 @@ class SelectedNodePaths(DirectObject):
return None
def getDeselectedAsList(self):
return self.deselectedDict.values()[:]
return list(self.deselectedDict.values())
def getDeselectedDict(self, id):
"""
@ -204,15 +204,24 @@ class SelectedNodePaths(DirectObject):
# Remove all selected nodePaths from the Scene Graph
self.forEachSelectedNodePathDo(NodePath.remove)
def toggleVis(self, nodePath):
if nodePath.is_hidden():
nodePath.show()
else:
nodePath.hide()
def toggleVisSelected(self):
selected = self.last
# Toggle visibility of selected node paths
if selected:
selected.toggleVis()
if selected.is_hidden():
selected.show()
else:
selected.hide()
def toggleVisAll(self):
# Toggle viz for all selected node paths
self.forEachSelectedNodePathDo(NodePath.toggleVis)
self.forEachSelectedNodePathDo(self.toggleVis)
def isolateSelected(self):
selected = self.last
@ -221,7 +230,7 @@ class SelectedNodePaths(DirectObject):
def getDirectNodePath(self, nodePath):
# Get this pointer
id = nodePath.id()
id = nodePath.get_key()
# First check selected dict
dnp = self.getSelectedDict(id)
if dnp:
@ -376,7 +385,7 @@ class DirectBoundingBox:
return '%.2f %.2f %.2f' % (vec[0], vec[1], vec[2])
def __repr__(self):
return (`self.__class__` +
return (repr(self.__class__) +
'\nNodePath:\t%s\n' % self.nodePath.getName() +
'Min:\t\t%s\n' % self.vecAsString(self.min) +
'Max:\t\t%s\n' % self.vecAsString(self.max) +

View File

@ -388,7 +388,7 @@ class SeSession(DirectObject): ### Customized DirectSession
messenger.send('DIRECT_preSelectNodePath', [dnp])
if fResetAncestry:
# Update ancestry
self.ancestry = dnp.getAncestors()
self.ancestry = list(dnp.getAncestors())
self.ancestry.reverse()
self.ancestryIndex = 0
# Update the selectedNPReadout
@ -479,8 +479,8 @@ class SeSession(DirectObject): ### Customized DirectSession
def isNotCycle(self, nodePath, parent):
if nodePath.id() == parent.id():
print 'DIRECT.reparent: Invalid parent'
if nodePath.get_key() == parent.get_key():
print('DIRECT.reparent: Invalid parent')
return 0
elif parent.hasParent():
return self.isNotCycle(nodePath, parent.getParent())
@ -520,7 +520,10 @@ class SeSession(DirectObject): ### Customized DirectSession
nodePath = self.selected.last
if nodePath:
# Now toggle node path's visibility state
nodePath.toggleVis()
if nodePath.is_hidden():
nodePath.show()
else:
nodePath.hide()
def removeNodePath(self, nodePath = 'None Given'):
if nodePath == 'None Given':
@ -732,8 +735,8 @@ class SeSession(DirectObject): ### Customized DirectSession
hprB = base.camera.getHpr()
posE = Point3((radius*-1.41)+center.getX(), (radius*-1.41)+center.getY(), (radius*1.41)+center.getZ())
hprE = Point3(-45, -38, 0)
print posB, hprB
print posE, hprE
print(posB, hprB)
print(posE, hprE)
posInterval1 = base.camera.posInterval(time, posE, bakeInStart = 1)
posInterval2 = base.camera.posInterval(time, posB, bakeInStart = 1)

View File

@ -12,15 +12,21 @@
#
#################################################################
import os, sys, string, Pmw, Tkinter
import os, sys, string, Pmw
from direct.showbase.DirectObject import DirectObject
from Tkinter import IntVar, Menu, PhotoImage, Label, Frame, Entry
from pandac.PandaModules import *
from panda3d.core import *
if sys.version_info >= (3, 0):
import tkinter
from tkinter import IntVar, Menu, PhotoImage, Label, Frame, Entry
else:
import Tkinter as tkinter
from Tkinter import IntVar, Menu, PhotoImage, Label, Frame, Entry
# Initialize icon directory
ICONDIR = getModelPath().findFile(Filename('icons')).toOsSpecific()
if not os.path.isdir(ICONDIR):
raise RuntimeError, "can't find DIRECT icon directory (%s)" % `ICONDIR`
raise RuntimeError("can't find DIRECT icon directory (%r)" % ICONDIR)
class TreeNode:
@ -187,9 +193,9 @@ class TreeNode:
oldcursor = self.canvas['cursor']
self.canvas['cursor'] = "watch"
self.canvas.update()
self.canvas.delete(Tkinter.ALL) # XXX could be more subtle
self.canvas.delete(tkinter.ALL) # XXX could be more subtle
self.draw(7, 2)
x0, y0, x1, y1 = self.canvas.bbox(Tkinter.ALL)
x0, y0, x1, y1 = self.canvas.bbox(tkinter.ALL)
self.canvas.configure(scrollregion=(0, 0, x1, y1))
self.canvas['cursor'] = oldcursor
@ -208,7 +214,7 @@ class TreeNode:
self.kidKeys = []
for item in sublist:
key = item.GetKey()
if self.children.has_key(key):
if key in self.children:
child = self.children[key]
else:
child = TreeNode(self.canvas, self, item, self.menuList)
@ -309,7 +315,7 @@ class TreeNode:
def edit(self, event=None):
self.entry = Entry(self.label, bd=0, highlightthickness=1, width=0)
self.entry.insert(0, self.label['text'])
self.entry.selection_range(0, Tkinter.END)
self.entry.selection_range(0, tkinter.END)
self.entry.pack(ipadx=5)
self.entry.focus_set()
self.entry.bind("<Return>", self.edit_finish)
@ -344,7 +350,7 @@ class TreeNode:
for item in sublist:
key = item.GetKey()
# Use existing child or create new TreeNode if none exists
if self.children.has_key(key):
if key in self.children:
child = self.children[key]
else:
child = TreeNode(self.canvas, self, item, self.menuList)

View File

@ -23,7 +23,7 @@
* parameter type accepts an arbitrary (or possibly fixed) number of nested
* fields, all of which are of the same type.
*/
class DCArrayParameter : public DCParameter {
class EXPCL_DIRECT_DCPARSER DCArrayParameter : public DCParameter {
public:
DCArrayParameter(DCParameter *element_type,
const DCUnsignedIntRange &size = DCUnsignedIntRange());

View File

@ -27,7 +27,7 @@
* This defines an interface to the Distributed Class, and is always
* implemented as a remote procedure method.
*/
class DCAtomicField : public DCField {
class EXPCL_DIRECT_DCPARSER DCAtomicField : public DCField {
public:
DCAtomicField(const std::string &name, DCClass *dclass, bool bogus_field);
virtual ~DCAtomicField();

View File

@ -41,7 +41,7 @@ class DCParameter;
/**
* Defines a particular DistributedClass as read from an input .dc file.
*/
class DCClass : public DCDeclaration {
class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {
public:
DCClass(DCFile *dc_file, const std::string &name,
bool is_struct, bool bogus_class);

View File

@ -23,7 +23,7 @@ class DCClass;
* This represents a class (or struct) object used as a parameter itself.
* This means that all the fields of the class get packed into the message.
*/
class DCClassParameter : public DCParameter {
class EXPCL_DIRECT_DCPARSER DCClassParameter : public DCParameter {
public:
DCClassParameter(const DCClass *dclass);
DCClassParameter(const DCClassParameter &copy);

View File

@ -26,7 +26,7 @@ class DCSwitch;
* only purpose is so that classes and typedefs can be stored in one list
* together so they can be ordered correctly on output.
*/
class DCDeclaration {
class EXPCL_DIRECT_DCPARSER DCDeclaration {
public:
virtual ~DCDeclaration();

View File

@ -34,7 +34,7 @@ class HashGenerator;
/**
* A single field of a Distributed Class, either atomic or molecular.
*/
class DCField : public DCPackerInterface, public DCKeywordList {
class EXPCL_DIRECT_DCPARSER DCField : public DCPackerInterface, public DCKeywordList {
public:
DCField();
DCField(const std::string &name, DCClass *dclass);

View File

@ -29,7 +29,7 @@ class DCDeclaration;
* Represents the complete list of Distributed Class descriptions as read from
* a .dc file.
*/
class DCFile {
class EXPCL_DIRECT_DCPARSER DCFile {
PUBLISHED:
DCFile();
~DCFile();

View File

@ -25,7 +25,7 @@ class HashGenerator;
* define a communication property associated with a field, for instance
* "broadcast" or "airecv".
*/
class DCKeyword : public DCDeclaration {
class EXPCL_DIRECT_DCPARSER DCKeyword : public DCDeclaration {
public:
DCKeyword(const std::string &name, int historical_flag = ~0);
virtual ~DCKeyword();

View File

@ -23,7 +23,7 @@ class HashGenerator;
* This is a list of keywords (see DCKeyword) that may be set on a particular
* field.
*/
class DCKeywordList {
class EXPCL_DIRECT_DCPARSER DCKeywordList {
public:
DCKeywordList();
DCKeywordList(const DCKeywordList &copy);

View File

@ -25,7 +25,7 @@ class DCParameter;
* This represents a combination of two or more related atomic fields, that
* will often be treated as a unit.
*/
class DCMolecularField : public DCField {
class EXPCL_DIRECT_DCPARSER DCMolecularField : public DCField {
public:
DCMolecularField(const std::string &name, DCClass *dclass);

View File

@ -52,7 +52,7 @@ operator = (const DCNumericRange<NUM> &copy) {
* otherwise.
*/
template <class NUM>
bool DCNumericRange<NUM>::
INLINE bool DCNumericRange<NUM>::
is_in_range(Number num) const {
if (_ranges.empty()) {
return true;
@ -106,7 +106,7 @@ get_one_value() const {
*
*/
template <class NUM>
void DCNumericRange<NUM>::
INLINE void DCNumericRange<NUM>::
generate_hash(HashGenerator &hashgen) const {
if (!_ranges.empty()) {
hashgen.add_int(_ranges.size());
@ -124,7 +124,7 @@ generate_hash(HashGenerator &hashgen) const {
*
*/
template <class NUM>
void DCNumericRange<NUM>::
INLINE void DCNumericRange<NUM>::
output(std::ostream &out, Number divisor) const {
if (!_ranges.empty()) {
typename Ranges::const_iterator ri;
@ -144,7 +144,7 @@ output(std::ostream &out, Number divisor) const {
* characters.
*/
template <class NUM>
void DCNumericRange<NUM>::
INLINE void DCNumericRange<NUM>::
output_char(std::ostream &out, Number divisor) const {
if (divisor != 1) {
output(out, divisor);
@ -179,7 +179,7 @@ clear() {
* minmax overlaps an existing minmax.
*/
template <class NUM>
bool DCNumericRange<NUM>::
INLINE bool DCNumericRange<NUM>::
add_range(Number min, Number max) {
// Check for an overlap. This is probably indicative of a typo and should
// be reported.

View File

@ -23,7 +23,7 @@
* to constrain simple numeric types, as well as array sizes.
*/
template <class NUM>
class DCNumericRange {
class EXPCL_DIRECT_DCPARSER DCNumericRange {
public:
typedef NUM Number;
@ -32,20 +32,20 @@ public:
INLINE DCNumericRange(const DCNumericRange &copy);
INLINE void operator = (const DCNumericRange &copy);
bool is_in_range(Number num) const;
INLINE bool is_in_range(Number num) const;
INLINE void validate(Number num, bool &range_error) const;
INLINE bool has_one_value() const;
INLINE Number get_one_value() const;
void generate_hash(HashGenerator &hashgen) const;
INLINE void generate_hash(HashGenerator &hashgen) const;
void output(std::ostream &out, Number divisor = 1) const;
void output_char(std::ostream &out, Number divisor = 1) const;
INLINE void output(std::ostream &out, Number divisor = 1) const;
INLINE void output_char(std::ostream &out, Number divisor = 1) const;
public:
INLINE void clear();
bool add_range(Number min, Number max);
INLINE bool add_range(Number min, Number max);
INLINE bool is_empty() const;
INLINE int get_num_ranges() const;

View File

@ -19,7 +19,7 @@
/**
* This is a block of data that receives the results of DCPacker.
*/
class DCPackData {
class EXPCL_DIRECT_DCPARSER DCPackData {
PUBLISHED:
INLINE DCPackData();
INLINE ~DCPackData();

View File

@ -31,7 +31,7 @@ class DCSwitchParameter;
* See also direct/src/doc/dcPacker.txt for a more complete description and
* examples of using this class.
*/
class DCPacker {
class EXPCL_DIRECT_DCPARSER DCPacker {
PUBLISHED:
DCPacker();
~DCPacker();

View File

@ -26,7 +26,7 @@ class DCSwitchParameter;
* requested from a particular field; its ownership is retained by the field
* so it must not be deleted.
*/
class DCPackerCatalog {
class EXPCL_DIRECT_DCPARSER DCPackerCatalog {
private:
DCPackerCatalog(const DCPackerInterface *root);
DCPackerCatalog(const DCPackerCatalog &copy);

View File

@ -64,7 +64,7 @@ END_PUBLISH
* Normally these methods are called only by the DCPacker object; the user
* wouldn't normally call these directly.
*/
class DCPackerInterface {
class EXPCL_DIRECT_DCPARSER DCPackerInterface {
public:
DCPackerInterface(const std::string &name = std::string());
DCPackerInterface(const DCPackerInterface &copy);

View File

@ -32,7 +32,7 @@ class HashGenerator;
* This may also be a typedef reference to another type, which has the same
* properties as the referenced type, but a different name.
*/
class DCParameter : public DCField {
class EXPCL_DIRECT_DCPARSER DCParameter : public DCField {
protected:
DCParameter();
DCParameter(const DCParameter &copy);

View File

@ -43,7 +43,7 @@ extern DCFile *dc_file;
// that has member functions in a union), so we'll use a class instead. That
// means we need to declare it externally, here.
class DCTokenType {
class EXPCL_DIRECT_DCPARSER DCTokenType {
public:
union U {
int s_int;

View File

@ -25,7 +25,7 @@
* divisor, which is meaningful only for the numeric type elements (and
* represents a fixed-point numeric convention).
*/
class DCSimpleParameter : public DCParameter {
class EXPCL_DIRECT_DCPARSER DCSimpleParameter : public DCParameter {
public:
DCSimpleParameter(DCSubatomicType type, unsigned int divisor = 1);
DCSimpleParameter(const DCSimpleParameter &copy);

View File

@ -27,7 +27,7 @@ class DCField;
* and represents two or more alternative unpacking schemes based on the first
* field read.
*/
class DCSwitch : public DCDeclaration {
class EXPCL_DIRECT_DCPARSER DCSwitch : public DCDeclaration {
public:
DCSwitch(const std::string &name, DCField *key_parameter);
virtual ~DCSwitch();

View File

@ -23,7 +23,7 @@ class DCSwitch;
* This represents a switch object used as a parameter itself, which packs the
* appropriate fields of the switch into the message.
*/
class DCSwitchParameter : public DCParameter {
class EXPCL_DIRECT_DCPARSER DCSwitchParameter : public DCParameter {
public:
DCSwitchParameter(const DCSwitch *dswitch);
DCSwitchParameter(const DCSwitchParameter &copy);

View File

@ -23,7 +23,7 @@ class DCParameter;
* This represents a single typedef declaration in the dc file. It assigns a
* particular type to a new name, just like a C typedef.
*/
class DCTypedef : public DCDeclaration {
class EXPCL_DIRECT_DCPARSER DCTypedef : public DCDeclaration {
public:
DCTypedef(DCParameter *parameter, bool implicit = false);
DCTypedef(const std::string &name);

View File

@ -70,6 +70,11 @@
#define END_PUBLISH
#define BLOCKING
// These control the declspec(dllexport/dllimport) on Windows. When compiling
// outside of Panda, we assume we aren't part of a DLL.
#define EXPCL_DIRECT_DCPARSER
#define EXPTP_DIRECT_DCPARSER
// Panda defines some assert-type macros. We map those to the standard assert
// macro outside of Panda.
#define nassertr(condition, return_value) assert(condition)

View File

@ -20,7 +20,7 @@
/**
* This class generates an arbitrary hash number from a sequence of ints.
*/
class HashGenerator {
class EXPCL_DIRECT_DCPARSER HashGenerator {
public:
HashGenerator();

View File

@ -30,7 +30,7 @@ typedef std::vector<int> vector_int;
* For a given integer n, it will return the nth prime number. This will
* involve a recompute step only if n is greater than any previous n.
*/
class PrimeNumberGenerator {
class EXPCL_DIRECT_DCPARSER PrimeNumberGenerator {
public:
PrimeNumberGenerator();

View File

@ -18,6 +18,7 @@
/* BUILDING_DIRECT is just a buildsystem shortcut for all of these: */
#ifdef BUILDING_DIRECT
#define BUILDING_DIRECT_DCPARSER
#define BUILDING_DIRECT_DEADREC
#define BUILDING_DIRECT_DIRECTD
#define BUILDING_DIRECT_INTERVAL
@ -26,6 +27,14 @@
#define BUILDING_DIRECT_DISTRIBUTED
#endif
#ifdef BUILDING_DIRECT_DCPARSER
#define EXPCL_DIRECT_DCPARSER EXPORT_CLASS
#define EXPTP_DIRECT_DCPARSER EXPORT_TEMPL
#else
#define EXPCL_DIRECT_DCPARSER IMPORT_CLASS
#define EXPTP_DIRECT_DCPARSER IMPORT_TEMPL
#endif
#ifdef BUILDING_DIRECT_DEADREC
#define EXPCL_DIRECT_DEADREC EXPORT_CLASS
#define EXPTP_DIRECT_DEADREC EXPORT_TEMPL

View File

@ -25,8 +25,8 @@ class PyDatagram(Datagram):
STUint64: (Datagram.addUint64, int),
STFloat64: (Datagram.addFloat64, None),
STString: (Datagram.addString, None),
STBlob: (Datagram.addString, None),
STBlob32: (Datagram.addString32, None),
STBlob: (Datagram.addBlob, None),
STBlob32: (Datagram.addBlob32, None),
}
#def addChannel(self, channelId):

View File

@ -23,8 +23,8 @@ class PyDatagramIterator(DatagramIterator):
STUint64: DatagramIterator.getUint64,
STFloat64: DatagramIterator.getFloat64,
STString: DatagramIterator.getString,
STBlob: DatagramIterator.getString,
STBlob32: DatagramIterator.getString32,
STBlob: DatagramIterator.getBlob,
STBlob32: DatagramIterator.getBlob32,
}
getChannel = DatagramIterator.getUint64

View File

@ -573,7 +573,23 @@ class MetaInterval(CMetaInterval):
out = ostream
CMetaInterval.timeline(self, out)
add_sequence = addSequence
add_parallel = addParallel
add_parallel_end_together = addParallelEndTogether
add_track = addTrack
add_interval = addInterval
set_manager = setManager
get_manager = getManager
set_t = setT
resume_until = resumeUntil
clear_to_initial = clearToInitial
clear_intervals = clearIntervals
set_play_rate = setPlayRate
priv_do_event = privDoEvent
priv_post_event = privPostEvent
set_interval_start_time = setIntervalStartTime
get_interval_start_time = getIntervalStartTime
get_duration = getDuration
class Sequence(MetaInterval):

View File

@ -679,7 +679,7 @@ write(std::ostream &out, int indent_level) const {
int total_digits = num_decimals + 4;
static const int max_digits = 32; // totally arbitrary
nassertv(total_digits <= max_digits);
char format_str[12];
char format_str[16];
sprintf(format_str, "%%%d.%df", total_digits, num_decimals);
indent(out, indent_level) << get_name() << ":\n";
@ -708,7 +708,7 @@ timeline(std::ostream &out) const {
int total_digits = num_decimals + 4;
static const int max_digits = 32; // totally arbitrary
nassertv(total_digits <= max_digits);
char format_str[12];
char format_str[16];
sprintf(format_str, "%%%d.%df", total_digits, num_decimals);
int extra_indent_level = 0;

View File

@ -3,6 +3,7 @@ Palette for Prototyping
"""
from .ProtoPaletteBase import *
import os
class ProtoPalette(ProtoPaletteBase):
def __init__(self):

View File

@ -89,7 +89,7 @@ class Transitions:
self.fade.setBin('unsorted', 0)
self.fade.setColor(0,0,0,0)
def getFadeInIval(self, t=0.5, finishIval=None):
def getFadeInIval(self, t=0.5, finishIval=None, blendType='noBlend'):
"""
Returns an interval without starting it. This is particularly useful in
cutscenes, so when the cutsceneIval is escaped out of we can finish the fade immediately
@ -103,6 +103,7 @@ class Transitions:
self.lerpFunc(self.fade, t,
self.alphaOff,
# self.alphaOn,
blendType=blendType
),
Func(self.fade.detachNode),
name = self.fadeTaskName,
@ -111,7 +112,7 @@ class Transitions:
transitionIval.append(finishIval)
return transitionIval
def getFadeOutIval(self, t=0.5, finishIval=None):
def getFadeOutIval(self, t=0.5, finishIval=None, blendType='noBlend'):
"""
Create a sequence that lerps the color out, then
parents the fade to hidden
@ -125,6 +126,7 @@ class Transitions:
self.lerpFunc(self.fade, t,
self.alphaOn,
# self.alphaOff,
blendType=blendType
),
name = self.fadeTaskName,
)
@ -132,7 +134,7 @@ class Transitions:
transitionIval.append(finishIval)
return transitionIval
def fadeIn(self, t=0.5, finishIval=None):
def fadeIn(self, t=0.5, finishIval=None, blendType='noBlend'):
"""
Play a fade in transition over t seconds.
Places a polygon on the aspect2d plane then lerps the color
@ -159,13 +161,13 @@ class Transitions:
else:
# Create a sequence that lerps the color out, then
# parents the fade to hidden
self.transitionIval = self.getFadeInIval(t, finishIval)
self.transitionIval = self.getFadeInIval(t, finishIval, blendType)
self.transitionIval.append(Func(self.__finishTransition))
self.__transitionFuture = AsyncFuture()
self.transitionIval.start()
return self.__transitionFuture
def fadeOut(self, t=0.5, finishIval=None):
def fadeOut(self, t=0.5, finishIval=None, blendType='noBlend'):
"""
Play a fade out transition over t seconds.
Places a polygon on the aspect2d plane then lerps the color
@ -189,7 +191,7 @@ class Transitions:
else:
# Create a sequence that lerps the color out, then
# parents the fade to hidden
self.transitionIval = self.getFadeOutIval(t, finishIval)
self.transitionIval = self.getFadeOutIval(t, finishIval, blendType)
self.transitionIval.append(Func(self.__finishTransition))
self.__transitionFuture = AsyncFuture()
self.transitionIval.start()
@ -264,7 +266,7 @@ class Transitions:
self.iris = loader.loadModel(self.IrisModelName)
self.iris.setPos(0, 0, 0)
def irisIn(self, t=0.5, finishIval=None):
def irisIn(self, t=0.5, finishIval=None, blendType = 'noBlend'):
"""
Play an iris in transition over t seconds.
Places a polygon on the aspect2d plane then lerps the scale
@ -284,7 +286,8 @@ class Transitions:
scale = 0.18 * max(base.a2dRight, base.a2dTop)
self.transitionIval = Sequence(LerpScaleInterval(self.iris, t,
scale = scale,
startScale = 0.01),
startScale = 0.01,
blendType=blendType),
Func(self.iris.detachNode),
Func(self.__finishTransition),
name = self.irisTaskName,
@ -295,7 +298,7 @@ class Transitions:
self.transitionIval.start()
return self.__transitionFuture
def irisOut(self, t=0.5, finishIval=None):
def irisOut(self, t=0.5, finishIval=None, blendType='noBlend'):
"""
Play an iris out transition over t seconds.
Places a polygon on the aspect2d plane then lerps the scale
@ -318,7 +321,8 @@ class Transitions:
scale = 0.18 * max(base.a2dRight, base.a2dTop)
self.transitionIval = Sequence(LerpScaleInterval(self.iris, t,
scale = 0.01,
startScale = scale),
startScale = scale,
blendType=blendType),
Func(self.iris.detachNode),
# Use the fade to cover up the hole that the iris would leave
Func(self.fadeOut, 0),
@ -441,7 +445,7 @@ class Transitions:
self.__letterboxFuture.setResult(None)
self.__letterboxFuture = None
def letterboxOn(self, t=0.25, finishIval=None):
def letterboxOn(self, t=0.25, finishIval=None, blendType='noBlend'):
"""
Move black bars in over t seconds.
"""
@ -461,11 +465,13 @@ class Transitions:
t,
pos = Vec3(0, 0, -1),
#startPos = Vec3(0, 0, -1.2),
blendType=blendType
),
LerpPosInterval(self.letterboxTop,
t,
pos = Vec3(0, 0, 0.8),
# startPos = Vec3(0, 0, 1),
blendType=blendType
),
),
Func(self.__finishLetterbox),
@ -476,7 +482,7 @@ class Transitions:
self.letterboxIval.start()
return self.__letterboxFuture
def letterboxOff(self, t=0.25, finishIval=None):
def letterboxOff(self, t=0.25, finishIval=None, blendType='noBlend'):
"""
Move black bars away over t seconds.
"""
@ -495,11 +501,13 @@ class Transitions:
t,
pos = Vec3(0, 0, -1.2),
# startPos = Vec3(0, 0, -1),
blendType=blendType
),
LerpPosInterval(self.letterboxTop,
t,
pos = Vec3(0, 0, 1),
# startPos = Vec3(0, 0, 0.8),
blendType=blendType
),
),
Func(self.letterbox.stash),

View File

@ -312,7 +312,7 @@ class Event:
object. """
def __init__(self):
self.__lock = core.Lock("Python Event")
self.__lock = core.Mutex("Python Event")
self.__cvar = core.ConditionVarFull(self.__lock)
self.__flag = False
@ -325,7 +325,7 @@ class Event:
self.__lock.acquire()
try:
self.__flag = True
self.__cvar.signalAll()
self.__cvar.notifyAll()
finally:
self.__lock.release()

View File

@ -263,7 +263,8 @@ class ParticlePanel(AppShell):
'Factory', 'Factory Type',
'Select type of particle factory',
('PointParticleFactory', 'ZSpinParticleFactory',
'OrientedParticleFactory'),
#'OrientedParticleFactory'
),
self.selectFactoryType)
factoryWidgets = (
('Factory', 'Life Span',

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 3.0.4. */
/* A Bison parser, made by GNU Bison 3.0.5. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1185,14 +1185,27 @@ constructor_prototype:
/* Functions with implicit return types, and constructors */
IDENTIFIER '('
{
push_scope($1->get_scope(current_scope, global_scope));
// Create a scope for this function.
CPPScope *scope = new CPPScope($1->get_scope(current_scope, global_scope),
$1->_names.back(), V_private);
// It still needs to be able to pick up any template arguments, if this is
// a definition for a method template. Add a fake "using" declaration to
// accomplish this.
scope->_using.insert(current_scope);
push_scope(scope);
}
function_parameter_list ')' function_post
{
CPPScope *scope = $1->get_scope(current_scope, global_scope);
CPPType *type;
if ($1->get_simple_name() == current_scope->get_simple_name() ||
$1->get_simple_name() == string("~") + current_scope->get_simple_name()) {
// This is a constructor, and has no return.
std::string simple_name = $1->get_simple_name();
if (!simple_name.empty() && simple_name[0] == '~') {
// A destructor has no return type.
type = new CPPSimpleType(CPPSimpleType::T_void);
} else if (scope != nullptr && simple_name == scope->get_simple_name()) {
// Neither does a constructor.
type = new CPPSimpleType(CPPSimpleType::T_void);
} else {
// This isn't a constructor, so it has an implicit return type of
@ -1209,7 +1222,16 @@ constructor_prototype:
}
| TYPENAME_IDENTIFIER '('
{
push_scope($1->get_scope(current_scope, global_scope));
// Create a scope for this function.
CPPScope *scope = new CPPScope($1->get_scope(current_scope, global_scope),
$1->_names.back(), V_private);
// It still needs to be able to pick up any template arguments, if this is
// a definition for a method template. Add a fake "using" declaration to
// accomplish this.
scope->_using.insert(current_scope);
push_scope(scope);
}
function_parameter_list ')' function_post
{

View File

@ -292,6 +292,10 @@ output_instance(ostream &out, int indent_level, CPPScope *scope,
out << str;
} else if (_flags & F_operator_typecast) {
out << "operator ";
_return_type->output_instance(out, indent_level, scope, complete, "", prename + str);
} else {
if (prename.empty()) {
_return_type->output_instance(out, indent_level, scope, complete,

View File

@ -545,6 +545,13 @@ is_copy_constructible(CPPVisibility min_vis) const {
return true;
}
if (get_move_constructor() != nullptr ||
get_move_assignment_operator() != nullptr) {
// A user-declared move constructor or move assignment operator means that
// the implicitly-declared copy constructor is deleted.
return false;
}
CPPInstance *destructor = get_destructor();
if (destructor != nullptr) {
if (destructor->_vis > min_vis) {

View File

@ -30,6 +30,20 @@ struct AtomicAdjust {
#include "atomicAdjustDummyImpl.h"
typedef AtomicAdjustDummyImpl AtomicAdjust;
#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))) || (defined(__clang__) && (__clang_major__ >= 3))
// GCC 4.7 and above has built-in __atomic functions for atomic operations.
// Clang 3.0 and above also supports them.
#include "atomicAdjustGccImpl.h"
typedef AtomicAdjustGccImpl AtomicAdjust;
#if (__GCC_ATOMIC_INT_LOCK_FREE + __GCC_ATOMIC_LONG_LOCK_FREE) > 0
#define HAVE_ATOMIC_COMPARE_AND_EXCHANGE 1
#endif
#if __GCC_ATOMIC_POINTER_LOCK_FREE > 0
#define HAVE_ATOMIC_COMPARE_AND_EXCHANGE_PTR 1
#endif
#elif (defined(__i386__) || defined(_M_IX86)) && !defined(__APPLE__)
// For an i386 architecture, we'll always use the i386 implementation. It
// should be safe for any OS, and it might be a bit faster than any OS-
@ -45,20 +59,6 @@ typedef AtomicAdjustI386Impl AtomicAdjust;
#define HAVE_ATOMIC_COMPARE_AND_EXCHANGE 1
#define HAVE_ATOMIC_COMPARE_AND_EXCHANGE_PTR 1
#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))) || (defined(__clang__) && (__clang_major__ >= 3))
// GCC 4.7 and above has built-in __atomic functions for atomic operations.
// Clang 3.0 and above also supports them.
#include "atomicAdjustGccImpl.h"
typedef AtomicAdjustGccImpl AtomicAdjust;
#if (__GCC_ATOMIC_INT_LOCK_FREE + __GCC_ATOMIC_INT_LOCK_FREE) > 0
#define HAVE_ATOMIC_COMPARE_AND_EXCHANGE 1
#endif
#if __GCC_ATOMIC_POINTER_LOCK_FREE > 0
#define HAVE_ATOMIC_COMPARE_AND_EXCHANGE_PTR 1
#endif
#elif defined(THREAD_WIN32_IMPL)
#include "atomicAdjustWin32Impl.h"

View File

@ -63,6 +63,9 @@
#define DTOOL_PLATFORM "android_i386"
#endif
#elif defined(__aarch64__)
#define DTOOL_PLATFORM "linux_aarch64"
#elif defined(__x86_64)
#define DTOOL_PLATFORM "linux_amd64"

View File

@ -97,10 +97,12 @@ typedef std::ios::seekdir ios_seekdir;
// in some important missing functions.
#if defined(__GLIBCXX__) && __GLIBCXX__ <= 20070719
#include <tr1/tuple>
#include <tr1/cmath>
namespace std {
using std::tr1::tuple;
using std::tr1::tie;
using std::tr1::copysign;
typedef decltype(nullptr) nullptr_t;
@ -111,6 +113,8 @@ namespace std {
template<class T> typename remove_reference<T>::type &&move(T &&t) {
return static_cast<typename remove_reference<T>::type&&>(t);
}
template<class T> struct owner_less;
};
#endif

View File

@ -169,7 +169,7 @@ add_hash(size_t hash, const Key &key) {
#ifdef _DEBUG
// We assume that the sequence is laid out sequentially in memory.
if (key.size() > 0) {
assert(&key[key.size() - 1] - &key[0] == key.size() - 1);
assert(&key[key.size() - 1] - &key[0] == (ptrdiff_t)key.size() - 1);
}
#endif
size_t num_bytes = (key.size() * sizeof(key[0]));

View File

@ -435,6 +435,7 @@ write(std::ostream &out) const {
PandaSystem *PandaSystem::
get_global_ptr() {
if (_global_ptr == nullptr) {
init_type();
_global_ptr = new PandaSystem;
}

View File

@ -673,12 +673,7 @@ get_valid_child_classes(std::map<std::string, CastDetails> &answer, CPPStructTyp
return;
}
CPPStructType::Derivation::const_iterator bi;
for (bi = inclass->_derivation.begin();
bi != inclass->_derivation.end();
++bi) {
const CPPStructType::Base &base = (*bi);
for (const CPPStructType::Base &base : inclass->_derivation) {
// if (base._vis <= V_public) can_downcast = false;
CPPStructType *base_type = TypeManager::resolve_type(base._base)->as_struct_type();
if (base_type != nullptr) {
@ -794,18 +789,15 @@ InterfaceMakerPythonNative::
*/
void InterfaceMakerPythonNative::
write_prototypes(ostream &out_code, ostream *out_h) {
Functions::iterator fi;
if (out_h != nullptr) {
*out_h << "#include \"py_panda.h\"\n\n";
}
/*
for (fi = _functions.begin(); fi != _functions.end(); ++fi)
{
Function *func = (*fi);
if (!func->_itype.is_global() && is_function_legal(func))
write_prototype_for (out_code, func);
for (Function *func : _functions) {
if (!func->_itype.is_global() && is_function_legal(func)) {
write_prototype_for(out_code, func);
}
}
*/
@ -821,6 +813,11 @@ write_prototypes(ostream &out_code, ostream *out_h) {
// _external_imports.insert(object->_itype._cpptype);
}
}
} else if (object->_itype.is_scoped_enum() && isExportThisRun(object->_itype._cpptype)) {
// Forward declare where we will put the scoped enum type.
string class_name = object->_itype._cpptype->get_local_name(&parser);
string safe_name = make_safe_name(class_name);
out_code << "static PyTypeObject *Dtool_Ptr_" << safe_name << " = nullptr;\n";
}
}
@ -828,8 +825,7 @@ write_prototypes(ostream &out_code, ostream *out_h) {
out_code << " * Extern declarations for imported classes\n";
out_code << " */\n";
for (std::set<CPPType *>::iterator ii = _external_imports.begin(); ii != _external_imports.end(); ii++) {
CPPType *type = (*ii);
for (CPPType *type : _external_imports) {
string class_name = type->get_local_name(&parser);
string safe_name = make_safe_name(class_name);
@ -919,22 +915,19 @@ write_prototypes_class_external(ostream &out, Object *obj) {
void InterfaceMakerPythonNative::
write_prototypes_class(ostream &out_code, ostream *out_h, Object *obj) {
std::string ClassName = make_safe_name(obj->_itype.get_scoped_name());
Functions::iterator fi;
out_code << "/**\n";
out_code << " * Forward declarations for top-level class " << ClassName << "\n";
out_code << " */\n";
/*
for (fi = obj->_methods.begin(); fi != obj->_methods.end(); ++fi) {
Function *func = (*fi);
for (Function *func : obj->_methods) {
write_prototype_for(out_code, func);
}
*/
/*
for (fi = obj->_constructors.begin(); fi != obj->_constructors.end(); ++fi) {
Function *func = (*fi);
for (Function *func : obj->_constructors) {
std::string fname = "int Dtool_Init_" + ClassName + "(PyObject *self, PyObject *args, PyObject *kwds)";
write_prototype_for_name(out_code, obj, func, fname);
}
@ -993,9 +986,6 @@ write_functions(ostream &out) {
*/
void InterfaceMakerPythonNative::
write_class_details(ostream &out, Object *obj) {
Functions::iterator fi;
Function::Remaps::const_iterator ri;
// std::string cClassName = obj->_itype.get_scoped_name();
std::string ClassName = make_safe_name(obj->_itype.get_scoped_name());
std::string cClassName = obj->_itype.get_true_name();
@ -1005,8 +995,7 @@ write_class_details(ostream &out, Object *obj) {
out << " */\n";
// First write out all the wrapper functions for the methods.
for (fi = obj->_methods.begin(); fi != obj->_methods.end(); ++fi) {
Function *func = (*fi);
for (Function *func : obj->_methods) {
if (func) {
// Write the definition of the generic wrapper function for this
// function.
@ -1015,18 +1004,13 @@ write_class_details(ostream &out, Object *obj) {
}
// Now write out generated getters and setters for the properties.
Properties::const_iterator pit;
for (pit = obj->_properties.begin(); pit != obj->_properties.end(); ++pit) {
Property *property = (*pit);
for (Property *property : obj->_properties) {
write_getset(out, obj, property);
}
// Write the constructors.
std::string fname = "static int Dtool_Init_" + ClassName + "(PyObject *self, PyObject *args, PyObject *kwds)";
for (fi = obj->_constructors.begin(); fi != obj->_constructors.end(); ++fi) {
Function *func = (*fi);
for (Function *func : obj->_constructors) {
string expected_params;
write_function_for_name(out, obj, func->_remaps, fname, expected_params, true, AT_keyword_args, RF_int);
}
@ -1052,17 +1036,16 @@ write_class_details(ostream &out, Object *obj) {
}
// Write make seqs: generated methods that return a sequence of items.
MakeSeqs::iterator msi;
for (msi = obj->_make_seqs.begin(); msi != obj->_make_seqs.end(); ++msi) {
if (is_function_legal((*msi)->_length_getter) &&
is_function_legal((*msi)->_element_getter)) {
write_make_seq(out, obj, ClassName, cClassName, *msi);
for (MakeSeq *make_seq : obj->_make_seqs) {
if (is_function_legal(make_seq->_length_getter) &&
is_function_legal(make_seq->_element_getter)) {
write_make_seq(out, obj, ClassName, cClassName, make_seq);
} else {
if (!is_function_legal((*msi)->_length_getter)) {
std::cerr << "illegal length function for MAKE_SEQ: " << (*msi)->_length_getter->_name << "\n";
if (!is_function_legal(make_seq->_length_getter)) {
std::cerr << "illegal length function for MAKE_SEQ: " << make_seq->_length_getter->_name << "\n";
}
if (!is_function_legal((*msi)->_element_getter)) {
std::cerr << "illegal element function for MAKE_SEQ: " << (*msi)->_element_getter->_name << "\n";
if (!is_function_legal(make_seq->_element_getter)) {
std::cerr << "illegal element function for MAKE_SEQ: " << make_seq->_element_getter->_name << "\n";
}
}
}
@ -1103,6 +1086,27 @@ write_class_details(ostream &out, Object *obj) {
}
}
// Are there any implicit cast operators that can cast this object to our
// desired pointer?
for (Function *func : obj->_methods) {
for (FunctionRemap *remap : func->_remaps) {
if (remap->_type == FunctionRemap::T_typecast_method &&
is_remap_legal(remap) &&
!remap->_return_type->return_value_needs_management() &&
(remap->_cppfunc->_storage_class & CPPInstance::SC_explicit) == 0 &&
TypeManager::is_pointer(remap->_return_type->get_new_type())) {
CPPType *cast_type = remap->_return_type->get_orig_type();
CPPType *obj_type = TypeManager::unwrap(TypeManager::resolve_type(remap->_return_type->get_new_type()));
string return_expr = "(" + cast_type->get_local_name(&parser) + ")*local_this";
out << " // " << *remap->_cppfunc << "\n";
out << " if (requested_type == Dtool_Ptr_" << make_safe_name(obj_type->get_local_name(&parser)) << ") {\n";
out << " return (void *)(" << remap->_return_type->get_return_expr(return_expr) << ");\n";
out << " }\n";
}
}
}
out << " return nullptr;\n";
out << "}\n\n";
@ -1297,11 +1301,11 @@ write_module_support(ostream &out, ostream *out_h, InterrogateModuleDef *def) {
out << "#ifndef LINK_ALL_STATIC\n";
out << " // Resolve externally imported types.\n";
for (std::set<CPPType *>::iterator ii = _external_imports.begin(); ii != _external_imports.end(); ++ii) {
string class_name = (*ii)->get_local_name(&parser);
for (CPPType *type : _external_imports) {
string class_name = type->get_local_name(&parser);
string safe_name = make_safe_name(class_name);
if (has_get_class_type_function(*ii)) {
if (has_get_class_type_function(type)) {
out << " Dtool_Ptr_" << safe_name << " = LookupRuntimeTypedClass(" << class_name << "::get_class_type());\n";
} else {
out << " Dtool_Ptr_" << safe_name << " = LookupNamedClass(\"" << class_name << "\");\n";
@ -1320,28 +1324,36 @@ write_module_support(ostream &out, ostream *out_h, InterrogateModuleDef *def) {
int enum_count = object->_itype.number_of_enum_values();
if (object->_itype.is_scoped_enum()) {
// Convert as Python 3.4 enum.
// Convert as Python 3.4-style enum.
string class_name = object->_itype._cpptype->get_local_name(&parser);
string safe_name = make_safe_name(class_name);
CPPType *underlying_type = TypeManager::unwrap_const(object->_itype._cpptype->as_enum_type()->get_underlying_type());
string cast_to = underlying_type->get_local_name(&parser);
out << "#if PY_VERSION_HEX >= 0x03040000\n\n";
out << " // enum class " << object->_itype.get_scoped_name() << "\n";
out << " {\n";
out << " PyObject *members = PyTuple_New(" << enum_count << ");\n";
out << " PyObject *member;\n";
for (int xx = 0; xx < enum_count; xx++) {
out << " member = PyTuple_New(2);\n"
" PyTuple_SET_ITEM(member, 0, PyUnicode_FromString(\""
"#if PY_MAJOR_VERSION >= 3\n"
" PyTuple_SET_ITEM(member, 0, PyUnicode_FromString(\""
<< object->_itype.get_enum_value_name(xx) << "\"));\n"
"#else\n"
" PyTuple_SET_ITEM(member, 0, PyString_FromString(\""
<< object->_itype.get_enum_value_name(xx) << "\"));\n"
"#endif\n"
" PyTuple_SET_ITEM(member, 1, Dtool_WrapValue(("
<< cast_to << ")" << object->_itype.get_scoped_name() << "::"
<< object->_itype.get_enum_value_name(xx) << "));\n"
" PyTuple_SET_ITEM(members, " << xx << ", member);\n";
}
out << " Dtool_Ptr_" << safe_name << " = Dtool_EnumType_Create(\""
<< object->_itype.get_name() << "\", members, \""
<< _def->module_name << "\");\n";
out << " PyModule_AddObject(module, \"" << object->_itype.get_name()
<< "\", Dtool_EnumType_Create(\"" << object->_itype.get_name()
<< "\", members, \"" << _def->module_name << "\"));\n";
<< "\", (PyObject *)Dtool_Ptr_" << safe_name << ");\n";
out << " }\n";
out << "#endif\n";
} else {
out << " // enum " << object->_itype.get_scoped_name() << "\n";
for (int xx = 0; xx < enum_count; xx++) {
@ -1555,7 +1567,6 @@ write_module_class(ostream &out, Object *obj) {
is_runtime_typed = true;
}
Functions::iterator fi;
out << "/**\n";
out << " * Python method tables for " << ClassName << " (" << export_class_name << ")\n" ;
out << " */\n";
@ -1566,8 +1577,7 @@ write_module_class(ostream &out, Object *obj) {
bool got_copy = false;
bool got_deepcopy = false;
for (fi = obj->_methods.begin(); fi != obj->_methods.end(); ++fi) {
Function *func = (*fi);
for (Function *func : obj->_methods) {
if (func->_name == "__copy__") {
got_copy = true;
} else if (func->_name == "__deepcopy__") {
@ -1604,9 +1614,7 @@ write_module_class(ostream &out, Object *obj) {
bool has_nonslotted = false;
Function::Remaps::const_iterator ri;
for (ri = func->_remaps.begin(); ri != func->_remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (FunctionRemap *remap : func->_remaps) {
if (!is_remap_legal(remap)) {
continue;
}
@ -1698,9 +1706,7 @@ write_module_class(ostream &out, Object *obj) {
out << " {\"__deepcopy__\", &map_deepcopy_to_copy, METH_VARARGS, nullptr},\n";
}
MakeSeqs::iterator msi;
for (msi = obj->_make_seqs.begin(); msi != obj->_make_seqs.end(); ++msi) {
MakeSeq *make_seq = (*msi);
for (MakeSeq *make_seq : obj->_make_seqs) {
if (!is_function_legal(make_seq->_length_getter) ||
!is_function_legal(make_seq->_element_getter)) {
continue;
@ -1876,10 +1882,7 @@ write_module_class(ostream &out, Object *obj) {
// This function handles both delattr and setattr. Fish out the
// remaps for both types.
set<FunctionRemap*>::const_iterator ri;
for (ri = def._remaps.begin(); ri != def._remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (FunctionRemap *remap : def._remaps) {
if (remap->_cppfunc->get_simple_name() == "__delattr__" && remap->_parameters.size() == 2) {
delattr_remaps.insert(remap);
@ -2029,10 +2032,7 @@ write_module_class(ostream &out, Object *obj) {
// This function handles both delitem and setitem. Fish out the
// remaps for either one.
set<FunctionRemap*>::const_iterator ri;
for (ri = def._remaps.begin(); ri != def._remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (FunctionRemap *remap : def._remaps) {
if (remap->_flags & FunctionRemap::F_setitem_int) {
setitem_remaps.insert(remap);
@ -2098,10 +2098,7 @@ write_module_class(ostream &out, Object *obj) {
// This function handles both delitem and setitem. Fish out the
// remaps for either one.
set<FunctionRemap*>::const_iterator ri;
for (ri = def._remaps.begin(); ri != def._remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (FunctionRemap *remap : def._remaps) {
if (remap->_flags & FunctionRemap::F_setitem) {
setitem_remaps.insert(remap);
@ -2185,9 +2182,7 @@ write_module_class(ostream &out, Object *obj) {
// Iterate through the remaps to find the one that matches our
// parameters.
set<FunctionRemap*>::const_iterator ri;
for (ri = def._remaps.begin(); ri != def._remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (FunctionRemap *remap : def._remaps) {
if (remap->_const_method) {
if ((remap->_flags & FunctionRemap::F_explicit_self) == 0) {
params_const.push_back("self");
@ -2254,9 +2249,7 @@ write_module_class(ostream &out, Object *obj) {
// Iterate through the remaps to find the one that matches our
// parameters.
set<FunctionRemap*>::const_iterator ri;
for (ri = def._remaps.begin(); ri != def._remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (FunctionRemap *remap : def._remaps) {
if (remap->_const_method) {
if ((remap->_flags & FunctionRemap::F_explicit_self) == 0) {
params_const.push_back("self");
@ -2340,10 +2333,7 @@ write_module_class(ostream &out, Object *obj) {
set<FunctionRemap*> one_param_remaps;
set<FunctionRemap*> two_param_remaps;
set<FunctionRemap*>::const_iterator ri;
for (ri = def._remaps.begin(); ri != def._remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (FunctionRemap *remap : def._remaps) {
if (remap->_parameters.size() == 2) {
one_param_remaps.insert(remap);
@ -2537,17 +2527,14 @@ write_module_class(ostream &out, Object *obj) {
out << " return nullptr;\n";
out << " }\n\n";
for (fi = obj->_methods.begin(); fi != obj->_methods.end(); ++fi) {
for (Function *func : obj->_methods) {
std::set<FunctionRemap*> remaps;
Function *func = (*fi);
if (!func) {
continue;
}
// We only accept comparison operators that take one parameter (besides
// 'this').
Function::Remaps::const_iterator ri;
for (ri = func->_remaps.begin(); ri != func->_remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (FunctionRemap *remap : func->_remaps) {
if (is_remap_legal(remap) && remap->_has_this && (remap->_args_type == AT_single_arg)) {
remaps.insert(remap);
}
@ -2634,9 +2621,7 @@ write_module_class(ostream &out, Object *obj) {
if (obj->_properties.size() > 0) {
// Write out the array of properties, telling Python which getter and
// setter to call when they are assigned or queried in Python code.
Properties::const_iterator pit;
for (pit = obj->_properties.begin(); pit != obj->_properties.end(); ++pit) {
Property *property = (*pit);
for (Property *property : obj->_properties) {
const InterrogateElement &ielem = property->_ielement;
if (!property->_has_this || property->_getter_remaps.empty()) {
continue;
@ -3060,10 +3045,10 @@ write_module_class(ostream &out, Object *obj) {
out << " // Dependent objects\n";
if (bases.size() > 0) {
string baseargs;
for (std::vector<CPPType*>::iterator bi = bases.begin(); bi != bases.end(); ++bi) {
string safe_name = make_safe_name((*bi)->get_local_name(&parser));
for (CPPType *base : bases) {
string safe_name = make_safe_name(base->get_local_name(&parser));
if (isExportThisRun(*bi)) {
if (isExportThisRun(base)) {
baseargs += ", (PyTypeObject *)&Dtool_" + safe_name;
out << " Dtool_PyModuleClassInit_" << safe_name << "(nullptr);\n";
@ -3158,29 +3143,37 @@ write_module_class(ostream &out, Object *obj) {
// support recently.
} else if (nested_obj->_itype.is_scoped_enum()) {
// Convert enum class as Python 3.4 enum.
// Convert enum class as Python 3.4-style enum.
string class_name = nested_obj->_itype._cpptype->get_local_name(&parser);
string safe_name = make_safe_name(class_name);
int enum_count = nested_obj->_itype.number_of_enum_values();
CPPType *underlying_type = TypeManager::unwrap_const(nested_obj->_itype._cpptype->as_enum_type()->get_underlying_type());
string cast_to = underlying_type->get_local_name(&parser);
out << "#if PY_VERSION_HEX >= 0x03040000\n\n";
out << " // enum class " << nested_obj->_itype.get_scoped_name() << ";\n";
out << " {\n";
out << " PyObject *members = PyTuple_New(" << enum_count << ");\n";
out << " PyObject *member;\n";
for (int xx = 0; xx < enum_count; xx++) {
out << " member = PyTuple_New(2);\n"
"#if PY_MAJOR_VERSION >= 3\n"
" PyTuple_SET_ITEM(member, 0, PyUnicode_FromString(\""
<< nested_obj->_itype.get_enum_value_name(xx) << "\"));\n"
"#else\n"
" PyTuple_SET_ITEM(member, 0, PyString_FromString(\""
<< nested_obj->_itype.get_enum_value_name(xx) << "\"));\n"
"#endif\n"
" PyTuple_SET_ITEM(member, 1, Dtool_WrapValue(("
<< cast_to << ")" << nested_obj->_itype.get_scoped_name() << "::"
<< nested_obj->_itype.get_enum_value_name(xx) << "));\n"
" PyTuple_SET_ITEM(members, " << xx << ", member);\n";
}
out << " Dtool_Ptr_" << safe_name << " = Dtool_EnumType_Create(\""
<< nested_obj->_itype.get_name() << "\", members, \""
<< _def->module_name << "\");\n";
out << " PyDict_SetItemString(dict, \"" << nested_obj->_itype.get_name()
<< "\", Dtool_EnumType_Create(\"" << nested_obj->_itype.get_name()
<< "\", members, \"" << _def->module_name << "\"));\n";
<< "\", (PyObject *)Dtool_Ptr_" << safe_name << ");\n";
out << " }\n";
out << "#endif\n";
} else if (nested_obj->_itype.is_enum()) {
out << " // enum " << nested_obj->_itype.get_scoped_name() << ";\n";
@ -3207,9 +3200,7 @@ write_module_class(ostream &out, Object *obj) {
}
// Also add the static properties, which can't be added via getset.
Properties::const_iterator pit;
for (pit = obj->_properties.begin(); pit != obj->_properties.end(); ++pit) {
Property *property = (*pit);
for (Property *property : obj->_properties) {
const InterrogateElement &ielem = property->_ielement;
if (property->_has_this || property->_getter_remaps.empty()) {
continue;
@ -3328,7 +3319,7 @@ write_prototype_for(ostream &out, InterfaceMaker::Function *func) {
*/
void InterfaceMakerPythonNative::
write_prototype_for_name(ostream &out, InterfaceMaker::Function *func, const std::string &function_namename) {
Function::Remaps::const_iterator ri;
// Function::Remaps::const_iterator ri;
// for (ri = func->_remaps.begin(); ri != func->_remaps.end(); ++ri) {
// FunctionRemap *remap = (*ri);
@ -3354,9 +3345,7 @@ write_function_for_top(ostream &out, InterfaceMaker::Object *obj, InterfaceMaker
// should even write it.
bool has_remaps = false;
Function::Remaps::const_iterator ri;
for (ri = func->_remaps.begin(); ri != func->_remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (FunctionRemap *remap : func->_remaps) {
if (!is_remap_legal(remap)) {
continue;
}
@ -3805,18 +3794,12 @@ void InterfaceMakerPythonNative::
write_coerce_constructor(ostream &out, Object *obj, bool is_const) {
std::map<int, std::set<FunctionRemap *> > map_sets;
std::map<int, std::set<FunctionRemap *> >::iterator mii;
std::set<FunctionRemap *>::iterator sii;
int max_required_args = 0;
Functions::iterator fi;
Function::Remaps::const_iterator ri;
// Go through the methods and find appropriate static make() functions.
for (fi = obj->_methods.begin(); fi != obj->_methods.end(); ++fi) {
Function *func = (*fi);
for (ri = func->_remaps.begin(); ri != func->_remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (Function *func : obj->_methods) {
for (FunctionRemap *remap : func->_remaps) {
if (is_remap_legal(remap) && remap->_flags & FunctionRemap::F_coerce_constructor) {
nassertd(!remap->_has_this) continue;
@ -3850,10 +3833,8 @@ write_coerce_constructor(ostream &out, Object *obj, bool is_const) {
// Now go through the constructors that are suitable for coercion. This
// excludes copy constructors and ones marked "explicit".
for (fi = obj->_constructors.begin(); fi != obj->_constructors.end(); ++fi) {
Function *func = (*fi);
for (ri = func->_remaps.begin(); ri != func->_remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (Function *func : obj->_constructors) {
for (FunctionRemap *remap : func->_remaps) {
if (is_remap_legal(remap) && remap->_flags & FunctionRemap::F_coerce_constructor) {
nassertd(!remap->_has_this) continue;
@ -4879,6 +4860,46 @@ write_function_instance(ostream &out, FunctionRemap *remap,
clear_error = true;
only_pyobjects = false;
} else if (TypeManager::is_scoped_enum(type)) {
if (args_type == AT_single_arg) {
param_name = "arg";
} else {
indent(out, indent_level) << "PyObject *" << param_name;
if (default_value != nullptr) {
out << " = nullptr";
}
out << ";\n";
format_specifiers += "O";
parameter_list += ", &" + param_name;
}
CPPEnumType *enum_type = (CPPEnumType *)TypeManager::unwrap(type);
CPPType *underlying_type = enum_type->get_underlying_type();
underlying_type = TypeManager::unwrap_const(underlying_type);
//indent(out, indent_level);
//underlying_type->output_instance(out, param_name + "_val", &parser);
//out << default_expr << ";\n";
extra_convert << "long " << param_name << "_val";
if (default_value != nullptr) {
extra_convert << " = (long)";
default_value->output(extra_convert, 0, &parser, false);
extra_convert <<
";\nif (" << param_name << " != nullptr) {\n"
" " << param_name << "_val = Dtool_EnumValue_AsLong(" + param_name + ");\n"
"}";
} else {
extra_convert
<< ";\n"
<< param_name << "_val = Dtool_EnumValue_AsLong(" + param_name + ");\n";
}
pexpr_string = "(" + enum_type->get_local_name(&parser) + ")" + param_name + "_val";
expected_params += classNameFromCppName(enum_type->get_simple_name(), false);
extra_param_check << " && " << param_name << "_val != -1";
clear_error = true;
} else if (TypeManager::is_bool(type)) {
if (args_type == AT_single_arg) {
param_name = "arg";
@ -6278,7 +6299,24 @@ pack_return_value(ostream &out, int indent_level, FunctionRemap *remap,
CPPType *orig_type = return_type->get_orig_type();
CPPType *type = return_type->get_new_type();
if (return_type->new_type_is_atomic_string() ||
if (TypeManager::is_scoped_enum(type)) {
InterrogateDatabase *idb = InterrogateDatabase::get_ptr();
TypeIndex type_index = builder.get_type(TypeManager::unwrap(TypeManager::resolve_type(orig_type)), false);
const InterrogateType &itype = idb->get_type(type_index);
string safe_name = make_safe_name(itype.get_scoped_name());
indent(out, indent_level)
<< "return PyObject_CallFunction((PyObject *)Dtool_Ptr_" << safe_name;
CPPType *underlying_type = ((CPPEnumType *)itype._cpptype)->get_underlying_type();
if (TypeManager::is_unsigned_integer(underlying_type)) {
out << ", \"k\", (unsigned long)";
} else {
out << ", \"l\", (long)";
}
out << "(" << return_expr << "));\n";
} else if (return_type->new_type_is_atomic_string() ||
TypeManager::is_simple(type) ||
TypeManager::is_char_pointer(type) ||
TypeManager::is_wchar_pointer(type) ||
@ -6504,11 +6542,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
std::set<FunctionRemap*> remaps;
// Extract only the getters that take one integral argument.
Function::Remaps::iterator it;
for (it = property->_getter_remaps.begin();
it != property->_getter_remaps.end();
++it) {
FunctionRemap *remap = *it;
for (FunctionRemap *remap : property->_getter_remaps) {
int min_num_args = remap->get_min_num_args();
int max_num_args = remap->get_max_num_args();
if (min_num_args <= 1 && max_num_args >= 1 &&
@ -6573,11 +6607,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
std::set<FunctionRemap*> remaps;
// Extract only the setters that take two arguments.
Function::Remaps::iterator it;
for (it = property->_setter_remaps.begin();
it != property->_setter_remaps.end();
++it) {
FunctionRemap *remap = *it;
for (FunctionRemap *remap : property->_setter_remaps) {
int min_num_args = remap->get_min_num_args();
int max_num_args = remap->get_max_num_args();
if (min_num_args <= 2 && max_num_args >= 2 &&
@ -6675,11 +6705,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
std::set<FunctionRemap*> remaps;
// Extract only the getters that take one argument. Fish out the ones
// already taken by the sequence getter.
Function::Remaps::iterator it;
for (it = property->_getter_remaps.begin();
it != property->_getter_remaps.end();
++it) {
FunctionRemap *remap = *it;
for (FunctionRemap *remap : property->_getter_remaps) {
int min_num_args = remap->get_min_num_args();
int max_num_args = remap->get_max_num_args();
if (min_num_args <= 1 && max_num_args >= 1 &&
@ -6808,11 +6834,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
std::set<FunctionRemap*> remaps;
// Extract only the getters that take one integral argument.
Function::Remaps::iterator it;
for (it = property->_getkey_function->_remaps.begin();
it != property->_getkey_function->_remaps.end();
++it) {
FunctionRemap *remap = *it;
for (FunctionRemap *remap : property->_getkey_function->_remaps) {
int min_num_args = remap->get_min_num_args();
int max_num_args = remap->get_max_num_args();
if (min_num_args <= 1 && max_num_args >= 1 &&
@ -6969,11 +6991,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
std::set<FunctionRemap*> remaps;
// Extract only the setters that take one argument.
Function::Remaps::iterator it;
for (it = property->_setter_remaps.begin();
it != property->_setter_remaps.end();
++it) {
FunctionRemap *remap = *it;
for (FunctionRemap *remap : property->_setter_remaps) {
int min_num_args = remap->get_min_num_args();
int max_num_args = remap->get_max_num_args();
if (min_num_args <= 1 && max_num_args >= 1) {
@ -7304,6 +7322,10 @@ is_cpp_type_legal(CPPType *in_ctype) {
// bool answer = false;
CPPType *type = TypeManager::resolve_type(in_ctype);
if (TypeManager::is_rvalue_reference(type)) {
return false;
}
type = TypeManager::unwrap(type);
if (TypeManager::is_void(type)) {
@ -7362,9 +7384,7 @@ isExportThisRun(Function *func) {
return false;
}
Function::Remaps::const_iterator ri;
for (ri = func->_remaps.begin(); ri != func->_remaps.end();) {
FunctionRemap *remap = (*ri);
for (FunctionRemap *remap : func->_remaps) {
return isExportThisRun(remap->_cpptype);
}
@ -7439,10 +7459,7 @@ has_coerce_constructor(CPPStructType *type) {
CPPScope::Functions::iterator fgi;
for (fgi = scope->_functions.begin(); fgi != scope->_functions.end(); ++fgi) {
CPPFunctionGroup *fgroup = fgi->second;
CPPFunctionGroup::Instances::iterator ii;
for (ii = fgroup->_instances.begin(); ii != fgroup->_instances.end(); ++ii) {
CPPInstance *inst = (*ii);
for (CPPInstance *inst : fgroup->_instances) {
CPPFunctionType *ftype = inst->_type->as_function_type();
if (ftype == nullptr) {
continue;
@ -7527,9 +7544,7 @@ is_remap_coercion_possible(FunctionRemap *remap) {
*/
bool InterfaceMakerPythonNative::
is_function_legal(Function *func) {
Function::Remaps::const_iterator ri;
for (ri = func->_remaps.begin(); ri != func->_remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
for (FunctionRemap *remap : func->_remaps) {
if (is_remap_legal(remap)) {
// printf(" Function Is Marked Legal %s\n",func->_name.c_str());
@ -7575,13 +7590,7 @@ DoesInheritFromIsClass(const CPPStructType *inclass, const std::string &name) {
return true;
}
CPPStructType::Derivation::const_iterator bi;
for (bi = inclass->_derivation.begin();
bi != inclass->_derivation.end();
++bi) {
const CPPStructType::Base &base = (*bi);
for (const CPPStructType::Base &base : inclass->_derivation) {
CPPStructType *base_type = TypeManager::resolve_type(base._base)->as_struct_type();
if (base_type != nullptr) {
if (DoesInheritFromIsClass(base_type, name)) {
@ -7632,9 +7641,7 @@ has_init_type_function(CPPType *type) {
}
const CPPFunctionGroup *group = it->second;
CPPFunctionGroup::Instances::const_iterator ii;
for (ii = group->_instances.begin(); ii != group->_instances.end(); ++ii) {
const CPPInstance *cppinst = *ii;
for (const CPPInstance *cppinst : group->_instances) {
const CPPFunctionType *cppfunc = cppinst->_type->as_function_type();
if (cppfunc != nullptr &&

View File

@ -124,6 +124,26 @@ is_reference(CPPType *type) {
}
}
/**
* Returns true if the indicated type is some kind of an rvalue reference.
*/
bool TypeManager::
is_rvalue_reference(CPPType *type) {
switch (type->get_subtype()) {
case CPPDeclaration::ST_const:
return is_rvalue_reference(type->as_const_type()->_wrapped_around);
case CPPDeclaration::ST_reference:
return type->as_reference_type()->_value_category == CPPReferenceType::VC_rvalue;
case CPPDeclaration::ST_typedef:
return is_rvalue_reference(type->as_typedef_type()->_type);
default:
return false;
}
}
/**
* Returns true if the indicated type is some kind of a reference or const
* reference type at all, false otherwise.
@ -310,6 +330,26 @@ is_struct(CPPType *type) {
}
}
/**
* Returns true if the indicated type is an enum class, const or otherwise.
*/
bool TypeManager::
is_scoped_enum(CPPType *type) {
switch (type->get_subtype()) {
case CPPDeclaration::ST_enum:
return ((CPPEnumType *)type)->is_scoped();
case CPPDeclaration::ST_const:
return is_scoped_enum(type->as_const_type()->_wrapped_around);
case CPPDeclaration::ST_typedef:
return is_scoped_enum(type->as_typedef_type()->_type);
default:
return false;
}
}
/**
* Returns true if the indicated type is some kind of enumerated type, const
* or otherwise.

View File

@ -44,6 +44,7 @@ public:
static bool is_assignable(CPPType *type);
static bool is_reference(CPPType *type);
static bool is_rvalue_reference(CPPType *type);
static bool is_ref_to_anything(CPPType *type);
static bool is_const_ref_to_anything(CPPType *type);
static bool is_const_pointer_to_anything(CPPType *type);
@ -52,6 +53,7 @@ public:
static bool is_pointer(CPPType *type);
static bool is_const(CPPType *type);
static bool is_struct(CPPType *type);
static bool is_scoped_enum(CPPType *type);
static bool is_enum(CPPType *type);
static bool is_const_enum(CPPType *type);
static bool is_const_ref_to_enum(CPPType *type);

View File

@ -97,6 +97,20 @@ INLINE PyObject *DtoolInstance_RichComparePointers(PyObject *v1, PyObject *v2, i
Py_RETURN_RICHCOMPARE(cmpval, 0, op);
}
/**
* Converts the enum value to a C long.
*/
INLINE long Dtool_EnumValue_AsLong(PyObject *value) {
PyObject *val = PyObject_GetAttrString(value, "value");
if (val != nullptr) {
long as_long = PyLongOrInt_AS_LONG(val);
Py_DECREF(val);
return as_long;
} else {
return -1;
}
}
/**
* These functions wrap a pointer for a class that defines get_type_handle().
*/

View File

@ -306,11 +306,39 @@ PyObject *_Dtool_Return(PyObject *value) {
return value;
}
#if PY_VERSION_HEX < 0x03040000
static PyObject *Dtool_EnumType_Str(PyObject *self) {
PyObject *name = PyObject_GetAttrString(self, "name");
#if PY_MAJOR_VERSION >= 3
PyObject *repr = PyUnicode_FromFormat("%s.%s", Py_TYPE(self)->tp_name, PyString_AS_STRING(name));
#else
PyObject *repr = PyString_FromFormat("%s.%s", Py_TYPE(self)->tp_name, PyString_AS_STRING(name));
#endif
Py_DECREF(name);
return repr;
}
static PyObject *Dtool_EnumType_Repr(PyObject *self) {
PyObject *name = PyObject_GetAttrString(self, "name");
PyObject *value = PyObject_GetAttrString(self, "value");
#if PY_MAJOR_VERSION >= 3
PyObject *repr = PyUnicode_FromFormat("<%s.%s: %ld>", Py_TYPE(self)->tp_name, PyString_AS_STRING(name), PyLongOrInt_AS_LONG(value));
#else
PyObject *repr = PyString_FromFormat("<%s.%s: %ld>", Py_TYPE(self)->tp_name, PyString_AS_STRING(name), PyLongOrInt_AS_LONG(value));
#endif
Py_DECREF(name);
Py_DECREF(value);
return repr;
}
#endif
/**
* Creates a Python 3.4-style enum type. Steals reference to 'names'.
* Creates a Python 3.4-style enum type. Steals reference to 'names', which
* should be a tuple of (name, value) pairs.
*/
PyObject *Dtool_EnumType_Create(const char *name, PyObject *names, const char *module) {
PyTypeObject *Dtool_EnumType_Create(const char *name, PyObject *names, const char *module) {
static PyObject *enum_class = nullptr;
#if PY_VERSION_HEX >= 0x03040000
static PyObject *enum_meta = nullptr;
static PyObject *enum_create = nullptr;
if (enum_meta == nullptr) {
@ -325,12 +353,69 @@ PyObject *Dtool_EnumType_Create(const char *name, PyObject *names, const char *m
PyObject *result = PyObject_CallFunction(enum_create, (char *)"OsN", enum_class, name, names);
nassertr(result != nullptr, nullptr);
#else
static PyObject *name_str;
static PyObject *name_sunder_str;
static PyObject *value_str;
static PyObject *value_sunder_str;
// Emulate something vaguely like the enum module.
if (enum_class == nullptr) {
#if PY_MAJOR_VERSION >= 3
name_str = PyUnicode_InternFromString("name");
value_str = PyUnicode_InternFromString("value");
name_sunder_str = PyUnicode_InternFromString("_name_");
value_sunder_str = PyUnicode_InternFromString("_value_");
#else
name_str = PyString_InternFromString("name");
value_str = PyString_InternFromString("value");
name_sunder_str = PyString_InternFromString("_name_");
value_sunder_str = PyString_InternFromString("_value_");
#endif
PyObject *name_value_tuple = PyTuple_New(4);
PyTuple_SET_ITEM(name_value_tuple, 0, name_str);
PyTuple_SET_ITEM(name_value_tuple, 1, value_str);
PyTuple_SET_ITEM(name_value_tuple, 2, name_sunder_str);
PyTuple_SET_ITEM(name_value_tuple, 3, value_sunder_str);
Py_INCREF(name_str);
Py_INCREF(value_str);
PyObject *slots_dict = PyDict_New();
PyDict_SetItemString(slots_dict, "__slots__", name_value_tuple);
Py_DECREF(name_value_tuple);
enum_class = PyObject_CallFunction((PyObject *)&PyType_Type, (char *)"s()N", "Enum", slots_dict);
nassertr(enum_class != nullptr, nullptr);
}
PyObject *result = PyObject_CallFunction((PyObject *)&PyType_Type, (char *)"s(O)N", name, enum_class, PyDict_New());
nassertr(result != nullptr, nullptr);
((PyTypeObject *)result)->tp_str = Dtool_EnumType_Str;
((PyTypeObject *)result)->tp_repr = Dtool_EnumType_Repr;
// Copy the names as instances of the above to the class dict.
Py_ssize_t size = PyTuple_GET_SIZE(names);
for (Py_ssize_t i = 0; i < size; ++i) {
PyObject *item = PyTuple_GET_ITEM(names, i);
PyObject *name = PyTuple_GET_ITEM(item, 0);
PyObject *value = PyTuple_GET_ITEM(item, 1);
PyObject *member = _PyObject_CallNoArg(result);
PyObject_SetAttr(member, name_str, name);
PyObject_SetAttr(member, name_sunder_str, name);
PyObject_SetAttr(member, value_str, value);
PyObject_SetAttr(member, value_sunder_str, value);
PyObject_SetAttr(result, name, member);
Py_DECREF(member);
}
Py_DECREF(names);
#endif
if (module != nullptr) {
PyObject *modstr = PyUnicode_FromString(module);
PyObject_SetAttrString(result, "__module__", modstr);
Py_DECREF(modstr);
}
return result;
nassertr(PyType_Check(result), nullptr);
return (PyTypeObject *)result;
}
/**

View File

@ -258,8 +258,10 @@ EXPCL_INTERROGATEDB PyObject *_Dtool_Return(PyObject *value);
/**
* Wrapper around Python 3.4's enum library, which does not have a C API.
*/
EXPCL_INTERROGATEDB PyObject *Dtool_EnumType_Create(const char *name, PyObject *names,
const char *module = nullptr);
EXPCL_INTERROGATEDB PyTypeObject *Dtool_EnumType_Create(const char *name, PyObject *names,
const char *module = nullptr);
EXPCL_INTERROGATEDB INLINE long Dtool_EnumValue_AsLong(PyObject *value);
/**

View File

@ -1 +1,8 @@
#pragma once
#include <stdtypedefs.h>
struct timespec {
time_t tv_sec;
long tv_nsec;
};

View File

@ -24,9 +24,10 @@
#include <pair>
#include <initializer_list>
#include <functional>
#include <memory>
namespace std {
template <class Key,
class T,
class Hash = hash<Key>,

View File

@ -24,6 +24,7 @@
#include <pair>
#include <initializer_list>
#include <functional>
#include <memory>
namespace std {
@ -46,7 +47,7 @@ namespace std {
typedef typename allocator_type::const_reference const_reference;
typedef size_t size_type;
typedef std::ptrdiff_t difference_type;
class iterator;
class const_iterator;
class local_iterator;

View File

@ -1 +1 @@
typedef DWORD socklen_t;
typedef int socklen_t;

View File

@ -36,7 +36,6 @@ extern "C" {
EXPCL_PYSTUB int PyDict_SetItem(...);
EXPCL_PYSTUB int PyDict_SetItemString(...);
EXPCL_PYSTUB int PyDict_Size(...);
EXPCL_PYSTUB int PyDict_Type(...);
EXPCL_PYSTUB int PyErr_Clear(...);
EXPCL_PYSTUB int PyErr_ExceptionMatches(...);
EXPCL_PYSTUB int PyErr_Fetch(...);
@ -54,9 +53,7 @@ extern "C" {
EXPCL_PYSTUB int PyEval_SaveThread(...);
EXPCL_PYSTUB int PyFloat_AsDouble(...);
EXPCL_PYSTUB int PyFloat_FromDouble(...);
EXPCL_PYSTUB int PyFloat_Type(...);
EXPCL_PYSTUB int PyGen_Check(...);
EXPCL_PYSTUB int PyGen_Type(...);
EXPCL_PYSTUB int PyGILState_Ensure(...);
EXPCL_PYSTUB int PyGILState_Release(...);
EXPCL_PYSTUB int PyImport_GetModuleDict(...);
@ -65,14 +62,12 @@ extern "C" {
EXPCL_PYSTUB int PyInt_AsSsize_t(...);
EXPCL_PYSTUB int PyInt_FromLong(...);
EXPCL_PYSTUB int PyInt_FromSize_t(...);
EXPCL_PYSTUB int PyInt_Type(...);
EXPCL_PYSTUB int PyIter_Next(...);
EXPCL_PYSTUB int PyList_Append(...);
EXPCL_PYSTUB int PyList_AsTuple(...);
EXPCL_PYSTUB int PyList_GetItem(...);
EXPCL_PYSTUB int PyList_New(...);
EXPCL_PYSTUB int PyList_SetItem(...);
EXPCL_PYSTUB int PyList_Type(...);
EXPCL_PYSTUB int PyLong_AsLong(...);
EXPCL_PYSTUB int PyLong_AsLongLong(...);
EXPCL_PYSTUB int PyLong_AsSsize_t(...);
@ -83,7 +78,6 @@ extern "C" {
EXPCL_PYSTUB int PyLong_FromSize_t(...);
EXPCL_PYSTUB int PyLong_FromUnsignedLong(...);
EXPCL_PYSTUB int PyLong_FromUnsignedLongLong(...);
EXPCL_PYSTUB int PyLong_Type(...);
EXPCL_PYSTUB int PyMapping_GetItemString(...);
EXPCL_PYSTUB int PyMem_Free(...);
EXPCL_PYSTUB int PyMemoryView_FromObject(...);
@ -121,9 +115,9 @@ extern "C" {
EXPCL_PYSTUB int PyObject_Repr(...);
EXPCL_PYSTUB int PyObject_RichCompareBool(...);
EXPCL_PYSTUB int PyObject_SelfIter(...);
EXPCL_PYSTUB int PyObject_SetAttr(...);
EXPCL_PYSTUB int PyObject_SetAttrString(...);
EXPCL_PYSTUB int PyObject_Str(...);
EXPCL_PYSTUB int PyObject_Type(...);
EXPCL_PYSTUB int PySeqIter_New(...);
EXPCL_PYSTUB int PySequence_Check(...);
EXPCL_PYSTUB int PySequence_Fast(...);
@ -138,7 +132,6 @@ extern "C" {
EXPCL_PYSTUB int PyString_InternFromString(...);
EXPCL_PYSTUB int PyString_InternInPlace(...);
EXPCL_PYSTUB int PyString_Size(...);
EXPCL_PYSTUB int PyString_Type(...);
EXPCL_PYSTUB int PySys_GetObject(...);
EXPCL_PYSTUB int PyThreadState_Clear(...);
EXPCL_PYSTUB int PyThreadState_Delete(...);
@ -180,7 +173,6 @@ extern "C" {
EXPCL_PYSTUB int PyUnicode_GetSize(...);
EXPCL_PYSTUB int PyUnicode_InternFromString(...);
EXPCL_PYSTUB int PyUnicode_InternInPlace(...);
EXPCL_PYSTUB int PyUnicode_Type(...);
EXPCL_PYSTUB int Py_BuildValue(...);
EXPCL_PYSTUB int Py_GetVersion(...);
EXPCL_PYSTUB int Py_InitModule4(...);
@ -232,8 +224,17 @@ extern "C" {
EXPCL_PYSTUB extern void *PyExc_SystemExit;
EXPCL_PYSTUB extern void *PyExc_TypeError;
EXPCL_PYSTUB extern void *PyExc_ValueError;
EXPCL_PYSTUB extern void *PyDict_Type;
EXPCL_PYSTUB extern void *PyFloat_Type;
EXPCL_PYSTUB extern void *PyGen_Type;
EXPCL_PYSTUB extern void *PyInt_Type;
EXPCL_PYSTUB extern void *PyList_Type;
EXPCL_PYSTUB extern void *PyLong_Type;
EXPCL_PYSTUB extern void *PyObject_Type;
EXPCL_PYSTUB extern void *PyString_Type;
EXPCL_PYSTUB extern void *PyTuple_Type;
EXPCL_PYSTUB extern void *PyType_Type;
EXPCL_PYSTUB extern void *PyUnicode_Type;
EXPCL_PYSTUB extern void *_PyThreadState_Current;
EXPCL_PYSTUB extern void *_Py_FalseStruct;
EXPCL_PYSTUB extern void *_Py_NoneStruct;
@ -265,7 +266,6 @@ int PyDict_Next(...) { return 0; };
int PyDict_SetItem(...) { return 0; };
int PyDict_SetItemString(...) { return 0; };
int PyDict_Size(...){ return 0; }
int PyDict_Type(...) { return 0; };
int PyErr_Clear(...) { return 0; };
int PyErr_ExceptionMatches(...) { return 0; };
int PyErr_Fetch(...) { return 0; }
@ -284,9 +284,7 @@ int PyEval_RestoreThread(...) { return 0; }
int PyEval_SaveThread(...) { return 0; }
int PyFloat_AsDouble(...) { return 0; }
int PyFloat_FromDouble(...) { return 0; }
int PyFloat_Type(...) { return 0; }
int PyGen_Check(...) { return 0; }
int PyGen_Type(...) { return 0; }
int PyGILState_Ensure(...) { return 0; }
int PyGILState_Release(...) { return 0; }
int PyImport_GetModuleDict(...) { return 0; }
@ -295,14 +293,12 @@ int PyInt_AsLong(...) { return 0; }
int PyInt_AsSsize_t(...) { return 0; }
int PyInt_FromLong(...) { return 0; }
int PyInt_FromSize_t(...) { return 0; }
int PyInt_Type(...) { return 0; }
int PyIter_Next(...) { return 0; }
int PyList_Append(...) { return 0; }
int PyList_AsTuple(...) { return 0; }
int PyList_GetItem(...) { return 0; }
int PyList_New(...) { return 0; }
int PyList_SetItem(...) { return 0; }
int PyList_Type(...) { return 0; }
int PyLong_AsLong(...) { return 0; }
int PyLong_AsLongLong(...) { return 0; }
int PyLong_AsSsize_t(...) { return 0; }
@ -313,7 +309,6 @@ int PyLong_FromLongLong(...) { return 0; }
int PyLong_FromSize_t(...) { return 0; }
int PyLong_FromUnsignedLong(...) { return 0; }
int PyLong_FromUnsignedLongLong(...) { return 0; }
int PyLong_Type(...) { return 0; }
int PyMapping_GetItemString(...) { return 0; }
int PyMem_Free(...) { return 0; }
int PyMemoryView_FromObject(...) { return 0; }
@ -351,9 +346,9 @@ int PyObject_Malloc(...) { return 0; }
int PyObject_Repr(...) { return 0; }
int PyObject_RichCompareBool(...) { return 0; }
int PyObject_SelfIter(...) { return 0; }
int PyObject_SetAttr(...) { return 0; }
int PyObject_SetAttrString(...) { return 0; }
int PyObject_Str(...) { return 0; }
int PyObject_Type(...) { return 0; }
int PySeqIter_New(...) { return 0; }
int PySequence_Check(...) { return 0; }
int PySequence_Fast(...) { return 0; }
@ -367,8 +362,6 @@ int PyString_FromString(...) { return 0; }
int PyString_FromStringAndSize(...) { return 0; }
int PyString_InternFromString(...) { return 0; }
int PyString_InternInPlace(...) { return 0; }
int PyString_Size(...) { return 0; }
int PyString_Type(...) { return 0; }
int PySys_GetObject(...) { return 0; }
int PyThreadState_Clear(...) { return 0; }
int PyThreadState_Delete(...) { return 0; }
@ -410,7 +403,6 @@ int PyUnicode_FromWideChar(...) { return 0; }
int PyUnicode_GetSize(...) { return 0; }
int PyUnicode_InternFromString(...) { return 0; }
int PyUnicode_InternInPlace(...) { return 0; }
int PyUnicode_Type(...) { return 0; }
int Py_GetVersion(...) { return 0; }
int Py_BuildValue(...) { return 0; }
int Py_InitModule4(...) { return 0; }
@ -468,8 +460,17 @@ void *PyExc_StopIteration = nullptr;
void *PyExc_SystemExit = nullptr;
void *PyExc_TypeError = nullptr;
void *PyExc_ValueError = nullptr;
void *PyDict_Type = nullptr;
void *PyFloat_Type = nullptr;
void *PyGen_Type = nullptr;
void *PyInt_Type = nullptr;
void *PyList_Type = nullptr;
void *PyLong_Type = nullptr;
void *PyObject_Type = nullptr;
void *PyString_Type = nullptr;
void *PyTuple_Type = nullptr;
void *PyType_Type = nullptr;
void *PyUnicode_Type = nullptr;
void *_PyThreadState_Current = nullptr;
void *_Py_FalseStruct = nullptr;
void *_Py_NoneStruct = nullptr;

View File

@ -1239,8 +1239,13 @@ done:
FunctionEnd
!ifndef LVM_GETITEMCOUNT
!define LVM_GETITEMCOUNT 0x1004
!endif
!ifndef LVM_GETITEMTEXT
!define LVM_GETITEMTEXT 0x102D
!endif
Function DumpLog
Exch $5

View File

@ -1352,6 +1352,9 @@ def CompileCxx(obj,src,opts):
# Fast math is nice, but we'd like to see NaN in dev builds.
cmd += " -fno-finite-math-only"
# Make sure this is off to avoid GCC/Eigen bug (see GitHub #228)
cmd += " -fno-unsafe-math-optimizations"
if (optlevel==1): cmd += " -ggdb -D_DEBUG"
if (optlevel==2): cmd += " -O1 -D_DEBUG"
if (optlevel==3): cmd += " -O2"
@ -5219,7 +5222,7 @@ if (PkgSkip("DIRECT")==0):
#
if (PkgSkip("DIRECT")==0):
OPTS=['DIR:direct/src/dcparser', 'WITHINPANDA', 'BISONPREFIX_dcyy', 'PYTHON']
OPTS=['DIR:direct/src/dcparser', 'BUILDING:DIRECT_DCPARSER', 'WITHINPANDA', 'BISONPREFIX_dcyy', 'PYTHON']
CreateFile(GetOutputDir()+"/include/dcParser.h")
TargetAdd('p3dcparser_dcParser.obj', opts=OPTS, input='dcParser.yxx')
TargetAdd('dcParser.h', input='p3dcparser_dcParser.obj', opts=['DEPENDENCYONLY'])

View File

@ -760,7 +760,6 @@
<File RelativePath="..\panda\src\gobj\bufferContext.cxx"></File>
<File RelativePath="..\panda\src\gobj\textureContext.I"></File>
<File RelativePath="..\panda\src\gobj\internalName.h"></File>
<File RelativePath="..\panda\src\gobj\test_gobj.cxx"></File>
<File RelativePath="..\panda\src\gobj\geomTristrips.h"></File>
<File RelativePath="..\panda\src\gobj\textureContext.h"></File>
<File RelativePath="..\panda\src\gobj\config_gobj.cxx"></File>
@ -1114,7 +1113,6 @@
<File RelativePath="..\panda\src\collide\collisionHandlerGravity.I"></File>
<File RelativePath="..\panda\src\collide\collisionLine.h"></File>
<File RelativePath="..\panda\src\collide\collisionHandlerPhysical.I"></File>
<File RelativePath="..\panda\src\collide\test_collide.cxx"></File>
<File RelativePath="..\panda\src\collide\collisionFloorMesh.cxx"></File>
<File RelativePath="..\panda\src\collide\collisionPolygon.h"></File>
<File RelativePath="..\panda\src\collide\collisionGeom.cxx"></File>
@ -1379,7 +1377,6 @@
<File RelativePath="..\panda\src\display\windowHandle.h"></File>
<File RelativePath="..\panda\src\display\displayRegionCullCallbackData.cxx"></File>
<File RelativePath="..\panda\src\display\graphicsOutput.cxx"></File>
<File RelativePath="..\panda\src\display\test_display.cxx"></File>
<File RelativePath="..\panda\src\display\graphicsBuffer.I"></File>
<File RelativePath="..\panda\src\display\stencilRenderStates.cxx"></File>
<File RelativePath="..\panda\src\display\stereoDisplayRegion.I"></File>
@ -3706,7 +3703,6 @@
<File RelativePath="..\panda\src\testbed\test_map.cxx"></File>
<File RelativePath="..\panda\src\testbed\pgrid.cxx"></File>
<File RelativePath="..\panda\src\testbed\pview.cxx"></File>
<File RelativePath="..\panda\src\testbed\text_test.cxx"></File>
</Filter>
<Filter Name="cull">
<File RelativePath="..\panda\src\cull\config_cull.cxx"></File>

View File

@ -102,7 +102,8 @@ MAYAVERSIONINFO = [("MAYA6", "6.0"),
("MAYA2015","2015"),
("MAYA2016","2016"),
("MAYA20165","2016.5"),
("MAYA2017","2017")
("MAYA2017","2017"),
("MAYA2018","2018"),
]
MAXVERSIONINFO = [("MAX6", "SOFTWARE\\Autodesk\\3DSMAX\\6.0", "installdir", "maxsdk\\cssdk\\include"),

View File

@ -488,7 +488,10 @@ def makewheel(version, output_dir, platform=default_platform):
# Write the panda3d tree. We use a custom empty __init__ since the
# default one adds the bin directory to the PATH, which we don't have.
whl.write_file_data('panda3d/__init__.py', '')
whl.write_file_data('panda3d/__init__.py', """"Python bindings for the Panda3D libraries"
__version__ = '{0}'
""".format(version))
ext_suffix = GetExtensionSuffix()

61
makepanda/test_wheel.py Executable file
View File

@ -0,0 +1,61 @@
#!/usr/bin/env python
"""
Tests a .whl file by installing it and pytest into a virtual environment and
running the test suite.
Requires pip to be installed, as well as 'virtualenv' on Python 2.
"""
import os
import sys
import shutil
import subprocess
import tempfile
from optparse import OptionParser
def test_wheel(wheel, verbose=False):
envdir = tempfile.mkdtemp(prefix="venv-")
print("Setting up virtual environment in {0}".format(envdir))
if sys.version_info >= (3, 0):
subprocess.call([sys.executable, "-m", "venv", "--clear", envdir])
else:
subprocess.call([sys.executable, "-m", "virtualenv", "--clear", envdir])
# Install pytest into the environment, as well as our wheel.
if sys.platform == "win32":
pip = os.path.join(envdir, "Scripts", "pip.exe")
else:
pip = os.path.join(envdir, "bin", "pip")
if subprocess.call([pip, "install", "pytest", wheel]) != 0:
shutil.rmtree(envdir)
sys.exit(1)
# Run the test suite.
if sys.platform == "win32":
python = os.path.join(envdir, "Scripts", "python.exe")
else:
python = os.path.join(envdir, "bin", "python")
test_cmd = [python, "-m", "pytest", "tests"]
if verbose:
test_cmd.append("--verbose")
exit_code = subprocess.call(test_cmd)
shutil.rmtree(envdir)
if exit_code != 0:
sys.exit(exit_code)
if __name__ == "__main__":
parser = OptionParser(usage="%prog [options] file...")
parser.add_option('', '--verbose', dest = 'verbose', help = 'Enable verbose output', action = 'store_true', default = False)
(options, args) = parser.parse_args()
if not args:
parser.print_usage()
sys.exit(1)
for arg in args:
test_wheel(arg, verbose=options.verbose)

View File

@ -419,15 +419,19 @@ get_sound(const std::string &file_name, bool positional, int) {
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
vfs->resolve_filename(path, get_model_path());
// Build a new AudioSound from the audio data.
PT(AudioSound) audioSound;
PT(FmodAudioSound) fmodAudioSound = new FmodAudioSound(this, path, positional);
// Locate the file on disk.
path.set_binary();
PT(VirtualFile) file = vfs->get_file(path);
if (file != nullptr) {
// Build a new AudioSound from the audio data.
PT(FmodAudioSound) sound = new FmodAudioSound(this, file, positional);
_all_sounds.insert(fmodAudioSound);
audioSound = fmodAudioSound;
return audioSound;
_all_sounds.insert(sound);
return sound;
} else {
audio_error("createSound(" << path << "): File not found.");
return get_null_sound();
}
}
/**

View File

@ -39,9 +39,10 @@ TypeHandle FmodAudioSound::_type_handle;
*/
FmodAudioSound::
FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) {
FmodAudioSound(AudioManager *manager, VirtualFile *file, bool positional) {
ReMutexHolder holder(FmodAudioManager::_lock);
audio_debug("FmodAudioSound::FmodAudioSound() Creating new sound, filename: " << file_name );
audio_debug("FmodAudioSound::FmodAudioSound() Creating new sound, filename: "
<< file->get_original_filename());
_active = manager->get_active();
_paused = false;
@ -77,20 +78,14 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) {
_manager = fmanager;
_channel = 0;
_file_name = file_name;
_file_name = file->get_original_filename();
_file_name.set_binary();
// Get the Speaker Mode [Important for later on.]
result = _manager->_system->getSpeakerMode( &_speakermode );
fmod_audio_errcheck("_system->getSpeakerMode()", result);
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
PT(VirtualFile) file = vfs->get_file(_file_name);
if (file == nullptr) {
// File not found. We will display the appropriate error message below.
result = FMOD_ERR_FILE_NOTFOUND;
} else {
{
bool preload = (fmod_audio_preload_threshold < 0) || (file->get_file_size() < fmod_audio_preload_threshold);
int flags = FMOD_SOFTWARE;
flags |= positional ? FMOD_3D : FMOD_2D;
@ -149,7 +144,7 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) {
#if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS)
// Otherwise, if the Panda threading system is compiled in, we can
// assign callbacks to read the file through the VFS.
name_or_data = (const char *)file.p();
name_or_data = (const char *)file;
sound_info.length = (unsigned int)info.get_size();
sound_info.useropen = open_callback;
sound_info.userclose = close_callback;

View File

@ -70,10 +70,11 @@
#include <fmod.hpp>
#include <fmod_errors.h>
class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound {
public:
class VirtualFile;
FmodAudioSound(AudioManager *manager, Filename fn, bool positional );
class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound {
public:
FmodAudioSound(AudioManager *manager, VirtualFile *file, bool positional);
~FmodAudioSound();
// For best compatibility, set the loop_count, start_time, volume, and

View File

@ -20,6 +20,7 @@
#include "collisionPlane.h"
#include "collisionSphere.h"
#include "collisionPolygon.h"
#include "collisionTube.h"
TypeHandle BulletBodyNode::_type_handle;
@ -804,6 +805,14 @@ add_shapes_from_collision_solids(CollisionNode *cnode) {
do_add_shape(BulletBoxShape::make_from_solid(box), ts);
}
// CollisionTube
else if (CollisionTube::get_class_type() == type) {
CPT(CollisionTube) tube = DCAST(CollisionTube, solid);
CPT(TransformState) ts = TransformState::make_pos((tube->get_point_b() + tube->get_point_a()) / 2.0);
do_add_shape(BulletCapsuleShape::make_from_solid(tube), ts);
}
// CollisionPlane
else if (CollisionPlane::get_class_type() == type) {
CPT(CollisionPlane) plane = DCAST(CollisionPlane, solid);

View File

@ -82,6 +82,22 @@ ptr() const {
return _shape;
}
/**
* Constructs a new BulletCapsuleShape using the information from a
* CollisionTube from the builtin collision system.
*/
BulletCapsuleShape *BulletCapsuleShape::
make_from_solid(const CollisionTube *solid) {
PN_stdfloat radius = solid->get_radius();
// CollisionTube height includes the hemispheres, Bullet only wants the cylinder height.
PN_stdfloat height = (solid->get_point_b() - solid->get_point_a()).length() - (radius * 2);
// CollisionTubes are always Z-Up.
return new BulletCapsuleShape(radius, height, Z_up);
}
/**
* Tells the BamReader how to create objects of type BulletShape.
*/

View File

@ -20,6 +20,8 @@
#include "bullet_utils.h"
#include "bulletShape.h"
#include "collisionTube.h"
/**
*
*/
@ -33,6 +35,8 @@ PUBLISHED:
BulletCapsuleShape(const BulletCapsuleShape &copy);
INLINE ~BulletCapsuleShape();
static BulletCapsuleShape *make_from_solid(const CollisionTube *solid);
INLINE PN_stdfloat get_radius() const;
INLINE PN_stdfloat get_half_height() const;

View File

@ -15,6 +15,18 @@
TypeHandle BulletPlaneShape::_type_handle;
/**
* Creates a plane shape from a plane definition.
*/
BulletPlaneShape::
BulletPlaneShape(LPlane plane) {
btVector3 btNormal = LVecBase3_to_btVector3(plane.get_normal());
_shape = new btStaticPlaneShape(btNormal, plane.get_w());
_shape->setUserPointer(this);
}
/**
*
*/
@ -50,6 +62,17 @@ ptr() const {
return _shape;
}
/**
*
*/
LPlane BulletPlaneShape::
get_plane() const {
LightMutexHolder holder(BulletWorld::get_global_lock());
btVector3 normal = _shape->getPlaneNormal();
return LPlane(normal[0], normal[1], normal[2], (PN_stdfloat)_shape->getPlaneConstant());
}
/**
*
*/

View File

@ -32,15 +32,18 @@ private:
INLINE BulletPlaneShape() : _shape(nullptr) {};
PUBLISHED:
explicit BulletPlaneShape(LPlane plane);
explicit BulletPlaneShape(const LVector3 &normal, PN_stdfloat constant);
BulletPlaneShape(const BulletPlaneShape &copy);
INLINE ~BulletPlaneShape();
LPlane get_plane() const;
LVector3 get_plane_normal() const;
PN_stdfloat get_plane_constant() const;
static BulletPlaneShape *make_from_solid(const CollisionPlane *solid);
MAKE_PROPERTY(plane, get_plane);
MAKE_PROPERTY(plane_normal, get_plane_normal);
MAKE_PROPERTY(plane_constant, get_plane_constant);

View File

@ -276,8 +276,15 @@ do_sync_b2p() {
// Update the synchronized transform with the current approximate center of
// the soft body
LVecBase3 pos = this->do_get_aabb().get_approx_center();
CPT(TransformState) ts = TransformState::make_pos(pos);
btVector3 pMin, pMax;
_soft->getAabb(pMin, pMax);
LPoint3 pos = (btVector3_to_LPoint3(pMin) + btVector3_to_LPoint3(pMax)) * 0.5;
CPT(TransformState) ts;
if (!pos.is_nan()) {
ts = TransformState::make_pos(pos);
} else {
ts = TransformState::make_identity();
}
NodePath np = NodePath::any_path((PandaNode *)this);
LVecBase3 scale = np.get_net_transform()->get_scale();

Some files were not shown because too many files have changed in this diff Show More