private void Awake() { GetEWScriptableObject(); matSearch = (MaterialSearch)eWSettings.materialSearch; matName = (MaterialName)eWSettings.materialName; moveMaterials = eWSettings.moveMaterials; assignmentMethod = (AssignmentMethod)eWSettings.assignmentMethod; }
private void Search() { MaterialQuerry impo = new MaterialQuerry { _Token = txtSearch.Text, SupplierID = cbbSupplier.SelectedValue != null?cbbSupplier.SelectedValue.ToString() : string.Empty, dtpFrom = dtpTimeFrom.EditValue != null ? (DateTime?)dtpTimeFrom.EditValue : null, dtpTo = dtpTimeTo.EditValue != null ? (DateTime?)dtpTimeTo.EditValue : null }; MaterialSearch materialSearch = new MaterialSearch(impo); lstUpdate = materialSearch.GetAllSearch(); gridUtility.BindingData(lstUpdate); gridView1.OptionsBehavior.Editable = false; }
private void MaterialEditor_OnKeyUp(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.S) { Save(); } else if (e.Control && e.KeyCode == Keys.R) { Reload(); } else if (e.Control && e.KeyCode == Keys.D) { GirdView_Materials.ClearSelection(); MaterialGrid.SelectedObject = null; } else if (e.Control && e.KeyCode == Keys.F) { MaterialSearch.Focus(); } }
void OnGUI() { float windowWidth = position.width - 25; scrollPos = EditorGUILayout.BeginScrollView(scrollPos); if (eWSettings == null) { GetEWScriptableObject(); } //------------------------------------ Extract Materials ----------------------------------------- EditorGUILayout.Space(); EditorGUILayout.LabelField("Extract Materials from Models", EditorStyles.boldLabel, GUILayout.Width(windowWidth)); EditorGUILayout.Space(); matSearch = (MaterialSearch)EditorGUILayout.EnumPopup("Material Search:", (MaterialSearch)eWSettings.materialSearch, GUILayout.Width(windowWidth)); matName = (MaterialName)EditorGUILayout.EnumPopup("Material Name:", (MaterialName)eWSettings.materialName, GUILayout.Width(windowWidth)); if (eWSettings.materialSearch != (int)matSearch || eWSettings.materialName != (int)matName) { eWSettings.materialSearch = (int)matSearch; eWSettings.materialName = (int)matName; SaveSettings(); } EditorGUILayout.Space(); moveMaterials = GUILayout.Toggle(eWSettings.moveMaterials, "Move Extracted Materials to Folder", GUILayout.Width(windowWidth)); if (eWSettings.moveMaterials != moveMaterials) { eWSettings.moveMaterials = moveMaterials; SaveSettings(); } if (moveMaterials) { EditorGUILayout.BeginHorizontal(GUILayout.Width(windowWidth)); EditorGUILayout.TextField(eWSettings.materialFolderPath, GUILayout.ExpandWidth(true)); if (GUILayout.Button("Browse", GUILayout.ExpandWidth(false))) { eWSettings.materialFolderPath = EditorUtility.SaveFolderPanel("Material Folder", eWSettings.materialFolderPath, Application.dataPath); SaveSettings(); } EditorGUILayout.EndHorizontal(); if (!eWSettings.materialFolderPath.Contains(Application.dataPath)) { EditorGUILayout.BeginHorizontal(GUILayout.Width(windowWidth)); EditorGUILayout.HelpBox("Choose the folder in Project", MessageType.Error); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); } //------------------------------------ Texture Assignment Tool ----------------------------------------- EditorGUILayout.Space(); EditorGUILayout.LabelField("Texture Assignment Tool", EditorStyles.boldLabel, GUILayout.Width(windowWidth)); EditorGUILayout.Space(); assignmentMethod = (AssignmentMethod)EditorGUILayout.EnumPopup("Texture Search Method:", (AssignmentMethod)eWSettings.assignmentMethod, GUILayout.Width(windowWidth)); if (eWSettings.assignmentMethod != (int)assignmentMethod) { eWSettings.assignmentMethod = (int)assignmentMethod; SaveSettings(); } assignmentProfileIndex = EditorGUILayout.Popup("Assignment Profiles:", assignmentProfileIndex, assignmentProfiles, GUILayout.Width(windowWidth)); if (assignmentProfileIndex < assignmentProfiles.Length - 1) { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(GUILayout.Width(windowWidth)); EditorGUILayout.LabelField("Shader Full Name:", EditorStyles.boldLabel, GUILayout.Width(windowWidth / 2)); EditorGUILayout.LabelField(eWSettings.assignmentProfilesList[assignmentProfileIndex].shaderName, GUILayout.Width(windowWidth / 2)); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(GUILayout.Width(windowWidth)); EditorGUILayout.LabelField("Profile Name:", GUILayout.Width(windowWidth / 2)); newProfile.profileName = EditorGUILayout.TextField(newProfile.profileName, GUILayout.Width(windowWidth / 2)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(GUILayout.Width(windowWidth)); EditorGUILayout.LabelField("Shader Full Name:", GUILayout.Width(windowWidth / 2)); newProfile.shaderName = EditorGUILayout.TextField(newProfile.shaderName, GUILayout.Width(windowWidth / 2)); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(GUILayout.Width(windowWidth)); EditorGUILayout.LabelField("Material Slot:", EditorStyles.boldLabel, GUILayout.Width(windowWidth / 2)); EditorGUILayout.LabelField("Texture Name:", EditorStyles.boldLabel, GUILayout.Width(windowWidth / 2)); EditorGUILayout.EndHorizontal(); if (assignmentProfileIndex < assignmentProfiles.Length - 1) { showProfile = EditorGUILayout.Foldout(showProfile, "Profile"); if (showProfile) { foreach (var assignmentProfileItem in eWSettings.assignmentProfilesList[assignmentProfileIndex].assignmentProfileItems) { string[] textureNames = assignmentProfileItem.textureName.Split(','); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(GUILayout.Width(windowWidth)); EditorGUILayout.LabelField(assignmentProfileItem.materialSlot); EditorGUILayout.EndHorizontal(); foreach (string textureName in textureNames) { if (textureName.Trim(' ').Length > 0) { EditorGUILayout.BeginHorizontal(GUILayout.Width(windowWidth)); EditorGUILayout.LabelField(" ", GUILayout.Width(windowWidth / 2)); EditorGUILayout.LabelField(textureName.Trim(' '), GUILayout.Width(windowWidth / 2)); EditorGUILayout.EndHorizontal(); } } } } EditorGUILayout.Space(); if (GUILayout.Button("Delete This Profile", GUILayout.Width(windowWidth))) { eWSettings.assignmentProfilesList.Remove(eWSettings.assignmentProfilesList[assignmentProfileIndex]); SaveSettings(); GetExistingAssignmentProfiles(); assignmentProfileIndex = 0; } EditorGUILayout.Space(); } else { EditorGUILayout.Space(); for (int index = 0; index < newProfileItems.Count; index++) { var tempProfileItem = newProfileItems[index]; EditorGUILayout.BeginHorizontal(GUILayout.Width(windowWidth)); tempProfileItem.materialSlot = EditorGUILayout.TextField(newProfileItems[index].materialSlot, GUILayout.Width(windowWidth / 2)); tempProfileItem.textureName = EditorGUILayout.TextField(newProfileItems[index].textureName, GUILayout.Width(windowWidth / 2)); EditorGUILayout.EndHorizontal(); newProfileItems[index] = tempProfileItem; } EditorGUILayout.Space(); if (GUILayout.Button("Add New Material Slot", GUILayout.Width(windowWidth))) { newProfileItems.Add(new EWScriptableObject.AssignmentProfile.AssignmentProfileItem { textureName = "", materialSlot = "" }); } if (GUILayout.Button("Delete Last Material Slot", GUILayout.Width(windowWidth))) { if (newProfileItems.Count > 0) { newProfileItems.Remove(newProfileItems[newProfileItems.Count - 1]); } } if (GUILayout.Button("Clear All Material Slots", GUILayout.Width(windowWidth))) { newProfileItems.Clear(); } if (GUILayout.Button("Save New Profile", GUILayout.Width(windowWidth))) { List <EWScriptableObject.AssignmentProfile.AssignmentProfileItem> filteredNewProfileItems = new List <EWScriptableObject.AssignmentProfile.AssignmentProfileItem>(); foreach (var newProfileItem in newProfileItems) { if (newProfileItem.materialSlot.Trim(' ').Length > 0 && newProfileItem.textureName.Trim(' ').Length > 0) { filteredNewProfileItems.Add(newProfileItem); } } newProfile.assignmentProfileItems = filteredNewProfileItems.ToArray(); if (newProfile.profileName.Length > 0 && newProfile.shaderName.Length > 0) { eWSettings.assignmentProfilesList.Add(newProfile); SaveSettings(); GetExistingAssignmentProfiles(); assignmentProfileIndex = eWSettings.assignmentProfilesList.Count - 1; newProfile.profileName = ""; newProfile.shaderName = ""; newProfileItems.Clear(); } else { Debug.Log("Profile not Saved. Profile Name and/or Shader Name are Empty"); EditorGUILayout.EndHorizontal(); } } EditorGUILayout.Space(); } //------------------------------------------------------Version---------------------------------- EditorGUILayout.Space(); EditorGUILayout.LabelField("Version", EditorStyles.boldLabel, GUILayout.Width(windowWidth)); EditorGUILayout.LabelField(version, GUILayout.Width(windowWidth)); EditorGUILayout.Space(); EditorGUILayout.EndScrollView(); }