Example #1
0
    public MegaShapeLoft GetClone()
    {
        GameObject to = new GameObject();

        MegaShapeLoft loft = to.AddComponent <MegaShapeLoft>();

        Copy(loft);
        loft.mesh = null;

        MegaLoftLayerBase[] layers = GetComponents <MegaLoftLayerBase>();

        for (int i = 0; i < layers.Length; i++)
        {
            layers[i].Copy(to);
        }

        loft.verts   = null;
        loft.uvs     = null;
        loft.cols    = null;
        loft.rebuild = true;
        loft.BuildMeshFromLayersNew();
        to.name = name + " clone";

        return(loft);
    }
Example #2
0
    public override void Notify(MegaSpline spline, int reason)
    {
        if (layerPath && layerPath.splines != null)
        {
            if (curve < layerPath.splines.Count)
            {
                if (layerPath.splines[curve] == spline)
                {
                    MegaShapeLoft loft = GetComponent <MegaShapeLoft>();
                    loft.rebuild = true;
                    loft.BuildMeshFromLayersNew();
                    return;
                }
            }
            else
            {
                curve = 0;
            }
        }

        for (int i = 0; i < loftsections.Count; i++)
        {
            if (loftsections[i].shape)
            {
                if (loftsections[i].shape.splines[loftsections[i].curve] == spline)
                {
                    MegaShapeLoft loft = GetComponent <MegaShapeLoft>();
                    loft.rebuild = true;
                    loft.BuildMeshFromLayersNew();
                    return;
                }
            }
        }
    }