Skip to content

Commit 2224451

Browse files
committed
feat(ui): 新增模型高度设置和运行时数据记录功能
## 变更内容 - 新增模型高度设置功能,允许按角色目标和模型单独设置高度 - 增加运行时数据记录功能,数据位于 config 文件夹的 RuntimeData/<ModelTarget>/<ModelId>.json - 优化动画参数显示界面,新增对参数名开头和结尾空白字符的提示功能 - 优化模型选择界面,AI角色会将在所有AI角色中设置的模型以紫色标出 - 修复特定情形下(如场景内远距离传送)动画器参数失去同步的问题 ## 相关文件 - DuckovCustomModel/RuntimeData/ - DuckovCustomModel/UI/Components/AnimatorParameterDisplay.cs - DuckovCustomModel/Managers/ModelManager.cs - DuckovCustomModel/HarmonyPatches/ - CHANGELOG.md, CHANGELOG_EN.md
2 parents 68468af + 7e11376 commit 2224451

41 files changed

Lines changed: 1144 additions & 271 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
[English](CHANGELOG_EN.md) | 中文
44

5+
## v1.10.5
6+
7+
- 动画参数显示界面优化
8+
- 新增对参数名开头和结尾空白字符的提示功能
9+
- 参数名开头或结尾的空格会以红色粗体的 `` 符号标记
10+
- 修复了特定情形下(如:场景内远距离传送)会导致动画器参数失去同步的问题
11+
- 增加了运行时的数据记录,数据位于 config 文件夹的 RuntimeData/&lt;ModelTarget&gt;/&lt;ModelId&gt;.json
12+
- 增加了模型高度设置功能,允许设置模型的高度,根据每个角色目标的每个模型单独设置
13+
- 高度对应角色模型的 HelmetLocator 的位置
14+
- 注意:如果模型不存在 HelmetLocator,那么该功能将会被禁用
15+
- 会记录于运行时数据记录中,并保持应用
16+
- **该功能不支持通过 “所有AI角色” 选项页面进行设置**
17+
- 优化了模型选择界面,现在AI角色会将在所有AI角色中设置的模型以紫色标出
18+
519
## v1.10.4-fix4
620

721
- 修复错误的将透视材质也替换成普通材质导致渲染表现异常的问题

CHANGELOG_EN.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
English | [中文](CHANGELOG.md)
44

5+
## v1.10.5
6+
7+
- Animator parameter display interface optimization
8+
- Added warning for leading and trailing whitespace characters in parameter names
9+
- Spaces at the beginning or end of parameter names are marked with red bold `` symbols
10+
- Fixed an issue where animator parameters could lose synchronization in specific scenarios (e.g., long-distance teleportation within a scene)
11+
- Added runtime data recording, data is located in config folder's RuntimeData/&lt;ModelTarget&gt;/&lt;ModelId&gt;.json
12+
- Added model height setting functionality, allows setting model height, configured separately for each model of each character target
13+
- Height corresponds to the position of the character model's HelmetLocator
14+
- Note: If the model does not have a HelmetLocator, this feature will be disabled
15+
- Recorded in runtime data and persisted
16+
- **This feature does not support configuration via the "All AI Characters" option page**
17+
- Optimized model selection interface, AI characters will now highlight models set in all AI characters in purple
18+
519
## v1.10.4-fix4
620

721
- Fixed the issue of replacing the transparent material with the normal material, causing abnormal rendering performance

DuckovCustomModel.Core/Data/ModelTargetType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static class ModelTargetType
1010
public const string Character = BuiltInPrefix + "Character";
1111
public const string Pet = BuiltInPrefix + "Pet";
1212
public const string AICharacterTemplate = BuiltInPrefix + "AICharacter_";
13-
public const string AllAICharacters = AICharacterTemplate + "*";
13+
public const string AllAICharacters = AICharacterTemplate + AICharacters.AllAICharactersKey;
1414

1515
public static string CreateAICharacterTargetType(string aiCharacterName)
1616
{
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace DuckovCustomModel.Configs
5+
{
6+
public class ModelRuntimeData : ConfigBase
7+
{
8+
public Dictionary<string, object> Data { get; set; } = [];
9+
10+
public T? GetValue<T>(string key)
11+
{
12+
if (string.IsNullOrWhiteSpace(key)) return default;
13+
if (!Data.TryGetValue(key, out var value)) return default;
14+
15+
try
16+
{
17+
if (value is T typedValue)
18+
return typedValue;
19+
20+
return (T)Convert.ChangeType(value, typeof(T));
21+
}
22+
catch
23+
{
24+
return default;
25+
}
26+
}
27+
28+
public void SetValue<T>(string key, T value)
29+
{
30+
if (string.IsNullOrWhiteSpace(key)) return;
31+
32+
if (value == null)
33+
Data.Remove(key);
34+
else
35+
Data[key] = value;
36+
}
37+
38+
public bool RemoveValue(string key)
39+
{
40+
return !string.IsNullOrWhiteSpace(key) && Data.Remove(key);
41+
}
42+
43+
public override void LoadDefault()
44+
{
45+
Data.Clear();
46+
}
47+
48+
public override bool Validate()
49+
{
50+
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
51+
if (Data != null) return false;
52+
Data = [];
53+
return true;
54+
}
55+
56+
public override void CopyFrom(IConfigBase other)
57+
{
58+
if (other is not ModelRuntimeData otherData) return;
59+
Data = new(otherData.Data);
60+
}
61+
}
62+
}

DuckovCustomModel/Constant.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public static class Constant
44
{
55
public const string ModID = "DuckovCustomModel";
66
public const string ModName = "Duckov Custom Model";
7-
public const string ModVersion = "1.10.4-fix4";
7+
public const string ModVersion = "1.10.5";
88
public const string HarmonyId = "com.ritsukage.DuckovCustomModel";
99
}
1010
}

DuckovCustomModel/Extensions/ShoulderSurfing/ShoulderCameraParameterUpdater.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class ShoulderCameraParameterUpdater : IAnimatorParameterUpdater, IDispos
1515
public ShoulderCameraParameterUpdater()
1616
{
1717
ShoulderCameraCompat.Initialize();
18-
_cancellationTokenSource = new CancellationTokenSource();
18+
_cancellationTokenSource = new();
1919
UpdateLoop(_cancellationTokenSource.Token).Forget();
2020
}
2121

DuckovCustomModel/Localizations/Chinese.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
"PublishedAt": "发布时间",
6767
"CharacterModelWarning": "由于部分角色使用建筑模型,因此不保证所有该角色都能被正确替换为设置的模型",
6868
"ModelAudioVolume": "模型音效音量",
69+
"ModelHeight": "模型高度",
70+
"Reset": "重置",
71+
"ClearRuntimeData": "清除运行时数据",
6972
"EmotionModifierKey1": "表情修饰键 1",
7073
"EmotionModifierKey2": "表情修饰键 2",
7174
"EmotionModifierKeyWarning": "警告:按下修饰键时会屏蔽所有其他按键响应,只能响应 F1~F8 组合键事件",

DuckovCustomModel/Localizations/ChineseTraditional.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
"PublishedAt": "發布時間",
6767
"CharacterModelWarning": "由於部分角色使用建築模型,因此不保證所有該角色都能被正確替換為設置的模型",
6868
"ModelAudioVolume": "模型音效音量",
69+
"ModelHeight": "模型高度",
70+
"Reset": "重置",
71+
"ClearRuntimeData": "清除運行時數據",
6972
"EmotionModifierKey1": "表情修飾鍵 1",
7073
"EmotionModifierKey2": "表情修飾鍵 2",
7174
"EmotionModifierKeyWarning": "警告:按下修飾鍵時會屏蔽所有其他按鍵響應,只能響應 F1~F8 組合鍵事件",

DuckovCustomModel/Localizations/English.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
"PublishedAt": "Published At",
6767
"CharacterModelWarning": "Some characters use building models, so not all instances of this character may be correctly replaced with the set model",
6868
"ModelAudioVolume": "Model Audio Volume",
69+
"ModelHeight": "Model Height",
70+
"Reset": "Reset",
71+
"ClearRuntimeData": "Clear Runtime Data",
6972
"EmotionModifierKey1": "Emotion Modifier Key 1",
7073
"EmotionModifierKey2": "Emotion Modifier Key 2",
7174
"EmotionModifierKeyWarning": "Warning: Pressing modifier keys will block all other key inputs, only F1~F8 combination key events will be responded to",

DuckovCustomModel/Localizations/French.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
"PublishedAt": "Publié le",
6767
"CharacterModelWarning": "Certains personnages utilisent des modèles de bâtiment, donc toutes les instances de ce personnage ne peuvent pas être correctement remplacées par le modèle défini",
6868
"ModelAudioVolume": "Volume audio du modèle",
69+
"ModelHeight": "Hauteur du modèle",
70+
"Reset": "Réinitialiser",
71+
"ClearRuntimeData": "Effacer les données d'exécution",
6972
"EmotionModifierKey1": "Touche de modification d'émotion 1",
7073
"EmotionModifierKey2": "Touche de modification d'émotion 2",
7174
"EmotionModifierKeyWarning": "Avertissement : Appuyer sur les touches de modification bloquera toutes les autres entrées de touches, seuls les événements de combinaison de touches F1~F8 seront pris en compte",

0 commit comments

Comments
 (0)