Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Util.GetTypeFromObj support some build-in object types. #69

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Editor/Drawers/DisabledDrawers/ReadOnlyAttributeDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ protected virtual (string error, bool disabled) IsDisabled(SerializedProperty pr
}

bool editorModeOk = Util.ConditionEditModeChecker(targetAttribute.EditorMode);
// empty = true
// And Mode
bool boolResultsOk = boolResults.All(each => each);
allResults.Add(editorModeOk && boolResultsOk);
}

// Or/And Mode
bool truly = targetAttributes.Length > 1 ? allResults.Any(each => each) : allResults.All(each => each);

// Or Mode
bool truly = allResults.Any(each => each);
#if SAINTSFIELD_DEBUG && SAINTSFIELD_DEBUG_READ_ONLY
Debug.Log($"{property.name} final={truly}/ars={string.Join(",", allResults)}");
#endif
Expand Down
8 changes: 4 additions & 4 deletions Editor/Drawers/VisibilityDrawers/ShowIfAttributeDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ protected override (string error, bool shown) IsShown(SerializedProperty propert
}

bool editorModeOk = Util.ConditionEditModeChecker(targetAttribute.EditorMode);
// empty = true
// And Mode
bool boolResultsOk = boolResults.All(each => each);
allResults.Add(editorModeOk && boolResultsOk);
}

// Or/And Mode
bool truly = targetAttributes.Length > 1 ? allResults.Any(each => each) : allResults.All(each => each);

// Or Mode
bool truly = allResults.Any(each => each);
#if SAINTSFIELD_DEBUG && SAINTSFIELD_DEBUG_READ_ONLY
UnityEngine.Debug.Log($"{property.name} final={truly}/ars={string.Join(",", allResults)}");
#endif
Expand Down
12 changes: 11 additions & 1 deletion Editor/Utils/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,17 @@ public static UnityEngine.Object GetTypeFromObj(UnityEngine.Object fieldResult,
}
}
break;


// Unity Build-in Object
case Texture:
case Sprite:
case Material:
case Mesh:
case Motion:
case AudioClip:
result = fieldResult;
break;

// default:
// Debug.Log(fieldResult.GetType());
// break;
Expand Down