mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
Formatting
This commit is contained in:
parent
3d5c5a2160
commit
f09c8161ea
@ -1,8 +1,7 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using XNode;
|
using XNode;
|
||||||
|
|
||||||
namespace XNodeEditor
|
namespace XNodeEditor {
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This asset processor resolves an issue with the new v2 AssetDatabase system present on 2019.3 and later. When
|
/// This asset processor resolves an issue with the new v2 AssetDatabase system present on 2019.3 and later. When
|
||||||
/// renaming a <see cref="XNode.NodeGraph"/> asset, it appears that sometimes the v2 AssetDatabase will swap which asset
|
/// renaming a <see cref="XNode.NodeGraph"/> asset, it appears that sometimes the v2 AssetDatabase will swap which asset
|
||||||
@ -11,23 +10,19 @@ namespace XNodeEditor
|
|||||||
/// finds a case where a <see cref="XNode.Node"/> has been made the main asset it will swap it back to being a sub-asset
|
/// finds a case where a <see cref="XNode.Node"/> has been made the main asset it will swap it back to being a sub-asset
|
||||||
/// and rename the node to the default name for that node type.
|
/// and rename the node to the default name for that node type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class GraphRenameFixAssetProcessor : AssetPostprocessor
|
internal sealed class GraphRenameFixAssetProcessor : AssetPostprocessor {
|
||||||
{
|
|
||||||
private static void OnPostprocessAllAssets(
|
private static void OnPostprocessAllAssets(
|
||||||
string[] importedAssets,
|
string[] importedAssets,
|
||||||
string[] deletedAssets,
|
string[] deletedAssets,
|
||||||
string[] movedAssets,
|
string[] movedAssets,
|
||||||
string[] movedFromAssetPaths)
|
string[] movedFromAssetPaths) {
|
||||||
{
|
for (int i = 0; i < movedAssets.Length; i++) {
|
||||||
for (int i = 0; i < movedAssets.Length; i++)
|
|
||||||
{
|
|
||||||
Node nodeAsset = AssetDatabase.LoadMainAssetAtPath(movedAssets[i]) as Node;
|
Node nodeAsset = AssetDatabase.LoadMainAssetAtPath(movedAssets[i]) as Node;
|
||||||
|
|
||||||
// If the renamed asset is a node graph, but the v2 AssetDatabase has swapped a sub-asset node to be its
|
// If the renamed asset is a node graph, but the v2 AssetDatabase has swapped a sub-asset node to be its
|
||||||
// main asset, reset the node graph to be the main asset and rename the node asset back to its default
|
// main asset, reset the node graph to be the main asset and rename the node asset back to its default
|
||||||
// name.
|
// name.
|
||||||
if (nodeAsset != null && AssetDatabase.IsMainAsset(nodeAsset))
|
if (nodeAsset != null && AssetDatabase.IsMainAsset(nodeAsset)) {
|
||||||
{
|
|
||||||
AssetDatabase.SetMainObject(nodeAsset.graph, movedAssets[i]);
|
AssetDatabase.SetMainObject(nodeAsset.graph, movedAssets[i]);
|
||||||
AssetDatabase.ImportAsset(movedAssets[i]);
|
AssetDatabase.ImportAsset(movedAssets[i]);
|
||||||
|
|
||||||
@ -37,4 +32,4 @@ namespace XNodeEditor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user