Page 1 of 1

Unsubscriptable Object

PostPosted: Wed Dec 31, 2008 9:28 am
by Justintime9
Shorah,

Today I moved on to the outside part of my age. It consists of a large grassy plain, and a skydome encompassing everything. The Ground is a grid, with many verts. After getting everything right, I exported it.

After awhile of exporting, it told me that the grass had too many verts for one material, and that I should split it up into more than one material. This was a familiar error, so I knew how to fix it.

When that was done, I tried exporting again, but this time I got an error I've never seen before. Here's what I got:

Image

Anyone know what's causing it? Thx for the help :)

Re: Unsubscriptable Object

PostPosted: Thu Jan 01, 2009 8:51 am
by Christian Walther
Looks like one of the materials of your mesh is None, at a cursory glance (I get a different error message when trying to subscript None, but that may be due to Python version). I don't have a conclusive list of circumstances under which that happens, but here's what I would check, off the top of my head: Does your mesh have more material indices (the x number in the "x Mat y" control) than actual materials linked? Are any materials linked to the object instead of the mesh (OB/ME switch in the Links and Pipeline box in the Shading > Material buttons panel)?

Re: Unsubscriptable Object

PostPosted: Sat Jan 03, 2009 6:22 am
by Justintime9
Well, I checked that, and none of those seem to be the problem. What exactly is "subscript" anyway, and why would it be unsubscriptable? The fact that someone moved this topic into the PyPRP seems to indicate it has something to do with python, which I'm terrible at :P

Re: Unsubscriptable Object

PostPosted: Sat Jan 03, 2009 6:56 am
by Christian Walther
Hm. Then I'm out of quick answers. What I would do on my own machine now is to insert more debugging output into PyPRP and/or poke around in the scene using Blender's interactive Python console. Let me know if you want me to walk you through that.

Or does the problem still occur when you strip everything out of your scene except the Grid.002 object? Then you could post the stripped-down Blender file and I'd have a look.

Yes, the error message comes from Python, not from PyPRP or Blender. To subscript means to try to access an element of something, like a list or dictionary. It doesn't work with objects that don't have elements, such as None. It happens twice in the line in question,
Code: Select all
baseVertexIdx = len(materialGroups[mface.mat]["vertices"])

First you get the element at index mface.mat from the list materialGroups, then the element named "vertices" of the result. I assume it's the second that trips up because the result from the first is None instead of a dictionary as expected.

Re: Unsubscriptable Object

PostPosted: Fri Jan 09, 2009 7:37 pm
by Lontahv
It looks like there are verts that don't belong to a particular material-group. I usually try to have one-material per object. Take a look at you're material assignment in the mesh settings in your buttons window for object "Grid.002". Take a look at how many materials are assigned (is should say something like "1 mat 3" or something, for instance).