示例#1
0
    public void AddColorer(VPaintObject vc)
    {
        if (!vc)
        {
            return;
        }
        if (colorers.Contains(vc))
        {
            return;
        }
        if (vc.GetMeshInstance() == null)
        {
            Debug.LogError("VPaint Object is missing a mesh.");
            return;
        }
        colorers.Add(vc);
        vertexCache.Add(new VPaintVertexCache()
        {
            vpaintObject = vc,
            vertices     = vc.GetMeshInstance().vertices
        });
#if UNITY_EDITOR
        UnityEditor.EditorUtility.SetDirty(this);
#endif
    }
示例#2
0
    public void CacheVertices(VPaintObject obj)
    {
        var cache = vertexCache.Find(c => c.vpaintObject == obj);

        if (cache == null)
        {
            vertexCache.Add(
                new VPaintVertexCache()
            {
                vpaintObject = obj,
                vertices     = obj.GetMeshInstance().vertices
            }
                );
        }
        else
        {
            cache.vertices = obj.GetMeshInstance().vertices;
        }
    }