docs: 更新 containers 和 threading 模块文档

- containers: 更新 string 类的多个方法文档
- threading: 更新 mutex 和 task-group 方法文档
This commit is contained in:
2026-03-26 01:59:14 +08:00
parent 8df04c120f
commit 5c3566774b
42 changed files with 714 additions and 96 deletions

View File

@@ -2,12 +2,14 @@
#include "Core/IEditorContext.h"
#include "Core/ISceneManager.h"
#include "Core/ISelectionManager.h"
#include "Core/IUndoManager.h"
#include "Core/EventBus.h"
#include "Core/EditorEvents.h"
#include "ComponentEditors/CameraComponentEditor.h"
#include "ComponentEditors/IComponentEditor.h"
#include "ComponentEditors/LightComponentEditor.h"
#include "ComponentEditors/TransformComponentEditor.h"
#include "Utils/UndoUtils.h"
#include <imgui.h>
#include <string>
@@ -25,6 +27,9 @@ InspectorPanel::~InspectorPanel() {
}
void InspectorPanel::OnSelectionChanged(const SelectionChangedEvent& event) {
if (m_context && m_context->GetUndoManager().HasPendingInteractiveChange()) {
m_context->GetUndoManager().FinalizeInteractiveChange();
}
m_selectedEntityId = event.primarySelection;
}
@@ -90,7 +95,9 @@ void InspectorPanel::RenderGameObject(::XCEngine::Components::GameObject* gameOb
strcpy_s(nameBuffer, gameObject->GetName().c_str());
ImGui::InputText("##Name", nameBuffer, sizeof(nameBuffer));
if (ImGui::IsItemDeactivatedAfterEdit()) {
m_context->GetSceneManager().RenameEntity(gameObject->GetID(), nameBuffer);
UndoUtils::ExecuteSceneCommand(*m_context, "Rename Entity", [&]() {
m_context->GetSceneManager().RenameEntity(gameObject->GetID(), nameBuffer);
});
}
ImGui::SameLine();
@@ -104,6 +111,10 @@ void InspectorPanel::RenderGameObject(::XCEngine::Components::GameObject* gameOb
for (auto* component : components) {
RenderComponent(component, gameObject);
}
if (m_context->GetUndoManager().HasPendingInteractiveChange() && !ImGui::IsAnyItemActive()) {
m_context->GetUndoManager().FinalizeInteractiveChange();
}
}
void InspectorPanel::RenderAddComponentPopup(::XCEngine::Components::GameObject* gameObject) {
@@ -133,8 +144,14 @@ void InspectorPanel::RenderAddComponentPopup(::XCEngine::Components::GameObject*
}
if (ImGui::MenuItem(label.c_str(), nullptr, false, canAdd)) {
if (editor->AddTo(gameObject)) {
m_context->GetSceneManager().MarkSceneDirty();
bool added = false;
UndoUtils::ExecuteSceneCommand(*m_context, std::string("Add ") + editor->GetDisplayName() + " Component", [&]() {
added = editor->AddTo(gameObject) != nullptr;
if (added) {
m_context->GetSceneManager().MarkSceneDirty();
}
});
if (added) {
ImGui::CloseCurrentPopup();
}
}
@@ -183,7 +200,7 @@ void InspectorPanel::RenderComponent(::XCEngine::Components::Component* componen
if (open) {
if (editor) {
if (editor->Render(component)) {
if (editor->Render(component, &m_context->GetUndoManager())) {
m_context->GetSceneManager().MarkSceneDirty();
}
} else {
@@ -201,8 +218,10 @@ void InspectorPanel::RemoveComponentByType(::XCEngine::Components::Component* co
return;
}
gameObject->RemoveComponent(component);
m_context->GetSceneManager().MarkSceneDirty();
UndoUtils::ExecuteSceneCommand(*m_context, std::string("Remove ") + component->GetName() + " Component", [&]() {
gameObject->RemoveComponent(component);
m_context->GetSceneManager().MarkSceneDirty();
});
}
}