internal static SaveVertexAttrMappingPresetWindow Show(Rect r, VertexAttributeMappingPreset preset) { s_TargetName = string.Empty; s_TargetPreset = preset; SaveVertexAttrMappingPresetWindow w = GetWindowWithRect <SaveVertexAttrMappingPresetWindow>(new Rect(r.xMax - (k_Width - k_Offset), r.y + k_Offset, k_Width, k_Height), true, L10n.Tr(k_Title)); //w.m_Parent.window.m_DontSaveToLayout = true; return(w); }
public static VertexAttributeMappingPreset ReadPreset(string name) { string path = VertexAttributeMapping.GetPresetFullPath(name); if (System.IO.File.Exists(path)) { var json = System.IO.File.ReadAllText(path); if (!string.IsNullOrEmpty(json)) { VertexAttributeMappingPreset preset = new VertexAttributeMappingPreset(); EditorJsonUtility.FromJsonOverwrite(json, preset); return(preset); } } return(null); }
/// <summary> /// Get Preset From UI Setting /// </summary> /// <returns></returns> public VertexAttributeMappingPreset GetCurrentVertexAttributeMappingPreset() { if (m_VertexAttrList.Count > 0) { VertexAttributeMappingPreset preset = new VertexAttributeMappingPreset(); for (int i = 0; i < m_VertexAttrList.Count; ++i) { var data = new VertexAttributeMappingData(); data.m_Enable = !m_VertexAttrList[i].Ignore; data.m_VertexAttributeName = m_VertexAttrList[i].CSVName; data.m_Attr = m_VertexAttrList[i].Attr; preset.m_Datas.Add(data); } return(preset); } return(null); }
public void ApplyVertexAttributeMappingPreset(VertexAttributeMappingPreset preset) { if (preset == null) { return; } for (int i = 0; i < m_VertexAttrList.Count; ++i) { var name = m_VertexAttrList[i].CSVName; var data = preset.GetData(name); if (data != null) { var newData = m_VertexAttrList[i]; newData.Ignore = !data.m_Enable; newData.Attr = data.m_Attr; m_VertexAttrList[i] = newData; } } }
public static void SavePreset(VertexAttributeMappingPreset preset, string name) { if (preset == null) { return; } if (string.IsNullOrEmpty(name)) { return; } if (!System.IO.Directory.Exists(VertexAttributeMapping.preferencesPath)) { System.IO.Directory.CreateDirectory(VertexAttributeMapping.preferencesPath); } string path = VertexAttributeMapping.GetPresetFullPath(name); var json = EditorJsonUtility.ToJson(preset, true); System.IO.File.WriteAllText(path, json); }