Blender's dotscene Export Confusion

magicmyshu

28-04-2007 13:16:48

Hi guys!

I was eventually able to figure out how to use Pyogre some time ago, however since then I've uninstalled it. Now some months later I discover Python-Ogre which was much much simpler to install. However, even with its simpler installation I'm having trouble getting content into the system.


I am a Blender user and I am having trouble with the dotscene exporter


I find the Blender data => Ogre data conversion technique to be somewhat weird and unnatural as I'm learning it , but in particular I'm having trouble with the conversion of the blender scene into the Ogre compatible dotscene files. I'm using the script (at least the one I could find) that calls itself the dotscene exporter, however the only scene files it creates are .xml - I'm sure there is some logic to this but the nature of the docs that I'm finding on the topic is highly confusing and somewhat scattered all over the internet apparently and hard to follow because they're seems to be bits of contradictory info everywhere and from all different versions of Ogre and from various dates and authors and programming languages - not to mention that the info on blender seems to be harder to come by. >.<


I already know how to export blender 3d meshes into mesh.xml files
and then how to use the xml converter in order to change that into an Ogre compatible 3d mesh ^^;

however - the scene files aren't coming out as .scene files the way that I beleive they are supposed to. They are only exporting my blender scenes into .xml and I don't know what I'm supposed to do from here.


I really feel terrible about asking such a dumb question, but thanks to anyone who can help

bharling

28-04-2007 14:22:31

in the python-ogre demos, in the 'Ogre' folder, there is a 'dotscene.py' script. This will load the xml files into python-ogre, and re-create the scene from blender. Check out the script for how to use it. You have to export every mesh in the scene as well and make sure they are available in your resources. The xml files for scenes exported from Blender do not require any other processing before they can be used in python-ogre.

magicmyshu

29-04-2007 00:23:28

I still have some figuring ot do but I'll give it a shot

andy

30-04-2007 11:17:09

If there is demand we could add the 'proper' dotscene (from Addons) importer to the Python-Ogre package???

konsumer

05-05-2007 10:36:43

I wrote the one that's in SVN. It seems to run pretty fast, and doesn't require any extra packages (like tinyXML, or whatever) and just uses stuff that come with python 2.4. It runs at totally comparable speeds, and I'm not really sure what the benefits of running it with the CPP implementation are. It seems like a thing that needs to be heavily modified to work well with the individual's game (I added a ton of stuff for my own including physics and sound, and modified my blender exporter...) and python-space is the perfect place to do this.

I made that as a quick proof-of-concept, and would be happy to make it work much better, if people are interested. I didn't realize it was in the SVN until now (I posted it in the forums, somewhere.)

konsumer

06-05-2007 03:14:14

Here is an updated version. I couldn't get the old one to work with the current Windows python-ogre release, so I made a few changes.

Included is a sample blender file with instructions, and a replacement dotscene.py file.

If you open the blender file and export things according to the directions, into a folder that is in your resources.cfg file, then edit dotscene.py to point to the location of the Scene.xml file, everything should look like this:

andy

06-05-2007 03:29:14

Very cool...
Do you mind me including this with the Python-Ogre package and putting it in the SVN?

Thanks

Andy

konsumer

06-05-2007 05:25:23

Do you mind me including this with the Python-Ogre package and putting it in the SVN?

No, like I said, I wrote the one that is currently in there. You may want to include the test output, and add a location to the resources.cfg file, so people can just double-click on it to test it out (so it's more like the other demos.)

I have included the product of using the blender exporter, and also made it work better for people who just want to use the loader in their own thing, without the demo (import it.) I updated the link above (here), so just put that stuff in the Python-Ogre package and in the SVN, and it will run like all the other demos.

I still want to add alot of features, but I haven't looked at it for a long time (I still can't get python-ogre built in Linux, and I really hate using windows.)

TwoD

06-05-2007 20:03:18

If anyone's interested, I recently translated the .scene loader found here:
http://www.ogre3d.org/wiki/index.php/Ne ... ene_Loader
to python for a project I'm working on. The code is a bit longer but I really like the way it's structured.

Like in the original C++ code, some things are missing and might be broken, but I'm trying to fix things when I notice I need a particular feature which isn't fully implemented.

Here's the source as it is now.

ethankennerly

03-06-2008 00:25:42

In Python-Ogre 1.1, I'm having trouble with PythonOgre/demos/ogre/dotscene.py

It has a couple of old imports (from pyogre import ogre), and then the dotscene format seems to be slightly different. The node 'rotation' and 'qw'...'qz' is used. Whereas, the Blender Export script that I downloaded from SVN today causes an export of 'quaternion' and 'w'...'z'.

https://svn.ogre3d.org/svnroot/ogreaddons/trunk/blendersceneexporter/
Is this the current Blender Exporter?

Which is the current dotscene standard: 'quaternion'/'w', or 'rotation'/'qw'? This documentation uses 'qw', but the scene exporter uses 'w'.
http://www.ogre3d.org/wiki/index.php/DotScene
http://www.ogre3d.org/wiki/index.php/New_DotScene_Loader
Do you know of a web page that documents the a dotscene standards?

The script in Python-Ogre 1.1 seems to be derived from this post's contributor more than a year ago: "python / PyOgre dotscene xml loader [ Fixed ]" http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=1583

As I haven't found a version that works, I'm in the process or rewriting the 'dotscene.py', yet someone here would know better than me. Is there a working version with the current Blender exporter?

Thanks for the help,

-- Ethan

machinimist

04-06-2008 12:10:38

i always wondered why meshes and the scene have to be exported separately? why doesn't the scene exporter also automatically export the needed meshes? i think that would be nice!

ethankennerly

04-06-2008 19:29:02

Knowing that:
* Single meshes are already exported (Ogre mesh exporter).
* Scenes are already exported (Blender dotscene exporter).

One technique that I've been thinking about (after the basics of scene importing are working) is to write a script that, if Blender scripting supports this cleanly, executes a mesh exporter on all selected meshes and then exports the scene too.

By a combo script that glues the above scripts together, you can pick and choose what you need to export, and still have a convenient method to do it all. The biggest time-saver I guess would be exporting all selected meshes, instead of one at a time. Do you know of (or have you tried) something like this?

-- Ethan

machinimist

04-06-2008 23:07:16

yes, this for sure would be possible and should be done like that in the official dot scene export scripts.

Zyzle

08-06-2008 00:54:53

I've been working on a dotscene loader for my own project for the past few days now, along with a wiki tutorial about its functionality which can be found here:

http://bloop.sourceforge.net/wiki/index.php/DotScene_Loader

This page although not complete yet does give a basic into into the parsing of the dotscene files, as usual any comments/suggestions are welcome.

At the moment the sceneLoader module supports meshes, lights and cameras however I do plan to add support for more of the dotscene format in future, hopefully what is there at the moment will be helpful to you.

ethankennerly

08-06-2008 16:50:23

Thanks, Zyzle! The dot scene loader code is succinct.

Over the last couple of days I had rewritten the Python-Ogre 1.1 demo 'dotscene.py' so that it worked with the latest Blender scene exporter. The resulting 'dotscene.py' is included in a proof of concept for an Ogre Toolkit:


http://runesinger.com/source/ogre_toolkit.zip

The package contains a complete (albeit trivial) example of camera, light, entity exported from Blender to Ogre, with the files and screenshot. Also is a PythonCard application for editing your Python-Ogre application while its running, which I discussed on the 'wxOgre' thread, and packaged at skorpio's request.

However, I didn't refactor the lights or entity yet; that's still a copy-and-paste of the Python-Ogre default demo 'dotscene.py' code. Learning from your crisp code, I should adopt your style next time I need to modify the code.

By the way, since you have a dotscene loader that works and I have one that works for the above test case, how do we get some combination of our working 'dotscene.py' into the Python-Ogre default installation? Correct me if I'm mistaken about the standards, but I believe the current demo 'dotscene.py' doesn't work with the current Blender scene exporter, and that we have ones that do.

-- Ethan
http://runesinger.com

Zyzle

08-06-2008 17:15:29

Yeah I think your right, looking through the dotscene.py that comes in the python-ogre distribution it does seem to be based on an older version of the dotscene format. (also there are a few more basic, albeit slightly trivial matters in the code I would like to see addressed... 'thingy' as a variable name :roll: )

I dont actually know who is responsible for maintaining this part of python ogre but hopefully they've seen this reopened thread and will make some changes.

My SceneLoader.py doesnt support everything in the dotscene format yet but I hope to add more functionality in the coming weeks.

All I need now is two more of me so I can do that, the Bloop code and the artwork all at the same time :?

bharling

09-06-2008 10:35:40

Hi folks,

I can update the python-ogre svn with a new dotscene loader, is there a final working version available yet? if so, point me in the direction and I can upload it to the main project

ethankennerly

09-06-2008 17:12:01

Cool, Bharling! Not a "final" version, but the one I wrote was copy-and-paste derived from the Python-Ogre 1.1 dotscene.py. Therefore, it supports everything that one did (camera, light, entity, scene node), except now for the latest Blender scene exporter format. I used a different approach (no class, just functions). Is a dotscene class necessary? If so, can do. What else should it do? Other than that, for readability and maintenance, I agree with Zyzle, that the variable names and 'try/except' blocks need revision. I can do that too, to the best of my free time and perhaps quirky coding style.

By the way, I believe the axis test case (screenshot in previous post) in that Ogre Toolkit is a suitable demo of dotscene. Want it too?

Zyzle

16-06-2008 00:14:21

Well I've finally finished the page about the SceneLoader.py module I created as part of Bloop.

The wiki page can be found here:

http://bloop.sourceforge.net/wiki/index ... ene_Loader

And the corresponding module code here:

http://bloop.svn.sourceforge.net/viewvc/bloop/trunk/src/Game/SceneLoader.py?view=markup