[Bf-python] mesh material names

R.Southall at brighton.ac.uk R.Southall at brighton.ac.uk
Sun Jan 24 19:36:44 CET 2010


I figured it out. TIt was as simple as this.


for mesh in meshes:
	meshmat=mesh.materials
	for meshmatname in meshmat:
		if meshmatname.name == ("calcplane"):
			for v in mesh.verts: 
				print v.co

-- 
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



-----Original Message-----
From: bf-python-bounces at blender.org on behalf of R.Southall at brighton.ac.uk
Sent: Sun 2010-01-24 18:04
To: bf-python at blender.org
Subject: [Bf-python] mesh material names
 
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 --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3312 bytes
Desc: not available
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20100124/17686289/attachment.bin>


More information about the Bf-python mailing list