动画和碰撞检测后,保持物体在最终位置而非恢复到起点;去掉动画时对物体和虚拟车辆的绿色渲染
This commit is contained in:
parent
a0651d60cd
commit
1370ce1fd2
@ -1384,13 +1384,13 @@ namespace NavisworksTransport.Core.Animation
|
||||
ModelHighlightHelper.ClearCollisionHighlights();
|
||||
LogManager.Debug("[动画开始] 已清除所有碰撞高亮");
|
||||
|
||||
// 高亮车辆对象(绿色)
|
||||
if (_animatedObject != null)
|
||||
{
|
||||
var vehicleItems = new List<ModelItem> { _animatedObject };
|
||||
ModelHighlightHelper.HighlightItems(ModelHighlightHelper.AnimatedObjectCategory, vehicleItems);
|
||||
LogManager.Debug("[动画开始] 已高亮车辆对象为绿色");
|
||||
}
|
||||
// 不再高亮车辆对象,保持原始外观(客户要求)
|
||||
// if (_animatedObject != null)
|
||||
// {
|
||||
// var vehicleItems = new List<ModelItem> { _animatedObject };
|
||||
// ModelHighlightHelper.HighlightItems(ModelHighlightHelper.AnimatedObjectCategory, vehicleItems);
|
||||
// LogManager.Debug("[动画开始] 已高亮车辆对象为绿色");
|
||||
// }
|
||||
|
||||
// 启动动画播放
|
||||
StartAnimationPlayback();
|
||||
@ -1514,14 +1514,8 @@ namespace NavisworksTransport.Core.Animation
|
||||
ModelHighlightHelper.ClearAllHighlights();
|
||||
LogManager.Info("动画停止:已清除所有高亮");
|
||||
|
||||
// 将物体移回起点位置并恢复初始朝向
|
||||
if (_pathPoints != null && _pathPoints.Count > 0 && _animatedObject != null)
|
||||
{
|
||||
MoveVehicleToPathStart();
|
||||
LogManager.Info($"物体已移回起点位置并恢复初始朝向");
|
||||
}
|
||||
|
||||
LogManager.Info("动画已停止");
|
||||
// 动画停止时保持物体在当前位置(不移回起点)
|
||||
LogManager.Info("动画已停止,物体保持在当前位置");
|
||||
|
||||
// 动画停止时不创建碰撞测试汇总,由动画完成事件统一处理
|
||||
LogManager.Info("动画停止,等待动画完成事件统一处理碰撞测试...");
|
||||
@ -1596,13 +1590,8 @@ namespace NavisworksTransport.Core.Animation
|
||||
.Select(g => g.First())
|
||||
.ToList();
|
||||
|
||||
// 将物体移回起点位置并恢复初始朝向
|
||||
if (_pathPoints != null && _pathPoints.Count > 0 && _animatedObject != null)
|
||||
{
|
||||
RestoreObjectToCADPosition();
|
||||
MoveVehicleToPathStart();
|
||||
LogManager.Info($"动画播放自然结束,物体已移回起点位置并恢复初始朝向");
|
||||
}
|
||||
// 动画自然结束时保持物体在最终位置(不移回起点)
|
||||
LogManager.Info("动画播放自然结束,物体保持在最终位置");
|
||||
|
||||
// 直接设置为完成状态,避免中间状态切换
|
||||
SetState(AnimationState.Finished);
|
||||
|
||||
@ -1009,19 +1009,19 @@ namespace NavisworksTransport
|
||||
LogManager.Warning("[分组测试] 分组为空(未检测到真实几何碰撞),未添加到主测试");
|
||||
}
|
||||
|
||||
// 碰撞测试完成后,将物体恢复到路径起点位置(如果提供了路径点)
|
||||
if (animatedObject != null && IsModelItemValid(animatedObject) && pathPoints != null && pathPoints.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
PathAnimationManager.GetInstance().MoveVehicleToPathStart(animatedObject, pathPoints);
|
||||
LogManager.Info($"已将 {animatedObject.DisplayName} 恢复到路径起点位置");
|
||||
}
|
||||
catch (Exception restoreEx)
|
||||
{
|
||||
LogManager.Error($"恢复物体到路径起点失败: {restoreEx.Message}");
|
||||
}
|
||||
}
|
||||
// 碰撞测试完成后,不再将物体恢复到路径起点(客户要求保持最终位置)
|
||||
// if (animatedObject != null && IsModelItemValid(animatedObject) && pathPoints != null && pathPoints.Count > 0)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// PathAnimationManager.GetInstance().MoveVehicleToPathStart(animatedObject, pathPoints);
|
||||
// LogManager.Info($"已将 {animatedObject.DisplayName} 恢复到路径起点位置");
|
||||
// }
|
||||
// catch (Exception restoreEx)
|
||||
// {
|
||||
// LogManager.Error($"恢复物体到路径起点失败: {restoreEx.Message}");
|
||||
// }
|
||||
// }
|
||||
|
||||
// 检查是否成功创建了主测试
|
||||
var finalMainTest = _documentClash.TestsData.Tests.FirstOrDefault(t => t.DisplayName.Contains("碰撞检测")) as ClashTest;
|
||||
@ -1781,19 +1781,19 @@ namespace NavisworksTransport
|
||||
LogManager.Warning("[批处理] 分组为空(未检测到真实几何碰撞),未添加到主测试");
|
||||
}
|
||||
|
||||
// 碰撞测试完成后,将物体恢复到路径起点位置(如果提供了路径点)
|
||||
if (animatedObject != null && IsModelItemValid(animatedObject) && pathPoints != null && pathPoints.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
PathAnimationManager.GetInstance().MoveVehicleToPathStart(animatedObject, pathPoints);
|
||||
LogManager.Info($"[批处理] 已将 {animatedObject.DisplayName} 恢复到路径起点位置");
|
||||
}
|
||||
catch (Exception restoreEx)
|
||||
{
|
||||
LogManager.Error($"[批处理] 恢复物体到路径起点失败: {restoreEx.Message}");
|
||||
}
|
||||
}
|
||||
// 碰撞测试完成后,不再将物体恢复到路径起点(客户要求保持最终位置)
|
||||
// if (animatedObject != null && IsModelItemValid(animatedObject) && pathPoints != null && pathPoints.Count > 0)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// PathAnimationManager.GetInstance().MoveVehicleToPathStart(animatedObject, pathPoints);
|
||||
// LogManager.Info($"[批处理] 已将 {animatedObject.DisplayName} 恢复到路径起点位置");
|
||||
// }
|
||||
// catch (Exception restoreEx)
|
||||
// {
|
||||
// LogManager.Error($"[批处理] 恢复物体到路径起点失败: {restoreEx.Message}");
|
||||
// }
|
||||
// }
|
||||
|
||||
return addedMainTest?.DisplayName;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ namespace NavisworksTransport.Utils
|
||||
{ PrecomputeCollisionResultsCategory, Color.FromByteRGB(156, 39, 176) }, // Material Purple #9C27B0(预计算碰撞,与红色/橙色明显区分)
|
||||
{ ChannelPreviewCategory, Color.Green },
|
||||
{ ClashDetectiveResultsCategory, Color.Red },
|
||||
{ AnimatedObjectCategory, Color.FromByteRGB(76, 175, 80) } // Material Green(动画车辆)
|
||||
{ AnimatedObjectCategory, Color.FromByteRGB(255, 193, 7) } // Amber/Yellow(动画车辆-琥珀黄,更醒目且不与碰撞检测红色冲突)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user