Transform operators ignore Pivot Point
Closed, InvalidPublic

Description

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 BA.org:
http://blenderartists.org/forum/showthread.php?244453-change-pivot-point-mode-with-python

Details

Type
Bug

Actually, it was this topic:

http://blenderartists.org/forum/showthread.php?253470-How-to-rotate-about-a-specified-point-3D-Cursor

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:
http://www.blender.org/documentation/blender_python_api_2_63_7/bpy.ops.html#overriding-context

Further don't see a bug here.

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 bpy.context.window_manager.windows:
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'}
break

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