From 49387b456abece9538e2a0aff00bf424d95c103d Mon Sep 17 00:00:00 2001 From: Hector <2055590199@qq.com> Date: Fri, 15 Aug 2025 09:20:35 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E6=8B=A9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/selection.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/core/selection.py b/core/selection.py index 28709a1c..8f2c020c 100644 --- a/core/selection.py +++ b/core/selection.py @@ -1304,28 +1304,25 @@ class SelectionSystem: scale_magnitude = (abs(node_scale.x) * abs(node_scale.y) * abs(node_scale.z)) ** (1.0/3.0) parent_cumulative_scale *= scale_magnitude current_node = current_node.getParent() - + # 获取目标节点自身的缩放 target_scale = self.gizmoTarget.getScale() target_scale_magnitude = (abs(target_scale.x) * abs(target_scale.y) * abs(target_scale.z)) ** (1.0/3.0) - + # 智能补偿策略: # 1. 只对父节点链的小缩放进行完全补偿(这通常是单位转换导致的) # 2. 对目标节点自身的缩放进行部分补偿(避免大模型缩小后移动过快) parent_compensation = 1.0 / parent_cumulative_scale if parent_cumulative_scale > 0 else 1.0 - + # 对目标节点自身的缩放使用平方根补偿,减少过度补偿 target_compensation = 1.0 / math.sqrt(target_scale_magnitude) if target_scale_magnitude > 0 else 1.0 - + # 限制目标补偿的最大值,避免移动过快 target_compensation = min(target_compensation, 10.0) # 最大10倍补偿 - + # 综合补偿因子 total_compensation = parent_compensation * target_compensation - scale_factor = pixel_to_world_ratio * 0.5 * total_compensation - - print(f"智能缩放补偿: 父链缩放={parent_cumulative_scale:.4f}, 目标缩放={target_scale_magnitude:.4f}") - print(f"父链补偿={parent_compensation:.2f}, 目标补偿={target_compensation:.2f}, 总补偿={total_compensation:.2f}") + scale_factor = pixel_to_world_ratio * 0.5*total_compensation # 【关键修复】:在正确的坐标系中计算移动向量 # 计算移动距离(标量)