Page 1 of 1

bpy.ops.transform.resize individual origins

Posted: Thu Jun 13, 2013 11:51 am
by michel_lef

I'm a newbie to bpy. I'm trying to scale faces from there individual origin inside the editmode just after extruding each face individually. In the blender interface, I would set the pivot option to "individual origins". But I can't find where to set this in scripting. Here is the bit of script I'm struggling with:

Code: Select all

import bpy

bpy.ops.mesh.primitive_grid_add(x_subdivisions=15, y_subdivisions=10)
bpy.ops.transform.resize(value=(15/2, 10/2, 1))
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude_faces_indiv={"mirror":False}, TRANSFORM_OT_shrink_fatten={"value":0, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
bpy.ops.transform.resize(value=(0.8, 0.8, 0.8))[code]
Thanks for your help!!![/code]

Posted: Thu Jun 13, 2013 7:07 pm
by CoDEmanX
there's no pivot option for the operator, and it IIRC it ignores the current pivot point settings.

See e.g. ... group_id=9

You might look into BMesh module, there is a distinct function for indivual extrude afaik.

Posted: Wed Jun 19, 2013 11:48 pm
by michel_lef
Thanks for your reply CoDEmanX !

I tried to find out a bit more about the Bmesh solution you proposed. I didn't got fare enough to reach a solution. But I succeeded scaling my grid faces individually by using a inset (bpy.ops.mesh.inset) after the extrude individually.

Though I found a solution for what I was busy with, I'm still interested in understanding the way I can manipulate origin in bpy. Fell free to post!

Posted: Fri Jun 21, 2013 12:46 am
by CoDEmanX
the origin is Object.location, if you wanna move just that location but not the mesh (from a visual view), then you would have to translate the object and also translate the mesh data but in the inversed direction