mirror of https://github.com/tuyoogame/YooAsset
update asset art scanner
parent
7cc985205a
commit
ef4f011cf6
|
@ -7,7 +7,6 @@ using UnityEditor;
|
|||
using UnityEngine;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.Tilemaps;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
public enum EHeaderType
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace YooAsset.Editor
|
|||
|
||||
/// <summary>
|
||||
/// 扫描模式
|
||||
/// 注意:文件路径或文件GUID
|
||||
/// </summary>
|
||||
public string ScannerSchema = string.Empty;
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ namespace YooAsset.Editor
|
|||
private Label _schemaGuideTxt;
|
||||
private TextField _scannerNameTxt;
|
||||
private TextField _scannerDescTxt;
|
||||
private ObjectField _scanSchemaField;
|
||||
private ObjectField _saveFolderField;
|
||||
private ObjectField _scannerSchemaField;
|
||||
private ObjectField _outputFolderField;
|
||||
private ScrollView _collectorScrollView;
|
||||
|
||||
private int _lastModifyScannerIndex = 0;
|
||||
|
@ -68,7 +68,10 @@ namespace YooAsset.Editor
|
|||
_scannerListView = root.Q<ListView>("ScannerListView");
|
||||
_scannerListView.makeItem = MakeScannerListViewItem;
|
||||
_scannerListView.bindItem = BindScannerListViewItem;
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
|
||||
#if UNITY_2022_3_OR_NEWER
|
||||
_scannerListView.selectionChanged += ScannerListView_onSelectionChange;
|
||||
#elif UNITY_2020_1_OR_NEWER
|
||||
_scannerListView.onSelectionChange += ScannerListView_onSelectionChange;
|
||||
#else
|
||||
_scannerListView.onSelectionChanged += ScannerListView_onSelectionChange;
|
||||
|
@ -120,22 +123,21 @@ namespace YooAsset.Editor
|
|||
});
|
||||
|
||||
// 扫描模式
|
||||
_scanSchemaField = root.Q<ObjectField>("ScanSchema");
|
||||
_scanSchemaField.RegisterValueChangedCallback(evt =>
|
||||
_scannerSchemaField = root.Q<ObjectField>("ScanSchema");
|
||||
_scannerSchemaField.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
var selectScanner = _scannerListView.selectedItem as AssetArtScanner;
|
||||
if (selectScanner != null)
|
||||
{
|
||||
string assetPath = AssetDatabase.GetAssetPath(evt.newValue);
|
||||
_scanSchemaField.value.name = assetPath;
|
||||
selectScanner.ScannerSchema = AssetDatabase.AssetPathToGUID(assetPath);
|
||||
AssetArtScannerSettingData.ModifyScanner(selectScanner);
|
||||
}
|
||||
});
|
||||
|
||||
// 存储目录
|
||||
_saveFolderField = root.Q<ObjectField>("SaveFolder");
|
||||
_saveFolderField.RegisterValueChangedCallback(evt =>
|
||||
_outputFolderField = root.Q<ObjectField>("OutputFolder");
|
||||
_outputFolderField.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
var selectScanner = _scannerListView.selectedItem as AssetArtScanner;
|
||||
if (selectScanner != null)
|
||||
|
@ -143,7 +145,6 @@ namespace YooAsset.Editor
|
|||
string assetPath = AssetDatabase.GetAssetPath(evt.newValue);
|
||||
if (AssetDatabase.IsValidFolder(assetPath))
|
||||
{
|
||||
_saveFolderField.value.name = assetPath;
|
||||
selectScanner.SaveDirectory = assetPath;
|
||||
AssetArtScannerSettingData.ModifyScanner(selectScanner);
|
||||
}
|
||||
|
@ -326,13 +327,13 @@ namespace YooAsset.Editor
|
|||
var scanSchema = selectScanner.LoadSchema();
|
||||
if (scanSchema == null)
|
||||
{
|
||||
_scanSchemaField.SetValueWithoutNotify(null);
|
||||
_scannerSchemaField.SetValueWithoutNotify(null);
|
||||
_schemaGuideTxt.text = string.Empty;
|
||||
Selection.activeObject = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_scanSchemaField.SetValueWithoutNotify(scanSchema);
|
||||
_scannerSchemaField.SetValueWithoutNotify(scanSchema);
|
||||
_schemaGuideTxt.text = scanSchema.GetUserGuide();
|
||||
Selection.activeObject = scanSchema;
|
||||
}
|
||||
|
@ -341,11 +342,11 @@ namespace YooAsset.Editor
|
|||
DefaultAsset saveFolder = AssetDatabase.LoadAssetAtPath<DefaultAsset>(selectScanner.SaveDirectory);
|
||||
if (saveFolder == null)
|
||||
{
|
||||
_saveFolderField.SetValueWithoutNotify(null);
|
||||
_outputFolderField.SetValueWithoutNotify(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
_saveFolderField.SetValueWithoutNotify(saveFolder);
|
||||
_outputFolderField.SetValueWithoutNotify(saveFolder);
|
||||
}
|
||||
|
||||
FillCollectorViewData();
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
<ui:Label display-tooltip-when-elided="true" name="SchemaUserGuide" style="-unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px; height: 40px;" />
|
||||
<ui:TextField picking-mode="Ignore" label="Scanner Name" name="ScannerName" />
|
||||
<ui:TextField picking-mode="Ignore" label="Scanner Desc" name="ScannerDesc" />
|
||||
<uie:ObjectField label="Scan Schema" name="ScanSchema" type="YooAsset.Editor.ScannerSchema, YooAsset.Editor" />
|
||||
<uie:ObjectField label="Save Folder" name="SaveFolder" type="UnityEditor.DefaultAsset, UnityEditor.CoreModule" />
|
||||
<uie:ObjectField label="Scanner Schema" name="ScanSchema" type="YooAsset.Editor.ScannerSchema, YooAsset.Editor" allow-scene-objects="false" />
|
||||
<uie:ObjectField label="Output Folder" name="OutputFolder" type="UnityEditor.DefaultAsset, UnityEditor.CoreModule" allow-scene-objects="false" />
|
||||
<ui:VisualElement name="CollectorAddContainer" style="height: 20px; flex-direction: row-reverse;">
|
||||
<ui:Button text="[ + ]" display-tooltip-when-elided="true" name="AddBtn" />
|
||||
<ui:Button text="Scan" display-tooltip-when-elided="true" name="ScanBtn" style="width: 60px;" />
|
||||
|
|
Loading…
Reference in New Issue