how can I create a list of object n a scene depending on a the value of their property ?
Well, it’s not so efficient, though I can’t think of another way.
I’d obtain a list off all objects in the scene.
Then i’d go through that list and count up all the objects that I wanted to put into my list.
I’d make an array that had this many elements in it.
I would then go through the original list again, this time adding the objects I was concerned with into the array I just created.
From memory, the script templates tell you how to get a list of all object in the scene.
Hope this helps you along.
I’m not sure what you mean by property, but you can always to something like this:
import Blender scn = Blender.Scene.GetCurrent() objs = [ob for ob in scn.objects if ob.type == 'Mesh'] print objs
This will get all mesh type objects. You can test for whatever you want in the if part. Example. To get all objects with LocZ=0.0:
objs=[ob for ob in scn.objects if ob.LocZ==0.0]
enhzflep, you don’t need to specify the length of a python array/list in advance
propell has shown how to do it the best way, but another, perhaps slightly clearer way is:
objs= for ob in scn.objects: if ob.type=="Mesh": objs.append(ob)