[SOLVED] Blender 2.71: error exporting textured material

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
Blaxar
Gnoblar
Posts: 10
Joined: Sat Aug 16, 2014 2:58 pm

[SOLVED] Blender 2.71: error exporting textured material

Post by Blaxar »

Hi,

I was trying to export a simple object I've made (a table) with blender2ogre, I've already managed to export it without any texture (and load it in my Ogre scene), this includes both the mesh and the (default) material.

But right after texturing it in Blender (2.71), when exporting I get this:

Code: Select all

Traceback (most recent call last):
  File "/home/blax/.config/blender/2.71/scripts/addons/io_export_ogreDotScene.py", line 3171, in execute
    self.ogre_export(self.filepath, context)
  File "/home/blax/.config/blender/2.71/scripts/addons/io_export_ogreDotScene.py", line 3534, in ogre_export
    material_files = self.dot_material(meshes + force_material_update, path, material_file_name_base)
  File "/home/blax/.config/blender/2.71/scripts/addons/io_export_ogreDotScene.py", line 3373, in dot_material
    data = generate_material( mat, path=path, copy_programs=True, touch_textures=CONFIG['TOUCH_TEXTURES'] )
  File "/home/blax/.config/blender/2.71/scripts/addons/io_export_ogreDotScene.py", line 7337, in generate_material
    passes = w.get_passes()
  File "/home/blax/.config/blender/2.71/scripts/addons/io_export_ogreDotScene.py", line 6989, in get_passes
    r.append( self.generate_pass(self.material) )
  File "/home/blax/.config/blender/2.71/scripts/addons/io_export_ogreDotScene.py", line 7013, in generate_pass
    slots = get_image_textures( mat )        # returns texture_slot objects (CLASSIC MATERIAL)
  File "/home/blax/.config/blender/2.71/scripts/addons/io_export_ogreDotScene.py", line 999, in get_image_textures
    if s and s.texture.type == 'IMAGE':
AttributeError: 'NoneType' object has no attribute 'type'

location: <unknown location>:-1

location: <unknown location>:-1
Of course nothing new as been exported (no overwriting of the existing files).

Just to detail the texturing part: I've simply added and loaded some texture (.png) for the default material on my object, then I used UV mapping to tile it properly on it, I can see the texture being correctly applied.

If I disable the "Export Materials" option in the blender2ogre export window, I have no error (save that I have no texture on my mesh of course), even with different image formats (.jpg, .bmp) this changes nothing.

I'm using version 0.6.0 of the exporter, which was intended for Blender 2.66 (an older version than mine), but unfortunately this is the most recent iteration of the script I can get my hand on.

This issue has been signalled here: here but nothing seems to be done.

Has anyone else here got this error using Blender 2.71 with blender2ogre ?
If so, is there any workaround ?

(I'm on ArchLinux, if that's of any help)

Thank you.
Last edited by Blaxar on Sat Nov 29, 2014 3:00 pm, edited 1 time in total.
jauthu
Gnoblar
Posts: 15
Joined: Fri Apr 22, 2011 11:06 pm
x 1

Re: Blender 2.71: error exporting textured material

Post by jauthu »

You could post your .blend file here (and to the blender2ogre issue tracker), so people can check and probably help you.

EDIT: I looked inside the script in blender... Most likely Blender API has changed. You might try using older blender version from here http://download.blender.org/release/Blender2.69/
User avatar
Blaxar
Gnoblar
Posts: 10
Joined: Sat Aug 16, 2014 2:58 pm

Re: Blender 2.71: error exporting textured material

Post by Blaxar »

Thanks for the reply, you responded shortly after I was investigating this again (after a few months) this is pretty good timing :D

I made the same supposition about the API changing too, however: I've tried both 2.66 and 2.69 (with corresponding version of the script) I got the same error each time, same goes for 2.72 (after updating it on my distro).

At this point I assume there's something wrong with my blend file, or that I've done something in a way the script did not anticipate, so here it is.

But you're right though, I should ask directly on the dedicated issue tracker, if this depends on something subtle to do on the Blender side I guess they might know better.

I'll keep all of this up to date, may I make some progress on this.
jauthu
Gnoblar
Posts: 15
Joined: Fri Apr 22, 2011 11:06 pm
x 1

Re: Blender 2.71: error exporting textured material

Post by jauthu »

I tried your file and the problem reproduces here in blender 2.68 is something wrong happens with your texture slots:

Code: Select all

<bpy_struct, MaterialTextureSlot("table1")>
<bpy_struct, MaterialTextureSlot("")>
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
As you can see, you have a wrong data in the second texture slot (while you can't see anything in the textures list in blender interface. I have no idea how could this happen. Simple work-around for me was to create second texture slot and then delete it. Then it exported well.
User avatar
Blaxar
Gnoblar
Posts: 10
Joined: Sat Aug 16, 2014 2:58 pm

Re: Blender 2.71: error exporting textured material

Post by Blaxar »

Thanks, your solution is neat !

Right after posting the last message, I fiddled with the python script (the same evening), I too have printed each texture slot in the for loop to find what's wrong, then noticed the same thing: a weird texture slot.

Instead of clearing things up blender-wise like you did, I ended up modifying the script to test if slot == None where needed (line 7071) and remove the test line 999, this did the trick but I was very reluctant to share or propose this as it seemed like a silly workaround, turns out it was.

I've just tried what you told, it worked, however regarding this shady second texture slot, I've noticed this:

Image

See how despite not being created yet, the second one offers me some mapping option ?
This is just a hint, but for sure when you really create the second texture slot and delete it, you're not proposed any option afterwards (as it's intended to be).

This is a weird behaviour from blender, the thing is I have no idea how to reproduce this in the first place so I cannot signal this "issue", I don't have a clue how it ended up this way, but apparently this happened to a few other people too.

Anyway, thank you !
Last edited by Blaxar on Sat Nov 29, 2014 4:48 pm, edited 3 times in total.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: [SOLVED] Blender 2.71: error exporting textured material

Post by spacegaier »

If this script change fixes the crash/error then that might be worth sending to the exporter maintainer to put into the official version.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
Blaxar
Gnoblar
Posts: 10
Joined: Sat Aug 16, 2014 2:58 pm

Re: [SOLVED] Blender 2.71: error exporting textured material

Post by Blaxar »

Alright, done.

See this pull request, I've made a less silly fix for the script than my original one.
Post Reply