Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by mkultra333 »

Scale/Rotate/Translate meshes and armatures in Edit mode, not Object mode.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by lf3thn4d »

Ctrl-A -> Apply Scale & Rotation to ObData?

Edit: Meh, i'm too slow. lol
zeromath
Gnoblar
Posts: 21
Joined: Mon Jul 05, 2010 5:19 pm

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by zeromath »

omg thx!! Now the Creator won't smite me :)
zeromath
Gnoblar
Posts: 21
Joined: Mon Jul 05, 2010 5:19 pm

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by zeromath »

lol sorry for the double post now, but I've got a second problem:

In blender, I keep certain objects as separate, but ogre exports them as different mesh files. This is a problem because I have to reassemble the .mesh files back again the world editor and it's really time consuming. Is there anyway I can export different object entities in the same .mesh file?
User avatar
koirat
Orc
Posts: 446
Joined: Mon Feb 25, 2008 7:56 pm
x 13

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by koirat »

One Blender Mesh = One Ogre Mesh (one exported file *.mesh.xml -> *.mesh).
This is a block of text that can be added to posts you make. There is a 255 character limit.
zeromath
Gnoblar
Posts: 21
Joined: Mon Jul 05, 2010 5:19 pm

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by zeromath »

koirat wrote:One Blender Mesh = One Ogre Mesh (one exported file *.mesh.xml -> *.mesh).

hmm...So there's no way I can get multiple blender meshes as one ogre mesh? OK, but when I export the blender meshes as ogre meshes, is there a way to keep the object's position in space...? Because I have a model of a car, and I find it really frustrating to reposition every part of it.
User avatar
koirat
Orc
Posts: 446
Joined: Mon Feb 25, 2008 7:56 pm
x 13

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by koirat »

If you are not using some kind of scene file / exporter.
You can set all your car meshes to have the same position. So for example center of the wheel mesh is in the same place as center of a car body.
How experienced you are with blender ? Do you understand what I said in this post ? Because for a blender newbies object position and mesh position is one and the same thing, but it is not.
This is a block of text that can be added to posts you make. There is a 255 character limit.
zeromath
Gnoblar
Posts: 21
Joined: Mon Jul 05, 2010 5:19 pm

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by zeromath »

I'm not a newbie to blender, I've got 5 years using it, but I am new to cgi terminology like the ones you mentioned...
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by cyrfer »

I would just combine the Bmeshes into a single Bmesh, then export. Unfortunately in this version of Blender, I don't think there is a concept of a hierarchy of meshes. Maybe the next version of blender will have a hierarchy and then the OgreMesh exporter can be smarter.
zeromath
Gnoblar
Posts: 21
Joined: Mon Jul 05, 2010 5:19 pm

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by zeromath »

koirat wrote:If you are not using some kind of scene file / exporter.
Hmm? Can a scene exporter get me the results I need?
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by lf3thn4d »

You can try the dotscene exporter. Try searching around in the forum.
User avatar
Svenstaro
Greenskin
Posts: 115
Joined: Fri Dec 15, 2006 1:30 pm
Location: Germany
x 3

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Svenstaro »

lf3thn4d, do you have a public git repo I can check out to help out with development? If not, I'm kindly requesting one hosted on github.com (or anywhere, really, I just like github.com). This will open up development a bit and would allow easy contribution.

Also, I'd like to request you name your releases after their version numbers. Right now, you are just replacing BlenderExporter.zip which is not a nice way as the md5s change while the file name stays the same. Please name any further releases like BlenderExporter-1.5.zip. Also, please consider using .tar.gz to preserve Unix file permissions.

Please do consider these requests.
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by lf3thn4d »

@Svenstaro: All work is committed to Ogre's main repo at here: http://bitbucket.org/sinbad/ogre/overview under Tools/BlenderExport. I'm using the v1-7 branch since the fixes are applicable for any v1.7 ogre build. Any changes will be merged into the default branch. So contributors just need to look there to help. Any patches should be submitted through the Ogre's patch system. Just assign the patch to me and I will have a look at it. :-)

About the versioning of the zip and tar.gz, truth is I did not intend it to be an official release of the exporter but only just as a temporary solution for many who doesn't know how to use a repository. However, since its some what becoming "official", point taken. I'll work on fixing it for future releases.
User avatar
Svenstaro
Greenskin
Posts: 115
Joined: Fri Dec 15, 2006 1:30 pm
Location: Germany
x 3

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Svenstaro »

Thanks a lot! I suggest then that you make two dirs so that the older exporter for Blender 2.49 can be preserved without going back in history. Is there already anything at all I can look at for the Blender 2.5 exporter?
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by lf3thn4d »

Yes i'm planning to have another dir for the new exporter. Probably calling it Blender25Export or Blender26Export? Not sure yet. Right now, blender's still not stable. I'm waiting for their stable build so I can be sure my effort won't be wasted if they end up changing API. So nothing has really been done except some hackish UI testing (I really wish they have proper UI documentation. It's quite frustrating to figure out how to get things done.)

I think I will setup a new wiki page soon to start with a wish list of what we want in the exporter and some mockup plans on the UI for feedback. :)
User avatar
Svenstaro
Greenskin
Posts: 115
Joined: Fri Dec 15, 2006 1:30 pm
Location: Germany
x 3

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Svenstaro »

User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by lf3thn4d »

Nice. We could probably bring it to be official if it's good enough. Or use it as a reference to build a proper official exporter. Thanks for the reference. :)
User avatar
rogerdv
Gnome
Posts: 351
Joined: Fri May 09, 2003 10:43 pm
Location: Cuba
x 1

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by rogerdv »

Im having a problem when exporting models with Subsurf modifier applied and an armature:

Code: Select all

Traceback (most recent call last):
  File "/usr/share/blender/scripts/ogrepkg/gui.py", line 1955, in _buttonHandler
    self.buttonEventDict[event].execute()
  File "/usr/share/blender/scripts/ogremeshesexporter.py", line 1886, in execute
    self.app.requireFaceMats.getValue(), \
  File "/usr/share/blender/scripts/ogremeshesexporter.py", line 1328, in export
    meshExporter.export(exportPath, materialManager, fixUpAxis, exportMesh, colouredAmbient, applyModifiers, convertXML)
  File "/usr/share/blender/scripts/ogrepkg/meshexport.py", line 881, in export
    self._write(dir, convertXML)
  File "/usr/share/blender/scripts/ogrepkg/meshexport.py", line 924, in _write
    self.submeshManager.write(fileObject, 1)
  File "/usr/share/blender/scripts/ogrepkg/meshexport.py", line 469, in write
    submesh.write(fileObject, indentation + 1)
  File "/usr/share/blender/scripts/ogrepkg/meshexport.py", line 424, in write
    self.vertexManager.writeBoneAssignments(fileObject, indentation + 1)
  File "/usr/share/blender/scripts/ogrepkg/meshexport.py", line 344, in writeBoneAssignments
    vertex.writeBoneAssignments(fileObject, indentation + 1)
  File "/usr/share/blender/scripts/ogrepkg/meshexport.py", line 219, in writeBoneAssignments
    for groupName in self.bMesh.getVertGroupNames():
AttributeError: mesh must be linked to an object first
If I apply the subsurface to a simple cube without armature, it exports without errors.
syndicatedragon
Kobold
Posts: 26
Joined: Thu Jun 21, 2007 4:16 am

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by syndicatedragon »

I'm sorry if this is stupid question and/or has been covered somewhere else. It seems like the exporter adds a lot of extra vertexes and faces. This could be because I'm totally new at blender, too. Here's the xml file generated straight from the default cube that blender starts with. I literally just started blender and exported. How can I get rid of the extra stuff?

Code: Select all

<mesh>
	<submeshes>
		<submesh material="Material" usesharedvertices="false">
			<faces count="12">
				<face v1="0" v2="1" v3="2"/>
				<face v1="0" v2="2" v3="3"/>
				<face v1="4" v2="5" v3="7"/>
				<face v1="5" v2="6" v3="7"/>
				<face v1="8" v2="9" v3="11"/>
				<face v1="9" v2="10" v3="11"/>
				<face v1="12" v2="13" v3="15"/>
				<face v1="13" v2="14" v3="15"/>
				<face v1="16" v2="17" v3="18"/>
				<face v1="16" v2="18" v3="19"/>
				<face v1="20" v2="21" v3="23"/>
				<face v1="21" v2="22" v3="23"/>
			</faces>
			<geometry vertexcount="24">
				<vertexbuffer positions="true" normals="true">
					<vertex>
						<position x="1.000000" y="-1.000000" z="-1.000000"/>
						<normal x="0.000000" y="-1.000000" z="0.000000"/>
					</vertex>
					<vertex>
						<position x="1.000000" y="-1.000000" z="1.000000"/>
						<normal x="0.000000" y="-1.000000" z="0.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="-1.000000" z="1.000000"/>
						<normal x="0.000000" y="-1.000000" z="0.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="-1.000000" z="-1.000000"/>
						<normal x="0.000000" y="-1.000000" z="0.000000"/>
					</vertex>
					<vertex>
						<position x="1.000000" y="1.000000" z="-0.999999"/>
						<normal x="0.000000" y="1.000000" z="0.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="1.000000" z="-1.000000"/>
						<normal x="0.000000" y="1.000000" z="0.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="1.000000" z="1.000000"/>
						<normal x="0.000000" y="1.000000" z="0.000000"/>
					</vertex>
					<vertex>
						<position x="0.999999" y="1.000000" z="1.000001"/>
						<normal x="0.000000" y="1.000000" z="0.000000"/>
					</vertex>
					<vertex>
						<position x="1.000000" y="-1.000000" z="-1.000000"/>
						<normal x="1.000000" y="-0.000000" z="0.000001"/>
					</vertex>
					<vertex>
						<position x="1.000000" y="1.000000" z="-0.999999"/>
						<normal x="1.000000" y="-0.000000" z="0.000001"/>
					</vertex>
					<vertex>
						<position x="0.999999" y="1.000000" z="1.000001"/>
						<normal x="1.000000" y="-0.000000" z="0.000001"/>
					</vertex>
					<vertex>
						<position x="1.000000" y="-1.000000" z="1.000000"/>
						<normal x="1.000000" y="-0.000000" z="0.000001"/>
					</vertex>
					<vertex>
						<position x="1.000000" y="-1.000000" z="1.000000"/>
						<normal x="-0.000000" y="-0.000000" z="1.000000"/>
					</vertex>
					<vertex>
						<position x="0.999999" y="1.000000" z="1.000001"/>
						<normal x="-0.000000" y="-0.000000" z="1.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="1.000000" z="1.000000"/>
						<normal x="-0.000000" y="-0.000000" z="1.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="-1.000000" z="1.000000"/>
						<normal x="-0.000000" y="-0.000000" z="1.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="-1.000000" z="1.000000"/>
						<normal x="-1.000000" y="-0.000000" z="-0.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="1.000000" z="1.000000"/>
						<normal x="-1.000000" y="-0.000000" z="-0.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="1.000000" z="-1.000000"/>
						<normal x="-1.000000" y="-0.000000" z="-0.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="-1.000000" z="-1.000000"/>
						<normal x="-1.000000" y="-0.000000" z="-0.000000"/>
					</vertex>
					<vertex>
						<position x="1.000000" y="1.000000" z="-0.999999"/>
						<normal x="0.000000" y="0.000000" z="-1.000000"/>
					</vertex>
					<vertex>
						<position x="1.000000" y="-1.000000" z="-1.000000"/>
						<normal x="0.000000" y="0.000000" z="-1.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="-1.000000" z="-1.000000"/>
						<normal x="0.000000" y="0.000000" z="-1.000000"/>
					</vertex>
					<vertex>
						<position x="-1.000000" y="1.000000" z="-1.000000"/>
						<normal x="0.000000" y="0.000000" z="-1.000000"/>
					</vertex>
				</vertexbuffer>
			</geometry>
		</submesh>
	</submeshes>
</mesh>
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by cyrfer »

@syndicatedragon: You are asking how to delete faces in Blender? This is the wrong forum for that. However, I recommend you select your object, go into "Edit Mode" (by clicking the mesh in the tree view, or TabKey), choosing "face select" mode (instead of vertex or others) at the bottom of the 3D viewport, start right-clicking (to select) on faces in the 3d scene and hit DeleteKey (I think). [edit]The faces in Blender are often quads, which the exporter has to split to make triangles. Maybe this is why you think there are twice as many faces as necessary.[/edit]
syndicatedragon
Kobold
Posts: 26
Joined: Thu Jun 21, 2007 4:16 am

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by syndicatedragon »

cyrfer wrote:@syndicatedragon: You are asking how to delete faces in Blender? This is the wrong forum for that. However, I recommend you select your object, go into "Edit Mode" (by clicking the mesh in the tree view, or TabKey), choosing "face select" mode (instead of vertex or others) at the bottom of the 3D viewport, start right-clicking (to select) on faces in the 3d scene and hit DeleteKey (I think). [edit]The faces in Blender are often quads, which the exporter has to split to make triangles. Maybe this is why you think there are twice as many faces as necessary.[/edit]
I'm wondering why a cube, when exported, apparently has 24 vertexes. Even if it had to make triangles, there should still only be the original 8 vertexes, right?
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by mkultra333 »

syndicatedragon wrote:
cyrfer wrote:@syndicatedragon: You are asking how to delete faces in Blender? This is the wrong forum for that. However, I recommend you select your object, go into "Edit Mode" (by clicking the mesh in the tree view, or TabKey), choosing "face select" mode (instead of vertex or others) at the bottom of the 3D viewport, start right-clicking (to select) on faces in the 3d scene and hit DeleteKey (I think). [edit]The faces in Blender are often quads, which the exporter has to split to make triangles. Maybe this is why you think there are twice as many faces as necessary.[/edit]
I'm wondering why a cube, when exported, apparently has 24 vertexes. Even if it had to make triangles, there should still only be the original 8 vertexes, right?
I'd guess the cube is not set to be smooth, so instead of 6 verts with normals pointing out from the corners, each face has 4 private verts with normals pointing straight out in the direction of the face.

As for the broken export with subsurfaces, try and find some way to convert the subsurfaces to actual mesh triangles and see how the export goes.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by cyrfer »

syndicatedragon wrote:I'm wondering why a cube, when exported, apparently has 24 vertexes. Even if it had to make triangles, there should still only be the original 8 vertexes, right?
I don't know what is the logic for the exporter to know when to make a new face, but mkultra333 is right that a cube should have extra vertices because the vertices belonging to faces with distinctly different normals themselves need distinctly different normal vector data.
PhyllisL
Gnoblar
Posts: 6
Joined: Thu Sep 02, 2010 4:56 am

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by PhyllisL »

I am using blender 2.49 on a mac and trying to install the exporter to Orge.. can not find path to install there is no blender/.blender/script directory that I can access even when I make hidden files visible ..any clues as to what is going on?
grol
Gnoblar
Posts: 9
Joined: Wed Apr 07, 2010 9:27 am

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by grol »

enter blender.app and (if I rememer ok) inside Contents/MacOs will be .blender directory with de scripts folder inside (if not, is not difficult to find)

if you are in not console mode, right click over blender.app and click "show contents" or something similar (I don't have it in english) to watch the content in Finder.

(I am not in the mac now, so I can't tell you better)

Otherwise, I had a big fight with OgreXMlConverter to run in mac os x, so I have to convert my meshes in windows (I will ask for help one of these days)

good luck!