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 1
Contact:

Ogre blender importer Addon

Post by lamogui » Wed Jan 20, 2016 5:05 pm

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.
0 x

User avatar
Zonder
Ogre Magi
Posts: 1133
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 22

Re: Ogre blender importer Addon

Post by Zonder » Thu Jan 21, 2016 9:29 am

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.
0 x
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 1
Contact:

Re: Ogre blender importer Addon

Post by lamogui » Fri Jan 22, 2016 12:49 am

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.
0 x

User avatar
Zonder
Ogre Magi
Posts: 1133
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 22

Re: Ogre blender importer Addon

Post by Zonder » Fri Jan 22, 2016 9:12 am

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.
0 x
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 1
Contact:

Re: Ogre blender importer Addon

Post by lamogui » Sat Jan 23, 2016 9:28 pm

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
0 x

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

Re: Ogre blender importer Addon

Post by lamogui » Mon Feb 22, 2016 2:23 am

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)
0 x

paul424
Goblin
Posts: 207
Joined: Thu May 24, 2012 7:16 pm
x 1

Re: Ogre blender importer Addon

Post by paul424 » Sun Sep 09, 2018 9:44 am

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
0 x

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

Re: Ogre blender importer Addon

Post by lamogui » Mon Sep 10, 2018 10:14 am

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 !
1 x

paul424
Goblin
Posts: 207
Joined: Thu May 24, 2012 7:16 pm
x 1

Re: Ogre blender importer Addon

Post by paul424 » Mon Sep 10, 2018 11:56 am

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 .
0 x

paul424
Goblin
Posts: 207
Joined: Thu May 24, 2012 7:16 pm
x 1

Re: Ogre blender importer Addon

Post by paul424 » Mon Sep 10, 2018 1:35 pm

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 ....
0 x

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

Re: Ogre blender importer Addon

Post by lamogui » Tue Sep 11, 2018 10:43 am

Yes probably I didn't support shared vertex data, I don't remember
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 873
Joined: Sun Mar 30, 2014 2:51 pm
x 176
Contact:

Re: Ogre blender importer Addon

Post by paroj » Tue Sep 11, 2018 11:21 am

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
0 x

Post Reply