A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
feat: Add PropertyEditor framework and base editors
esengine00e27a9d432b
diff --git a/src/esengine/editor/CMakeLists.txt b/src/esengine/editor/CMakeLists.txtindex 0aede264c..cd717bd02 100644--- a/src/esengine/editor/CMakeLists.txt+++ b/src/esengine/editor/CMakeLists.txt@@ -4,6 +4,11 @@ set(EDITOR_SOURCESmain.cppEditorApplication.cpp+ # Property editors+ property/PropertyEditor.cpp+ property/editors/FloatEditor.cpp+ property/editors/Vector3Editor.cpp+# Panelspanels/HierarchyPanel.cpp)@@ -22,6 +27,11 @@ set(EDITOR_HEADERScommand/PropertyCommand.hppcommand/EditorCommands.hpp+ # Property editors+ property/PropertyEditor.hpp+ property/editors/FloatEditor.hpp+ property/editors/Vector3Editor.hpp+# Panelspanels/HierarchyPanel.hpp)diff --git a/src/esengine/editor/property/PropertyEditor.cpp b/src/esengine/editor/property/PropertyEditor.cppnew file mode 100644index 000000000..aeac2b942--- /dev/null+++ b/src/esengine/editor/property/PropertyEditor.cpp@@ -0,0 +1,69 @@+/**+ * @file PropertyEditor.cpp+ * @brief PropertyEditor implementation+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */++#include "PropertyEditor.hpp"+#include "../command/CommandHistory.hpp"++namespace esengine::editor {++// =============================================================================+// Constructor+// =============================================================================++PropertyEditor::PropertyEditor(const ui::WidgetId& id, const std::string& propertyName)+ : ui::Widget(id), propertyName_(propertyName), label_(propertyName) {}++// =============================================================================+// Label+// =============================================================================++void PropertyEditor::setLabel(const std::string& label) {+ if (label_ == label) {+ return;+ }++ label_ = label;+ invalidateLayout();+}++void PropertyEditor::setShowLabel(bool show) {+ if (showLabel_ == show) {+ return;+ }++ showLabel_ = show;+ invalidateLayout();+}++// =============================================================================+// Command Integration+// =============================================================================++void PropertyEditor::setCommandHistory(CommandHistory* history) {+ commandHistory_ = history;+}++// =============================================================================+// Protected Methods+// =============================================================================++void PropertyEditor::notifyValueChanged(const std::any& oldValue, const std::any& newValue) {+ if (commandHistory_) {+ auto command = createCommand(oldValue, newValue);+ if (command) {+ commandHistory_->execute(std::move(command));+ }+ }++ onValueChanged.publish(newValue);+}++} // namespace esengine::editordiff --git a/src/esengine/editor/property/PropertyEditor.hpp b/src/esengine/editor/property/PropertyEditor.hppnew file mode 100644index 000000000..16d37b525--- /dev/null+++ b/src/esengine/editor/property/PropertyEditor.hpp@@ -0,0 +1,169 @@+/**+ * @file PropertyEditor.hpp+ * @brief Base class for property editing widgets+ * @details Provides the foundation for type-specific property editors that+ * integrate with the command system for undo/redo support.+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */+#pragma once++// =============================================================================+// Includes+// =============================================================================++#include "../../ui/widgets/Widget.hpp"+#include "../../events/Signal.hpp"++#include <any>+#include <string>++namespace esengine::editor {++class Command;+class CommandHistory;++// =============================================================================+// PropertyEditor Class+// =============================================================================++/**+ * @brief Base class for property editing widgets+ *+ * @details PropertyEditor provides a common interface for widgets that edit+ * component properties. Each editor creates commands for modifications+ * to enable undo/redo support.+ *+ * @code+ * class FloatEditor : public PropertyEditor {+ * public:+ * void setValue(const std::any& value) override {+ * f32 floatValue = std::any_cast<f32>(value);+ * textField_->setText(std::to_string(floatValue));+ * }+ *+ * std::any getValue() const override {+ * return std::stof(textField_->getText());+ * }+ * };+ * @endcode+ */+class PropertyEditor : public ui::Widget {+public:+ /**+ * @brief Constructs a property editor+ * @param id Unique widget identifier+ * @param propertyName Name of the property being edited+ */+ explicit PropertyEditor(const ui::WidgetId& id, const std::string& propertyName);++ ~PropertyEditor() override = default;++ // =========================================================================+ // Property Access+ // =========================================================================++ /**+ * @brief Sets the property value+ * @param value New value (type-specific, stored as std::any)+ */+ virtual void setValue(const std::any& value) = 0;++ /**+ * @brief Gets the current property value+ * @return Current value as std::any+ */+ virtual std::any getValue() const = 0;++ /**+ * @brief Gets the property name+ * @return Property name string+ */+ const std::string& getPropertyName() const { return propertyName_; }++ // =========================================================================+ // Label+ // =========================================================================++ /**+ * @brief Sets the display label+ * @param label Label text (defaults to property name)+ */+ void setLabel(const std::string& label);++ /**+ * @brief Gets the display label+ * @return Label text+ */+ const std::string& getLabel() const { return label_; }++ /**+ * @brief Sets whether to show the label+ * @param show True to show label+ */+ void setShowLabel(bool show);++ /**+ * @brief Gets whether the label is shown+ * @return True if label is shown+ */+ bool getShowLabel() const { return showLabel_; }++ // =========================================================================+ // Command Integration+ // =========================================================================++ /**+ * @brief Sets the command history for undo/redo+ * @param history Command history manager+ */+ void setCommandHistory(CommandHistory* history);++ /**+ * @brief Gets the command history+ * @return Command history manager or nullptr+ */+ CommandHistory* getCommandHistory() const { return commandHistory_; }++ // =========================================================================+ // Signals+ // =========================================================================++ /**+ * @brief Emitted when the value changes+ * @param value New value as std::any+ */+ Signal<void(const std::any&)> onValueChanged;++protected:+ /**+ * @brief Creates a command for a value change+ * @param oldValue Previous value+ * @param newValue New value+ * @return Command object or nullptr+ */+ virtual Unique<Command> createCommand(const std::any& oldValue,+ const std::any& newValue) = 0;++ /**+ * @brief Notifies that the value has changed+ * @param oldValue Previous value+ * @param newValue New value+ *+ * @details Creates and executes a command if command history is set,+ * otherwise just emits the signal.+ */+ void notifyValueChanged(const std::any& oldValue, const std::any& newValue);++ std::string propertyName_;+ std::string label_;+ bool showLabel_ = true;++ CommandHistory* commandHistory_ = nullptr;+};++} // namespace esengine::editordiff --git a/src/esengine/editor/property/editors/FloatEditor.cpp b/src/esengine/editor/property/editors/FloatEditor.cppnew file mode 100644index 000000000..a30a7e10a--- /dev/null+++ b/src/esengine/editor/property/editors/FloatEditor.cpp@@ -0,0 +1,269 @@+/**+ * @file FloatEditor.cpp+ * @brief FloatEditor implementation+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */++#include "FloatEditor.hpp"+#include "../../command/PropertyCommand.hpp"+#include "../../../ui/UIContext.hpp"+#include "../../../ui/rendering/UIBatchRenderer.hpp"+#include "../../../events/Sink.hpp"++#include <sstream>+#include <iomanip>++namespace esengine::editor {++// =============================================================================+// Constructor+// =============================================================================++FloatEditor::FloatEditor(const ui::WidgetId& id, const std::string& propertyName)+ : PropertyEditor(id, propertyName) {++ if (showLabel_) {+ auto labelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_label"));+ labelWidget->setText(label_);+ labelWidget_ = labelWidget.get();+ addChild(std::move(labelWidget));+ }++ auto textField = makeUnique<ui::TextField>(ui::WidgetId(getId().path + "_text"));+ textField->setWidth(ui::SizeValue::px(TEXTFIELD_WIDTH));+ textField_ = textField.get();+ addChild(std::move(textField));++ sink(textField_->onTextChanged).connect(+ [this](const std::string& text) { onTextChanged(text); }+ );++ updateTextFromValue();+}++// =============================================================================+// PropertyEditor Interface+// =============================================================================++void FloatEditor::setValue(const std::any& value) {+ try {+ f32 newValue = std::any_cast<f32>(value);+ if (value_ == newValue) {+ return;+ }++ value_ = newValue;+ updateTextFromValue();+ updateSliderFromValue();+ } catch (const std::bad_any_cast&) {+ }+}++std::any FloatEditor::getValue() const {+ return value_;+}++// =============================================================================+// Range Configuration+// =============================================================================++void FloatEditor::setRange(f32 min, f32 max) {+ min_ = min;+ max_ = max;++ if (slider_) {+ slider_->setRange(min_, max_);+ }+}++void FloatEditor::setStep(f32 step) {+ step_ = step;++ if (slider_) {+ slider_->setStep(step_);+ }+}++// =============================================================================+// Display Options+// =============================================================================++void FloatEditor::setShowSlider(bool show) {+ if (showSlider_ == show) {+ return;+ }++ showSlider_ = show;++ if (showSlider_ && !slider_) {+ auto sliderWidget = makeUnique<ui::Slider>(+ ui::WidgetId(getId().path + "_slider"),+ ui::SliderOrientation::Horizontal+ );+ sliderWidget->setRange(min_, max_);+ sliderWidget->setStep(step_);+ slider_ = sliderWidget.get();+ addChild(std::move(sliderWidget));++ sink(slider_->onValueChanged).connect(+ [this](f32 value) { onSliderChanged(value); }+ );++ updateSliderFromValue();+ } else if (!showSlider_ && slider_) {+ removeChild(slider_);+ slider_ = nullptr;+ }++ invalidateLayout();+}++// =============================================================================+// Widget Interface+// =============================================================================++glm::vec2 FloatEditor::measure(f32 availableWidth, f32 availableHeight) {+ f32 width = 0.0f;+ f32 height = 20.0f;++ if (labelWidget_ && showLabel_) {+ width += LABEL_WIDTH + SPACING;+ }++ width += TEXTFIELD_WIDTH;++ if (slider_ && showSlider_) {+ width += SPACING;+ f32 sliderWidth = availableWidth - width;+ if (sliderWidth > 100.0f) {+ width += sliderWidth;+ }+ }++ const ui::SizeConstraints& constraints = getConstraints();+ width = glm::clamp(width, constraints.minWidth, constraints.maxWidth);+ height = glm::clamp(height, constraints.minHeight, constraints.maxHeight);++ return glm::vec2(width, height);+}++void FloatEditor::render(ui::UIBatchRenderer& renderer) {+ const ui::Rect& bounds = getBounds();+ f32 x = bounds.x;++ if (labelWidget_ && showLabel_) {+ ui::Rect labelBounds{x, bounds.y, LABEL_WIDTH, bounds.height};+ labelWidget_->layout(labelBounds);+ labelWidget_->renderTree(renderer);+ x += LABEL_WIDTH + SPACING;+ }++ if (textField_) {+ ui::Rect textBounds{x, bounds.y, TEXTFIELD_WIDTH, bounds.height};+ textField_->layout(textBounds);+ textField_->renderTree(renderer);+ x += TEXTFIELD_WIDTH;+ }++ if (slider_ && showSlider_) {+ x += SPACING;+ f32 sliderWidth = bounds.x + bounds.width - x;+ ui::Rect sliderBounds{x, bounds.y, sliderWidth, bounds.height};+ slider_->layout(sliderBounds);+ slider_->renderTree(renderer);+ }+}++// =============================================================================+// Protected Methods+// =============================================================================++Unique<Command> FloatEditor::createCommand(const std::any& oldValue,+ const std::any& newValue) {+ try {+ f32 oldFloat = std::any_cast<f32>(oldValue);+ f32 newFloat = std::any_cast<f32>(newValue);++ return makeUnique<LambdaCommand>(+ "Modify " + propertyName_,+ [this, newFloat]() {+ setValue(newFloat);+ return CommandResult::Success;+ },+ [this, oldFloat]() {+ setValue(oldFloat);+ }+ );+ } catch (const std::bad_any_cast&) {+ return nullptr;+ }+}++// =============================================================================+// Private Methods+// =============================================================================++void FloatEditor::onTextChanged(const std::string& text) {+ if (updatingFromSlider_) {+ return;+ }++ updatingFromText_ = true;++ try {+ f32 oldValue = value_;+ f32 newValue = std::stof(text);++ if (oldValue != newValue) {+ value_ = newValue;+ updateSliderFromValue();+ notifyValueChanged(oldValue, newValue);+ }+ } catch (const std::invalid_argument&) {+ } catch (const std::out_of_range&) {+ }++ updatingFromText_ = false;+}++void FloatEditor::onSliderChanged(f32 value) {+ if (updatingFromText_) {+ return;+ }++ updatingFromSlider_ = true;++ f32 oldValue = value_;+ if (oldValue != value) {+ value_ = value;+ updateTextFromValue();+ notifyValueChanged(oldValue, value);+ }++ updatingFromSlider_ = false;+}++void FloatEditor::updateTextFromValue() {+ if (updatingFromText_ || !textField_) {+ return;+ }++ std::ostringstream oss;+ oss << std::fixed << std::setprecision(2) << value_;+ textField_->setText(oss.str());+}++void FloatEditor::updateSliderFromValue() {+ if (updatingFromSlider_ || !slider_) {+ return;+ }++ slider_->setValue(value_);+}++} // namespace esengine::editordiff --git a/src/esengine/editor/property/editors/FloatEditor.hpp b/src/esengine/editor/property/editors/FloatEditor.hppnew file mode 100644index 000000000..15ccac4ad--- /dev/null+++ b/src/esengine/editor/property/editors/FloatEditor.hpp@@ -0,0 +1,152 @@+/**+ * @file FloatEditor.hpp+ * @brief Property editor for floating-point values+ * @details Combines a TextField for precise input with an optional Slider+ * for visual adjustment.+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */+#pragma once++// =============================================================================+// Includes+// =============================================================================++#include "../PropertyEditor.hpp"+#include "../../../ui/widgets/TextField.hpp"+#include "../../../ui/widgets/Slider.hpp"+#include "../../../ui/widgets/Label.hpp"++namespace esengine::editor {++// =============================================================================+// FloatEditor Class+// =============================================================================++/**+ * @brief Property editor for f32 values+ *+ * @details Renders a label (optional), text field, and optional slider.+ * Creates PropertyCommand<f32> for undo/redo support.+ *+ * @code+ * auto editor = makeUnique<FloatEditor>(WidgetId("speed"), "Speed");+ * editor->setValue(5.0f);+ * editor->setRange(0.0f, 100.0f);+ * editor->setShowSlider(true);+ * editor->onValueChanged.connect([](const std::any& value) {+ * f32 speed = std::any_cast<f32>(value);+ * ES_LOG_INFO("Speed: {}", speed);+ * });+ * @endcode+ */+class FloatEditor : public PropertyEditor {+public:+ /**+ * @brief Constructs a float editor+ * @param id Unique widget identifier+ * @param propertyName Name of the property being edited+ */+ explicit FloatEditor(const ui::WidgetId& id, const std::string& propertyName);++ ~FloatEditor() override = default;++ // =========================================================================+ // PropertyEditor Interface+ // =========================================================================++ void setValue(const std::any& value) override;+ std::any getValue() const override;++ // =========================================================================+ // Range Configuration+ // =========================================================================++ /**+ * @brief Sets the value range for the slider+ * @param min Minimum value+ * @param max Maximum value+ */+ void setRange(f32 min, f32 max);++ /**+ * @brief Gets the minimum value+ * @return Minimum value+ */+ f32 getMin() const { return min_; }++ /**+ * @brief Gets the maximum value+ * @return Maximum value+ */+ f32 getMax() const { return max_; }++ /**+ * @brief Sets the step size for the slider+ * @param step Step size+ */+ void setStep(f32 step);++ /**+ * @brief Gets the step size+ * @return Step size+ */+ f32 getStep() const { return step_; }++ // =========================================================================+ // Display Options+ // =========================================================================++ /**+ * @brief Sets whether to show the slider+ * @param show True to show slider+ */+ void setShowSlider(bool show);++ /**+ * @brief Gets whether the slider is shown+ * @return True if slider is shown+ */+ bool getShowSlider() const { return showSlider_; }++ // =========================================================================+ // Widget Interface+ // =========================================================================++ glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;+ void render(ui::UIBatchRenderer& renderer) override;++protected:+ Unique<Command> createCommand(const std::any& oldValue,+ const std::any& newValue) override;++private:+ void onTextChanged(const std::string& text);+ void onSliderChanged(f32 value);++ void updateTextFromValue();+ void updateSliderFromValue();++ f32 value_ = 0.0f;+ f32 min_ = 0.0f;+ f32 max_ = 100.0f;+ f32 step_ = 1.0f;++ bool showSlider_ = false;+ bool updatingFromText_ = false;+ bool updatingFromSlider_ = false;++ ui::Label* labelWidget_ = nullptr;+ ui::TextField* textField_ = nullptr;+ ui::Slider* slider_ = nullptr;++ static constexpr f32 LABEL_WIDTH = 60.0f;+ static constexpr f32 TEXTFIELD_WIDTH = 80.0f;+ static constexpr f32 SPACING = 8.0f;+};++} // namespace esengine::editordiff --git a/src/esengine/editor/property/editors/Vector3Editor.cpp b/src/esengine/editor/property/editors/Vector3Editor.cppnew file mode 100644index 000000000..8b55554e5--- /dev/null+++ b/src/esengine/editor/property/editors/Vector3Editor.cpp@@ -0,0 +1,225 @@+/**+ * @file Vector3Editor.cpp+ * @brief Vector3Editor implementation+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */++#include "Vector3Editor.hpp"+#include "../../command/PropertyCommand.hpp"+#include "../../../ui/UIContext.hpp"+#include "../../../ui/rendering/UIBatchRenderer.hpp"+#include "../../../events/Sink.hpp"++namespace esengine::editor {++// =============================================================================+// Constructor+// =============================================================================++Vector3Editor::Vector3Editor(const ui::WidgetId& id, const std::string& propertyName)+ : PropertyEditor(id, propertyName) {++ if (showLabel_) {+ auto mainLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_label"));+ mainLabelWidget->setText(label_);+ mainLabel_ = mainLabelWidget.get();+ addChild(std::move(mainLabelWidget));+ }++ auto xLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_x_label"));+ xLabelWidget->setText("X");+ xLabel_ = xLabelWidget.get();+ addChild(std::move(xLabelWidget));++ auto xEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_x"), "x");+ xEditorWidget->setShowLabel(false);+ xEditor_ = xEditorWidget.get();+ addChild(std::move(xEditorWidget));++ auto yLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_y_label"));+ yLabelWidget->setText("Y");+ yLabel_ = yLabelWidget.get();+ addChild(std::move(yLabelWidget));++ auto yEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_y"), "y");+ yEditorWidget->setShowLabel(false);+ yEditor_ = yEditorWidget.get();+ addChild(std::move(yEditorWidget));++ auto zLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_z_label"));+ zLabelWidget->setText("Z");+ zLabel_ = zLabelWidget.get();+ addChild(std::move(zLabelWidget));++ auto zEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_z"), "z");+ zEditorWidget->setShowLabel(false);+ zEditor_ = zEditorWidget.get();+ addChild(std::move(zEditorWidget));++ sink(xEditor_->onValueChanged).connect(+ [this](const std::any&) { onComponentChanged(); }+ );+ sink(yEditor_->onValueChanged).connect(+ [this](const std::any&) { onComponentChanged(); }+ );+ sink(zEditor_->onValueChanged).connect(+ [this](const std::any&) { onComponentChanged(); }+ );+}++// =============================================================================+// PropertyEditor Interface+// =============================================================================++void Vector3Editor::setValue(const std::any& value) {+ try {+ glm::vec3 newValue = std::any_cast<glm::vec3>(value);+ if (value_ == newValue) {+ return;+ }++ value_ = newValue;++ updatingFromValue_ = true;+ xEditor_->setValue(value_.x);+ yEditor_->setValue(value_.y);+ zEditor_->setValue(value_.z);+ updatingFromValue_ = false;+ } catch (const std::bad_any_cast&) {+ }+}++std::any Vector3Editor::getValue() const {+ return value_;+}++// =============================================================================+// Widget Interface+// =============================================================================++glm::vec2 Vector3Editor::measure(f32 availableWidth, f32 availableHeight) {+ f32 width = 0.0f;+ f32 height = 20.0f;++ if (mainLabel_ && showLabel_) {+ width += MAIN_LABEL_WIDTH + SPACING;+ }++ width += COMPONENT_LABEL_WIDTH + SPACING + FLOAT_EDITOR_WIDTH + SPACING;+ width += COMPONENT_LABEL_WIDTH + SPACING + FLOAT_EDITOR_WIDTH + SPACING;+ width += COMPONENT_LABEL_WIDTH + SPACING + FLOAT_EDITOR_WIDTH;++ const ui::SizeConstraints& constraints = getConstraints();+ width = glm::clamp(width, constraints.minWidth, constraints.maxWidth);+ height = glm::clamp(height, constraints.minHeight, constraints.maxHeight);++ return glm::vec2(width, height);+}++void Vector3Editor::render(ui::UIBatchRenderer& renderer) {+ const ui::Rect& bounds = getBounds();+ f32 x = bounds.x;++ if (mainLabel_ && showLabel_) {+ ui::Rect labelBounds{x, bounds.y, MAIN_LABEL_WIDTH, bounds.height};+ mainLabel_->layout(labelBounds);+ mainLabel_->renderTree(renderer);+ x += MAIN_LABEL_WIDTH + SPACING;+ }++ if (xLabel_) {+ ui::Rect labelBounds{x, bounds.y, COMPONENT_LABEL_WIDTH, bounds.height};+ xLabel_->layout(labelBounds);+ xLabel_->renderTree(renderer);+ x += COMPONENT_LABEL_WIDTH + SPACING;+ }++ if (xEditor_) {+ ui::Rect editorBounds{x, bounds.y, FLOAT_EDITOR_WIDTH, bounds.height};+ xEditor_->layout(editorBounds);+ xEditor_->renderTree(renderer);+ x += FLOAT_EDITOR_WIDTH + SPACING;+ }++ if (yLabel_) {+ ui::Rect labelBounds{x, bounds.y, COMPONENT_LABEL_WIDTH, bounds.height};+ yLabel_->layout(labelBounds);+ yLabel_->renderTree(renderer);+ x += COMPONENT_LABEL_WIDTH + SPACING;+ }++ if (yEditor_) {+ ui::Rect editorBounds{x, bounds.y, FLOAT_EDITOR_WIDTH, bounds.height};+ yEditor_->layout(editorBounds);+ yEditor_->renderTree(renderer);+ x += FLOAT_EDITOR_WIDTH + SPACING;+ }++ if (zLabel_) {+ ui::Rect labelBounds{x, bounds.y, COMPONENT_LABEL_WIDTH, bounds.height};+ zLabel_->layout(labelBounds);+ zLabel_->renderTree(renderer);+ x += COMPONENT_LABEL_WIDTH + SPACING;+ }++ if (zEditor_) {+ ui::Rect editorBounds{x, bounds.y, FLOAT_EDITOR_WIDTH, bounds.height};+ zEditor_->layout(editorBounds);+ zEditor_->renderTree(renderer);+ }+}++// =============================================================================+// Protected Methods+// =============================================================================++Unique<Command> Vector3Editor::createCommand(const std::any& oldValue,+ const std::any& newValue) {+ try {+ glm::vec3 oldVec = std::any_cast<glm::vec3>(oldValue);+ glm::vec3 newVec = std::any_cast<glm::vec3>(newValue);++ return makeUnique<LambdaCommand>(+ "Modify " + propertyName_,+ [this, newVec]() {+ setValue(newVec);+ return CommandResult::Success;+ },+ [this, oldVec]() {+ setValue(oldVec);+ }+ );+ } catch (const std::bad_any_cast&) {+ return nullptr;+ }+}++// =============================================================================+// Private Methods+// =============================================================================++void Vector3Editor::onComponentChanged() {+ if (updatingFromValue_) {+ return;+ }++ glm::vec3 oldValue = value_;++ try {+ value_.x = std::any_cast<f32>(xEditor_->getValue());+ value_.y = std::any_cast<f32>(yEditor_->getValue());+ value_.z = std::any_cast<f32>(zEditor_->getValue());++ if (oldValue != value_) {+ notifyValueChanged(oldValue, value_);+ }+ } catch (const std::bad_any_cast&) {+ }+}++} // namespace esengine::editordiff --git a/src/esengine/editor/property/editors/Vector3Editor.hpp b/src/esengine/editor/property/editors/Vector3Editor.hppnew file mode 100644index 000000000..e8920db46--- /dev/null+++ b/src/esengine/editor/property/editors/Vector3Editor.hpp@@ -0,0 +1,95 @@+/**+ * @file Vector3Editor.hpp+ * @brief Property editor for 3D vector values+ * @details Combines three FloatEditors (X, Y, Z) for editing glm::vec3.+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */+#pragma once++// =============================================================================+// Includes+// =============================================================================++#include "../PropertyEditor.hpp"+#include "FloatEditor.hpp"+#include "../../../ui/widgets/Label.hpp"++#include <glm/glm.hpp>++namespace esengine::editor {++// =============================================================================+// Vector3Editor Class+// =============================================================================++/**+ * @brief Property editor for glm::vec3 values+ *+ * @details Renders three FloatEditors for X, Y, Z components with labels.+ * Creates LambdaCommand for undo/redo support.+ *+ * @code+ * auto editor = makeUnique<Vector3Editor>(WidgetId("position"), "Position");+ * editor->setValue(glm::vec3(1.0f, 2.0f, 3.0f));+ * editor->onValueChanged.connect([](const std::any& value) {+ * glm::vec3 pos = std::any_cast<glm::vec3>(value);+ * ES_LOG_INFO("Position: ({}, {}, {})", pos.x, pos.y, pos.z);+ * });+ * @endcode+ */+class Vector3Editor : public PropertyEditor {+public:+ /**+ * @brief Constructs a Vector3 editor+ * @param id Unique widget identifier+ * @param propertyName Name of the property being edited+ */+ explicit Vector3Editor(const ui::WidgetId& id, const std::string& propertyName);++ ~Vector3Editor() override = default;++ // =========================================================================+ // PropertyEditor Interface+ // =========================================================================++ void setValue(const std::any& value) override;+ std::any getValue() const override;++ // =========================================================================+ // Widget Interface+ // =========================================================================++ glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;+ void render(ui::UIBatchRenderer& renderer) override;++protected:+ Unique<Command> createCommand(const std::any& oldValue,+ const std::any& newValue) override;++private:+ void onComponentChanged();++ glm::vec3 value_{0.0f};+ bool updatingFromValue_ = false;++ ui::Label* mainLabel_ = nullptr;+ ui::Label* xLabel_ = nullptr;+ ui::Label* yLabel_ = nullptr;+ ui::Label* zLabel_ = nullptr;++ FloatEditor* xEditor_ = nullptr;+ FloatEditor* yEditor_ = nullptr;+ FloatEditor* zEditor_ = nullptr;++ static constexpr f32 MAIN_LABEL_WIDTH = 60.0f;+ static constexpr f32 COMPONENT_LABEL_WIDTH = 12.0f;+ static constexpr f32 FLOAT_EDITOR_WIDTH = 60.0f;+ static constexpr f32 SPACING = 4.0f;+};++} // namespace esengine::editor