[Bf-python] Object/Mesh constructors

Campbell Barton ideasman42 at gmail.com
Sun Jul 11 12:41:39 CEST 2010


http://www.blender.org/documentation/250PythonDoc/bpy.types.ObjectModifiers.html#bpy.types.ObjectModifiers.new
eg:
 mod = obj.modifiers.new(name="NewMod", type='EDGE_SPLIT')

On Sun, Jul 11, 2010 at 11:09 AM, Goat Man <goatman.py at gmail.com> wrote:
> 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
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
>



-- 
- Campbell



More information about the Bf-python mailing list