bpy.ops.transform.resize individual origins

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
michel_lef
Posts: 0
Joined: Thu Jun 13, 2013 11:29 am

bpy.ops.transform.resize individual origins

Post by michel_lef » Thu Jun 13, 2013 11:51 am

Hello,

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.object.editmode_toggle()
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]

CoDEmanX
Posts: 0
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Post by CoDEmanX » Thu Jun 13, 2013 7:07 pm

there's no pivot option for the operator, and it IIRC it ignores the current pivot point settings.

See e.g.
http://projects.blender.org/tracker/?fu ... group_id=9

You might look into BMesh module, there is a distinct function for indivual extrude afaik.
I'm sitting, waiting, wishing, building Blender in superstition...

michel_lef
Posts: 0
Joined: Thu Jun 13, 2013 11:29 am

Post by michel_lef » Wed Jun 19, 2013 11:48 pm

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!

CoDEmanX
Posts: 0
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Post by CoDEmanX » Fri Jun 21, 2013 12:46 am

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
I'm sitting, waiting, wishing, building Blender in superstition...

Post Reply