UsdAsset Buttons react to loaded state of UsdAsset instance.
MODIFY
package/com.unity.formats.usd/Editor/Scripts/Behaviors/UsdAssetEditor.cs
package/com.unity.formats.usd/Editor/Scripts/Behaviors/UsdAssetEditor.cs
@@ -126,6 +126,11 @@ namespace Unity.Formats.USD {
style.fontSize = 12;
style.wordWrap = true;
EditorGUILayout.LabelField("Edit prefab for destructive operations", style);
+ } else {
+ if (usdAsset.transform.childCount == 0) {
+ if (GUILayout.Button(new GUIContent(m_reimportButton, "Import from USD"), buttonStyle)) {
+ ReloadFromUsd(usdAsset, forceRebuild: true);
+ }
} else {
if (GUILayout.Button(new GUIContent(m_reimportButton, "Reimport from USD (destructive)"), buttonStyle)) {
if (EditorUtility.DisplayDialog("Reimport from Source", "Destroy and rebuild all USD objects?\n\n"
@@ -134,6 +139,9 @@ namespace Unity.Formats.USD {
ReloadFromUsd(usdAsset, forceRebuild: true);
}
}
+ }
+
+ EditorGUI.BeginDisabledGroup(usdAsset.transform.childCount == 0);
if (GUILayout.Button(new GUIContent(m_trashButton, "Remove USD Contents (destructive)"), buttonStyle)) {
if (EditorUtility.DisplayDialog("Clear Contents", "Destroy all USD objects?\n\n"
+ "Any GameObject with a UsdPrimSource will be destroyed. "
@@ -149,6 +157,7 @@ namespace Unity.Formats.USD {
DetachFromUsd(usdAsset);
}
}
+ EditorGUI.EndDisabledGroup();
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();

UsdAsset Buttons react to loaded state of UsdAsset instance.