选择修改
This commit is contained in:
parent
95e0681d7c
commit
49387b456a
@ -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
|
||||
|
||||
# 【关键修复】:在正确的坐标系中计算移动向量
|
||||
# 计算移动距离(标量)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user