Translation operator moves Child-Of constrained bones in the parent space instead of world #42256

Closed
opened 2014-10-16 13:06:01 +02:00 by Lukas Tönne · 8 comments
Member

Test file child_constraint_problem.blend

Select the top bone with the child-of constraint, press G to move it with the transform operator, observe the movement direction.

Bone with a child-of constraint to another bone. Moving the bone with the translation operator or the manipulators interprets the offset in the constraint target's ("parent") space instead of world space. Changing the world transform with a python script, however, works fine:

import bpy
from mathutils import *

ob = "Armature"
bone = "head"

def translate_world(obname, bonename, offset):
    scene = bpy.context.scene
    ob = scene.objects[obname]
    bone = ob.pose.bones[bonename]
    
    mat = Matrix.Translation(Vector(offset))
    bone.matrix = ob.matrix_world.inverted() * mat * bone.matrix

translate_world(ob, bone, (3,0,0))
Test file [child_constraint_problem.blend](https://archive.blender.org/developer/F117669/child_constraint_problem.blend) Select the top bone with the child-of constraint, press G to move it with the transform operator, observe the movement direction. Bone with a child-of constraint to another bone. Moving the bone with the translation operator or the manipulators interprets the offset in the constraint target's ("parent") space instead of world space. Changing the world transform with a python script, however, works fine: ``` import bpy from mathutils import * ob = "Armature" bone = "head" def translate_world(obname, bonename, offset): scene = bpy.context.scene ob = scene.objects[obname] bone = ob.pose.bones[bonename] mat = Matrix.Translation(Vector(offset)) bone.matrix = ob.matrix_world.inverted() * mat * bone.matrix translate_world(ob, bone, (3,0,0)) ```
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Bastien Montagne was assigned by Lukas Tönne 2014-10-16 13:06:01 +02:00
Author
Member

Added subscriber: @LukasTonne

Added subscriber: @LukasTonne
Author
Member

The problem seems to be related to translation offset, disabling these 3 lines fixes the directions (but breaks gives wrong translation from rotational part):
https://developer.blender.org/diffusion/B/browse/master/source/blender/blenkernel/intern/constraint.c$814

Disabling inverse matrix for transform operator also seems to "fix" the effect:
https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/transform/transform_conversions.c$4774

The problem seems to be related to translation offset, disabling these 3 lines fixes the directions (but breaks gives wrong translation from rotational part): https://developer.blender.org/diffusion/B/browse/master/source/blender/blenkernel/intern/constraint.c$814 Disabling inverse matrix for transform operator also seems to "fix" the effect: https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/transform/transform_conversions.c$4774

So, could reproduce the same issue with mere objects - as soon as you do not use all parent's transform, and do rotate the parent, transform is broken.

child_constraint_noloc_transform_issue.blend

This has clearly to see with constinv and the hack done at the end of childof_evaluate() (first link by Lukas in above comment). Still digging…

So, could reproduce the same issue with mere objects - as soon as you do not use all parent's transform, and do rotate the parent, transform is broken. [child_constraint_noloc_transform_issue.blend](https://archive.blender.org/developer/F117687/child_constraint_noloc_transform_issue.blend) This has clearly to see with constinv and the hack done at the end of `childof_evaluate()` (first link by Lukas in above comment). Still digging…
Member

Added subscriber: @JoshuaLeung

Added subscriber: @JoshuaLeung

This issue was referenced by 61d1477415

This issue was referenced by 61d14774150662a8cbcf439c7e93959fd3c74834

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 61d1477415.

Closed by commit 61d1477415.
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
4 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#42256
No description provided.