mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Revert "fix to https://github.com/IfcOpenShell/IfcOpenShell/commit/7f87f1fb89fb001320223a4d85e6267f342bf13c: have rotation around the object's origin, not the world origin"
This reverts commit 249e68f163.
This commit is contained in:
@@ -578,21 +578,9 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator):
|
||||
dot_product = expected_new_world_direction.dot(current_world_direction)
|
||||
angle = acos(min(max(dot_product, -1), 1))
|
||||
|
||||
# Rotate around object's own origin
|
||||
# Decompose the matrix to get translation, rotation, scale
|
||||
translation, rotation, scale = obj.matrix_world.decompose()
|
||||
|
||||
# Create rotation matrix and convert to quaternion
|
||||
# Create and apply rotation matrix
|
||||
rotation_matrix = Matrix.Rotation(angle, 4, rotation_axis)
|
||||
rotation_quat = rotation_matrix.to_quaternion()
|
||||
|
||||
# Apply rotation to existing rotation (quaternion multiplication)
|
||||
new_rotation = rotation_quat @ rotation
|
||||
|
||||
# Reconstruct matrix_world with same translation, new rotation, same scale
|
||||
obj.matrix_world = (
|
||||
Matrix.Translation(translation) @ new_rotation.to_matrix().to_4x4() @ Matrix.Scale(1, 4)
|
||||
)
|
||||
obj.matrix_world = rotation_matrix @ obj.matrix_world
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
bonsai.core.geometry.switch_representation(
|
||||
|
||||
Reference in New Issue
Block a user