In the MWE (Minimal Working Example) below I created 4 spheres and placed them at 4 different locations along the Y-axis. I would like to scale each sphere as per my wish (lets say 2 in the X,Y,Z).
import bpy
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=False, confirm=False)
bpy.ops.mesh.primitive_uv_sphere_add(enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
bpy.ops.mesh.primitive_uv_sphere_add(enter_editmode=False, align='WORLD', location=(0, 2.5, 0), scale=(1, 1, 1))
bpy.ops.mesh.primitive_uv_sphere_add(enter_editmode=False, align='WORLD', location=(0, 5, 0), scale=(1, 1, 1))
bpy.ops.mesh.primitive_uv_sphere_add(enter_editmode=False, align='WORLD', location=(0, 7.5, 0), scale=(1, 1, 1))
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_by_type(type="MESH")
bpy.ops.object.join()
bpy.ops.object.mode_set(mode='EDIT')
bpy.context.tool_settings.transform_pivot_point = 'INDIVIDUAL_ORIGINS'
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.transform.resize(value=(2, 2, 2))
I'm scaling the spheres in Edit Mode using INDIVIDUAL_ORIGINS
where the center of the spheres should have stayed exactly where they currently are and scale by a factor of 2. But somehow this is not respected, and looks like BOUNDING_BOX_CENTER
is used instead. How can I achieve that using python scripting? Though I can use the scale function in the MWE for each individual sphere, in my actual case there exist several thousands of spheres and individually scaling each sphere is out of reach.
Also how can I scale the objects (spheres in my example) that lie between certain specific coordinates? For example, I just want to scale the spheres whose centers are engulfed between (0,2,0) to (0,6,0) i.e only spheres 2, 3 are scaled and the spheres 1, 4 remain unscaled?
I am using Blender version 3.3.1 for reference.
bpy.context.tool_settings.transform_pivot_point = 'INDIVIDUAL_ORIGINS'
, it is not being respected when doingbpy.ops.transform.resize(value=(2, 2, 2))
in Edit Mode. It sticks toBOUNDING_BOX_CENTER
$\endgroup$