Unsubscriptable Object

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

Unsubscriptable Object

Postby Justintime9 » Wed Dec 31, 2008 9:28 am

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 :)
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Unsubscriptable Object

Postby Christian Walther » Thu Jan 01, 2009 8:51 am

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)?
Christian Walther
 
Posts: 443
Joined: Sun Jun 08, 2008 3:10 am
Location: Switzerland

Re: Unsubscriptable Object

Postby Justintime9 » Sat Jan 03, 2009 6:22 am

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
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Unsubscriptable Object

Postby Christian Walther » Sat Jan 03, 2009 6:56 am

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.
Christian Walther
 
Posts: 443
Joined: Sun Jun 08, 2008 3:10 am
Location: Switzerland

Re: Unsubscriptable Object

Postby Lontahv » Fri Jan 09, 2009 7:37 pm

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).
Currently getting some ink on my hands over at the Guild Of Ink-Makers (PyPRP2).
User avatar
Lontahv
Councilor of Artistic Direction
 
Posts: 1331
Joined: Wed Oct 03, 2007 2:09 pm


Return to Building

Who is online

Users browsing this forum: No registered users and 8 guests

cron