示例#1
0
    public List <CutSettingData> GetSettings()
    {
        var data       = new List <CutSettingData>();
        var minDepth   = Double.Parse(minDepthField.GetComponent <TMPro.TMP_InputField>().text);
        var multipiece = Multipiece.value > 0;

        for (var index = 0; index < cutSettingColorGameObjects.Count; index++)
        {
            var child = cutSettingColorGameObjects[index];
            var line  = child.GetComponent <CutSettingUILine>();

            var algo = (Algorithm.AlgorithmType)line.AlgoDropdown.value;
            if (algo == Algorithm.AlgorithmType.Ignore)
            {
                continue;
            }
            if (line.mainToggle.isOn)
            {
                ColorManager.Instance.MainColorId = index;
                continue; //Maincolor will not be cut, so no need to add it to data
            }
            var depth          = Double.Parse(line.depthField.text);
            var modifier       = (CutSettingData.Modifier)line.ModifierDropdown.value;
            var cutSettingData = new CutSettingData(index, algo, depth, modifier, minDepth, multipiece);
            data.Add(cutSettingData);
        }
        return(data);
    }
示例#2
0
    private IEnumerator CutCoroutine(CutSettingData cutSettings)
    {
        var algorithm = Algorithm.BuildAlgo(cutSettings.algo);
        var info      = new CuttingInfo()
        {
            mesh    = mesh,
            oldMesh = originalMesh,
            data    = cutSettings
        };
        var newMesh = algorithm.Cut(info);

        mesh = g3UnityUtils.SetGOMesh(gameObject, newMesh);
        yield return(null);
    }