AttributeError: 'NoneType' object has no attribute 'getData'

Since adding rigging and animation to my model I’m unable to export to an .x file using the python script.

Blender AttributeError: ‘NoneType’ object has no attribute ‘getData’

Any help would be hugely appreciated.

can you post the error? (mainly the line number)


Compiled with Python version 2.5.
Checking for installed Python… got it!
Traceback (most recent call last):
File “<string>”, line 172, in draw
File “<string>”, line 86, in my_callback
File “<string>”, line 394, in SelectObjs
File “<string>”, line 352, in writeObjFrames
File “<string>”, line 514, in writeRootBone
File “<string>”, line 485, in exportMeshArm
AttributeError: ‘NoneType’ object has no attribute ‘getData’

---------------------- Below is Line 485 in Context ---------------------

#Export Mesh with Armature
def exportMeshArm(self,arm,arm_ob,ch_obj):
tex = []
(Line 485) mesh = ch_obj.getData()
self.writeTextures(ch_obj, tex)
self.writeMeshcoordArm(ch_obj ,arm_ob)
self.writeMeshMaterialList(ch_obj, mesh, tex)
self.writeMeshNormals(ch_obj, mesh)
self.writeMeshTextureCoords(ch_obj, mesh)
#self.file.write(" } // End of the Frame %s
" % (
self.file.write(" } // End of the Object %s
" % (

Surely someone knows a fix for this. It’s really putting a cramp in my productivity.

You’ll get that error if the mesh isn’t connected “correctly” to the armature.

Don’t connect the mesh to armature any other way than the following: Select the mesh, shift select the armature, CTRL P to parent the mesh to armature, dont create vertex groups. Then create the vertex groups manually. A mesh should have a vertex group for each bone (even if there is no actual vertices assigned) and all vertices in the mesh must be assigned to a bone.

That won’t affect the weight painting, will it? I’m pretty sure it automatically assigned groups for the vertices. I should assign each vertex to the bone that it’s most weighted towards? And that won’t affect my weight painting?

Thanks for the reply =)

  • C

For lowpoly models, particularly when exporting to directX ,it is better to assign vertex groups manually. It’s pretty important that a vertex has a weight of 1 which can only really be guaranteed by manually assigining vertex groups.

Blender’s animation tools are geared more towards high poly models for film animation where all the fancy techniques such as weight painting, heat painting, soft body interaction, shape keys, lattices etc really come into their own. The rules for low poly modelling and animation for export to game formats is KISS…Keep it simple. Most, if not all the tutorials and techniques you see for using Blender’s animation tools are unsuitable for Low Poly application. Low Poly is a technique all to it’s self. Plus, DirectX is a pretty pish format and unfortunately not well supported by Blender… the script does work but you’ve got to do it exactly the way the exporter wants you to. The new FBX exporter is much better if your application supports it.

Once you’ve done it a couple of times you’ll realise that assigning the vertex groups manually is actually faster than weight painting as long as you set your model up properly in a decent pose you can border select almost everything you need to.

One more thing, don’t use envelopes either.

Are you saying that if a vertex has a weight of 3/4 from one bone and 1/4 from another that would be ok? I’d rather do the extra work of ensuring this than having every vertice only be influenced by one bone.

This is what I got from the FBX exporter, but I’m not sure if it’s the “new” one.

Compiled with Python version 2.5.
Checking for installed Python… got it!
Traceback (most recent call last):
File “<string>”, line 1394, in write_ui
File “<string>”, line 742, in write_scene
AttributeError: ‘Blender Object’ object has no attribute ‘bones’

No, I’m saying that every vertex should be assigned to only a single bone with weight 1.0 otherwise the directX export may fail. If you are going to weight paint I suggest you set the weight to 1.0 and paint everything red.

Ref FBX for all the instructions and test files you’ll need visit link below.

And a word of advice for anybody using Blender for export to game/realtime formats with animation… take baby steps to build up your knowledge of the exporter in question. For example.

Can you export a static cube and view it in your target application?
Can you texture the cube and export it and view in your target application?
Can you attach the cube to a single bone armature and keyframe a few frames of animation and export it correctly and view it in your application?

If you answer no to any of the above don’t waste your time with the complex nuances of rigging, skinning and posing until you can export a textured, animated cube.

I see a lot of people (in various forums) spending hours creating some humongous complex mesh (or groups of meshes) with fancy multibone rigs and dozens of actions and then complaining that they cant get it to export from Blender. Not a criticism of anybody in particular just an observation. When you encounter a problem break it down all the way to first principles and work your way up the ladder of complexity. If this stuff were easy everybody would be doing it.:slight_smile:

So it dosn’t work correctly. Being able to get what you do in Blender out and into your app should be a basic bit of functionaity. If it can’t do that then… it doesn’t work correctly.

Weighting everything one isn’t a good option. It makes for a poorly deforming mesh. I’ll have to find a different modeling program and start from scratch.

~ C

Regarding your first point you’ll find huge inconscenties between different apps that “support” the DirectX format. Some apps will load the files OK some won’t. That’s down to interpretation or implementation of the coders of each individual app. Blender is no different from a lot of other apps in this regard. What is your target application?

Regarding poorly deforming meshes with weight 1.0, well, that’s where you utilise your skills as a modeller and texture artist. Low poly modelling is an art in itself because of such compromises that need to be made no matter what tool you use. Unless you’re developing models for next gen platforms poly count will be the driving factor of any realtime model and it’s up to you to model, rig and texture the mesh to create the illusion of a high poly animated character (but not neccessarily utilising the same tools and techniques a film animator will use).

In your quest for a new modeller heed my comments about baby steps. Don’t dive in modelling and rigging until you’ve got the basics of the art pipeline down first.

Deleted this post because it’s now irrelevant and distracting.

Still working on this issue. It’s taking way too long to figure out. At this point I’m thinking it’s not the script, but the way I’ve got things set up in Blender. Could someone PLEASE let me email them my blend file and take a look to see if there’s anything obvious that I’ve done wrong? I’m just not experienced enough to figure it out. I would sooooo much appreciate it.

Problem fixed. I figured out the python just enough to put in some debugging and figured out the armature had to be the parent of the mesh and not visa versa. sigh

Which is what I told you to do in post #5 :confused:

Glad you got it working though.

Crap, you did. My attention got fixed on the whole vertex group thing and I missed the other part. Probably because at the time I didn’t have either parented to either. Thanks for your help… you did get me pointed in the right direction for experimentation. I learned in the process anyway =)