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

@@ -7,6 +7,7 @@
#include <XCEditor/Widgets/UIEditorMenuPopup.h>
#include <array>
#include <cstddef>
#include <cstdint>
#include <string>
@@ -21,7 +22,10 @@ enum class UIEditorPropertyGridFieldKind : std::uint8_t {
Text = 0,
Bool,
Number,
Enum
Enum,
Vector2,
Vector3,
Vector4
};
enum class UIEditorPropertyGridHitTargetKind : std::uint8_t {
@@ -54,6 +58,42 @@ struct UIEditorPropertyGridEnumFieldValue {
std::size_t selectedIndex = 0u;
};
struct UIEditorPropertyGridVector2FieldValue {
std::array<double, 2u> values = { 0.0, 0.0 };
std::array<std::string, 2u> componentLabels = { std::string("X"), std::string("Y") };
double step = 0.1;
double minValue = -1000000.0;
double maxValue = 1000000.0;
bool integerMode = false;
};
struct UIEditorPropertyGridVector3FieldValue {
std::array<double, 3u> values = { 0.0, 0.0, 0.0 };
std::array<std::string, 3u> componentLabels = {
std::string("X"),
std::string("Y"),
std::string("Z")
};
double step = 0.1;
double minValue = -1000000.0;
double maxValue = 1000000.0;
bool integerMode = false;
};
struct UIEditorPropertyGridVector4FieldValue {
std::array<double, 4u> values = { 0.0, 0.0, 0.0, 0.0 };
std::array<std::string, 4u> componentLabels = {
std::string("X"),
std::string("Y"),
std::string("Z"),
std::string("W")
};
double step = 0.1;
double minValue = -1000000.0;
double maxValue = 1000000.0;
bool integerMode = false;
};
struct UIEditorPropertyGridField {
std::string fieldId = {};
std::string label = {};
@@ -64,6 +104,9 @@ struct UIEditorPropertyGridField {
bool boolValue = false;
UIEditorPropertyGridNumberFieldValue numberValue = {};
UIEditorPropertyGridEnumFieldValue enumValue = {};
UIEditorPropertyGridVector2FieldValue vector2Value = {};
UIEditorPropertyGridVector3FieldValue vector3Value = {};
UIEditorPropertyGridVector4FieldValue vector4Value = {};
};
struct UIEditorPropertyGridSection {