Page MenuHome

Transform operators ignore Pivot Point
Closed, InvalidPublic


for instance,
bpy.ops.transform.rotate(...) rotates around median point (?), ignoring the pivot_point setting.

If you hit R and move mouse, it rotates around cursor if pivot point is set to 'CURSOR', but there's no way to do this via Python.

Transform operators should either have a pivot_point parameter or should respect the current pivot_point property

Topic at

Event Timeline

codemanx edited a custom field.May 29 2012, 10:01 PM

Actually, it was this topic:

It's a problem of context, the pivot point is a 3D view setting. If you execute this from e.g. the console, it will not be taken into account, but if you do it from an operator that runs in that 3D view, it will work.

It's possible to run an operator in a particular area:

Further don't see a bug here.

Brecht Van Lommel (brecht) changed the task status from Unknown Status to Invalid.May 31 2012, 7:04 PM

context overriding for a simple transform sounds needlessly complicated. And it doesn't even work!

I can call bpy.ops.transform.rotate(override, value=(45,)) while being in Mesh editmode, but in object mode, it either does nothing as edit_object has invalid type or it crashes Blender

simply run script with attached .blend
(my rig is Windows 7 64bit, Blender 2.63a)

correction: in editmode it rotates, but still ignores the pivot point. I added pivot_point to override but still no effect, it rotates around center :(

import bpy

for window in
screen = window.screen

for area in screen.areas:
if area.type == 'VIEW_3D':
override = {'window': window, 'screen': screen, 'area': area, 'scene': bpy.context.scene, 'edit_object': bpy.context.edit_object, 'selected_objects': bpy.context.selected_objects, 'pivot_point': 'CURSOR'}

bpy.ops.transform.rotate(override, value=(45,))