コード例 #1
0
ファイル: TextureTool.cs プロジェクト: Bananaman043/cbre
        private void TextureJustified(JustifyMode justifymode, bool treatasone, int tileX, int tileY)
        {
            if (Document.Selection.IsEmpty())
            {
                return;
            }
            var boxAlignMode = (justifymode == JustifyMode.Fit)
                                   ? Face.BoxAlignMode.Center // Don't care about the align mode when centering
                                   : (Face.BoxAlignMode)Enum.Parse(typeof(Face.BoxAlignMode), justifymode.ToString());
            Cloud cloud = null;
            Action <Document, Face> action;

            if (treatasone)
            {
                // If we treat as one, it means we want to align to one great big cloud
                cloud = new Cloud(Document.Selection.GetSelectedFaces().SelectMany(x => x.Vertices).Select(x => x.Location));
            }

            if (justifymode == JustifyMode.Fit)
            {
                action = (d, x) => x.FitTextureToPointCloud(cloud ?? new Cloud(x.Vertices.Select(y => y.Location)), tileX, tileY);
            }
            else
            {
                action = (d, x) => x.AlignTextureWithPointCloud(cloud ?? new Cloud(x.Vertices.Select(y => y.Location)), boxAlignMode);
            }

            Document.PerformAction("Align texture", new EditFace(Document.Selection.GetSelectedFaces(), action, false));
        }
コード例 #2
0
ファイル: TextureTool.cs プロジェクト: silky/sledge
        private void TextureJustified(JustifyMode justifymode, bool treatasone, int tileX, int tileY)
        {
            if (Document.Selection.IsEmpty()) return;
            var boxAlignMode = (justifymode == JustifyMode.Fit)
                                   ? Face.BoxAlignMode.Center // Don't care about the align mode when centering
                                   : (Face.BoxAlignMode) Enum.Parse(typeof (Face.BoxAlignMode), justifymode.ToString());
            Cloud cloud = null;
            Action<Document, Face> action;
            if (treatasone)
            {
                // If we treat as one, it means we want to align to one great big cloud
                cloud = new Cloud(Document.Selection.GetSelectedFaces().SelectMany(x => x.Vertices).Select(x => x.Location));
            }

            if (justifymode == JustifyMode.Fit)
            {
                action = (d, x) => x.FitTextureToPointCloud(cloud ?? new Cloud(x.Vertices.Select(y => y.Location)), tileX, tileY);
            }
            else
            {
                action = (d, x) => x.AlignTextureWithPointCloud(cloud ?? new Cloud(x.Vertices.Select(y => y.Location)), boxAlignMode);
            }

            Document.PerformAction("Align texture", new EditFace(Document.Selection.GetSelectedFaces(), action, false));
        }
コード例 #3
0
ファイル: TextureTool.cs プロジェクト: Bananaman043/cbre
 private void TextureJustified(object sender, JustifyMode justifymode, bool treatasone)
 {
     TextureJustified(justifymode, treatasone, 1, 1);
 }
コード例 #4
0
ファイル: TextureTool.cs プロジェクト: silky/sledge
 private void TextureJustified(object sender, JustifyMode justifymode, bool treatasone)
 {
     TextureJustified(justifymode, treatasone, 1, 1);
 }