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 = ( optiondefs = (
('title', self.appname, None), ('title', self.appname, None),
) )
self.defineoptions(kw, optiondefs) self.defineoptions(kw, optiondefs)
self.Metanode=nodePath self.Metanode=nodePath
if(nodePath.hasTag("Metadata")): if(nodePath.hasTag("Metadata")):
self.Metatag=self.Metanode.getTag("Metadata") self.Metatag=self.Metanode.getTag("Metadata")
if parent == None: if parent == None:
self.parent = Toplevel() self.parent = Toplevel()
@ -36,24 +36,24 @@ class MetadataPanel(AppShell,Pmw.MegaWidget):
def appInit(self): def appInit(self):
print "Metadata Panel" print "Metadata Panel"
def createInterface(self): def createInterface(self):
interior = self.interior() interior = self.interior()
mainFrame = Frame(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) relief = RIDGE, borderwidth=5)
tag_label.pack() tag_label.pack()
source=StringVar() source=StringVar()
source.set(self.Metatag) source.set(self.Metatag)
self.tag_text=Entry(mainFrame, width=10,textvariable=source) self.tag_text=Entry(mainFrame, width=10,textvariable=source)
self.tag_text.pack() self.tag_text.pack()
set_button=Button(mainFrame, text='Set Metadata',font=('MSSansSerif', 15), set_button=Button(mainFrame, text='Set Metadata',font=('MSSansSerif', 15),
relief = RIDGE, borderwidth=5, command= lambda:self.SetIt()) relief = RIDGE, borderwidth=5, command= lambda:self.SetIt())
set_button.pack() set_button.pack()
mainFrame.pack(fill = 'both', expand = 1) mainFrame.pack(fill = 'both', expand = 1)
def SetIt(self): 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) # resetAll(self)
# This function will reset the whole scene # This function will reset the whole scene
################################################################# #################################################################
# Delete Everything in the Scene Graph # Delete Everything in the Scene Graph
for index in self.ModelDic: for index in self.ModelDic:
self.ModelDic[index].removeNode() self.ModelDic[index].removeNode()
for index in self.ActorDic: for index in self.ActorDic:
@ -137,22 +137,22 @@ class dataHolder:
self.collisionDict[index].removeNode() self.collisionDict[index].removeNode()
for index in self.particleNodes: for index in self.particleNodes:
self.particleDict[index].cleanup() self.particleDict[index].cleanup()
self.particleNodes[index].removeNode() self.particleNodes[index].removeNode()
# Clear all data containers in the dataHolder # Clear all data containers in the dataHolder
self.ModelDic.clear() self.ModelDic.clear()
self.ModelRefDic.clear() self.ModelRefDic.clear()
self.ActorDic.clear() self.ActorDic.clear()
self.ActorRefDic.clear() self.ActorRefDic.clear()
self.dummyDict.clear() self.dummyDict.clear()
self.lightManager.deleteAll() self.lightManager.deleteAll()
self.blendAnimDict.clear() self.blendAnimDict.clear()
self.particleDict.clear() self.particleDict.clear()
self.particleNodes.clear() self.particleNodes.clear()
self.ModelNum=0 self.ModelNum=0
self.ActorNum=0 self.ActorNum=0
self.theScene=None self.theScene=None
messenger.send('SGE_Update Explorer',[render]) messenger.send('SGE_Update Explorer',[render])
print 'Scene should be cleaned up!' print 'Scene should be cleaned up!'
@ -207,10 +207,10 @@ class dataHolder:
self.removeObj(node) self.removeObj(node)
list = self.lightManager.delete(name) list = self.lightManager.delete(name)
return list return list
elif self.particleNodes.has_key(name): elif self.particleNodes.has_key(name):
self.particleNodes[name].removeNode() self.particleNodes[name].removeNode()
del self.particleNodes[name] del self.particleNodes[name]
del self.particleDict[name] del self.particleDict[name]
else: else:
print 'You cannot remove this NodePath' print 'You cannot remove this NodePath'
return return
@ -588,7 +588,7 @@ class dataHolder:
return True return True
return False return False
def bindCurveToNode(self,node,curveCollection): def bindCurveToNode(self,node,curveCollection):
########################################################################### ###########################################################################
# bindCurveToNode(self,node,curveCollection) # bindCurveToNode(self,node,curveCollection)
@ -929,143 +929,143 @@ class dataHolder:
# loadScene(self) # loadScene(self)
# Opens a dialog box asking for a scene file to load. It then removes # Opens a dialog box asking for a scene file to load. It then removes
# the current scene and opens the new one. # the current scene and opens the new one.
# It basically proceeds by executig the python file containing the scene # It basically proceeds by executig the python file containing the scene
# and then re-populating the various dictionaries based on the dictionaries # and then re-populating the various dictionaries based on the dictionaries
# in the scene file hence reviving the state for the scene # in the scene file hence reviving the state for the scene
########################################################################### ###########################################################################
### Ask for a filename ### Ask for a filename
OpenFilename = tkFileDialog.askopenfilename(filetypes = [("PY","py")],title = "Load Scene") OpenFilename = tkFileDialog.askopenfilename(filetypes = [("PY","py")],title = "Load Scene")
if(not OpenFilename): if(not OpenFilename):
return None return None
f=Filename.fromOsSpecific(OpenFilename) f=Filename.fromOsSpecific(OpenFilename)
fileName=f.getBasenameWoExtension() fileName=f.getBasenameWoExtension()
dirName=f.getFullpathWoExtension() dirName=f.getFullpathWoExtension()
print "DATAHOLDER::" + dirName print "DATAHOLDER::" + dirName
############################################################################ ############################################################################
# Append the path to this file to our sys path where python looks for modules # 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 # 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())) sys.path.append(os.path.dirname(f.toOsSpecific()))
############################################################################ ############################################################################
# Actually import the scene... this executes the code in the scene # Actually import the scene... this executes the code in the scene
############################################################################ ############################################################################
self.theScene=__import__(fileName) 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 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]) messenger.send('SGE_Update Explorer',[render])
# Lets call some important initialization methods on our scene: # 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 #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 # Populate Model related Dictionaries
############################################################################ ############################################################################
for model in self.Scene.ModelDic: for model in self.Scene.ModelDic:
self.ModelDic[model]=self.Scene.ModelDic[model] self.ModelDic[model]=self.Scene.ModelDic[model]
#self.ModelRefDic[model]=self.Scene.ModelRefDic[model] # The Old absolute paths way #self.ModelRefDic[model]=self.Scene.ModelRefDic[model] # The Old absolute paths way
self.ModelRefDic[model]=Filename(dirName + "/" + self.Scene.ModelRefDic[model]) # Relative Paths self.ModelRefDic[model]=Filename(dirName + "/" + self.Scene.ModelRefDic[model]) # Relative Paths
self.ModelNum=self.ModelNum+1 self.ModelNum=self.ModelNum+1
############################################################################ ############################################################################
# Populate Actor related Dictionaries # Populate Actor related Dictionaries
############################################################################ ############################################################################
for actor in self.Scene.ActorDic: for actor in self.Scene.ActorDic:
self.ActorDic[actor]=self.Scene.ActorDic[actor] self.ActorDic[actor]=self.Scene.ActorDic[actor]
#self.ActorRefDic[actor]=self.Scene.ActorRefDic[actor] # Old way of doing absolute paths #self.ActorRefDic[actor]=self.Scene.ActorRefDic[actor] # Old way of doing absolute paths
self.ActorRefDic[actor]=Filename(dirName + "/" + self.Scene.ActorRefDic[actor]) # Relative Paths self.ActorRefDic[actor]=Filename(dirName + "/" + self.Scene.ActorRefDic[actor]) # Relative Paths
if(self.Scene.blendAnimDict.has_key(str(actor))): if(self.Scene.blendAnimDict.has_key(str(actor))):
self.blendAnimDict[actor]=self.Scene.blendAnimDict[actor] self.blendAnimDict[actor]=self.Scene.blendAnimDict[actor]
self.ActorNum=self.ActorNum+1 self.ActorNum=self.ActorNum+1
############################################################################ ############################################################################
# Populate Light related Dictionaries # Populate Light related Dictionaries
############################################################################ ############################################################################
#print self.Scene.LightDict #print self.Scene.LightDict
for light in self.Scene.LightDict: for light in self.Scene.LightDict:
#print light #print light
alight=self.Scene.LightDict[light] alight=self.Scene.LightDict[light]
type=self.Scene.LightTypes[light] type=self.Scene.LightTypes[light]
thenode=self.Scene.LightNodes[light] thenode=self.Scene.LightNodes[light]
#print type #print type
if type == 'ambient': if type == 'ambient':
self.lightManager.create('ambient',alight.getColor(),name=alight.getName(),tag=thenode.getTag("Metadata")) self.lightManager.create('ambient',alight.getColor(),name=alight.getName(),tag=thenode.getTag("Metadata"))
elif type == 'directional': elif type == 'directional':
#print alight.getPoint() #print alight.getPoint()
#print alight.getDirection() #print alight.getDirection()
self.lightManager.create('directional',alight.getColor(),alight.getSpecularColor(),thenode.getPos(),thenode.getHpr(),name=alight.getName(),tag=thenode.getTag("Metadata")) self.lightManager.create('directional',alight.getColor(),alight.getSpecularColor(),thenode.getPos(),thenode.getHpr(),name=alight.getName(),tag=thenode.getTag("Metadata"))
elif type == 'point': elif type == 'point':
atten=alight.getAttenuation() atten=alight.getAttenuation()
#print alight.getPoint() #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")) 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': 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")) 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: else:
print 'Invalid light type' print 'Invalid light type'
############################################################################ ############################################################################
# Populate Dummy related Dictionaries # Populate Dummy related Dictionaries
############################################################################ ############################################################################
for dummy in self.Scene.dummyDict: for dummy in self.Scene.dummyDict:
self.dummyDict[dummy] = self.Scene.dummyDict[dummy] self.dummyDict[dummy] = self.Scene.dummyDict[dummy]
############################################################################ ############################################################################
# Populate Collision related Dictionaries # Populate Collision related Dictionaries
############################################################################ ############################################################################
for collnode in self.Scene.collisionDict: for collnode in self.Scene.collisionDict:
self.collisionDict[collnode]=self.Scene.collisionDict[collnode] self.collisionDict[collnode]=self.Scene.collisionDict[collnode]
############################################################################ ############################################################################
# Populate Mopath related Dictionaries # Populate Mopath related Dictionaries
############################################################################ ############################################################################
for node in self.Scene.curveDict: for node in self.Scene.curveDict:
curveCollection=self.Scene.curveDict[node] curveCollection=self.Scene.curveDict[node]
for curve in curveCollection: for curve in curveCollection:
curveColl=ParametricCurveCollection() curveColl=ParametricCurveCollection()
nodeP=loader.loadModel(curve) nodeP=loader.loadModel(curve)
curveColl.addCurves(nodeP.node()) curveColl.addCurves(nodeP.node())
nodeP.removeNode() nodeP.removeNode()
thenode=render.find("**/"+str(node)) thenode=render.find("**/"+str(node))
self.bindCurveToNode(thenode,curveColl) self.bindCurveToNode(thenode,curveColl)
############################################################################ ############################################################################
# Populate Particle related Dictionaries # Populate Particle related Dictionaries
############################################################################ ############################################################################
for effect in self.Scene.particleDict: for effect in self.Scene.particleDict:
theeffect=self.Scene.particleDict[effect] theeffect=self.Scene.particleDict[effect]
emitter=loader.loadModel("sphere") emitter=loader.loadModel("sphere")
emitter.setPosHprScale(theeffect.getX(),theeffect.getY(),theeffect.getZ(),theeffect.getH(),theeffect.getP(),theeffect.getR(),theeffect.getSx(),theeffect.getSy(),theeffect.getSz()) 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.setPos(0,0,0)
theeffect.setName(str(effect)) theeffect.setName(str(effect))
tempparent=theeffect.getParent() tempparent=theeffect.getParent()
theeffect.reparentTo(emitter) theeffect.reparentTo(emitter)
emitter.setName(str(effect)) emitter.setName(str(effect))
emitter.reparentTo(tempparent) emitter.reparentTo(tempparent)
theeffect.enable() theeffect.enable()
self.particleDict[effect]=theeffect self.particleDict[effect]=theeffect
self.particleNodes[effect]=emitter 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()
############################################################################
# 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]) messenger.send('SGE_Update Explorer',[render])
if(OpenFilename): if(OpenFilename):
return OpenFilename return OpenFilename
else: else:
return None return None
def getList(self): 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.initialiseoptions(myLevelEditor)
self.parent.resizable(False,False) ## Disable the ability to resize for this Window. self.parent.resizable(False,False) ## Disable the ability to resize for this Window.
######### Set the event handler ########## ######### Set the event handler ##########
self.dataFlowEvents = [ self.dataFlowEvents = [
## Event from Side Window ## Event from Side Window
@ -202,14 +202,14 @@ class myLevelEditor(AppShell):
['SEditor-ToggleBackface',self.toggleBackface], ['SEditor-ToggleBackface',self.toggleBackface],
['SEditor-ToggleTexture',self.toggleTexture], ['SEditor-ToggleTexture',self.toggleTexture],
['SEditor-ToggleWireframe',self.toggleWireframe], ['SEditor-ToggleWireframe',self.toggleWireframe],
['ParticlePanel_Added_Effect',self.addParticleEffect], ['ParticlePanel_Added_Effect',self.addParticleEffect],
] ]
################################# #################################
### Collision detection ### Collision detection
################################# #################################
self.cTrav = CollisionTraverser() self.cTrav = CollisionTraverser()
base.cTrav = self.cTrav base.cTrav = self.cTrav
for event in self.dataFlowEvents: for event in self.dataFlowEvents:
@ -223,7 +223,7 @@ class myLevelEditor(AppShell):
['SGE_Remove', self.remove], ['SGE_Remove', self.remove],
['SGE_Add Dummy', self.addDummyNode], ['SGE_Add Dummy', self.addDummyNode],
['SGE_Add Collision Object', self.addCollisionObj], ['SGE_Add Collision Object', self.addCollisionObj],
['SGE_Metadata', self.openMetadataPanel], ['SGE_Metadata', self.openMetadataPanel],
['SGE_Set as Reparent Target', self.setAsReparentTarget], ['SGE_Set as Reparent Target', self.setAsReparentTarget],
['SGE_Reparent to Target', self.reparentToNode], ['SGE_Reparent to Target', self.reparentToNode],
['SGE_Animation Panel', self.openAnimPanel], ['SGE_Animation Panel', self.openAnimPanel],
@ -255,17 +255,17 @@ class myLevelEditor(AppShell):
### Create SceneEditor Ver. DirectSession ### Create SceneEditor Ver. DirectSession
self.seSession = SeSession() self.seSession = SeSession()
self.seSession.enable() self.seSession.enable()
SEditor.camera.setPos(0,-50,10) SEditor.camera.setPos(0,-50,10)
self.placer=None self.placer=None
self.MopathPanel = None self.MopathPanel = None
self.alignPanelDict = {} self.alignPanelDict = {}
#self.quadview=QuadView() #self.quadview=QuadView()
self.lightingPanel = None
self.controllerPanel = None self.lightingPanel = None
self.particlePanel = None self.controllerPanel = None
self.particlePanel = None
### Create Side Window ### Create Side Window
self.sideWindow = sideWindow(worldColor = self.worldColor, self.sideWindow = sideWindow(worldColor = self.worldColor,
@ -293,7 +293,7 @@ class myLevelEditor(AppShell):
### Creating the Buttons in the window frame ### Creating the Buttons in the window frame
####################################################### #######################################################
buttonFrame = Frame(interior) buttonFrame = Frame(interior)
self.image=[] self.image=[]
self.image.append(PhotoImage(file='new.gif'))#0 self.image.append(PhotoImage(file='new.gif'))#0
self.image.append(PhotoImage(file='open.gif'))#1 self.image.append(PhotoImage(file='open.gif'))#1
self.image.append(PhotoImage(file='save.gif'))#2 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')) self.image.append(PhotoImage(file='blank.gif'))
self.image.append(PhotoImage(file='blank.gif')) self.image.append(PhotoImage(file='blank.gif'))
i = 0 i = 0
@ -324,11 +324,11 @@ class myLevelEditor(AppShell):
i += 1 i += 1
button = Button(buttonFrame, image = element, command=lambda n=i : self.buttonPushed(n)) button = Button(buttonFrame, image = element, command=lambda n=i : self.buttonPushed(n))
button.pack(fill=X, side = LEFT) button.pack(fill=X, side = LEFT)
buttonFrame.pack(fill=X, side=LEFT,expand=True) buttonFrame.pack(fill=X, side=LEFT,expand=True)
def buttonPushed(self, buttonIndex): def buttonPushed(self, buttonIndex):
################################################################# #################################################################
# buttonPushed(self, buttonNum) # buttonPushed(self, buttonNum)
@ -339,8 +339,8 @@ class myLevelEditor(AppShell):
#### Change here to process the button event further. #### Change here to process the button event further.
#### ####
if buttonIndex==1: # New Scene if buttonIndex==1: # New Scene
self.newScene() self.newScene()
return return
elif buttonIndex==2: # Open Scene elif buttonIndex==2: # Open Scene
self.openScene() self.openScene()
return return
@ -357,13 +357,13 @@ class myLevelEditor(AppShell):
self.openPlacerPanel() self.openPlacerPanel()
return return
elif buttonIndex==7: # Open Mopath Panel elif buttonIndex==7: # Open Mopath Panel
self.openMoPathPanel() self.openMoPathPanel()
return return
elif buttonIndex==8: # Open Lighting Panel elif buttonIndex==8: # Open Lighting Panel
self.openLightingPanel() self.openLightingPanel()
return return
elif buttonIndex==9: # Open Particle Panel elif buttonIndex==9: # Open Particle Panel
self.openParticlePanel() self.openParticlePanel()
return return
elif buttonIndex==10: elif buttonIndex==10:
self.openInputPanel() self.openInputPanel()
@ -570,7 +570,7 @@ class myLevelEditor(AppShell):
## Processing message events ## Processing message events
def makeDirty(self): def makeDirty(self):
self.Dirty=1 self.Dirty=1
def removeLight(self, lightNode): def removeLight(self, lightNode):
################################################################# #################################################################
@ -627,7 +627,7 @@ class myLevelEditor(AppShell):
list, lightNode = AllScene.createLight(type = type) list, lightNode = AllScene.createLight(type = type)
if self.lightingPanel != None: if self.lightingPanel != None:
self.lightingPanel.updateList(list,lightNode) self.lightingPanel.updateList(list,lightNode)
self.makeDirty() self.makeDirty()
return return
def lightingPanelClose(self): def lightingPanelClose(self):
@ -662,9 +662,9 @@ class myLevelEditor(AppShell):
return return
def openMetadataPanel(self,nodePath=None): def openMetadataPanel(self,nodePath=None):
print nodePath print nodePath
self.MetadataPanel=MetadataPanel(nodePath) self.MetadataPanel=MetadataPanel(nodePath)
pass pass
def duplicate(self, nodePath = None): def duplicate(self, nodePath = None):
################################################################# #################################################################
@ -706,7 +706,7 @@ class myLevelEditor(AppShell):
# #
################################################################# #################################################################
AllScene.addDummyNode(nodepath) AllScene.addDummyNode(nodepath)
self.makeDirty() self.makeDirty()
pass pass
def addCollisionObj(self, nodepath = None): def addCollisionObj(self, nodepath = None):
@ -820,67 +820,67 @@ class myLevelEditor(AppShell):
# and will reset the application title to "New Scene" # and will reset the application title to "New Scene"
################################################################# #################################################################
self.closeAllSubWindows() ## Close all sub window self.closeAllSubWindows() ## Close all sub window
if(self.CurrentFileName): if(self.CurrentFileName):
currentF=Filename(self.CurrentFileName) currentF=Filename(self.CurrentFileName)
self.CurrentFileName=None self.CurrentFileName=None
AllScene.resetAll() AllScene.resetAll()
currentModName=currentF.getBasenameWoExtension() currentModName=currentF.getBasenameWoExtension()
# Let us actually remove the scene from sys modules... this is done because every scene is loaded as a module # 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 # 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 there is ever a garbage colleciton bug..this might be a point to look at
if sys.modules.has_key(currentModName): if sys.modules.has_key(currentModName):
del sys.modules[currentModName] del sys.modules[currentModName]
print sys.getrefcount(AllScene.theScene) print sys.getrefcount(AllScene.theScene)
del AllScene.theScene del AllScene.theScene
else: else:
AllScene.resetAll() AllScene.resetAll()
self.parent.title('Scene Editor - New Scene') self.parent.title('Scene Editor - New Scene')
pass pass
def openScene(self): def openScene(self):
################################################################# #################################################################
# 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): if(self.CurrentFileName or self.Dirty):
saveScene = tkMessageBox._show("Load scene","Save the current scene?",icon = tkMessageBox.QUESTION,type = tkMessageBox.YESNOCANCEL) saveScene = tkMessageBox._show("Load scene","Save the current scene?",icon = tkMessageBox.QUESTION,type = tkMessageBox.YESNOCANCEL)
if (saveScene == "yes"): if (saveScene == "yes"):
self.saveScene() self.saveScene()
elif (saveScene == "cancel"): elif (saveScene == "cancel"):
return return
self.closeAllSubWindows() ## Close all sub window self.closeAllSubWindows() ## Close all sub window
if(self.CurrentFileName): if(self.CurrentFileName):
currentF=Filename(self.CurrentFileName) currentF=Filename(self.CurrentFileName)
AllScene.resetAll() AllScene.resetAll()
currentModName=currentF.getBasenameWoExtension() currentModName=currentF.getBasenameWoExtension()
# Let us actually remove the scene from sys modules... this is done because every scene is loaded as a module # 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 # 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 there is ever a garbage colleciton bug..this might be a point to look at
if sys.modules.has_key(currentModName): if sys.modules.has_key(currentModName):
del sys.modules[currentModName] del sys.modules[currentModName]
print sys.getrefcount(AllScene.theScene) print sys.getrefcount(AllScene.theScene)
del AllScene.theScene del AllScene.theScene
else: else:
AllScene.resetAll() AllScene.resetAll()
self.CurrentFileName = AllScene.loadScene() self.CurrentFileName = AllScene.loadScene()
if(self.CurrentFileName==None):
return
thefile=Filename(self.CurrentFileName) if(self.CurrentFileName==None):
thedir=thefile.getFullpathWoExtension() return
print "SCENE EDITOR::" + thedir
self.CurrentDirName=thedir thefile=Filename(self.CurrentFileName)
if self.CurrentFileName != None: thedir=thefile.getFullpathWoExtension()
print "SCENE EDITOR::" + thedir
self.CurrentDirName=thedir
if self.CurrentFileName != None:
self.parent.title('Scene Editor - '+ Filename.fromOsSpecific(self.CurrentFileName).getBasenameWoExtension()) self.parent.title('Scene Editor - '+ Filename.fromOsSpecific(self.CurrentFileName).getBasenameWoExtension())
if self.lightingPanel !=None: if self.lightingPanel !=None:
lightList=AllScene.getList() lightList=AllScene.getList()
self.lightingPanel.updateList(lightList) self.lightingPanel.updateList(lightList)
messenger.send('SGE_Update Explorer',[render]) messenger.send('SGE_Update Explorer',[render])
# Close the side window in order to reset all world settings to fit the scene we have loaded. # Close the side window in order to reset all world settings to fit the scene we have loaded.
self.sideWindow.quit() self.sideWindow.quit()
@ -905,45 +905,45 @@ class myLevelEditor(AppShell):
# If this filename exists in sys.modules you cannot use it # If this filename exists in sys.modules you cannot use it
################################################################# #################################################################
if(self.CurrentFileName): if(self.CurrentFileName):
f=FileSaver() f=FileSaver()
f.SaveFile(AllScene,self.CurrentFileName,self.CurrentDirName,1) f.SaveFile(AllScene,self.CurrentFileName,self.CurrentDirName,1)
self.Dirty=0 self.Dirty=0
else: else:
self.saveAsScene() self.saveAsScene()
pass pass
def saveAsScene(self): def saveAsScene(self):
################################################################# #################################################################
# saveAsScene(self) # saveAsScene(self)
# Ask for filename using a file save dialog # Ask for filename using a file save dialog
# If this filename exists in sys.modules you cannot use it # If this filename exists in sys.modules you cannot use it
# Instantiate FileSaver from seFileSaver.py and pass it the filename # Instantiate FileSaver from seFileSaver.py and pass it the filename
################################################################# #################################################################
fileName = tkFileDialog.asksaveasfilename(filetypes = [("PY","py")],title = "Save Scene") fileName = tkFileDialog.asksaveasfilename(filetypes = [("PY","py")],title = "Save Scene")
if(not fileName): if(not fileName):
return return
fCheck=Filename(fileName) fCheck=Filename(fileName)
#print fCheck.getBasenameWoExtension() #print fCheck.getBasenameWoExtension()
############################################################################### ###############################################################################
# !!!!! See if a module exists by this name... if it does you cannot use this filename !!!!! # !!!!! See if a module exists by this name... if it does you cannot use this filename !!!!!
############################################################################### ###############################################################################
if(sys.modules.has_key(fCheck.getBasenameWoExtension())): if(sys.modules.has_key(fCheck.getBasenameWoExtension())):
tkMessageBox.showwarning( tkMessageBox.showwarning(
"Save file", "Save file",
"Cannot save with this name because there is a system module with the same name. Please resave as something else." "Cannot save with this name because there is a system module with the same name. Please resave as something else."
) )
return return
self.CurrentDirName=fileName self.CurrentDirName=fileName
fileName=fileName+".py" fileName=fileName+".py"
f=FileSaver() f=FileSaver()
self.CurrentFileName=fileName self.CurrentFileName=fileName
f.SaveFile(AllScene,fileName,self.CurrentDirName,0) f.SaveFile(AllScene,fileName,self.CurrentDirName,0)
self.Dirty=0 self.Dirty=0
self.parent.title('Scene Editor - '+ Filename.fromOsSpecific(self.CurrentFileName).getBasenameWoExtension()) self.parent.title('Scene Editor - '+ Filename.fromOsSpecific(self.CurrentFileName).getBasenameWoExtension())
pass pass
def loadModel(self): def loadModel(self):
@ -962,7 +962,7 @@ class myLevelEditor(AppShell):
title = 'Load New Model', title = 'Load New Model',
parent = self.parent) parent = self.parent)
if modelFilename: if modelFilename:
self.makeDirty() self.makeDirty()
if not AllScene.loadModel(modelFilename, Filename.fromOsSpecific(modelFilename)): if not AllScene.loadModel(modelFilename, Filename.fromOsSpecific(modelFilename)):
print '----Error! No Such Model File!' print '----Error! No Such Model File!'
pass pass
@ -983,9 +983,9 @@ class myLevelEditor(AppShell):
title = 'Load New Actor', title = 'Load New Actor',
parent = self.parent) parent = self.parent)
if ActorFilename: if ActorFilename:
self.makeDirty() self.makeDirty()
if not AllScene.loadActor(ActorFilename, Filename.fromOsSpecific(ActorFilename)): if not AllScene.loadActor(ActorFilename, Filename.fromOsSpecific(ActorFilename)):
print '----Error! No Such Model File!' print '----Error! No Such Model File!'
pass pass
@ -1162,24 +1162,24 @@ class myLevelEditor(AppShell):
return return
def addParticleEffect(self,effect_name,effect,node): def addParticleEffect(self,effect_name,effect,node):
AllScene.particleDict[effect_name]=effect AllScene.particleDict[effect_name]=effect
AllScene.particleNodes[effect_name]=node AllScene.particleNodes[effect_name]=node
if not self.ParticleEnable: if not self.ParticleEnable:
AllScene.particleNodes[effect_name].setTransparency(True) AllScene.particleNodes[effect_name].setTransparency(True)
AllScene.particleNodes[effect_name].setAlphaScale(0) AllScene.particleNodes[effect_name].setAlphaScale(0)
AllScene.particleNodes[effect_name].setBin("fixed",1) AllScene.particleNodes[effect_name].setBin("fixed",1)
return return
def openParticlePanel(self): def openParticlePanel(self):
if self.particlePanel != None: if self.particlePanel != None:
## There already has a Particle panel! ## There already has a Particle panel!
return return
if(len(AllScene.particleDict)==0): if(len(AllScene.particleDict)==0):
self.particlePanel=seParticlePanel.ParticlePanel() self.particlePanel=seParticlePanel.ParticlePanel()
else: else:
for effect in AllScene.particleDict: for effect in AllScene.particleDict:
theeffect=AllScene.particleDict[effect] theeffect=AllScene.particleDict[effect]
self.particlePanel=seParticlePanel.ParticlePanel(particleEffect=theeffect,effectsDict=AllScene.particleDict) self.particlePanel=seParticlePanel.ParticlePanel(particleEffect=theeffect,effectsDict=AllScene.particleDict)
pass pass
@ -1325,7 +1325,7 @@ class myLevelEditor(AppShell):
self.menuEdit.entryconfig('Duplicate', state=NORMAL) self.menuEdit.entryconfig('Duplicate', state=NORMAL)
self.menuEdit.entryconfig('Remove', state=NORMAL) self.menuEdit.entryconfig('Remove', state=NORMAL)
self.menuEdit.entryconfig('Object Properties', state=NORMAL) self.menuEdit.entryconfig('Object Properties', state=NORMAL)
if callBack: if callBack:
self.seSession.select(nodePath,fResetAncestry=1) self.seSession.select(nodePath,fResetAncestry=1)
messenger.send('SGE_Update Explorer',[render]) messenger.send('SGE_Update Explorer',[render])
if not taskMgr.hasTaskNamed('seMonitorSelectedNode'): if not taskMgr.hasTaskNamed('seMonitorSelectedNode'):

View File

@ -603,6 +603,6 @@ class LoadAnimPanel(AppShell):
# Then, it will close the panel itself. # Then, it will close the panel itself.
################################################################# #################################################################
messenger.send('AW_AnimationLoad',[self.Actor,self.animDic]) messenger.send('AW_AnimationLoad',[self.Actor,self.animDic])
#print self.animDic #print self.animDic
self.quit() self.quit()
return 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'): def printParams(self, file = sys.stdout, targ = 'self'):
"""printParams(file, targ)""" """printParams(file, targ)"""
i1=" " i1=" "
i2=i1+i1 i2=i1+i1
file.write(i2+'# Force parameters\n') file.write(i2+'# Force parameters\n')
for i in range(self.node.getNumForces()): for i in range(self.node.getNumForces()):
f = self.node.getForce(i) f = self.node.getForce(i)

View File

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

View File

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

View File

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

View File

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

View File

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