ui: add vector4 editor field validation

This commit is contained in:
2026-04-08 03:23:15 +08:00
parent 2e961295bf
commit 7be3b2cc45
19 changed files with 2346 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
#include <windowsx.h>
#include <algorithm>
#include <array>
#include <filesystem>
#include <sstream>
#include <string>
@@ -262,6 +263,18 @@ UIEditorPropertyGridField MakeEnumField(
return field;
}
UIEditorPropertyGridField MakeVector4Field(
std::string id,
std::string label,
std::array<double, 4u> values) {
UIEditorPropertyGridField field = {};
field.fieldId = std::move(id);
field.label = std::move(label);
field.kind = UIEditorPropertyGridFieldKind::Vector4;
field.vector4Value.values = values;
return field;
}
std::vector<UIEditorPropertyGridSection> BuildSections() {
return {
{
@@ -269,6 +282,7 @@ std::vector<UIEditorPropertyGridSection> BuildSections() {
"Inspector",
{
MakeBoolField("enabled", "Enabled", true),
MakeVector4Field("rotation", "Rotation", { 0.0, 15.0, 0.0, 1.0 }),
MakeNumberField("render_queue", "Render Queue", 2000.0),
MakeEnumField("render_mode", "Render Mode", { "Opaque", "Cutout", "Fade" }, 0u),
MakeTextField("tag", "Tag", "Player")
@@ -871,7 +885,7 @@ private:
shellMetrics.bodyFontSize);
drawList.AddText(
UIPoint(layout.introRect.x + 16.0f, layout.introRect.y + 94.0f),
"2. 点击 value hostBool toggle、Number/Text edit、Enum popup。",
"2. 点击 value hostBool toggle、Vector4 宿主排版、Number/Text edit、Enum popup。",
shellPalette.textPrimary,
shellMetrics.bodyFontSize);
drawList.AddText(