Script not appearing in menu

Hi,

I’ve been following a tutorial on making a Blender export script (here if you’re wondering), and am having a problem enabling the script in Blender. As per the tutorial, I manually added the scripts to the Blender addons folder in their own subfolder, and Blender seems to locate and read it properly in the Addons menu.

http://i.imgur.com/KskhaFg.png?1

I have no problem ticking the check box and all seems fine, but when I head into the export section of the menu bar, there’s nothing to be found.

http://i.imgur.com/84YVuZD.png

The script was created for Blender 2.62 and I’ve tried using it with the same results in both 2.65 and 2.68 both with and without changing the version value in the script. It seems like I’m overlooking something stupid that’s causing the problem, but I can’t for the life of me figure out what it is. Has there been any API changes that I’m unaware of between 2.62 and 2.65 that would cause this, or is it something entirely different?

Also on this topic, is there a page that shows a version-by-version changelog to the API?

Thanks

Hard to say what is wrong without seeing your code or any error messages.

Thank you for replying.

The scripts are here, I have not modified them: http://dl.dropbox.com/u/26641698/Tutorial3Files.zip

I get no error messages when enabling the addon in the user preferences menu, anywhere else where I may find one?

Thanks again,
SwissCheese77

Check the system console!

Yes, several api changes were made since 2.62 and some.of them may cause older
Scripts to stop.working. but check for the actual error message first before worring about it

There aren’t any errors registered on the console, everything works perfectly until I try to find it in the menus and it simply isn’t there.

did you really check the system console, not the python console? There has to be an error in the script, or there’s no code that adds to the menu…

I’ve checked both. The problem is that it doesn’t appear in the menu so I can’t run it to check the script for errors. Everything seems to work fine up until that point without errors in either console. No message at all appears when I check the ‘enable’ box in the Addons menu, is there supposed to be some sort of success confirmation?

if the tick of the tickbox appears, that is sort of a confirmation. Note however, that errors can occur even before activation (script compilation before execution) or during the registration. Does the addon support your blender version? And are you sure it adds to the file menu?

I manually got the script to run in the Blender console, and it finally gave me an error message. Hope this helps you guys!

I don’t see why this would cause it not to show up in the menu, just looks like some general code issues to me. Of course I’m not an expert at how Blender operates… :stuck_out_tongue:


bpy.ops.export_my_format.fmt()
Error: Traceback (most recent call last):
  File "C:\Users\Brian\AppData\Roaming\Blender Foundation\Blender\2.62\scripts\addons\io_mesh_test\exporter.py", line 87, in execute
    fileBody.tri_list = self.extract_triangles(fileBody.mesh);
  File "C:\Users\Brian\AppData\Roaming\Blender Foundation\Blender\2.62\scripts\addons\io_mesh_test\exporter.py", line 59, in extract_triangles
    face_verts = face.vertices;
AttributeError: 'tuple' object has no attribute 'vertices'


location:C:\Program Files (x86)\Blender Foundation\Blender\2.62\scripts\modules\bpy\ops.py:180






Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "C:\Program Files (x86)\Blender Foundation\Blender\2.62\scripts\modules\bpy\ops.py", line 180, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Traceback (most recent call last):
  File "C:\Users\Brian\AppData\Roaming\Blender Foundation\Blender\2.62\scripts\addons\io_mesh_test\exporter.py", line 87, in execute
    fileBody.tri_list = self.extract_triangles(fileBody.mesh);
  File "C:\Users\Brian\AppData\Roaming\Blender Foundation\Blender\2.62\scripts\addons\io_mesh_test\exporter.py", line 59, in extract_triangles
    face_verts = face.vertices;
AttributeError: 'tuple' object has no attribute 'vertices'


location:C:\Program Files (x86)\Blender Foundation\Blender\2.62\scripts\modules\bpy\ops.py:180

variable “face” has obviously a type other than the script author expected, maybe due to incompatibility with >2.63 (bmesh)?

you should add print(face) above the error line to see what it contains

The reason it doesn’t show up in the menu is because of line 21 in init.py:

self.layout.operator(Exporter.bl_idname, text="My Model Format(.fmt)");

should be:

self.layout.operator(exporter.Exporter.bl_idname, text="My Model Format(.fmt)");

Really I think you’d be better off just working your way through one of the exporter scripts that come with Blender because the API has changed a lot since this script was created. You are obviously not running it on the latest version of Blender because the error I get is when it tries to access the faces attribute in a Mesh object, which I assume since bmesh was added, doesn’t exist any more.

Just had a look at the actually main script and I can see you are probably getting the error because you are not calculating the tessellated faces first.

    
def extract_triangles(self, mesh):
        # Create an empty array to store out triangles.
        triangle_list = [];
        
        mesh.calc_tessface()
        
        # Loop through all of the faces defined in the mesh
        for face in mesh.tessfaces: ....

Thank you dbo, I honestly never thought about using a default Blender script as a template. In hindsight, that’s probably the best choice I have. I think I’ll go down that route.

Thank you both for your help!