Beispiel #1
0
        public void CheckMeshBeforeSaving()
        {
            m_dmesh.RemoveUnusedVerts();
            m_dmesh.DeconvertPolysToTris();

            string issues;

            if (m_dmesh.CheckAndCleanMeshIssues(false, out issues))
            {
                AddOutputText(issues);
                Utility.DebugPopup("Mesh has issues.  See output window for details.");
            }
        }
        public bool SaveDecalMesh(DMesh dm, string path_to_file, bool silent = false)
        {
            try {
                JObject root = new JObject();
                dm.DeconvertPolysToTris();

                dm.Serialize(root);

                string new_file_data = root.ToString(Formatting.Indented);

                File.WriteAllText(path_to_file, new_file_data);

                if (!silent)
                {
                    this.m_filepath_current_decal = path_to_file;
                    this.Text = "Overload DMesh Editor - " + path_to_file;

                    AddOutputText(string.Format("Saved decal: {0}", path_to_file));

                    AddRecentFile(path_to_file);
                    dm.dirty = false;
                }

                return(true);
            }
            catch (Exception ex) {
                Utility.DebugLog("Failed to save decal mesh: " + ex.Message);
                return(false);
            }
        }