コード例 #1
0
        private void DrawBindPose()
        {
            Debug.Assert(bindPoseView.IsRepainting());

            for (int i = 0; i < spriteMeshData.bones.Count; i++)
            {
                var spriteBoneData = spriteMeshData.bones[i];
                var color          = CommonDrawingUtility.CalculateNiceColor(i, kNiceColorCount);

                bindPoseView.DrawBone(spriteBoneData.position, spriteBoneData.endPosition, selection.IsSelected(i), bindPoseView.hoveredBone == i, color);
            }
        }
コード例 #2
0
        private void PrepareColors()
        {
            Debug.Assert(spriteMeshData != null);

            m_Colors.Clear();

            for (int i = 0; i < spriteMeshData.vertices.Count; ++i)
            {
                BoneWeight boneWeight = m_Weights[i];
                float      weightSum  = boneWeight.weight0 + boneWeight.weight1 + boneWeight.weight2 + boneWeight.weight3;

                var color = CommonDrawingUtility.CalculateNiceColor(boneWeight.boneIndex0, kNiceColorCount) * boneWeight.weight0 +
                            CommonDrawingUtility.CalculateNiceColor(boneWeight.boneIndex1, kNiceColorCount) * boneWeight.weight1 +
                            CommonDrawingUtility.CalculateNiceColor(boneWeight.boneIndex2, kNiceColorCount) * boneWeight.weight2 +
                            CommonDrawingUtility.CalculateNiceColor(boneWeight.boneIndex3, kNiceColorCount) * boneWeight.weight3;

                color.a = 1f;

                m_Colors.Add(Color.Lerp(Color.black, color, weightSum));
            }
        }