Simple LEvel Editor for Panda3D (WORKING!)


V 1.01

DOWNLOAD LINK (ziped source):

What’s new:
-should not crash when hightmap is missing
-walk maps
Layer #0 in the texture paint mode has now a special use. It’s just another gray-scale image/mask and you can’t select a texture for it, by itself it does exactly nothing, but the image can be used to determine what parts of the map are walkable. There’s a good example on the forum on how it can be used: Limiting the terrain that an actor can walk on
It’s even a bit simpler if you use a geomipterrain the worlds X and Y map exactly to the maps X and Y coordinates.


Isn’t available the possibility to load an already existent map into the editor?

added these 4 lines at the end of init make the map load in case there is a name specified via command line:

		# if there are additional args then load map
		# else create a new map
		if len(sys.argv) >1:

I found an annoying bug :frowning: I paint on a first layer. Then i switch to the second and paint there, switch back to 1st layer and paint. I lost all the previous modifications I did to the first layer.



def selctLayer(self, layer, notUsed=None):        
        self.textureFrames[0]['frameColor']=(1, 1, 1, 0.5)
        if os.path.exists(path+self.saveName+"/"+file):    
            self.altPlane.setTexture(loader.loadTexture(path+self.saveName+"/"+file), 1)
            self.altPlane.setTexture(loader.loadTexture("full_mask.png"), 1)
        if layer == len(self.textureFrames)-1:
            self.textureFrames.append(DirectFrame(frameSize=(-64, 0, 0, 64),
                                    frameColor=(1, 1, 1, 1),
            self.textureFrames[layer+1].bind(DGG.B1PRESS, self.selctLayer,[layer+1]) 

The only change is TexturePool.releaseAllTextures() at the top of the function (line 946)

packed and fixed:


Hi wezu, is there a way to get the brush to behave more like an airbrush than a stamp? Currently holding down the mouse button doesn’t paint continuously like expected.


No, I don’t think so, at least I don’t know how to do it.


Hi, wezu. Are you still developing your editor?


Not at this point in time. I’m working on something else now (, but I want to get back to the editor sometime in the future (after pyweek, at End-o-may-or-so-but-don’t-quote-me) and do a major rework.


OK, I see. Anyway, it already has enough functionality for me. It even has the same concepts I had in mind when tried to make a similar editor in Dark Basic. Thank you for the tool!


I have a new version. It’s still work in progress, but some parts are working ok.

-90% of the code rewritten. I’ve split the code into 4 classes, it should be easier to edit or reuse parts of it if someone wants to roll an editor of his own.
-The heightmap is applied in a shader, so drawing it is 5-30x faster (with a 512x512 map), so the height map can be drawn with a click-hold-drag technique and not a click-wait-click technique like it was earlier.
-The camera is controlled with the mouse, and (some) brush settings are controlled from the keyboard, the default keys look like this:
[A] and [D] -scale brush
[Q] and [E] - rotate brush
[W] and [S] - scale brush strength (height/alpha)
[+] and [-] or [mouse wheel] - camera zoom
[mouse3] or [alt] - pan camera (on mouse move)
[mouse2] or [ctrl] - rotate camera (on mouse move)
[mouse1] - paint
[f1] - paint height map mode
[f2] - paint texture mode
[tab] - switch between razing and lowering the terrain in height map paint mode
-The color texture is one big texture (2048x2048) plus some crazy details - the crazy details are controlled with a widget in the bottom left corner with 3 sliders (do experiment, you’ll get it). Not sure if I’ll keep it I may revert to some sort of texture splatting in the end.
-Saving works, but more as a proof of concept, it always saves to 3 files in the save directory

DOWNLOAD LINK (source in zip):

This is not a final version.


How does one download this file from Sendspace? I can’t find a download link at the site. I have the same problem with the other files to which you’ve linked at that site. :question:


Hmm, I was able to download it ok. It should have a link ‘Click here to start download from sendspace’.

I’ve downloaded it and put it into my dropbox if it still doesn’t work for you:

Maybe github would be a nice place for it if Wezu continues to develop it…


I’ll admit that I’m not a fan of Sendspace’s seeming tendency to half-cover the download page with other links, some of which can easily appear to be the download link. I fear that it can be easy to miss the actual download link, or mistakenly click on one of the other links. :confused:

More on-topic, this is looking good–well done, I do believe. :slight_smile:


Sendspace used to be good, but now it has all them false links and signup/pay/buy/whatnot… I call it the imageshack syndrome.
I’ll try to put up a project page on github or sourceforge in a day or two.


I’ve set up a page on Github:

To be honest it’s my first git repo, so if something is wrong with it let me know.


A bit of an update:
-proper saving and loading menu (but don’t bug me for a file browser)
-grass painting

The grass painting uses hardware instancing and I’m not sure I’ve got the shader right. My driver (ati) will eat almost any GLSL shader, so I can’t be sure it’s 100% correct. Wouldn’t mind if someone would test it :wink:


Hmm, yeah the grass instancing isn’t working for me on nvidia. Errors relating to casting ints / floats:

:display:gsg:glgsg(error): An error occurred while compiling shader shaders/grass_v.glsl
0(4) : warning C7572: OpenGL requires extension names to begin with 'GL_'
0(20) : error C7011: implicit cast from "int" to "float"
0(30) : error C7011: implicit cast from "int" to "float"
0(30) : error C7011: implicit cast from "int" to "float"
0(35) : error C7011: implicit cast from "int" to "float"

Had a brief look and fixed those, but then got to problem with anim_data not being sent to the shader.

0(4) : warning C7572: OpenGL requires extension names to begin with 'GL_'

That I don’t understand.

Line #4 is:

#extension GL_EXT_draw_instanced : enable

…but then again my driver says:

 WARNING: 0:4: warning(#62) enable/warn/disable extension isn't found, extension
 'GL_EXT_draw_instanced' is not supported

It’s a warning, so it should work anyway, right?
The ‘implicit cast from “int” to “float”’ a presume where I wrote 0 and should have 0.0.

I got rid of the anim_data input. You can see now where the grass tiles are, but it should work.

I just made a commit to the git, if You’d give it a second go, that would be great.


Yeah - it still works for me with the warning.

Still wasn’t working, missed out on a few casts. I fixed them in your grass and terrain shaders. Heres a pull request :

Hopefully it doesn’t break ATI, but the grass and terrain now works really well :slight_smile:


Works great on (my) ATI, merged it, thanks.

I think I’ll keep the terrain texture painting as it is. The 80 texture samples are much more then I could have with any sort of texture splatting, and there’s nothing standing in the way of adding 80 more if I need to. The size of the grass that I made is such that a map should be ~50m not 5km, so I think I’ll change the size of the details and leave it at that. One other thing I may add is that the scale of the texture used for painting will stay the same (more or less I hope) even if the size of the brush is changed (the texture gets blurred now) - it won’t be pixel perfect, not with rotating the brushes but I think it will be better then it is now.

I also think I’ll get rid of the shader I used for painting the hight map and always display the level textured and ‘grassed’ that should make things easier… or add a button somewhere to switch it on and off if someone wants to use the editor only for editing heightmaps, not as a level editor.

…but probably not today :mrgreen:

Oh, and if someone is wondering how the grass looks, but didn’t download the files (yet), here’s a screenshot:


I’ve added the option to drop objects into the map, and also a ability to pick them up later (for this to work the models need to have collision geometry under a node/group named ‘collision’ ).

The models/objects dropped are organized into a quad tree, that should help with collisions, but it also should make things simpler to flatten.

The editor can also generate a collision mesh that is just like the visible geometry (more or less) and also organized into a quad tree. This is more accurate then checking the heightmap.



Saving and loading objects works.