bpy.ops.transform.rotate doesn't work in blender as module or in blender in background mode. #88610

Closed
opened 2021-05-27 00:49:28 +02:00 by Oscar Arenas · 11 comments

System Information
Operating system: Ubuntu 18.04
Graphics card: AMD Radeon Pro 5300M 4 GB

Blender Version
Broken: 2.93
Worked: 2.83

Short description of error
I work with python scripts using blender as a module installed locally. There is an issue with the context using the transform rotate or rotate_normal operators (bpy.ops.transform.rotate) of a selected mesh. This was working well on blender 2.83 but does not work on the latest 2.93 beta, (I also test it on 3.00 alpha, and either worked). If you test the translate operator (bpy.ops.transform.translate) in the same conditions, it works but no with the rotate operator.

Exact steps for others to reproduce the error
Just open in a new python shell:

>>> import bpy
>>> bpy.app.version_string

'2.93.0 Beta'
>>> bpy.ops.transform.translate()

{'FINISHED'}
>>> bpy.ops.transform.rotate()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/2.93/scripts/modules/bpy/ops.py", line 132, in __call__
    ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.transform.rotate.poll() failed, context is incorrect
>>> bpy.ops.transform.translate.poll()

True
>>> bpy.ops.transform.rotate.poll()

False

This is a bare explanation, that shows the error, But Also I tested it by selecting mesh, changing context, modes, and always i got the same error when using bpy.ops.transform.rotate via script in a terminal or python shell. But I think also happen when blender is launched in background mode as can be seen in this StackOverflow question: https://stackoverflow.com/questions/67659621/how-to-use-the-rotate-operator-on-blender-python-if-you-execute-the-script-on-th

**System Information** Operating system: Ubuntu 18.04 Graphics card: AMD Radeon Pro 5300M 4 GB **Blender Version** Broken: 2.93 Worked: 2.83 **Short description of error** I work with python scripts using blender as a module installed locally. There is an issue with the context using the transform rotate or rotate_normal operators (bpy.ops.transform.rotate) of a selected mesh. This was working well on blender 2.83 but does not work on the latest 2.93 beta, (I also test it on 3.00 alpha, and either worked). If you test the translate operator (bpy.ops.transform.translate) in the same conditions, it works but no with the rotate operator. **Exact steps for others to reproduce the error** Just open in a new python shell: ``` >>> import bpy >>> bpy.app.version_string '2.93.0 Beta' >>> bpy.ops.transform.translate() {'FINISHED'} >>> bpy.ops.transform.rotate() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.9/dist-packages/2.93/scripts/modules/bpy/ops.py", line 132, in __call__ ret = _op_call(self.idname_py(), None, kw) RuntimeError: Operator bpy.ops.transform.rotate.poll() failed, context is incorrect >>> bpy.ops.transform.translate.poll() True >>> bpy.ops.transform.rotate.poll() False ``` This is a bare explanation, that shows the error, But Also I tested it by selecting mesh, changing context, modes, and always i got the same error when using bpy.ops.transform.rotate via script in a terminal or python shell. But I think also happen when blender is launched in background mode as can be seen in this StackOverflow question: https://stackoverflow.com/questions/67659621/how-to-use-the-rotate-operator-on-blender-python-if-you-execute-the-script-on-th
Author

Added subscriber: @osk386

Added subscriber: @osk386
Author

Seems like the default working context (Layout) does not accept some operators. I was able to override the context using VIEW_3D screen, I guess that this was made intentionally, So I need to modify my all code to use an overriding context.

Seems like the default working context (Layout) does not accept some operators. I was able to override the context using VIEW_3D screen, I guess that this was made intentionally, So I need to modify my all code to use an overriding context.

Added subscriber: @Darknoodles

Added subscriber: @Darknoodles
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

HI @osk386 , thanks for the report. I can not reproduce this on 2.93LTS (2021-06-02) and current master with default startup.

Can you please check again with newest versions?: https://builder.blender.org/download/daily

HI @osk386 , thanks for the report. I can not reproduce this on 2.93LTS (2021-06-02) and current master with default startup. Can you please check again with newest versions?: https://builder.blender.org/download/daily
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Changed status from 'Needs User Info' to: 'Archived'

Changed status from 'Needs User Info' to: 'Archived'
Member

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed.

Thanks again for the report. If the problem persists please open a new report with the required information.

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed. Thanks again for the report. If the problem persists please open a new report with the required information.
Member

Closed as duplicate of #99037

Closed as duplicate of #99037

This issue was referenced by 77eadbede4

This issue was referenced by 77eadbede493cb2a02b82981ad71af3da86b2d0c

Changed status from 'Duplicate' to: 'Resolved'

Changed status from 'Duplicate' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#88610
No description provided.