Blender importer [WIP]

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
tgraupmann
Gnoll
Posts: 696
Joined: Sun Feb 20, 2005 5:28 am
Contact:

Post by tgraupmann »

My bad, the plugin crashes, but when it returns to Blender, the import was successful, directly from the mesh. HA
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

Ok. This thread gets confusing. :)
Just to make it clear: Not the plugin crashes, but the OgreXmlConverter.exe does. When you don't let the plugin convert the mesh.xml without calling OgreXmlConverter.exe everyhting works fine.
Since this OgreXmlConverter.exe bugs gets on my nerve I will look into it this evening.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

Strange. When I use the OgreXmlConverter.exe from the command line tools download, I get an access violation on conversion of the mesh.
team-pantheon programmer
creators of Rastullahs Lockenpracht
tgraupmann
Gnoll
Posts: 696
Joined: Sun Feb 20, 2005 5:28 am
Contact:

Post by tgraupmann »

File a bug. Great work.
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA
Contact:

Post by walaber »

oh my dear god this just saved my life! i just saved over a really important .blend from my trampoline game, and while I couldn't get the armature/animation back (yet), I was able to get my mesh and UVs, which is a huge savior.

haffax, you are my hero!

everyone else, BACK UP OFTEN!!!
Go Go Gadget OGRE!!
Image
randall
Halfling
Posts: 63
Joined: Sun Jan 23, 2005 1:04 pm
Location: Poland

Post by randall »

Strange. When I use the OgreXmlConverter.exe from the command line tools download, I get an access violation on conversion of the mesh.
The same here.
User avatar
Jerky
Orc Shaman
Posts: 791
Joined: Wed Mar 02, 2005 4:13 am
Location: Springville, Utah
Contact:

Post by Jerky »

@walaber: You can also set Blender to save other versions of the file after a dertain amount of time (autosave). That could help too :).
Erik Briggs (Jerky)
My Blog
Project Wish
Image
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

randall wrote:
Strange. When I use the OgreXmlConverter.exe from the command line tools download, I get an access violation on conversion of the mesh.
The same here.
Well, this is the downloadable version of the tool. Build OgreXmlConverter yourself and it will work fine. The binary download is still version 1.0.3.

walaber, glad you found it useful. :)
The animation import is not forgotten. I just wait till Python API access to the armature system is ready in Blender 2.40. Don't want to implement this twice.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA
Contact:

Post by walaber »

@Jerky- yes. after this incident I upped it to 5 temporary files, all 10 minutes apart, so I have 50 minutes to realize my mistake :) however I think every time you save it copies the pre-save to the latest backup file, so if I were to save 5 times after making a mistake that would be a problem :)

@haffax- indeed. I'm looking forward to 2.40's animation improvements as well! no rush, my game doesn't have too much animation yet, so it's not a large chore to rebuild the armature and animations.
Go Go Gadget OGRE!!
Image
User avatar
Jerky
Orc Shaman
Posts: 791
Joined: Wed Mar 02, 2005 4:13 am
Location: Springville, Utah
Contact:

Post by Jerky »

Getting an error in the Blender log:

Code: Select all

Reading mesh file I:\ProjectWish\Ogre\MeshViewer\g_Group4405.mesh.xml...
Traceback (most recent call last):
  File "<string>", line 493, in fileselection_callback
  File "<string>", line 390, in collect_materials
AttributeError: 'module' object has no attribute 'compile'
MeshConverter.exe is a fresh build from CVS. Python is 2.3. Any ideas?
Erik Briggs (Jerky)
My Blog
Project Wish
Image
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

It doesn't seem to find the re module. Are you sure your python installation is detected by Blender? The console then shows "Using Python version 2.3". If it isn't shown, then you have to setup Blender to use your Python first.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
Jerky
Orc Shaman
Posts: 791
Joined: Wed Mar 02, 2005 4:13 am
Location: Springville, Utah
Contact:

Post by Jerky »

Yeah, I edited that part of the log out. I am using 2.3, and it says exactly what you said: "Using python version 2.3"

I have no problems with the exporter, just the importer.
Erik Briggs (Jerky)
My Blog
Project Wish
Image
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

I don't really have an idea what could be wrong. The line it fails, it is accessing the regular expression module re. So maybe it is not part of your python installation or not installed properly?

Here is the log of an python interactive shell session.
lines starting with >>> is user input. Please try if you get similiar output. If not, then maybe your installation is faulty. If it looks similiar, then I don't have a clue. :(

Code: Select all

ActivePython 2.3.5 Build 236 (ActiveState Corp.) based on
Python 2.3.5 (#62, Feb  9 2005, 16:17:08) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> print re
<module 're' from 'C:\Python23\lib\re.pyc'>
>>> foo = re.compile('.*')
>>> print foo
<_sre.SRE_Pattern object at 0x008C9EC8>
>>>
team-pantheon programmer
creators of Rastullahs Lockenpracht
antont
Gnoblar
Posts: 22
Joined: Fri Mar 11, 2005 8:12 am
Location: Oulu, Finland
x 1
Contact:

Post by antont »

btw, have you guys already looked at getting the scripts work with the upcoming Blender 2.4 series? (like with 2.40alphas or current cvs)

there is a new Mesh module that might serve you better than NMesh, or then not, and a rewritten Armature (in progress)

~Toni
~Toni
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

According to the deceloper's wiki is the Armature API not ready yet (even in alpha2). I did not yet try to convert the script. But I eventually will of course. :)
team-pantheon programmer
creators of Rastullahs Lockenpracht
antont
Gnoblar
Posts: 22
Joined: Fri Mar 11, 2005 8:12 am
Location: Oulu, Finland
x 1
Contact:

Post by antont »

the beginnings of the new Armature are in the CVS now, were added after alpha2 (i maintain that wiki page :) .. getters should be there and that's all you need for export i guess, but i havent looked in detail yet.
~Toni
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

Thanks, since this is an importer, I better wait for the setters. ;)

Will there be setters for vertex weights too? The old API didn't have those, which makes importing an already rigged mesh difficult.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA
Contact:

Post by walaber »

looks like 1.4 will be a big (good) change to the animation system. I'm holding off on animating my models for now until it's released... or switch to CVS if I can't wait :)
Go Go Gadget OGRE!!
Image
antont
Gnoblar
Posts: 22
Joined: Fri Mar 11, 2005 8:12 am
Location: Oulu, Finland
x 1
Contact:

Post by antont »

oh gee, i did not even notice this was the importer thread, sorry :)

how do you end up with Ogre models that you dont have in some modeller format that Blender supports (like .blend or .obj?)? i find it surprising that there is a need for importer. but can well believe that it is practical to be able to just open and edit the already ogre-prepared models..

i'd hope you'd take a look at the new Mesh module in 2.40, although in some cases you might be still better of with NMesh like before. iirc the vertex groups are somehow there too.

the armature setters are still open for feedback, feel free to influence to get it in a nice shape for you.
~Toni
User avatar
Jerky
Orc Shaman
Posts: 791
Joined: Wed Mar 02, 2005 4:13 am
Location: Springville, Utah
Contact:

Post by Jerky »

BTW, for anyone with similar problems as I was having, my problem was python. I had version 2.4 installed, even though that version of blender (2.37) did not support it. I had to install python 2.3.5 and add its directories to my PYTHONPATH system environment variable to get it all working correctly. After that was in, every importer/exporter works flawlessly (or as they should ;)).
Erik Briggs (Jerky)
My Blog
Project Wish
Image
User avatar
CaseyB
OGRE Contributor
OGRE Contributor
Posts: 1335
Joined: Sun Nov 20, 2005 2:42 pm
Location: Columbus, Ohio
x 3
Contact:

Post by CaseyB »

I don't know if this is dead or not, but I tried using the Importer with Blender 2.40 and I got the following error

Code: Select all

Traceback (most recent call last):
    File "<string>", line 109, in ?
ImportError: No module named glob
I have no idea what that means!
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

This project is not dead, I just don't have the time for it right now, though I am in the process of integrating Skeleton import.

The importer works just fine with Blender 2.40/2.41.

In your case the problem seems to be, that you don't have Python 2.4 installed or not properly setup so, that Blender finds it. You need to set the PYTHON environment variable to point to your python.exe.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

Using Python version 2.4
Reading mesh file d:\ogredist\samples\common\bin\release\TestLevel.xml...
Mesh with 0 shared vertices.
Submesh 0 with 15 vertices and 12 faces...
done.
Submesh 1 with 30 vertices and 42 faces...
done.
Submesh 2 with 27 vertices and 20 faces...
done.
Submesh 3 with 22 vertices and 12 faces...
done.
Submesh 4 with 14 vertices and 12 faces...
done.
Submesh 5 with 12 vertices and 12 faces...
done.
Submesh 6 with 29 vertices and 20 faces...
done.
Submesh 7 with 28 vertices and 16 faces...
done.
Submesh 8 with 28 vertices and 20 faces...
done.
Submesh 9 with 22 vertices and 20 faces...
done.
Submesh 10 with 95 vertices and 60 faces...
done.
Submesh 11 with 24 vertices and 12 faces...
done.
Submesh 12 with 48 vertices and 24 faces...
done.
Submesh 13 with 121 vertices and 200 faces...
done.
Submesh 14 with 32 vertices and 24 faces...
done.
Submesh 15 with 32 vertices and 24 faces...
done.
Traceback (most recent call last):
File "<string>", line 504, in fileselection_callback
File "<string>", line 289, in CreateBlenderMesh
RuntimeError: object data material lists can't have more than 16 materials
Is that true?
Funny thing is that testlevel.material only contains 7 materials.
But the level.mesh.xml does indeed have more than 16 submeshes.
Is that a limitation of Blender itself? Or did I find a bug in the importer script? :wink:

I wanted to clean up the dotsceneoctree testlevel, because OPCODE tells me that the model has 1239468 degenerate faces. :)
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

This is a bug in the script and marked as todo.

I made a quick fix for this, but couldn't yet test, if this fixes the issue.
If you could please test this, then I can commit it to the CVS.

http://www.rafb.net/paste/results/yA7DFt91.txt
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

Now I get this:

Code: Select all

Using Python version 2.4
Reading mesh file d:\ogredist\samples\common\bin\release\TestLevel.xml...
Mesh with 0 shared vertices.
Submesh 0 with 15 vertices and 12 faces...
done.
Submesh 1 with 30 vertices and 42 faces...
done.
Submesh 2 with 27 vertices and 20 faces...
done.
Traceback (most recent call last):
  File "<string>", line 505, in fileselection_callback
  File "<string>", line 292, in CreateBlenderMesh
AttributeError: material already in the list
Post Reply