Ogre blender importer Addon

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
User avatar
lamogui
Gnoblar
Posts: 10
Joined: Wed Jan 20, 2016 4:56 pm
x 3
Contact:

Ogre blender importer Addon

Post by lamogui »

Just to let know that I'm currently developing a blender addon to import .mesh, .skeleton and .material into latest blender (binary no xml) with the latest version Ogre 1.10
Here:
https://github.com/lamogui/ogre_blender_importer

UPDATE 1:
Now the addon can load .mesh using the blender GUI and load .material, .skeleton manually using the terminal
It's still early so there is huge lack of features.
Last edited by lamogui on Sat Feb 27, 2016 12:37 am, edited 1 time in total.
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: Ogre blender importer Addon

Post by Zonder »

It's a great idea having both import and export available in blender, will help blender become the first go tool for ogre :)

But wouldn't it be better to use Ogre directly from Python to load the mesh, then process the loaded file? I don't know much about python so this might actually be more complicated also the format isn't going to change for v1 anyway.
There are 10 types of people in the world: Those who understand binary, and those who don't...
User avatar
lamogui
Gnoblar
Posts: 10
Joined: Wed Jan 20, 2016 4:56 pm
x 3
Contact:

Re: Ogre blender importer Addon

Post by lamogui »

As far as I know python can't load c++ class natively from dll or whatever so it would need to write a "C Python" binding of Ogre + the python script for blender. So I think rewrite the ogre class like "inside ogre" is the best way to have an easy maintenable and multiplatform code (I try to use the same class name and same variables everywhere in the python code).

EDIT: I juste saw the "PythonOgre" project but the lastest version is 1.6.
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: Ogre blender importer Addon

Post by Zonder »

lamogui wrote: EDIT: I juste saw the "PythonOgre" project but the lastest version is 1.6.
Latest is here http://sourceforge.net/projects/python- ... est/1.7.2/ you could try building the bindings for the latest version maybe? But as I mentioned since this is v1 the chance of the format changing is very slim. If you were doing this for v2 it would probably be better using OGRE via Bindings.
There are 10 types of people in the world: Those who understand binary, and those who don't...
User avatar
lamogui
Gnoblar
Posts: 10
Joined: Wed Jan 20, 2016 4:56 pm
x 3
Contact:

Re: Ogre blender importer Addon

Post by lamogui »

Okay I just downloaded it but I never deal with this kind of package before and my goal is to have something functional very quickly for the 1.10 version. But if a repo exists that could permit me to compile bindings for 1.10 don't hesitate.

olol very bad english
User avatar
lamogui
Gnoblar
Posts: 10
Joined: Wed Jan 20, 2016 4:56 pm
x 3
Contact:

Re: Ogre blender importer Addon

Post by lamogui »

Ok I just updated the addon
At the moment it can load separately: .material, .mesh, .skeleton (without animations)
Currently no link between the 3 files (so no wightmap, no UVMap, no material and skeleton linking) and many features are not supported yet.
I have a big issue for loading the animation (It need to do maths )

My next goal is to have a gui integration then material linking to mesh (so I will probably "load from folder" to load material then skeleton then mesh)
User avatar
paul424
Gnome
Posts: 314
Joined: Thu May 24, 2012 7:16 pm
x 13

Re: Ogre blender importer Addon

Post by paul424 »

Time to necropost this thread :




What I am doing wrong ?

EDIT: after many adventures I managed your code to have :

blender --python /usr/share/blender/2.79/scripts/addons/ogre_blender_importer-master/OgreMeshSerializer.py -- Dirt100.mesh

Code: Select all

Read prefs: /home/tom/.config/blender/2.79/config/userpref.blend
WARNING: "io_export_rogremesh" is missing
Rpython module is not cached, you must exit Blender to compile the module:
cd io_export_rogremesh; python rogremesh.py
Starting blender2ogre 0.5.9
[WARNING]: Invalid my-shaders path
M_MESH
Skeletally animated: False
  M_SUBMESH
Traceback (most recent call last):
  File "/usr/share/blender/2.79/scripts/addons/ogre_blender_importer-master/OgreMeshSerializer.py", line 145, in <module>
    meshserializer.importMesh(meshfile);
  File "/usr/share/blender/2.79/scripts/addons/ogre_blender_importer-master/OgreMeshSerializer.py", line 109, in importMesh
    impl.importMesh(stream,mesh,self.listener);
  File "/home/tom/.config/blender/2.79/scripts/addons/OgreMeshSerializerImpl.py", line 472, in importMesh
    self._readMesh(stream, mesh, listener);
  File "/home/tom/.config/blender/2.79/scripts/addons/OgreMeshSerializerImpl.py", line 410, in _readMesh
    self._readSubMesh(stream,mesh,listener);
  File "/home/tom/.config/blender/2.79/scripts/addons/OgreMeshSerializerImpl.py", line 175, in _readSubMesh
    submesh = mesh.createSubMesh();
  File "/home/tom/.config/blender/2.79/scripts/addons/OgreMesh.py", line 62, in createSubMesh
    sub = OgreSubMesh(self);
  File "/home/tom/.config/blender/2.79/scripts/addons/OgreSubMesh.py", line 30, in __init__
    self.vertexData = parent.sharedVertexData;
AttributeError: 'OgreMesh' object has no attribute 'sharedVertexData'

Blender quit

Blender quit
User avatar
lamogui
Gnoblar
Posts: 10
Joined: Wed Jan 20, 2016 4:56 pm
x 3
Contact:

Re: Ogre blender importer Addon

Post by lamogui »

Hello
Have you tried to use the addon the classic way: installed in APPDATA addon (don't remember the folders) and using the blender import menu ?
On which platform do you run blender ?
Is the version of your model the 1.10 version ?
I no more work on this addon now but maybe I can do a quick fix for you if I see I don't take much time !
User avatar
paul424
Gnome
Posts: 314
Joined: Thu May 24, 2012 7:16 pm
x 13

Re: Ogre blender importer Addon

Post by paul424 »

I am using the newest blender on OpenSuse 15 Leap, with Ogre 1.10.11 ...
No, I haven't used the appData way yet...
Hmm the model might be older then 1.10 if this might be the problem I will convert the mesh ASAP when I am back home .
User avatar
paul424
Gnome
Posts: 314
Joined: Thu May 24, 2012 7:16 pm
x 13

Re: Ogre blender importer Addon

Post by paul424 »

I upgraded the mesh with MeshUpgraderTool and it works and IT WORKS !!!!
Thank you , you are the king :) :*

IMHO: you could add all those missing 'import os' and other imports to proper files so the people which doesn't know python can use your software as well :).
EDIT: arght, Dirt_fl_1111.mesh works , that is the mesh I have a special interest , although the first mesh, from the previous example, Dirt100.mesh doesn't load -- it stays with the same error , even after OgreMeshUpgrade'ing it .. Maybe because it uses that sharedVertexData thingie ...

Mine goal is achieved, we can continue fixing the BlenderImporter for the sake of the other people if you wish ....
User avatar
lamogui
Gnoblar
Posts: 10
Joined: Wed Jan 20, 2016 4:56 pm
x 3
Contact:

Re: Ogre blender importer Addon

Post by lamogui »

Yes probably I didn't support shared vertex data, I don't remember
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: Ogre blender importer Addon

Post by paroj »

paul424 wrote: Mon Sep 10, 2018 1:35 pm
Mine goal is achieved, we can continue fixing the BlenderImporter for the sake of the other people if you wish ....
Note that nowadays there is the Python component with full api coverage
https://github.com/OGRECave/ogre/blob/m ... /sample.py
joe70
Gnoblar
Posts: 9
Joined: Thu Apr 05, 2018 5:57 pm
x 1

Re: Ogre blender importer Addon

Post by joe70 »

Hi, friends

I'm using blender 2.79 and Ogre 1.9. I've a .mesh files build with blender2Ogre (and mesh.xml too). I've missed the original blend files and I'd like obtain a blend file from the mesh files (a recovery way is to do the reverse way). The mesh are simple geometrical figures without skeleton.

I've tried with lamogui/ogre_blender_importer (https://github.com/lamogui/ogre_blender_importer) and with liyonghelpme/ogre-blender-2.7-import.py (https://gist.github.com/liyonghelpme/2c ... acd8f89878) and I've got errors in both cases.

Do you now another tools I can try?
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 155

Re: Ogre blender importer Addon

Post by sercero »

What errors did you get?

I don't know of any tools...
Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 614
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 25

Re: Ogre blender importer Addon

Post by Slicky »

Can you use the Ogre assimp tool to export and then possibly transfer to another format?
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: Ogre blender importer Addon

Post by paroj »

the kenshi exporter also supports importing: https://www.lofigames.com/phpBB3/viewto ... 11&t=10732
joe70
Gnoblar
Posts: 9
Joined: Thu Apr 05, 2018 5:57 pm
x 1

Re: Ogre blender importer Addon

Post by joe70 »

Thanks paroj, Kenshi runs right, enought for i need.
Post Reply