/// <summary> /// Not yet documented. /// </summary> protected override void DrawPropertyLayout(GUIContent label) { // Display evt. errors in creating context. if (this.parentPath.ErrorMessage != null) { SirenixEditorGUI.ErrorMessageBox(this.parentPath.ErrorMessage); } // Gotta check that constantly, the value can change from outside the inspector! //if (this.requireExistingPath && Event.current.type == EventType.Layout) //{ // this.exists = this.PathExists(this.ValueEntry.SmartValue, this.parentPath.GetString(this.Property)); //} // Display required valid path error if enabled. //if (this.requireExistingPath && this.exists == false) //{ // SirenixEditorGUI.ErrorMessageBox("The path does not exist."); //} // Draw field. EditorGUI.BeginChangeCheck(); this.ValueEntry.SmartValue = SirenixEditorFields.FolderPathField(label, this.ValueEntry.SmartValue, this.parentPath.GetString(this.Property), this.Attribute.AbsolutePath, this.Attribute.UseBackslashes); // Update existing check //if (EditorGUI.EndChangeCheck() && requireExistingPath) //{ // this.exists = this.PathExists(this.ValueEntry.SmartValue, this.parentPath.GetString(this.Property)); //} }
/// <summary> /// Not yet documented. /// </summary> protected override void DrawPropertyLayout(IPropertyValueEntry <string> entry, FolderPathAttribute attribute, GUIContent label) { // Create a property context for the parent path. InspectorProperty parentProperty = entry.Property.FindParent(PropertyValueCategory.Member, true); PropertyContext <FolderPathContext> context; if (entry.Context.Get <FolderPathContext>(this, "FolderPath", out context)) { context.Value = new FolderPathContext() { ParentPath = new StringMemberHelper(parentProperty.ParentType, attribute.ParentFolder), }; context.Value.Exists = PathExists(entry.SmartValue, context.Value.ParentPath.GetString(entry)); } // Display evt. errors in creating context. if (context.Value.ParentPath.ErrorMessage != null) { SirenixEditorGUI.ErrorMessageBox(context.Value.ParentPath.ErrorMessage); } // Display required valid path error if enabled. if (attribute.RequireValidPath && context.Value.Exists == false) { SirenixEditorGUI.ErrorMessageBox("The path is invalid."); } // Draw field. EditorGUI.BeginChangeCheck(); entry.SmartValue = SirenixEditorFields.FolderPathField(label, entry.SmartValue, context.Value.ParentPath.GetString(entry), attribute.AbsolutePath, attribute.UseBackslashes); // Update existing check if (EditorGUI.EndChangeCheck() && attribute.RequireValidPath) { context.Value.Exists = PathExists(entry.SmartValue, context.Value.ParentPath.GetString(entry)); } }