From 6bb89aad3a3c959b2a3c8212b53309308d82f302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=93=AE?= <834207172@qq.com> Date: Tue, 30 Sep 2025 15:55:11 +0800 Subject: [PATCH] 111 --- .../Editor/BuildAsset/CreatAssetWindow.cs | 5 +- .../Editor/BuildAsset/OneKeyBuildWindow.cs | 2 +- Assets/00.StaryEvo/package.json | 2 +- Assets/00.StaryEvoTools/package.json | 2 +- .../Editor/Script/CreatPointCloudWindow.cs | 3 +- .../Editor/Script/CreatPointModelWindow.cs | 324 ++++++++++++------ .../Script/Entity/ModelLibraryResponses.cs | 31 ++ .../Entity/ModelLibraryResponses.cs.meta | 3 + Assets/11.PointCloudTools/package.json | 2 +- 9 files changed, 265 insertions(+), 109 deletions(-) create mode 100644 Assets/11.PointCloudTools/Editor/Script/Entity/ModelLibraryResponses.cs create mode 100644 Assets/11.PointCloudTools/Editor/Script/Entity/ModelLibraryResponses.cs.meta diff --git a/Assets/00.StaryEvo/Editor/BuildAsset/CreatAssetWindow.cs b/Assets/00.StaryEvo/Editor/BuildAsset/CreatAssetWindow.cs index a74cfde..6e28e0d 100644 --- a/Assets/00.StaryEvo/Editor/BuildAsset/CreatAssetWindow.cs +++ b/Assets/00.StaryEvo/Editor/BuildAsset/CreatAssetWindow.cs @@ -211,7 +211,10 @@ namespace Stary.Evo.Editor } - [TitleGroup("预览Domain作用域")] public List domainList; + [TitleGroup("预览Domain作用域")] + [ListDrawerSettings(DraggableItems = false, ShowFoldout = false, ShowPaging = false, ShowItemCount = false, + HideRemoveButton = true,HideAddButton = true)] + public List domainList; protected override void Initialize() { diff --git a/Assets/00.StaryEvo/Editor/BuildAsset/OneKeyBuildWindow.cs b/Assets/00.StaryEvo/Editor/BuildAsset/OneKeyBuildWindow.cs index 10fc166..834075e 100644 --- a/Assets/00.StaryEvo/Editor/BuildAsset/OneKeyBuildWindow.cs +++ b/Assets/00.StaryEvo/Editor/BuildAsset/OneKeyBuildWindow.cs @@ -33,7 +33,7 @@ namespace Stary.Evo.Editor public bool isOneKeyBuild; [ListDrawerSettings(DraggableItems = false, ShowFoldout = false, ShowPaging = false, ShowItemCount = false, - HideRemoveButton = true)] + HideRemoveButton = true,HideAddButton = true)] public List OneKeyBuildEntities = new List(); protected override void Initialize() diff --git a/Assets/00.StaryEvo/package.json b/Assets/00.StaryEvo/package.json index f1f9f30..5efaebe 100644 --- a/Assets/00.StaryEvo/package.json +++ b/Assets/00.StaryEvo/package.json @@ -1,6 +1,6 @@ { "name": "com.staryevo.main", - "version": "2.0.8", + "version": "2.0.9", "displayName": "00.StaryEvo", "description": "This is an Framework package(后台服务器版本,端口9527)", "unity": "2021.3", diff --git a/Assets/00.StaryEvoTools/package.json b/Assets/00.StaryEvoTools/package.json index fd436e3..7b25621 100644 --- a/Assets/00.StaryEvoTools/package.json +++ b/Assets/00.StaryEvoTools/package.json @@ -1,6 +1,6 @@ { "name": "com.staryevo.tools", - "version": "1.1.0", + "version": "1.1.1", "displayName": "00.StaryEvo.Tools", "description": "This is an Framework package(后台服务器版本,端口9527)", "unity": "2021.3", diff --git a/Assets/11.PointCloudTools/Editor/Script/CreatPointCloudWindow.cs b/Assets/11.PointCloudTools/Editor/Script/CreatPointCloudWindow.cs index 3f7baad..d7338eb 100644 --- a/Assets/11.PointCloudTools/Editor/Script/CreatPointCloudWindow.cs +++ b/Assets/11.PointCloudTools/Editor/Script/CreatPointCloudWindow.cs @@ -65,7 +65,8 @@ namespace Stary.Evo.Editor } } - + [ListDrawerSettings(DraggableItems = false, ShowFoldout = false, ShowPaging = false, ShowItemCount = false, + HideRemoveButton = true,HideAddButton = true)] [TitleGroup("预览场景")] public List SceneWorkEntities; protected override async void Initialize() { diff --git a/Assets/11.PointCloudTools/Editor/Script/CreatPointModelWindow.cs b/Assets/11.PointCloudTools/Editor/Script/CreatPointModelWindow.cs index 96a880f..01de160 100644 --- a/Assets/11.PointCloudTools/Editor/Script/CreatPointModelWindow.cs +++ b/Assets/11.PointCloudTools/Editor/Script/CreatPointModelWindow.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Linq; using Cysharp.Threading.Tasks; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -11,6 +12,7 @@ using Stary.Evo.Editor; using Stary.Evo.Editor.Entity; using UnityEditor; using UnityEngine; +using UnityEngine.Serialization; public class CreatPointModelWindow : OdinEditorWindow { @@ -35,16 +37,26 @@ public class CreatPointModelWindow : OdinEditorWindow scenarioType = EditorPrefs.GetString("scenarioType"); } - [TitleGroup("创建")] [InfoBox("Model名称")] + [TitleGroup("创建")] [HorizontalGroup("创建/数据")] [HideLabel] [InfoBox("Model名称")] public string modelName; - [TitleGroup("创建")] [InfoBox("Model描述")] [ValueDropdown("GetModelType")][OnValueChanged("SetModelType")] + [TitleGroup("创建")] + [HorizontalGroup("创建/数据")] + [HideLabel] + [InfoBox("Model描述")] + [ValueDropdown("GetModelType")] + [OnValueChanged("SetModelType")] public string modelType; - [TitleGroup("创建")] [InfoBox("Scenario描述")] [ValueDropdown("GetScenarioType")][OnValueChanged("SetScenarioType")] + [TitleGroup("创建")] + [HorizontalGroup("创建/数据")] + [HideLabel] + [InfoBox("Scenario描述")] + [ValueDropdown("GetScenarioType")] + [OnValueChanged("SetScenarioType")] public string scenarioType; - [TitleGroup("创建")] [ReadOnly] [InfoBox("文件所对应数据库id")] + [TitleGroup("上传")] [HorizontalGroup("上传/文件")] [HideLabel] [ReadOnly] [InfoBox("文件所对应数据库id")] public string documentFileid; private List GetModelType() => _modelTypes; @@ -53,6 +65,131 @@ public class CreatPointModelWindow : OdinEditorWindow private void SetModelType() => EditorPrefs.SetString("modelType", modelType); private void SetScenarioType() => EditorPrefs.SetString("scenarioType", scenarioType); + [TitleGroup("上传")] + [Button("创建Model", ButtonSizes.Large)] + public async void CreatModel() + { + if (string.IsNullOrEmpty(modelName) || string.IsNullOrEmpty(modelType) || string.IsNullOrEmpty(scenarioType) || + string.IsNullOrEmpty(documentFileid)) + { + EditorUtility.DisplayDialog("提示", "modelName和modelType和scenarioType和documentFileid不能为空", "确定"); + return; + } + + string ip = EditorPrefs.GetString("ip"); + if (string.IsNullOrEmpty(ip)) + { + EditorUtility.DisplayDialog("提示", "ip不能为空", "确定"); + return; + } + + var pointModelEntity = new + { + Name = modelName, + ModelType = modelType, + ScenarioType = scenarioType, + DocumentFileid = documentFileid, + }; + string postData = JsonConvert.SerializeObject(pointModelEntity); + ResultMessageEntity entity = await WebRequestSystem.Post($"{ip}/ModelLibrary/AddModel", postData); + if (entity.code == 200) + { + EditorUtility.DisplayDialog("提示", "创建成功", "确定"); + modelName = ""; + documentFileid = ""; + EditorPrefs.SetString("documentFileid", ""); + EditorPrefs.SetString("modelType", ""); + EditorPrefs.SetString("scenarioType", ""); + } + else if (entity.code == 4009) + { + EditorUtility.DisplayDialog("提示", $"创建失败,存在相同名称元素", "确定"); + } + } + + [TitleGroup("上传")] + [VerticalGroup("上传/文件/上传")] + [HideLabel] + [Sirenix.OdinInspector.FilePath(AbsolutePath = false, Extensions = "$modelType")] + [OnValueChanged("UpdateModel")] + public string modelPath; + + [TitleGroup("上传")] [VerticalGroup("上传/文件/上传")] [ReadOnly] [HideLabel, ProgressBar(0, 100f)] + public float modelUpdateInterval = 0f; + + public async void UpdateModel() + { + if (string.IsNullOrEmpty(modelPath)) + { + EditorUtility.DisplayDialog("提示", "modelPath不能为空", "确定"); + return; + } + + string ip = EditorPrefs.GetString("ip"); + if (string.IsNullOrEmpty(ip)) + { + EditorUtility.DisplayDialog("提示", "ip不能为空", "确定"); + return; + } + + var messageEntity = await WebRequestSystem.PostFile(ip + "/FileLoad/UpLoadFile", new[] { modelPath }, + (progress) => + { + modelUpdateInterval = progress * 100f; + if (progress >= 1) + { + EditorUtility.DisplayDialog("提示", $"上传成功!", "确定"); + } + }); + + if (messageEntity.code == 200) + { + List resultMessageEntities = + JsonConvert.DeserializeObject>(messageEntity.data.ToString()); + if (resultMessageEntities.Count > 0) + { + foreach (var resultMessageEntity in resultMessageEntities) + { + var data = JsonConvert.DeserializeObject(resultMessageEntity.data.ToString()) as JObject; + documentFileid = data["id"].ToString(); + EditorPrefs.SetString("documentFileid", documentFileid); + } + } + } + } + + [FormerlySerializedAs("PointModelEntities")] + [ListDrawerSettings(DraggableItems = false, ShowFoldout = false, ShowPaging = false, ShowItemCount = false, + HideRemoveButton = true, HideAddButton = true)] + [TitleGroup("预览模型")] + public List pointModelEntities; + + protected override async void Initialize() + { + base.Initialize(); + string ip = EditorPrefs.GetString("ip"); + if (string.IsNullOrEmpty(ip)) + { + EditorUtility.DisplayDialog("提示", "ip不能为空", "确定"); + return; + } + + ResultMessageEntity entity = await WebRequestSystem.Get(ip, "/ModelLibrary/FindModelAll"); + if (entity.code == 200) + { + var modelLibraryResponses = + JsonConvert.DeserializeObject>(entity.data.ToString()); + pointModelEntities = modelLibraryResponses.Select(x => new PointModelEntity(this) + { + id = x.id, + Name = x.Name, + ModelType = x.ModelType, + ScenarioType = x.ScenarioType, + DocumentFileid = x.DocumentFileid, + }).ToList(); + } + } + private static async UniTask> GetModelTypes() { string ip = EditorPrefs.GetString("ip"); @@ -62,18 +199,11 @@ public class CreatPointModelWindow : OdinEditorWindow return null; } - // var entity = new PointModelEntity - // { - // modelName = modelName, - // modelType = modelType, - // scenarioType = scenarioType, - // }; - //string postData = JsonConvert.SerializeObject(entity); ResultMessageEntity entity = await WebRequestSystem.Get(ip, "/ModelLibrary/FindModelType"); if (entity.code == 200) { - var modelTypes = JsonConvert.DeserializeObject>(entity.data.ToString()); - return modelTypes; + var modelTypes = JsonConvert.DeserializeObject(entity.data.ToString()); + return modelTypes.ToList(); } else { @@ -102,113 +232,101 @@ public class CreatPointModelWindow : OdinEditorWindow } } - [TitleGroup("创建")] - [Button("创建Model", ButtonSizes.Large)] - public async void CreatModel() - { - if (string.IsNullOrEmpty(modelName) || string.IsNullOrEmpty(modelType) || string.IsNullOrEmpty(scenarioType) || - string.IsNullOrEmpty(documentFileid)) - { - EditorUtility.DisplayDialog("提示", "modelName和modelType和scenarioType和documentFileid不能为空", "确定"); - return; - } - - string ip = EditorPrefs.GetString("ip"); - if (string.IsNullOrEmpty(ip)) - { - EditorUtility.DisplayDialog("提示", "ip不能为空", "确定"); - return; - } - - var pointModelEntity = new PointModelEntity - { - Name = modelName, - ModelType = modelType, - ScenarioType = scenarioType, - DocumentFileid = documentFileid, - }; - string postData = JsonConvert.SerializeObject(pointModelEntity); - ResultMessageEntity entity = await WebRequestSystem.Post($"{ip}/ModelLibrary/AddModel", postData); - if (entity.code == 200) - { - EditorUtility.DisplayDialog("提示", "创建成功", "确定"); - modelName = ""; - documentFileid = ""; - EditorPrefs.SetString("documentFileid",""); - EditorPrefs.SetString("modelType",""); - EditorPrefs.SetString("scenarioType",""); - } - else if (entity.code == 4009) - { - EditorUtility.DisplayDialog("提示", $"创建失败,存在相同名称元素", "确定"); - } - } - - [TitleGroup("上传")] [InfoBox("Model路径")] [Sirenix.OdinInspector.FilePath(Extensions = "$modelType")] - public string modelPath; - - [TitleGroup("上传")] [ReadOnly][HideLabel, ProgressBar(0, 100f)] - public float modelUpdateInterval = 0f; - - [TitleGroup("上传")] - [Button("上传Model", ButtonSizes.Large)] - public async void UpdateModel() - { - if (string.IsNullOrEmpty(modelPath)) - { - EditorUtility.DisplayDialog("提示", "modelPath不能为空", "确定"); - return; - } - - string ip = EditorPrefs.GetString("ip"); - if (string.IsNullOrEmpty(ip)) - { - EditorUtility.DisplayDialog("提示", "ip不能为空", "确定"); - return; - } - - var messageEntity = await WebRequestSystem.PostFile(ip + "/FileLoad/UpLoadFile", new[] { modelPath }, (progress) => - { - modelUpdateInterval = progress * 100f; - }); - - if (messageEntity.code == 200) - { - List resultMessageEntities = - JsonConvert.DeserializeObject>(messageEntity.data.ToString()); - if (resultMessageEntities.Count > 0) - { - foreach (var resultMessageEntity in resultMessageEntities) - { - var data = JsonConvert.DeserializeObject(resultMessageEntity.data.ToString()) as JObject; - documentFileid = data["id"].ToString(); - EditorPrefs.SetString("documentFileid", documentFileid); - } - } - } - } - [Serializable] public class PointModelEntity { + private readonly CreatPointModelWindow window; + + /// + /// id + /// + [HideInInspector] public string id; + /// /// 模型名称 /// - public string Name { get; set; } + [TitleGroup("$id")] [HorizontalGroup("$id/数据")] [HideLabel] [InfoBox("模型名称")] + public string Name; /// /// 模型标签 /// - public string ModelType { get; set; } + [TitleGroup("$id")] [HorizontalGroup("$id/数据")] [HideLabel] [InfoBox("模型标签")] [ValueDropdown("GetModelType")] + public string ModelType; /// /// 场景标签 /// - public string ScenarioType { get; set; } + [TitleGroup("$id")] [HorizontalGroup("$id/数据")] [HideLabel] [InfoBox("场景标签")] [ValueDropdown("GetScenarioType")] + public string ScenarioType; /// /// 文件id /// - public string DocumentFileid { get; set; } + [TitleGroup("$id")] [HorizontalGroup("$id/数据")] [HideLabel] [ReadOnly] [InfoBox("文件id")] + public string DocumentFileid; + + + public PointModelEntity(CreatPointModelWindow window) + { + this.window = window; + } + + [TitleGroup("$id")] + [HorizontalGroup("$id/button")] + [Button("", Icon = SdfIconType.ArrowUpCircleFill, IconAlignment = IconAlignment.RightEdge)] + public async void UpdatePointCloud() + { + string ip = EditorPrefs.GetString("ip"); + if (string.IsNullOrEmpty(ip)) + { + EditorUtility.DisplayDialog("提示", "ip不能为空", "确定"); + return; + } + + var pointModelEntity = new + { + Name = Name, + ModelType = ModelType, + ScenarioType = ScenarioType, + DocumentFileid = DocumentFileid, + }; + string body = JsonConvert.SerializeObject(pointModelEntity); + ResultMessageEntity entity = await WebRequestSystem.Put($"{ip}/ModelLibrary/UpdateModel", body); + if (entity.code == 200) + { + EditorUtility.DisplayDialog("提示", $"更新成功{pointModelEntity}", "确定"); + } + } + + [TitleGroup("$id")] + [HorizontalGroup("$id/button")] + [Button("", Icon = SdfIconType.XCircle, IconAlignment = IconAlignment.RightEdge)] + public async void DeletePointCloud() + { + string ip = EditorPrefs.GetString("ip"); + if (string.IsNullOrEmpty(ip)) + { + EditorUtility.DisplayDialog("提示", "ip不能为空", "确定"); + return; + } + + ResultMessageEntity entity = await WebRequestSystem.Delete(ip, $"/ModelLibrary/DeleteModelbyid/{id}"); + if (entity.code == 200) + { + window.pointModelEntities.Remove(this); + EditorUtility.DisplayDialog("提示", "删除成功", "确定"); + } + } + + private List GetModelType() + { + return window.GetModelType(); + } + + private List GetScenarioType() + { + return window.GetScenarioType(); + } } } \ No newline at end of file diff --git a/Assets/11.PointCloudTools/Editor/Script/Entity/ModelLibraryResponses.cs b/Assets/11.PointCloudTools/Editor/Script/Entity/ModelLibraryResponses.cs new file mode 100644 index 0000000..a0ad7e1 --- /dev/null +++ b/Assets/11.PointCloudTools/Editor/Script/Entity/ModelLibraryResponses.cs @@ -0,0 +1,31 @@ +namespace Stary.Evo.Editor.Entity +{ + public class ModelLibraryResponses + { + /// + /// id + /// + public string id { get; set; } + + /// + /// 名称 + /// + public string Name { get; set; } + + /// + /// 模型类别 + /// + public string ModelType { get; set; } + + /// + /// 使用场景类别 + /// + public string ScenarioType { get; set; } + + /// + /// 产品包路径 + /// + public string DocumentFileid { get; set; } + + } +} \ No newline at end of file diff --git a/Assets/11.PointCloudTools/Editor/Script/Entity/ModelLibraryResponses.cs.meta b/Assets/11.PointCloudTools/Editor/Script/Entity/ModelLibraryResponses.cs.meta new file mode 100644 index 0000000..8eb635a --- /dev/null +++ b/Assets/11.PointCloudTools/Editor/Script/Entity/ModelLibraryResponses.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 12a06324569c4a8588564b00a09af17f +timeCreated: 1759202524 \ No newline at end of file diff --git a/Assets/11.PointCloudTools/package.json b/Assets/11.PointCloudTools/package.json index b93f722..b61ac19 100644 --- a/Assets/11.PointCloudTools/package.json +++ b/Assets/11.PointCloudTools/package.json @@ -1,6 +1,6 @@ { "name": "com.pointcloud", - "version": "1.0.3", + "version": "1.0.4", "displayName": "11.PointCloudTools", "description": "点云开发工具", "unity": "2021.3",