[Bf-python] mesh material names

R.Southall at brighton.ac.uk R.Southall at brighton.ac.uk
Sun Jan 24 19:04:46 CET 2010


Hi there.
I am struggling writing my first Blender python script, and my question is thus pretty basic.
I have a list of materials associated with meshes which I got by doing:
 
 
meshes = Blender.Mesh.Get()
for mesh in meshes:
	meshmat=mesh.materials
 
Printing meshmat then gives me [[Material "Cube"]] and [[Material "calcplane"]
I then want to only proceed with the next action if the material has the calcplane name. I have tried
 
 
if meshmat == "calcplane":
		for v in mesh.verts:
			print v.co
 
But I cannot get it to recognise the material name 'calcplane' and as meshmat has no name attribute in this context, as far as I can tell, I can't figure out how to get just the actual names out of meshmat.
 
Am I missing something simple or doing this in completely the wrong way?
 
Cheers
 
Ryan

-- 
Dr Ryan Southall.
Senior Research Fellow,
School of Architecture and Design,
University of Brighton,
Mithras House,
Lewes Road,
Brighton.
BN2 4AT.
Tel: (01273) 642335
Fax: (01273) 642348
Email: R.Southall at brighton.ac.uk




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20100124/997d5b7e/attachment.html>


More information about the Bf-python mailing list