[Bf-python] Object/Mesh constructors

Goat Man goatman.py at gmail.com
Sun Jul 11 11:09:33 CEST 2010


What about modifier constructors, there is no bpy.data.modifiers.

bpy.ops.object.add_modifier only works on the active selection, but
bpy.context.active_object is readonly, and appending to bpy.context.selected
does nothing.
ob.modifiers.add() also fails.

On Thu, Jul 8, 2010 at 9:36 PM, Campbell Barton <ideasman42 at gmail.com>wrote:

> mesh = bpy.data.meshes.new(name="Foo")
> obj = bpy.data.objects.new(name="Foo", object_data=mesh)
> bpy.context.scene.objects.link(obj)
>
> On Thu, Jul 8, 2010 at 2:57 PM, David Jagoe <davidjagoe at gmail.com> wrote:
> > G'day all,
> >
> > Is there a better way to add an object than using bpy.ops.object_add
> > or (e.g) bpy.ops.mesh.primitive_plane_add?
> >
> > I've tried to use bpy.types.Mesh.
> >
> > Ideally I would like something like a normal factory or constructor
> > method that returns the object to me so that I can manipulate it
> > further. I imagine that such a facility must exist but I can't seem to
> > find it.
> >
> >
> > Thanks,
> > David
> > _______________________________________________
> > Bf-python mailing list
> > Bf-python at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-python
> >
>
>
>
> --
> - Campbell
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20100711/fecd8033/attachment.html>


More information about the Bf-python mailing list