Emanuele, try this code I just posted on forum to see if works, because if not maybe you got issues with wxWidgets (maybe an older version):
discourse.panda3d.org/viewtopic … 0185#30185
I can assure you it’s not likely to be a wxWidgets issue. Like I said, I just checked in some fixes that will most likely fix it, try those.
so then is a syncro problem between wx and panda stuff, pro-rsoft, as I experienced before. Talking about the code I posted mentioned above, it have been very hard to make it working and stable here on my rig because of many errors similar of that posted by Emanuele. Maybe you may look into to see if there is some useful for you to solve your issues.
It’s most likely a mistake in the editor. Looking at the traceback, here’s the most likely cause: when you select an item in the editor, the SceneGraphTree.selectNodePath method gets raised. This calls wx.TreeCtrl.SelectItem, which raises SceneGraphTree.onSelChange, which calls modelController.selectModel, which raises the event SceneGraphTree.selectNodePath, and this process continues round and round. I’ve added a hack around this circular selection.
Please stop debating what the problem might be when you can just do an “svn update” and see if it works now.
sorry to not have good news for you pro-rsoft but the situation is deteriorated here, this is what I got now just launching src/main.py:
:grutil(warning): Rescaling heightfield image /home2/kartoffeln/Work/c/panda/SVN/EDITOR/trunk/examples/terrain.png to 257 by 257 pixels
:grutil(warning): Rescaling heightfield image /home2/kartoffeln/Work/c/panda/SVN/EDITOR/trunk/examples/terrain.png to 257 by 257 pixels
I: EditApp.loadEggModelsFile: done
Traceback (most recent call last):
File "src/main.py", line 45, in <module>
app = EditorApp(editor)
File "/home2/kartoffeln/Work/c/panda/SVN/EDITOR/trunk/src/wxgui/pEditorApp.py", line 58, in __init__
self.sceneGraphTree = SceneGraphTree(self.sideBarSplitter)
File "/home2/kartoffeln/Work/c/panda/SVN/EDITOR/trunk/src/wxgui/pSceneGraphTree.py", line 32, in __init__
self.reload()
File "/home2/kartoffeln/Work/c/panda/SVN/EDITOR/trunk/src/wxgui/pSceneGraphTree.py", line 66, in reload
self.onSelChange(renderId)
File "/home2/kartoffeln/Work/c/panda/SVN/EDITOR/trunk/src/wxgui/pSceneGraphTree.py", line 40, in onSelChange
if self.ignoreSelChange: return
AttributeError: 'SceneGraphTree' object has no attribute 'ignoreSelChange'
Just for check: I noticed you put in the command line switching and made default wxgui, is that right?
For bugreports please note that we not only need the console output. but a exact description of what you did.
- operating system
- selected gui
- revision
- what you did after you started the editor
- console output
the more info we get. the more likely we can find and resolve a problem.
pro-rsoft: the problem is that it’s valid to have the same object selected multiple times. so i cant really catch that in the editor. i could actually send different signals, depending if a model has been selected again (which changes the type of modification in the gui), or a different object has been selected.
– edit –
i implemented that suggested change above:
now there are 2 different signals sent by the modelcontroller. EVENT_MODELCONTROLLER_SELECT_MODEL_CHANGE is sent if a different model has been selected (may be None).
EVENT_MODELCONTROLLER_SELECT_MODEL_AGAIN is sent if a model has been selected repeatedly.
i think (and hope) this problem is solved now.
Yep, the recursion bug was resolved (i think, i hope)!
Now you must move row 34 in:
“…/wxgui/pSceneGraphTree.py”
to row 29, so the editor starts.
Mmm…a stupid question: how can I move the viewport camera in the “wxgui” version?
thats not yet implemented afaik
i’ve been working on the dgui interface a bit, now all windows are sidebars:
open windows:
with some closed windows:
[/img]
Hi all,
I would like to contribute to the editor with some suggestions, because, unfortunately, I do not have free time to work on it. However, someday I will try it (I hope):
-
Triggers. This is a must-have in an editor. When a character or an avatar enters into or passes over a concrete area (rectangle, circle, polygon, etc), the trigger shall set a flag, execute a function, send a message or any other action required by the game.
Users shall be able to define the triggers inside of the editor and the game engine will execute them. -
Objects / Scenes properties. I would add properties to them like size, weight, magic points, etc. Or even user-defined. The game engine will use them when required.
-
Collision. To let the users the possibility to add collision models or boxes to objects. Also, to define a special collision object like the ground floor or a water object.
-
Pathfinding. (This is very complicated, I think). To define the walkable areas of a scene. It can be done manually or automatically. I suggest to save the maps or walk-points in separate files.
-
Exits. To define special exits that connect two scenes. In my game, an exit includes the area, the other scene name, the actor’s new position and orientation.
-
Not egg files. Best option is to let the final user to decide what to use. I would suggest to create .py files directly. So, a .py file will include the definition of the scene.
Usually, in a game, you have an object manager, a room manager, etc. In my opinion, it is very complicated to use that kind of mechanism / patterns loading the scene from an .egg file.Well, this is just my opinion. I hope this help.
Regads,
Alberto
Can somone post this in a way that is easier to download and try out. Maybe a zip file somewhere. That google page is confusing for those of use NOT using linux(Yes there are some of us here) and NOT intimately familair with the ins and outs of SVN
hi ajfg,
thanks for the input.
a lot of the things you suggest are acutally planned, however implementing them takes quite a while. keeping things consistent and easy to manage is one of the biggest challenges. while i would like to add as many features as possible it’s more important to have something manageable.
At the current state the world editor is more or less usable. That means you can place particlesystems, models, sounds, terrains and lights. The initial target for a minimal version is reached at this stage. while it’s working, it’s not finished. it needs polishing and checking for bugs.
However i have started working on another part of the editor which will concentrate on editing existing models. My target is to make it possible to edit terrains, paint the terrain add collision solids to models. those collision boxes should be able to provide triggers.
adding properties to objects is possible, however at the current state it doesnt make sense to add such a feature.
it’s not reasonable to add pathfinding in the next versions, it may one time be possible to define a walk-point-grid. however ai and such is not something to include into the editor.
i wont change the usage of egg-files to any other format. It does provide a good and standardized way to store informations. saving to py files is one of the worst concepts i can think of. it’s like html code generated by some early wysiwyg editors. It’s currently possible to write and read from egg files. while it only respects external referenced files it does work for loading and saving very well.
While it’s saved to a egg file format it’s not yet readable from panda3d directly, it’s planned to use some other file extension, while keeping the file-format. To read the scene you need the loader (which is part of the editor, test it when starting the editor with -n). The loader also uses some modules to manage the scene, which will be enabled as well (for example a modelIdManager which knows every object placed)
i will add a sample programm which shows usage of all enabled features when using the editor only to load a scene.
We will release a package for easy install once the editor is in a usable state.
Right now it doesnt work well enought to do that
In my opinion COLLADA is the best choice: standard, multi-purpose and with an existent Panda3D importer made by pror-soft.
you misunderstand the purpose of the worldeditor. the egg files it writes does not contain a real model. it doesnt contain any vertex informations at all. the only thing it does is linking existing models by using externalReferences (which is a feature collada cant provide). similar to a html page with links to pages that contain informations. it should be possible to link collada models into the scene as well, if panda can read those models.
the objecteditor part will make it possible to modify models. while collada might be a better option there, i rely on EggData to read and write models. a important part in this is writing… panda doesnt support collada writing, thus it’s currently not possible to edit models in any other format then egg.
Actually, COLLADA does support external references, and panda can write collada files (the egg2dae isn’t that far yet though.)
so it could be a good functionality. but .egg has more priority right now.
Hi Hypnos,
Triggers are not just the collision boxes. They are a sort of sensors. So, you need something to test and a way of communicating the result of the test.
Then, if you do not plan to add such features, why are you doing another simple editor? There are hundreds on Internet. Just take an open source and change the way of exporting the scenes or maps.
For me an editor has to provide more features than just putting an object over another object or painting the ground. It helps game designers to easily create scenes, rooms or games. For example:
- Objects. Fixed or moveable. Can or cannot by taken, used, actioned, etc.
Which key opens a door. - Herarchy of objects. Base and derivate classes
- Triggers. When they are active or not. How to pass from one state to another. Different shapes; circle, rectangle, polygon. 2D or 3D
- Meshes. Navigation mesh; where an avatar can walk. Collision mesh.
Normal mesh. They have to be stored in separated files.
Just my opinion.
Regards,
Alberto
Your ideas sound good, and IMHO it wouldn’t be a bad idea to have a mode where that’s possible and to save the scene as .py file.
i’ve made some progress in this week.
it’s now possible to paint terrain within the editor (using a shader)
it’s also possible to edit egg file parameters (of models) like collision settings etc.
the mayor time between the last update and the current state was due to a mayor reconstruction of the core system. it also took a while to get directgui interfaces setup i could use.
the wx-gui is currently broken in the cvs.
i’ve created a sample which shows, how a scene created with the editor, can be used:
the code is pretty simple:
#!/usr/bin/env python
''' sample showing the usage of the editor in scene loading
'''
from pandac.PandaModules import *
from direct.showbase.DirectObject import DirectObject
KEYBINDINGS = {
'w': [Vec3(0,20,0), Vec3(0,0,0)],
's': [Vec3(0,-20,0), Vec3(0,0,0)],
'q': [Vec3(-10,0,0), Vec3(0,0,0)],
'e': [Vec3(10,0,0), Vec3(0,0,0)],
'a': [Vec3(0,0,0), Vec3(45,0,0)],
'd': [Vec3(0,0,0), Vec3(-45,0,0)],
}
class Player(DirectObject):
def __init__(self):
self.terrain = modelIdManager.getObjectByName('terrain.png')[0]
#self.terrain.terrainNode.setRenderModeWireframe()
self.playerNode = render.attachNewNode('playerPos')
self.playerNode.setPos(0,0,0)
self.focalPoint = self.playerNode.attachNewNode('focalPoint')
self.focalPoint.setPos(0,100,0)
base.camera.reparentTo(self.playerNode)
base.camera.setPos(0,-25,50)
base.camera.lookAt(self.playerNode, Point3(0,0,10))
base.camLens.setFar(2000)
taskMgr.add(self.update, 'update')
self.pressedKeys = dict()
for key in KEYBINDINGS.keys():
self.accept(key, self.keyPress, [key, True])
self.accept(key+"-up", self.keyPress, [key, False])
def keyPress(self, key, state):
self.pressedKeys[key] = state
def update(self, task):
dt = globalClock.getDt()
for key, state in self.pressedKeys.items():
if state:
mov, rot = KEYBINDINGS[key]
self.playerNode.setPos(self.playerNode, mov*dt)
self.playerNode.setHpr(self.playerNode, rot*dt)
# get elevation of the player on the terrain
playerPos = self.playerNode.getPos(self.terrain.terrainNode)
terrainZ = self.terrain.terrain.getElevation(playerPos[0], playerPos[1])
playerZ = render.getRelativePoint( self.terrain.terrainNode, Vec3(0,0,terrainZ) )
self.playerNode.setZ(render, playerZ.getZ() + 3)
# set the focal point
focalPos = self.focalPoint.getPos(self.terrain.terrainNode)
self.terrain.terrain.setFocalPoint(focalPos)
self.terrain.terrain.update()
return task.cont
if __name__ == '__main__':
from direct.directbase import DirectStart
from core.pMain import *
#base.disableMouse()
editor = EditorClass(render)
editor.loadEggModelsFile("examples/mytestscene.egs")
player = Player()
print "all objects"
for obj in modelIdManager.getAllObjects():
print " -", obj.getName()
run()
and that’s a movie from running this sample:
http://public.nouser.org/~rspoerri/tmp/editor-game.mpv
the whole scene was created with the editor, (not the models itself, but placement etc.) the particle systems can be placed, also the particle editor open when you select a particel system, thus you can modify it (watch changes in the editor). The terrain painting and height deformation work quite well now.
the scene is not yet optimized to look very well, the texture modes could be improved, as well as the textures themself. the terrain popping is because i am using a very low detail on the geomipterrain.