This commit is contained in:
David Rose 2004-08-06 23:03:47 +00:00
parent 4f7f89164d
commit ba417bb875
13 changed files with 1469 additions and 1469 deletions

View File

@ -23,10 +23,10 @@ class MetadataPanel(AppShell,Pmw.MegaWidget):
optiondefs = (
('title', self.appname, None),
)
self.defineoptions(kw, optiondefs)
self.Metanode=nodePath
if(nodePath.hasTag("Metadata")):
self.Metatag=self.Metanode.getTag("Metadata")
self.defineoptions(kw, optiondefs)
self.Metanode=nodePath
if(nodePath.hasTag("Metadata")):
self.Metatag=self.Metanode.getTag("Metadata")
if parent == None:
self.parent = Toplevel()
@ -36,24 +36,24 @@ class MetadataPanel(AppShell,Pmw.MegaWidget):
def appInit(self):
print "Metadata Panel"
print "Metadata Panel"
def createInterface(self):
interior = self.interior()
mainFrame = Frame(interior)
tag_label=Label (mainFrame,text="Enter Metadata",font=('MSSansSerif', 15),
tag_label=Label (mainFrame,text="Enter Metadata",font=('MSSansSerif', 15),
relief = RIDGE, borderwidth=5)
tag_label.pack()
source=StringVar()
source.set(self.Metatag)
self.tag_text=Entry(mainFrame, width=10,textvariable=source)
self.tag_text.pack()
set_button=Button(mainFrame, text='Set Metadata',font=('MSSansSerif', 15),
tag_label.pack()
source=StringVar()
source.set(self.Metatag)
self.tag_text=Entry(mainFrame, width=10,textvariable=source)
self.tag_text.pack()
set_button=Button(mainFrame, text='Set Metadata',font=('MSSansSerif', 15),
relief = RIDGE, borderwidth=5, command= lambda:self.SetIt())
set_button.pack()
mainFrame.pack(fill = 'both', expand = 1)
set_button.pack()
mainFrame.pack(fill = 'both', expand = 1)
def SetIt(self):
self.Metanode.setTag("Metadata",self.tag_text.get())
self.Metanode.setTag("Metadata",self.tag_text.get())

View File

@ -126,7 +126,7 @@ class dataHolder:
# resetAll(self)
# This function will reset the whole scene
#################################################################
# Delete Everything in the Scene Graph
# Delete Everything in the Scene Graph
for index in self.ModelDic:
self.ModelDic[index].removeNode()
for index in self.ActorDic:
@ -137,22 +137,22 @@ class dataHolder:
self.collisionDict[index].removeNode()
for index in self.particleNodes:
self.particleDict[index].cleanup()
self.particleNodes[index].removeNode()
self.particleNodes[index].removeNode()
# Clear all data containers in the dataHolder
self.ModelDic.clear()
self.ModelDic.clear()
self.ModelRefDic.clear()
self.ActorDic.clear()
self.ActorRefDic.clear()
self.dummyDict.clear()
self.lightManager.deleteAll()
self.blendAnimDict.clear()
self.particleDict.clear()
self.particleNodes.clear()
self.dummyDict.clear()
self.lightManager.deleteAll()
self.blendAnimDict.clear()
self.particleDict.clear()
self.particleNodes.clear()
self.ModelNum=0
self.ActorNum=0
self.theScene=None
self.theScene=None
messenger.send('SGE_Update Explorer',[render])
print 'Scene should be cleaned up!'
@ -207,10 +207,10 @@ class dataHolder:
self.removeObj(node)
list = self.lightManager.delete(name)
return list
elif self.particleNodes.has_key(name):
self.particleNodes[name].removeNode()
del self.particleNodes[name]
del self.particleDict[name]
elif self.particleNodes.has_key(name):
self.particleNodes[name].removeNode()
del self.particleNodes[name]
del self.particleDict[name]
else:
print 'You cannot remove this NodePath'
return
@ -588,7 +588,7 @@ class dataHolder:
return True
return False
def bindCurveToNode(self,node,curveCollection):
###########################################################################
# bindCurveToNode(self,node,curveCollection)
@ -929,143 +929,143 @@ class dataHolder:
# loadScene(self)
# Opens a dialog box asking for a scene file to load. It then removes
# the current scene and opens the new one.
# It basically proceeds by executig the python file containing the scene
# and then re-populating the various dictionaries based on the dictionaries
# in the scene file hence reviving the state for the scene
# It basically proceeds by executig the python file containing the scene
# and then re-populating the various dictionaries based on the dictionaries
# in the scene file hence reviving the state for the scene
###########################################################################
### Ask for a filename
OpenFilename = tkFileDialog.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
############################################################################
# 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
############################################################################
sys.path.append(os.path.dirname(f.toOsSpecific()))
OpenFilename = tkFileDialog.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
############################################################################
# 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
############################################################################
sys.path.append(os.path.dirname(f.toOsSpecific()))
############################################################################
# Actually import the scene... this executes the code in the scene
############################################################################
self.theScene=__import__(fileName)
self.Scene=self.theScene.SavedScene(0,seParticleEffect,seParticles,dirName) # Specify load mode of 0 which will allow us to pass seParticle and seParticleEffect
messenger.send('SGE_Update Explorer',[render])
############################################################################
# Actually import the scene... this executes the code in the scene
############################################################################
self.theScene=__import__(fileName)
self.Scene=self.theScene.SavedScene(0,seParticleEffect,seParticles,dirName) # Specify load mode of 0 which will allow us to pass seParticle and seParticleEffect
messenger.send('SGE_Update Explorer',[render])
# Lets call some important initialization methods on our scene:
#self.Scene.starteffects(0,seParticleEffect,seParticles,dirName) # This special calling of start effect with mode 0 is to use seParticleEffect and seParticles
############################################################################
# Populate Model related Dictionaries
############################################################################
for model in self.Scene.ModelDic:
self.ModelDic[model]=self.Scene.ModelDic[model]
#self.ModelRefDic[model]=self.Scene.ModelRefDic[model] # The Old absolute paths way
self.ModelRefDic[model]=Filename(dirName + "/" + self.Scene.ModelRefDic[model]) # Relative Paths
############################################################################
# Populate Model related Dictionaries
############################################################################
for model in self.Scene.ModelDic:
self.ModelDic[model]=self.Scene.ModelDic[model]
#self.ModelRefDic[model]=self.Scene.ModelRefDic[model] # The Old absolute paths way
self.ModelRefDic[model]=Filename(dirName + "/" + self.Scene.ModelRefDic[model]) # Relative Paths
self.ModelNum=self.ModelNum+1
############################################################################
# Populate Actor related Dictionaries
############################################################################
for actor in self.Scene.ActorDic:
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))):
self.blendAnimDict[actor]=self.Scene.blendAnimDict[actor]
self.ActorNum=self.ActorNum+1
############################################################################
# Populate Actor related Dictionaries
############################################################################
for actor in self.Scene.ActorDic:
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))):
self.blendAnimDict[actor]=self.Scene.blendAnimDict[actor]
self.ActorNum=self.ActorNum+1
############################################################################
# Populate Light related Dictionaries
############################################################################
############################################################################
# Populate Light related Dictionaries
############################################################################
#print self.Scene.LightDict
for light in self.Scene.LightDict:
#print light
alight=self.Scene.LightDict[light]
type=self.Scene.LightTypes[light]
thenode=self.Scene.LightNodes[light]
#print type
if type == 'ambient':
#print light
alight=self.Scene.LightDict[light]
type=self.Scene.LightTypes[light]
thenode=self.Scene.LightNodes[light]
#print type
if type == 'ambient':
self.lightManager.create('ambient',alight.getColor(),name=alight.getName(),tag=thenode.getTag("Metadata"))
elif type == 'directional':
#print alight.getPoint()
#print alight.getDirection()
#print alight.getPoint()
#print alight.getDirection()
self.lightManager.create('directional',alight.getColor(),alight.getSpecularColor(),thenode.getPos(),thenode.getHpr(),name=alight.getName(),tag=thenode.getTag("Metadata"))
elif type == 'point':
atten=alight.getAttenuation()
#print alight.getPoint()
atten=alight.getAttenuation()
#print alight.getPoint()
self.lightManager.create('point',alight.getColor(),alight.getSpecularColor(),thenode.getPos(),Vec3(1,0,0),atten.getX(),atten.getY(),atten.getZ(),name=alight.getName(),tag=thenode.getTag("Metadata"))
elif type == 'spot':
atten=alight.getAttenuation()
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
############################################################################
for dummy in self.Scene.dummyDict:
self.dummyDict[dummy] = self.Scene.dummyDict[dummy]
############################################################################
# Populate Dummy related Dictionaries
############################################################################
for dummy in self.Scene.dummyDict:
self.dummyDict[dummy] = self.Scene.dummyDict[dummy]
############################################################################
# Populate Collision related Dictionaries
############################################################################
for collnode in self.Scene.collisionDict:
self.collisionDict[collnode]=self.Scene.collisionDict[collnode]
############################################################################
# Populate Collision related Dictionaries
############################################################################
for collnode in self.Scene.collisionDict:
self.collisionDict[collnode]=self.Scene.collisionDict[collnode]
############################################################################
# Populate Mopath related Dictionaries
############################################################################
for node in self.Scene.curveDict:
curveCollection=self.Scene.curveDict[node]
for curve in curveCollection:
curveColl=ParametricCurveCollection()
nodeP=loader.loadModel(curve)
curveColl.addCurves(nodeP.node())
nodeP.removeNode()
thenode=render.find("**/"+str(node))
self.bindCurveToNode(thenode,curveColl)
############################################################################
# Populate Particle related Dictionaries
############################################################################
############################################################################
# Populate Mopath related Dictionaries
############################################################################
for node in self.Scene.curveDict:
curveCollection=self.Scene.curveDict[node]
for curve in curveCollection:
curveColl=ParametricCurveCollection()
nodeP=loader.loadModel(curve)
curveColl.addCurves(nodeP.node())
nodeP.removeNode()
thenode=render.find("**/"+str(node))
self.bindCurveToNode(thenode,curveColl)
############################################################################
# Populate Particle related Dictionaries
############################################################################
for effect in self.Scene.particleDict:
theeffect=self.Scene.particleDict[effect]
emitter=loader.loadModel("sphere")
emitter.setPosHprScale(theeffect.getX(),theeffect.getY(),theeffect.getZ(),theeffect.getH(),theeffect.getP(),theeffect.getR(),theeffect.getSx(),theeffect.getSy(),theeffect.getSz())
theeffect.setPos(0,0,0)
theeffect.setName(str(effect))
tempparent=theeffect.getParent()
theeffect.reparentTo(emitter)
emitter.setName(str(effect))
emitter.reparentTo(tempparent)
theeffect.enable()
self.particleDict[effect]=theeffect
self.particleNodes[effect]=emitter
# Clean up things added to scene graph by saved file's code execution
for light in self.Scene.LightDict:
vestige=render.find('**/'+light)
if(vestige != None):
vestige.removeNode()
theeffect=self.Scene.particleDict[effect]
emitter=loader.loadModel("sphere")
emitter.setPosHprScale(theeffect.getX(),theeffect.getY(),theeffect.getZ(),theeffect.getH(),theeffect.getP(),theeffect.getR(),theeffect.getSx(),theeffect.getSy(),theeffect.getSz())
theeffect.setPos(0,0,0)
theeffect.setName(str(effect))
tempparent=theeffect.getParent()
theeffect.reparentTo(emitter)
emitter.setName(str(effect))
emitter.reparentTo(tempparent)
theeffect.enable()
self.particleDict[effect]=theeffect
self.particleNodes[effect]=emitter
############################################################################
# return the filename and update the scenegraph explorer window
############################################################################
# Clean up things added to scene graph by saved file's code execution
for light in self.Scene.LightDict:
vestige=render.find('**/'+light)
if(vestige != None):
vestige.removeNode()
############################################################################
# return the filename and update the scenegraph explorer window
############################################################################
messenger.send('SGE_Update Explorer',[render])
if(OpenFilename):
if(OpenFilename):
return OpenFilename
else:
return None
else:
return None
def getList(self):
return self.lightManager.getList()
return self.lightManager.getList()

File diff suppressed because it is too large Load Diff

View File

@ -147,7 +147,7 @@ class myLevelEditor(AppShell):
self.initialiseoptions(myLevelEditor)
self.parent.resizable(False,False) ## Disable the ability to resize for this Window.
######### Set the event handler ##########
self.dataFlowEvents = [
## Event from Side Window
@ -202,14 +202,14 @@ class myLevelEditor(AppShell):
['SEditor-ToggleBackface',self.toggleBackface],
['SEditor-ToggleTexture',self.toggleTexture],
['SEditor-ToggleWireframe',self.toggleWireframe],
['ParticlePanel_Added_Effect',self.addParticleEffect],
['ParticlePanel_Added_Effect',self.addParticleEffect],
]
#################################
### Collision detection
#################################
self.cTrav = CollisionTraverser()
self.cTrav = CollisionTraverser()
base.cTrav = self.cTrav
for event in self.dataFlowEvents:
@ -223,7 +223,7 @@ class myLevelEditor(AppShell):
['SGE_Remove', self.remove],
['SGE_Add Dummy', self.addDummyNode],
['SGE_Add Collision Object', self.addCollisionObj],
['SGE_Metadata', self.openMetadataPanel],
['SGE_Metadata', self.openMetadataPanel],
['SGE_Set as Reparent Target', self.setAsReparentTarget],
['SGE_Reparent to Target', self.reparentToNode],
['SGE_Animation Panel', self.openAnimPanel],
@ -255,17 +255,17 @@ class myLevelEditor(AppShell):
### Create SceneEditor Ver. DirectSession
self.seSession = SeSession()
self.seSession.enable()
SEditor.camera.setPos(0,-50,10)
SEditor.camera.setPos(0,-50,10)
self.placer=None
self.MopathPanel = None
self.alignPanelDict = {}
#self.quadview=QuadView()
self.placer=None
self.MopathPanel = None
self.alignPanelDict = {}
#self.quadview=QuadView()
self.lightingPanel = None
self.controllerPanel = None
self.particlePanel = None
self.lightingPanel = None
self.controllerPanel = None
self.particlePanel = None
### Create Side Window
self.sideWindow = sideWindow(worldColor = self.worldColor,
@ -293,7 +293,7 @@ class myLevelEditor(AppShell):
### Creating the Buttons in the window frame
#######################################################
buttonFrame = Frame(interior)
self.image=[]
self.image=[]
self.image.append(PhotoImage(file='new.gif'))#0
self.image.append(PhotoImage(file='open.gif'))#1
self.image.append(PhotoImage(file='save.gif'))#2
@ -314,9 +314,9 @@ class myLevelEditor(AppShell):
self.image.append(PhotoImage(file='blank.gif'))
self.image.append(PhotoImage(file='blank.gif'))
self.image.append(PhotoImage(file='blank.gif'))
self.image.append(PhotoImage(file='blank.gif'))
self.image.append(PhotoImage(file='blank.gif'))
self.image.append(PhotoImage(file='blank.gif'))
self.image.append(PhotoImage(file='blank.gif'))
self.image.append(PhotoImage(file='blank.gif'))
self.image.append(PhotoImage(file='blank.gif'))
i = 0
@ -324,11 +324,11 @@ class myLevelEditor(AppShell):
i += 1
button = Button(buttonFrame, image = element, command=lambda n=i : self.buttonPushed(n))
button.pack(fill=X, side = LEFT)
buttonFrame.pack(fill=X, side=LEFT,expand=True)
def buttonPushed(self, buttonIndex):
#################################################################
# buttonPushed(self, buttonNum)
@ -339,8 +339,8 @@ class myLevelEditor(AppShell):
#### Change here to process the button event further.
####
if buttonIndex==1: # New Scene
self.newScene()
return
self.newScene()
return
elif buttonIndex==2: # Open Scene
self.openScene()
return
@ -357,13 +357,13 @@ class myLevelEditor(AppShell):
self.openPlacerPanel()
return
elif buttonIndex==7: # Open Mopath Panel
self.openMoPathPanel()
self.openMoPathPanel()
return
elif buttonIndex==8: # Open Lighting Panel
self.openLightingPanel()
return
elif buttonIndex==9: # Open Particle Panel
self.openParticlePanel()
self.openParticlePanel()
return
elif buttonIndex==10:
self.openInputPanel()
@ -570,7 +570,7 @@ class myLevelEditor(AppShell):
## Processing message events
def makeDirty(self):
self.Dirty=1
self.Dirty=1
def removeLight(self, lightNode):
#################################################################
@ -627,7 +627,7 @@ class myLevelEditor(AppShell):
list, lightNode = AllScene.createLight(type = type)
if self.lightingPanel != None:
self.lightingPanel.updateList(list,lightNode)
self.makeDirty()
self.makeDirty()
return
def lightingPanelClose(self):
@ -662,9 +662,9 @@ class myLevelEditor(AppShell):
return
def openMetadataPanel(self,nodePath=None):
print nodePath
self.MetadataPanel=MetadataPanel(nodePath)
pass
print nodePath
self.MetadataPanel=MetadataPanel(nodePath)
pass
def duplicate(self, nodePath = None):
#################################################################
@ -706,7 +706,7 @@ class myLevelEditor(AppShell):
#
#################################################################
AllScene.addDummyNode(nodepath)
self.makeDirty()
self.makeDirty()
pass
def addCollisionObj(self, nodepath = None):
@ -820,67 +820,67 @@ class myLevelEditor(AppShell):
# and will reset the application title to "New Scene"
#################################################################
self.closeAllSubWindows() ## Close all sub window
if(self.CurrentFileName):
currentF=Filename(self.CurrentFileName)
self.CurrentFileName=None
if(self.CurrentFileName):
currentF=Filename(self.CurrentFileName)
self.CurrentFileName=None
AllScene.resetAll()
currentModName=currentF.getBasenameWoExtension()
# 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):
del sys.modules[currentModName]
print sys.getrefcount(AllScene.theScene)
del AllScene.theScene
else:
AllScene.resetAll()
self.parent.title('Scene Editor - New Scene')
currentModName=currentF.getBasenameWoExtension()
# 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):
del sys.modules[currentModName]
print sys.getrefcount(AllScene.theScene)
del AllScene.theScene
else:
AllScene.resetAll()
self.parent.title('Scene Editor - New Scene')
pass
def openScene(self):
#################################################################
# openScene(self)
#################################################################
# In the future try and provide merging of two scenes
# In the future try and provide merging of two scenes
if(self.CurrentFileName or self.Dirty):
saveScene = tkMessageBox._show("Load scene","Save the current scene?",icon = tkMessageBox.QUESTION,type = tkMessageBox.YESNOCANCEL)
if (saveScene == "yes"):
self.saveScene()
elif (saveScene == "cancel"):
return
saveScene = tkMessageBox._show("Load scene","Save the current scene?",icon = tkMessageBox.QUESTION,type = tkMessageBox.YESNOCANCEL)
if (saveScene == "yes"):
self.saveScene()
elif (saveScene == "cancel"):
return
self.closeAllSubWindows() ## Close all sub window
if(self.CurrentFileName):
currentF=Filename(self.CurrentFileName)
AllScene.resetAll()
currentModName=currentF.getBasenameWoExtension()
# 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):
del sys.modules[currentModName]
print sys.getrefcount(AllScene.theScene)
del AllScene.theScene
if(self.CurrentFileName):
currentF=Filename(self.CurrentFileName)
AllScene.resetAll()
currentModName=currentF.getBasenameWoExtension()
# 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):
del sys.modules[currentModName]
print sys.getrefcount(AllScene.theScene)
del AllScene.theScene
else:
AllScene.resetAll()
AllScene.resetAll()
self.CurrentFileName = AllScene.loadScene()
if(self.CurrentFileName==None):
return
self.CurrentFileName = AllScene.loadScene()
thefile=Filename(self.CurrentFileName)
thedir=thefile.getFullpathWoExtension()
print "SCENE EDITOR::" + thedir
self.CurrentDirName=thedir
if self.CurrentFileName != None:
if(self.CurrentFileName==None):
return
thefile=Filename(self.CurrentFileName)
thedir=thefile.getFullpathWoExtension()
print "SCENE EDITOR::" + thedir
self.CurrentDirName=thedir
if self.CurrentFileName != None:
self.parent.title('Scene Editor - '+ Filename.fromOsSpecific(self.CurrentFileName).getBasenameWoExtension())
if self.lightingPanel !=None:
if self.lightingPanel !=None:
lightList=AllScene.getList()
self.lightingPanel.updateList(lightList)
messenger.send('SGE_Update Explorer',[render])
# Close the side window in order to reset all world settings to fit the scene we have loaded.
self.sideWindow.quit()
@ -905,45 +905,45 @@ class myLevelEditor(AppShell):
# If this filename exists in sys.modules you cannot use it
#################################################################
if(self.CurrentFileName):
f=FileSaver()
f.SaveFile(AllScene,self.CurrentFileName,self.CurrentDirName,1)
self.Dirty=0
else:
self.saveAsScene()
if(self.CurrentFileName):
f=FileSaver()
f.SaveFile(AllScene,self.CurrentFileName,self.CurrentDirName,1)
self.Dirty=0
else:
self.saveAsScene()
pass
def saveAsScene(self):
#################################################################
# saveAsScene(self)
# saveAsScene(self)
# Ask for filename using a file save dialog
# If this filename exists in sys.modules you cannot use it
# Instantiate FileSaver from seFileSaver.py and pass it the filename
#################################################################
fileName = tkFileDialog.asksaveasfilename(filetypes = [("PY","py")],title = "Save Scene")
if(not fileName):
return
fCheck=Filename(fileName)
#print fCheck.getBasenameWoExtension()
###############################################################################
# !!!!! See if a module exists by this name... if it does you cannot use this filename !!!!!
###############################################################################
if(sys.modules.has_key(fCheck.getBasenameWoExtension())):
tkMessageBox.showwarning(
if(not fileName):
return
fCheck=Filename(fileName)
#print fCheck.getBasenameWoExtension()
###############################################################################
# !!!!! See if a module exists by this name... if it does you cannot use this filename !!!!!
###############################################################################
if(sys.modules.has_key(fCheck.getBasenameWoExtension())):
tkMessageBox.showwarning(
"Save file",
"Cannot save with this name because there is a system module with the same name. Please resave as something else."
)
)
return
self.CurrentDirName=fileName
fileName=fileName+".py"
return
self.CurrentDirName=fileName
fileName=fileName+".py"
f=FileSaver()
self.CurrentFileName=fileName
f.SaveFile(AllScene,fileName,self.CurrentDirName,0)
self.Dirty=0
self.parent.title('Scene Editor - '+ Filename.fromOsSpecific(self.CurrentFileName).getBasenameWoExtension())
self.CurrentFileName=fileName
f.SaveFile(AllScene,fileName,self.CurrentDirName,0)
self.Dirty=0
self.parent.title('Scene Editor - '+ Filename.fromOsSpecific(self.CurrentFileName).getBasenameWoExtension())
pass
def loadModel(self):
@ -962,7 +962,7 @@ class myLevelEditor(AppShell):
title = 'Load New Model',
parent = self.parent)
if modelFilename:
self.makeDirty()
self.makeDirty()
if not AllScene.loadModel(modelFilename, Filename.fromOsSpecific(modelFilename)):
print '----Error! No Such Model File!'
pass
@ -983,9 +983,9 @@ class myLevelEditor(AppShell):
title = 'Load New Actor',
parent = self.parent)
if ActorFilename:
self.makeDirty()
self.makeDirty()
if not AllScene.loadActor(ActorFilename, Filename.fromOsSpecific(ActorFilename)):
print '----Error! No Such Model File!'
pass
@ -1162,24 +1162,24 @@ class myLevelEditor(AppShell):
return
def addParticleEffect(self,effect_name,effect,node):
AllScene.particleDict[effect_name]=effect
AllScene.particleNodes[effect_name]=node
if not self.ParticleEnable:
AllScene.particleDict[effect_name]=effect
AllScene.particleNodes[effect_name]=node
if not self.ParticleEnable:
AllScene.particleNodes[effect_name].setTransparency(True)
AllScene.particleNodes[effect_name].setAlphaScale(0)
AllScene.particleNodes[effect_name].setBin("fixed",1)
return
return
def openParticlePanel(self):
if self.particlePanel != None:
## There already has a Particle panel!
return
if(len(AllScene.particleDict)==0):
self.particlePanel=seParticlePanel.ParticlePanel()
else:
for effect in AllScene.particleDict:
theeffect=AllScene.particleDict[effect]
self.particlePanel=seParticlePanel.ParticlePanel(particleEffect=theeffect,effectsDict=AllScene.particleDict)
if(len(AllScene.particleDict)==0):
self.particlePanel=seParticlePanel.ParticlePanel()
else:
for effect in AllScene.particleDict:
theeffect=AllScene.particleDict[effect]
self.particlePanel=seParticlePanel.ParticlePanel(particleEffect=theeffect,effectsDict=AllScene.particleDict)
pass
@ -1325,7 +1325,7 @@ class myLevelEditor(AppShell):
self.menuEdit.entryconfig('Duplicate', state=NORMAL)
self.menuEdit.entryconfig('Remove', state=NORMAL)
self.menuEdit.entryconfig('Object Properties', state=NORMAL)
if callBack:
if callBack:
self.seSession.select(nodePath,fResetAncestry=1)
messenger.send('SGE_Update Explorer',[render])
if not taskMgr.hasTaskNamed('seMonitorSelectedNode'):

View File

@ -603,6 +603,6 @@ class LoadAnimPanel(AppShell):
# Then, it will close the panel itself.
#################################################################
messenger.send('AW_AnimationLoad',[self.Actor,self.animDic])
#print self.animDic
#print self.animDic
self.quit()
return

File diff suppressed because it is too large Load Diff

View File

@ -96,8 +96,8 @@ class ForceGroup(DirectObject):
def printParams(self, file = sys.stdout, targ = 'self'):
"""printParams(file, targ)"""
i1=" "
i2=i1+i1
i1=" "
i2=i1+i1
file.write(i2+'# Force parameters\n')
for i in range(self.node.getNumForces()):
f = self.node.getForce(i)

View File

@ -26,7 +26,7 @@ class seLight(NodePath):
linear = 0.0,
quadratic = 0.0,
exponent = 0.0,
tag="",
tag="",
lence = None):
#################################################################
# __init__(self, light, parent, type,
@ -38,7 +38,7 @@ class seLight(NodePath):
# linear = 0.0,
# quadratic = 0.0,
# exponent = 0.0,
# tag="",
# tag="",
# lence = None):
# This constructor will create a light node inside it and upcast
# this light node to itself as a nodePath.
@ -68,24 +68,24 @@ class seLight(NodePath):
node = light.upcastToPandaNode()
# Attach node to self
self.LightNode=parent.attachNewNode(node)
self.LightNode.setTag("Metadata",tag)
if(self.type=='spot'):
self.LightNode.setHpr(self.orientation)
self.LightNode.setPos(self.position)
else:
self.LightNode.setHpr(self.orientation)
self.LightNode.setPos(self.position)
self.assign(self.LightNode)
self.LightNode=parent.attachNewNode(node)
self.LightNode.setTag("Metadata",tag)
if(self.type=='spot'):
self.LightNode.setHpr(self.orientation)
self.LightNode.setPos(self.position)
else:
self.LightNode.setHpr(self.orientation)
self.LightNode.setPos(self.position)
self.assign(self.LightNode)
if(self.type=='spot'):
self.helpModel = loader.loadModelCopy( "Spotlight" )
elif(self.type=='point'):
self.helpModel = loader.loadModelCopy( "Pointlight" )
elif(self.type=='directional'):
self.helpModel = loader.loadModelCopy( "Dirlight" )
else:
else:
self.helpModel = loader.loadModelCopy( "misc/Sphere" )
self.helpModel.setColor(self.lightcolor)
self.helpModel.reparentTo(self)
@ -156,7 +156,7 @@ class seLight(NodePath):
# Although you can call this function for all kinds of light,
# it will only meanful if this light is not a ambient light.
#################################################################
return self.specularColor
return self.specularColor
def setSpecColor(self,color):
#################################################################
@ -178,7 +178,7 @@ class seLight(NodePath):
# It only has meaning for "point Light" and "Directional light"
#################################################################
self.position = self.LightNode.getPos()
return self.position
return self.position
def setPosition(self, pos):
#################################################################
@ -201,8 +201,8 @@ class seLight(NodePath):
#
#################################################################
self.orientation = self.LightNode.getHpr()
return self.orientation
return self.orientation
def setOrientation(self,orient):
#################################################################
# setOrientation(self, orient)
@ -228,7 +228,7 @@ class seLight(NodePath):
# tyoe of lights.
#
#################################################################
return Vec3(self.constant,self.linear,self.quadratic)
return Vec3(self.constant,self.linear,self.quadratic)
def setConstantAttenuation(self, value):
#################################################################
@ -269,7 +269,7 @@ class seLight(NodePath):
# This function will return the value of the Exponent Attenuation
# of this light node. (float)
#################################################################
return self.exponent
return self.exponent
def setExponent(self, value):
#################################################################
@ -291,8 +291,8 @@ class seLightManager(NodePath):
# Initialize the superclass
NodePath.__init__(self)
# Create a node for the lights
self.lnode=render.attachNewNode('Lights')
self.assign(self.lnode)
self.lnode=render.attachNewNode('Lights')
self.assign(self.lnode)
# Create a light attrib
self.lightAttrib = LightAttrib.makeAllOff()
self.lightDict = {}
@ -319,8 +319,8 @@ class seLightManager(NodePath):
linear = 0.0,
quadratic = 0.0,
exponent = 0.0,
tag= "",
name='DEFAULT_NAME'):
tag= "",
name='DEFAULT_NAME'):
#################################################################
# create(self, type = 'ambient',
# lightcolor=VBase4(0.3,0.3,0.3,1),
@ -331,12 +331,12 @@ class seLightManager(NodePath):
# linear = 0.0,
# quadratic = 0.0,
# exponent = 0.0,
# tag= "",
# name='DEFAULT_NAME')
# As you can see, once user call this function and specify those
# variables, this function will create a seLight node.
# In the default, the light which just has been created will be
# set to off.
# tag= "",
# name='DEFAULT_NAME')
# As you can see, once user call this function and specify those
# variables, this function will create a seLight node.
# In the default, the light which just has been created will be
# set to off.
#################################################################
### create the light
@ -344,10 +344,10 @@ class seLightManager(NodePath):
if type == 'ambient':
self.ambientCount += 1
if(name=='DEFAULT_NAME'):
if(name=='DEFAULT_NAME'):
light = AmbientLight('ambient_' + `self.ambientCount`)
else:
light = AmbientLight(name)
else:
light = AmbientLight(name)
light.setColor(lightcolor)
@ -355,18 +355,18 @@ class seLightManager(NodePath):
self.directionalCount += 1
if(name=='DEFAULT_NAME'):
light = DirectionalLight('directional_' + `self.directionalCount`)
else:
light = DirectionalLight(name)
else:
light = DirectionalLight(name)
light.setColor(lightcolor)
light.setSpecularColor(specularColor)
elif type == 'point':
self.pointCount += 1
if(name=='DEFAULT_NAME'):
if(name=='DEFAULT_NAME'):
light = PointLight('point_' + `self.pointCount`)
else:
light = PointLight(name)
else:
light = PointLight(name)
light.setColor(lightcolor)
light.setSpecularColor(specularColor)
@ -374,10 +374,10 @@ class seLightManager(NodePath):
elif type == 'spot':
self.spotCount += 1
if(name=='DEFAULT_NAME'):
if(name=='DEFAULT_NAME'):
light = Spotlight('spot_' + `self.spotCount`)
else:
light = Spotlight(name)
else:
light = Spotlight(name)
light.setColor(lightcolor)
lence = PerspectiveLens()
@ -399,9 +399,9 @@ class seLightManager(NodePath):
linear = linear,
quadratic = quadratic,
exponent = exponent,
tag=tag,
tag=tag,
lence = lence
)
)
self.lightDict[light.getName()] = lightNode
self.setOn(lightNode)
@ -629,4 +629,4 @@ class seLightManager(NodePath):
# This function actually has the same functionality with getLightList(),
# but this one should be more efficient.
#################################################################
return self.lightDict.keys()
return self.lightDict.keys()

View File

@ -94,7 +94,7 @@ class DirectManipulationControl(PandaObject):
return Task.cont
def manipulationStop(self,xy=[]):
taskMgr.remove('manipulateObject')
taskMgr.remove('manipulateObject')
taskMgr.remove('manip-move-wait')
taskMgr.remove('manip-watch-mouse')
# depending on flag.....

View File

@ -209,12 +209,12 @@ class ParticleEffect(NodePath):
"""loadConfig(filename)"""
#try:
# if vfs:
print vfs.readFile(filename)
print vfs.readFile(filename)
exec vfs.readFile(filename)
print "Particle Effect Reading using VFS"
print "Particle Effect Reading using VFS"
# else:
# execfile(filename.toOsSpecific())
# print "Shouldnt be wrong"
# execfile(filename.toOsSpecific())
# print "Shouldnt be wrong"
#except:
# self.notify.error('loadConfig: failed to load particle file: '+ repr(filename))
@ -222,7 +222,7 @@ class ParticleEffect(NodePath):
def AppendConfig(self, f):
f.write('\n')
i1=" "
i1=" "
i2=i1+i1
# Make sure we start with a clean slate
f.write(i2+'self.effect.reset()\n')
@ -242,9 +242,9 @@ class ParticleEffect(NodePath):
for p in self.particlesDict.values():
target = 'p%d' % num
num = num + 1
f.write(i2+"if(mode==0):\n")
f.write(i2+i1+target + ' = seParticles.Particles(\'%s\')\n' % p.getName())
f.write(i2+"else:\n")
f.write(i2+"if(mode==0):\n")
f.write(i2+i1+target + ' = seParticles.Particles(\'%s\')\n' % p.getName())
f.write(i2+"else:\n")
f.write(i2+i1+target + ' = Particles.Particles(\'%s\')\n' % p.getName())
p.printParams(f, target)
f.write(i2+'self.effect.addParticles(%s)\n' % target)

View File

@ -34,7 +34,7 @@ class ParticlePanel(AppShell):
# Record particle effect
if particleEffect != None:
self.particleEffect = particleEffect
self.effectsDict = effectsDict
self.effectsDict = effectsDict
else:
# Or create a new one if none given
particles = seParticles.Particles()
@ -47,17 +47,17 @@ class ParticlePanel(AppShell):
particles.enable()
pe = seParticleEffect.ParticleEffect('effect1', particles)
self.particleEffect = pe
self.emitter=loader.loadModel("sphere")
pe.reparentTo(self.emitter)
self.emitter.setName("effect1")
self.emitter.reparentTo(render)
self.emitter=loader.loadModel("sphere")
pe.reparentTo(self.emitter)
self.emitter.setName("effect1")
self.emitter.reparentTo(render)
pe.enable()
messenger.send('ParticlePanel_Added_Effect',['effect1',pe,self.emitter])
self.effectsDict[self.particleEffect.getName()]=self.particleEffect
self.effectsDict[self.particleEffect.getName()]=self.particleEffect
messenger.send('SGE_Update Explorer',[render])
messenger.send('SGE_Update Explorer',[render])
# Initialize application specific info
AppShell.__init__(self)
@ -1713,7 +1713,7 @@ class ParticlePanel(AppShell):
name = askstring('Particle Panel', 'Effect Name:',
parent = self.parent)
if name:
particles = seParticles.Particles()
particles = seParticles.Particles()
particles.setBirthRate(0.02)
particles.setLitterSize(10)
particles.setLitterSpread(0)
@ -1725,12 +1725,12 @@ class ParticlePanel(AppShell):
self.effectsDict[name] = effect
self.updateMenusAndLabels()
self.selectEffectNamed(name)
self.emitter=loader.loadModel("sphere")
self.emitter.setName(name)
effect.reparentTo(self.emitter)
self.emitter.reparentTo(render)
self.emitter=loader.loadModel("sphere")
self.emitter.setName(name)
effect.reparentTo(self.emitter)
self.emitter.reparentTo(render)
effect.enable()
messenger.send('ParticlePanel_Added_Effect',[name,effect,self.emitter])
messenger.send('ParticlePanel_Added_Effect',[name,effect,self.emitter])
messenger.send('SGE_Update Explorer',[render])
def createNewParticles(self):

View File

@ -223,8 +223,8 @@ class Particles(ParticleSystem.ParticleSystem):
def printParams(self, file = sys.stdout, targ = 'self'):
"""printParams(file, targ)"""
i1=" "
i2=i1+i1
i1=" "
i2=i1+i1
file.write(i2+'# Particles parameters\n')
file.write(i2+targ + '.setFactory(\"' + self.factoryType + '\")\n')
file.write(i2+targ + '.setRenderer(\"' + self.rendererType + '\")\n')

View File

@ -550,13 +550,13 @@ class SelectionRay(SelectionQueue):
# No mouse in window.
self.clearEntries()
return
mx = base.mouseWatcherNode.getMouseX()
mx = base.mouseWatcherNode.getMouseX()
my = base.mouseWatcherNode.getMouseY()
#base.mouseWatcherNode.setDisplayRegion(base.win.getDisplayRegion(0))
#mx = base.mouseWatcherNode.getMouseX()+1
#my = base.mouseWatcherNode.getMouseY()+1
#print base.camNode.getName()
#print "Arrived X" + str(mx) + " Arrived Y " + str(my)
#print base.camNode.getName()
#print "Arrived X" + str(mx) + " Arrived Y " + str(my)
self.collider.setFromLens( base.camNode, mx, my )
self.ct.traverse( targetNodePath )