public bool ImportOBJ(DMesh dm, string path_to_file) { dm.Init(this); try { if (!OverloadLevelEditor.ImportOBJ.ImportOBJToDMesh(dm, path_to_file, false, this, tm_decal)) { return(false); } dm.UpdateGLTextures(tm_decal); dm.dirty = false; if (!dm.WasConverted()) { m_dmesh.ConvertTrisToPolysRaw(); dm.dirty = true; } UpdateOptionLabels(); return(true); } catch (Exception ex) { Utility.DebugPopup("Failed to load OBJ: " + ex.Message, "Error"); return(false); } }
public bool LoadDecalMesh(DMesh dm, string path_to_file) { dm.Init(this); try { string file_data = System.IO.File.ReadAllText(path_to_file); JObject root = JObject.Parse(file_data); dm.Deserialize(root); dm.UpdateGLTextures(tm_decal); this.m_filepath_current_decal = path_to_file; this.Text = "Overload DMesh Editor - " + path_to_file; AddOutputText(string.Format("Loaded dmesh: {0}", path_to_file)); AddRecentFile(path_to_file); dm.dirty = false; if (!dm.WasConverted()) { m_dmesh.ConvertTrisToPolysRaw(); dm.dirty = true; } UpdateOptionLabels(); return(true); } catch (Exception ex) { Utility.DebugLog("Failed to load decal mesh: " + ex.Message); return(false); } }
public void LoadDecalsInDir(string dir, bool all_dir = false) { if (!Directory.Exists(dir)) { return; } string[] files = Directory.GetFiles(dir, "*.dmesh", (all_dir ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)); m_dmesh = new List <DMesh>(); foreach (string file in files) { // Remove all the extra stuff to get the names string mesh_name = Utility.GetRelativeExtensionlessFilenameFromDirectory(dir, file); m_decal_list.Add(mesh_name); m_decal_readonly.Add(m_builtin_decal_list.Contains(mesh_name) ? true : false); // Load the decal into memory m_active_dmesh = new DMesh(mesh_name); LoadDecalMesh(m_active_dmesh, file); m_active_dmesh.UpdateGLTextures(tex_manager, editor.tm_level); m_dmesh.Add(m_active_dmesh); } UpdateActiveDMesh(); }