Chicken, an Egg exporter for Blender 2.49 and lower

When its rewritten. From scratch. Ok, the current stuff can be used as a guide, but it is going to be a lot of work. Not worth starting until the next beta though, when the api starts getting locked down and documented. I will start work on this at some point, but I’m targeting 2.60 for release, i.e. when 2.49 is replaced as the stable version, so don’t expect it soon.

Blender 249.2 (compiled with Python 2.6.1)
Panda3D 1.6.2
Chicken R85

File "C:\Panda3D-1.6.2\python\Lib\shlex.py", line 12, in <module>
    from collections import deque

ImportError: No module named collections

I took a quick scan through the thread and didn’t see a latest Blender version I should be using, but probably missed it somewhere. What’s the (best) version of Blender I should be using for compatibility? Or is this another issue entirely?

edit stupid Dyslexia

That combination of versions should work fine, so no issue there. Not sure what the cause is, but at a guess something is wrong with the python install - that error makes no sense in the context of Chicken and is coming from elsewhere. (It implies files missing from the python directory - the collections module has been around since 2.4 according to some quick googling.) You might want to do a normal python install and get Blender to use that rather than the Python version installed with Panda, though really that shouldn’t be a problem and has worked fine for other people.

Could you give me the entire error however, in fact all of the output? There should be lines above that error message that will give me more information.

I’ld also find out what version of python panda is using also, just to be sure - type ppython on the command line and it should give it in the opening text. Also try python on its own, and check for other versions of python being installed. If there are multiple versions they could be having a fight with each other. (If you have a pre-2.4 version get rid of it and see what happens.)

Entire output from Blender opening until error received:

Compiled with Python version 2.6.1.
Checking for installed Python... got it!
Traceback (Most recent call last):
    File "<string>, line 1, in <module>
    File "C:\blender\.blender\scripts\chicken_exportR85.py", line 2216, in <module>
        import webbrowser
    File "C:\Panda3D-1.6.2\python\Lib\webbrowser.py", line 6, in <module>
        import shlex
    File "C:\Panda3D-1.6.2\python\Lib\shlex.py", line 12, in <module>
        from collections import deque
Import Error: No module named collections

Here’s the first lines from running ppython:

Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32

I currently have 2 versions of python installed. One came with Panda3D which is what I have my PYTHONPATH set to, the other is from OpenOffice and is python 2.6.1 judging by the folder name (Python-core-2.6.1). The OpenOffice python will not run and comes up with an error saying there’s a missing Python26.dll so I cannot guarantee it’s version 2.6.1.

Note the first line of that error message - ‘Compiled with Python version 2.6.1.’ - my guess is that Blender is finding and using the Open Office version of python, and yet using the 2.5.2 libraries from the Panda directory. This is in of itself bad, but given the fact that Open Offices python has evidently been screwed with its no surprise that things have all gone pear shaped. Given what you have said about PYTHONPATH I’m not sure how this is happening however - firstly I would double check that Open Office hasn’t inserted itself into PYTHONPATH at all, as that would be the obvious explanation. I’ld also check for other environment variables related to python - they might be pointing to the OpenOffice version and being picked up by Blender/the Panda version. Failing that I might try installing a standalone version of python and putting that into PYTHONPATH instead, to see if that makes a difference - its possible something has tried to be clever and screwed over a python install somehow.

Thank you lethe, I followed your advice and installed a standalone 2.6.4 Python installation and the exporter is working fine now. I should have just done that in the first place but with the errors it just had me confused.

lete I need your advice
I’m on the way to make a snippet to explain (first off to myself) how octree stuff work and after a while I guess I figured out, but I need your blessing for the chicken part.
I did a plane with a thousand quads and proper collide tag then to make it an octree collider I summoned chicken and clicked the “collision octree” button and exporting just like this I obtain a usual egg without octreefying applied - after that I then clicked both “collision octree” and “make octree” and exported again and this time I had an octreefied egg, with a collide group named ‘octree-root’ I may use for my script. Is this the correct approach or there is a better one? Also, I exported the collision mesh in a single piece and as a standalone egg but what if I need to apply this procedure to a multi-branch model with either visible geometry and nested collision mesh branches, do you think I’ll got a complete mess?

You’ve got it almost right, the only bit I think your off with is ‘collision octree’ only matters if ‘make octree’ is selected - all having it selected does is take the octree down so it has much fewer polygons per chunk than without it selected - its basically a parameter toggle. Lots of chunks with few polygons per chunk is optimal for collisions whilst a few large chunks with lots of polygons is optimal for rendering (In the situations where it makes sense to octree the visible - more often than not you might as well do that manually.) - that is all its toggling between. But if your not octree-ing you can ignore the ‘collison octree’ button entirely.

I’m afraid the octree script currently assumes a single chunk of geometry - it will not work at all if you apply it to multiple chunks. Ultimately in the future I would like to move to a tagging scheme, where you tag the objects to be octree-ed, but that probably won’t be for a long while, i.e. until the Blender 2.5x exporter is out.

damn, I guess I’m pretty unable to understand properly this stuff - maybe I’m missing the meaning of some term here: what do you mean talking about ‘chunk’? do you mean a single mesh perhaps? anyhow I’m finding hard to see the real deal with octreefying collision geometry, or maybe I’m doing wrong tests cos I don’t find appreciable frame rate gains, dunno. If you or someone got a direction for a proper test I could make to show the difference, I’ll so appreciate it.

By chunk I just mean the lowest levels of the octree - where the geometry is. So yes, each chunk is a small mesh - basically the algorithm takes a big mesh and chops it up into lots of little meshes, chunks as I call them, and then arranges them in a hierarchy so culling routines can quickly ignore large amounts of data.

Octrees are not really a small program thing - they are an advanced optimisation technique to be used when dealing with 10s of thousands of polygons, maybe even 100s, usually for collision detection. The best test is to get a really high resolution mesh and then to collide with it. But don’t expect this to make a noticeable framerate difference unless you have lots of geometry and/or lots of collisions - you will probably have to time it to see the improvement. Also note that this technique only matters for Pandas physics - if using ode its useless, as ode has even better tricks built in.

ah thankyou lethe that encourage me, I was getting right - as you said I guess would be useful just with clever culling routines - for both sides (visible geometry or not). Now I can go on.

Hey can someone tell me how to install the exporter?.. it doesnt works for me… i have the last blender and the last python but when i use the exporter it says that chicken_interface could not be importen… the the message error says : chicken need a full python instalation… i just dont get it

Well, you appear to have two problems here:

  1. Chicken requires that blender have a full version of python for running scripts, which is not the default. Sometimes having python installed is not enough - you have to tell Blender where to find python. google is your friend here.

  2. If you partially install the script files or install to the wrong directory then you get the chicken_interface error. Go read the installation guide, which will tell you how to install it correctly.

Fix the second problem first - the first could be spurious.

will try the frist one… cuz the .rar file have two folders and a python file… i just copied the files inside the folders and pasted it in the same folder on blender scripts… and did the same with the python file but in the script directory itslef… maybe blender dont find the python… im very new in all this … sorry for the ignorance.

Err, it should be a .zip file containing 2 directories, a python file and an installation guide - where are you getting this version from? Download the version from http://sourceforge.net/projects/chicken-export/ to get the correct version. And then read the installation guide!

So I copied all the files to my .blender/scripts/ directory (so I have ~/.blender/scripts/chicken_exportR85, ~/.blender/scripts/bpydata and ~/.blender/scripts/bpymodules but I don’t see any export to egg option when I look under File->Export in Blender. I also don’t seem to get any errors about not being able to load the exporter. Any suggestions?

noisymouse: Are you on windows or Linux? I ask because Windows has multiple possible install locations - they are listed in the installation guide, so you probably need to try the others - no errors and no exporter usually means Blender is not looking in the directory you’ve stuck it in. (And I think you are probably Windows, because you put chicken_exportR85, rather than chicken_exportR85.py, when only Windows hides file extensions as far as I know!)

When you do install Chicken there should already be lots of plugins in the relevant folder, which is a good indication you have got it right. Though if you have installed blender more than once then that isn’t entirely convincing, as different installs could of copied the default scripts to different locations, without deleting the previous set.

Now if you are running Linux (Which the use of ~ would suggest.) there is a possibility that your distro doesn’t stick them there - most do, but there are exceptions. Otherwise I’m not sure - if Blender sees the files I can think of no situation where it does nothing.

Oh, I forgot the file extension. I’m using Gentoo Linux. How can I add a plugin path to Blender?

OK, I found what I needed, it was just that the Python Scripts path wasn’t set. Thanks.

i have everything… i did just like noisymouse… the chicken_export85 in …/.blender/script… the folder in bpydata in …/.blender/script/bpydata and the file in bpymodule in …/.blender/script/bpymodule… id tell the blender where is the python instalation folder and everything but i just keep getting the error that the chicken_interface could not be imported and that i need a full python instalation T.T… someone help me!..

PD:I have windows 7 32bits.