public static QuickPolygon LoadPreset(QuickPolygon polygon, string name, bool loadMesh = false, bool recalculate = true) { if (PresetsManager.IsPresetExists(name)) { PresetsManager.LoadPresetFor(name, polygon, loadMesh); } else { Debug.LogWarning(MSG.Warnings.PRESET_NOT_FOUND); } return(polygon); }
private void DrawPresetsSaveInspector() { // Don't allow saving presets if multiobject editing. if (!serializedObject.isEditingMultipleObjects) { PresetName = EditorGUILayout.TextField("Name", PresetName); if (PresetsManager.IsPresetExists(PresetName)) { if (GUILayout.Button("Update")) { if (!string.IsNullOrEmpty(PresetName)) { PresetsManager.SavePreset(PresetName, (QuickPolygon)targets[0]); PresetName = ""; GUI.FocusControl(null); } } } else { if (GUILayout.Button("Save")) { if (!string.IsNullOrEmpty(PresetName) && PresetName != "None") { PresetsManager.SavePreset(PresetName, (QuickPolygon)targets[0]); PresetName = ""; GUI.FocusControl(null); } } } if (!string.IsNullOrEmpty(((QuickPolygon)targets[0]).CurrentPresetName) && ((QuickPolygon)targets[0]).CurrentPresetName != "None" && PresetsManager.IsPresetExists(((QuickPolygon)targets[0]).CurrentPresetName)) { EditorGUILayout.LabelField("Selected", ((QuickPolygon)targets[0]).CurrentPresetName); if (GUILayout.Button("Update")) { if (!string.IsNullOrEmpty(((QuickPolygon)targets[0]).CurrentPresetName)) { PresetsManager.SavePreset(((QuickPolygon)targets[0]).CurrentPresetName, (QuickPolygon)targets[0]); GUI.FocusControl(null); } } } } else { EditorGUILayout.HelpBox(MSG.Warnings.PRESET_MULTIOBJECT_SAVING_DISABLED, MessageType.Info); } }
public static QuickPolygon CreateFromLastPreset(string name, MeshType meshIndex, Vector3 position, Quaternion rotation, bool isUI) { PresetsRecord lastPreset = PresetsManager.GetLastUsedPreset(); QuickPolygon mesh = Create(name, meshIndex, position, rotation, isUI); if (lastPreset != null && PresetsManager.IsPresetExists(lastPreset)) { PresetsManager.LoadPresetFor(lastPreset, mesh); } else { Debug.LogWarning(MSG.Warnings.PRESET_LAST_NOT_FOUND); } mesh.RecalculateMesh(); return(mesh); }