Crash running transform.translate operator on IK bone #82484

Closed
opened 2020-11-07 12:10:15 +01:00 by (disabled) · 7 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce GTX 950/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.75

Blender Version
Broken: version: 2.90.1, branch: master, commit date: 2020-09-23 06:43, hash: 3e85bb34d0
Bug also in my latest build of 9af6c041e8, debugger shows t->region->regiondata is NULL here (transform.c) .

Short description of error
As by title. The reason is the missing region in overriden context. Your example in bpy.ops should take that into account.

Exact steps for others to reproduce the error

  1. Open the attached blend
  2. Run the script in fron of you

crash_missing_region_in_override.blend

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: GeForce GTX 950/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.75 **Blender Version** Broken: version: 2.90.1, branch: master, commit date: 2020-09-23 06:43, hash: `3e85bb34d0` Bug also in my latest build of 9af6c041e8fc2f32d9db53b7821111ca724ead17, debugger shows `t->region->regiondata` is NULL [here (transform.c) ](https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/transform/transform.c$89) . **Short description of error** As by title. The reason is the missing region in overriden context. Your example in [bpy.ops ](https://docs.blender.org/api/current/bpy.ops.html#execution-context) should take that into account. **Exact steps for others to reproduce the error** 1. Open the attached blend 2. Run the script in fron of you [crash_missing_region_in_override.blend](https://archive.blender.org/developer/F9227089/crash_missing_region_in_override.blend)
Author

Added subscriber: @alefor

Added subscriber: @alefor

Added subscriber: @rjg

Added subscriber: @rjg

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Robert Guetzkow self-assigned this 2020-11-07 15:17:05 +01:00

If you are overriding the context, you need to know exactly what you're doing. It's very easy to supply an incomplete or wrong context that will make Blender try to access the wrong data or dereference a pointer that isn't actually pointing to the expected context data. Not every operator requires the same information, the context that is required depends on the particular operator that is used. In this case it's very noticeable that Blender's Python API is only wrapping C and C++ code and all warnings from the Gotcha section apply. Additionally, using bpy.ops.transform.translate for translating bones via Python is most likely not the right approach for what you're trying to do.

You can get and set the location of the pose bones without any operators, e.g. like this for moving them along the x-axis:

import bpy

armature = bpy.context.scene.objects["Armature"]

for pose_bone in armature.pose.bones:
    pose_bone.location[0] = pose_bone.location[0] + 0.5

I don't know exactly what you goal with the script was, so the right solution for your problem might need a different approach.

If you need help learning or using Blender, please post a question on one of our [community websites ]], for instance https:*blender.stackexchange.com/ , https:*blenderartists.org/ or the [ https:*blender.chat/channel/support | #support channel on Blender chat . The bug tracker is only for bug reports.

If you are overriding the context, you need to know exactly what you're doing. It's very easy to supply an incomplete or wrong context that will make Blender try to access the wrong data or dereference a pointer that isn't actually pointing to the expected context data. Not every operator requires the same information, the context that is required depends on the particular operator that is used. In this case it's very noticeable that Blender's Python API is only wrapping C and C++ code and all warnings from the [Gotcha ](https://docs.blender.org/api/current/info_gotcha.html#help-my-script-crashes-blender) section apply. Additionally, using `bpy.ops.transform.translate` for translating bones via Python is most likely not the right approach for what you're trying to do. You can get and set the location of the pose bones without any operators, e.g. like this for moving them along the x-axis: ``` import bpy armature = bpy.context.scene.objects["Armature"] for pose_bone in armature.pose.bones: pose_bone.location[0] = pose_bone.location[0] + 0.5 ``` I don't know exactly what you goal with the script was, so the right solution for your problem might need a different approach. If you need help learning or using Blender, please post a question on one of our [community websites ]], for instance [[ https:*blender.stackexchange.com/ | Blender's StackExchange ]], [[ https:*blenderartists.org/ | blenderartists.org ]] or the [[ https:*blender.chat/channel/support | #support channel on Blender chat ](https:*www.blender.org/community/). The bug tracker is only for bug reports.

Added subscriber: @Blendify

Added subscriber: @Blendify

@Blendify We might want to add a warning box in the context override section for this kind of issue, since it is really easy to get this wrong.

@Blendify We might want to add a warning box in the context override section for this kind of issue, since it is really easy to get this wrong.
Author

Removed subscriber: @alefor

Removed subscriber: @alefor
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
2 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#82484
No description provided.