Copying attributes

Terry Hancock hancock at anansispaceworks.com
Thu Jul 21 21:17:28 EDT 2005


On Thursday 21 July 2005 03:47 am, red wrote:
> Terry Hancock wrote:
> > I'm not sure either, yet, but can you indicate which line in your
> > listing is 102 in the source file?  That might be helpful.
> 
> 101: ##	f1.normal = copy.deepcopy(f.normal)
> 102:	f1.normal = NMesh.Vert(f.normal[0], f.normal[1], f.normal[2])
> 
> I've tried with deepcopy, but the result is exactly same.

Okay, well you do realize that the traceback means that it is not
*your copy* that lacks the normal attribute, but the object you
are passing it (f).  This is the loop variable, which is looping through
mesh.faces.  "mesh" was passed into the function. So the question
is, is "mesh" what you think it is?  It clearly has an attribute called
"faces", because you didn't get an error there. But is "faces" a list,
dictionary, or tuple (or something more obscure)?  And whatever it
is that you are iterating over, the elements of it don't appear to have
a "normal" attribute, so they probably aren't what you thought they
were.

Without knowing the Blender API, I probably can't help more than
that (we'd also have to see where the "mesh" variable came from,
I think).

Anyway, the trace back had to occur on the first reference to f.normal:
"f.normal[0]".  So that's what you should be checking into.  The deepcopy
has nothing to do with it.

Cheers,
Terry
 
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list