public void DrawBone(Vector3 position, Vector3 right, Vector3 forward, float length, Color color, bool isChained, bool isSelected, bool isJointHovered, bool isTailHovered, bool isHot) { var endPosition = position + right * length; var rotation = Quaternion.LookRotation(forward, Vector3.Cross(right, forward)); var boneBodyColor = color; var boneJointColor = new Color(0f, 0f, 0f, 0.75f * color.a); var tailColor = new Color(0f, 0f, 0f, 0.75f * color.a); var hoveredColor = Handles.preselectionColor; var selectedColor = Handles.selectedColor; var drawRectCap = false; if (isJointHovered) { boneJointColor = hoveredColor; } if (isHot && (IsActionHot(SkeletonAction.MoveBone) || IsActionHot(SkeletonAction.MoveJoint))) { boneJointColor = selectedColor; } if (mode == SkeletonMode.EditPose || mode == SkeletonMode.CreateBone) { if (isJointHovered || isSelected) { drawRectCap = true; } } else if (mode == SkeletonMode.EditJoints || mode == SkeletonMode.SplitBone) { rotation = Quaternion.identity; drawRectCap = true; } if (drawRectCap) { Handles.RectangleHandleCap(0, position, rotation, BoneDrawingUtility.GetBoneRadius(position), EventType.Repaint); } BoneDrawingUtility.DrawBone(position, endPosition, forward, boneBodyColor); BoneDrawingUtility.DrawBoneNode(position, forward, boneJointColor); if (!isChained && (IsCapable(SkeletonAction.ChangeLength) || IsCapable(SkeletonAction.MoveEndPosition))) { if (isTailHovered) { tailColor = hoveredColor; } if (isHot && (IsActionHot(SkeletonAction.ChangeLength) || IsActionHot(SkeletonAction.MoveEndPosition))) { tailColor = selectedColor; } BoneDrawingUtility.DrawBoneNode(endPosition, forward, tailColor); } }
public void DrawBoneParentLink(Vector3 parentPosition, Vector3 position, Vector3 forward, Color color) { BoneDrawingUtility.DrawBone(position, parentPosition, forward, color); }