void DisplayStatusMessages() { m_Status = MessageType.None; m_StatusMessages.Clear(); var hierarchyStatus = StatusMessageUtility.GetHierarchyStatusMessage(targets, out var hierarchyStatusMessage); if (!string.IsNullOrEmpty(hierarchyStatusMessage)) { m_StatusMessages.Add(hierarchyStatusMessage); m_Status = (MessageType)math.max((int)m_Status, (int)hierarchyStatus); } if (m_StatusMessages.Count > 0) { EditorGUILayout.HelpBox(string.Join("\n\n", m_StatusMessages), m_Status); } }
void UpdateStatusMessages() { m_Status = MessageType.None; m_StatusMessages.Clear(); if (m_NumImplicitStatic != 0) { m_StatusMessages.Add(Styles.GetStaticColliderStatusMessage(targets.Length)); } m_ShapeSuggestions.Clear(); foreach (PhysicsShapeAuthoring shape in targets) { switch (shape.ShapeType) { case ShapeType.Box: var box = shape.GetBakedBoxProperties(); var max = math.cmax(box.Size); var min = math.cmin(box.Size); if (min == 0f) { m_ShapeSuggestions.Add(Styles.BoxPlaneSuggestion); } else if (box.BevelRadius == min * 0.5f) { if (min == max) { m_ShapeSuggestions.Add(Styles.BoxSphereSuggestion); } else if (math.lengthsq(box.Size - new float3(min)) == math.pow(max - min, 2f)) { m_ShapeSuggestions.Add(Styles.BoxCapsuleSuggestion); } } break; case ShapeType.Capsule: var capsule = shape.GetBakedCapsuleProperties(out var c, out var h, out var o); if (h == 2f * capsule.Radius) { m_ShapeSuggestions.Add(Styles.CapsuleSphereSuggestion); } break; case ShapeType.Cylinder: var cylinder = shape.GetBakedCylinderProperties(); if (cylinder.BevelRadius == cylinder.Radius) { m_ShapeSuggestions.Add(cylinder.Height == 2f * cylinder.Radius ? Styles.CylinderSphereSuggestion : Styles.CylinderCapsuleSuggestion); } break; } } foreach (var suggestion in m_ShapeSuggestions) { m_StatusMessages.Add(suggestion); } var hierarchyStatus = StatusMessageUtility.GetHierarchyStatusMessage(targets, out var hierarchyStatusMessage); if (!string.IsNullOrEmpty(hierarchyStatusMessage)) { m_StatusMessages.Add(hierarchyStatusMessage); m_Status = (MessageType)math.max((int)m_Status, (int)hierarchyStatus); } m_MatrixStates.Clear(); foreach (var t in targets) { var localToWorld = (float4x4)(t as Component).transform.localToWorldMatrix; m_MatrixStates.Add(ManipulatorUtility.GetMatrixState(ref localToWorld)); } m_MatrixStatus = StatusMessageUtility.GetMatrixStatusMessage(m_MatrixStates, out var matrixStatusMessage); if (m_MatrixStatus != MessageType.None) { m_StatusMessages.Add(matrixStatusMessage); m_Status = (MessageType)math.max((int)m_Status, (int)m_MatrixStatus); } m_GeometryStatus = MessageType.None; m_GeometryStatusMessages.Clear(); if ((m_GeometryState & GeometryState.NoGeometry) == GeometryState.NoGeometry) { m_GeometryStatusMessages.Add(Styles.GetNoGeometryWarning(targets.Length)); m_GeometryStatus = (MessageType)math.max((int)m_GeometryStatus, (int)MessageType.Error); } if ((m_GeometryState & GeometryState.NonReadableGeometry) == GeometryState.NonReadableGeometry) { m_GeometryStatusMessages.Add(Styles.GetNonReadableGeometryWarning(targets.Length)); m_GeometryStatus = (MessageType)math.max((int)m_GeometryStatus, (int)MessageType.Warning); } if ((m_GeometryState & GeometryState.MeshWithSkinnedPoints) == GeometryState.MeshWithSkinnedPoints) { m_GeometryStatusMessages.Add(Styles.GetMeshWithSkinnedPointsWarning(targets.Length)); m_GeometryStatus = (MessageType)math.max((int)m_GeometryStatus, (int)MessageType.Warning); } }