editor: add typed light hierarchy submenu
This commit is contained in:
@@ -141,8 +141,16 @@ inline ActionBinding MakeCreateCameraEntityAction() {
|
|||||||
return MakeAction("Camera");
|
return MakeAction("Camera");
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ActionBinding MakeCreateLightEntityAction() {
|
inline ActionBinding MakeCreateDirectionalLightEntityAction() {
|
||||||
return MakeAction("Light");
|
return MakeAction("Directional Light");
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ActionBinding MakeCreatePointLightEntityAction() {
|
||||||
|
return MakeAction("Point Light");
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ActionBinding MakeCreateSpotLightEntityAction() {
|
||||||
|
return MakeAction("Spot Light");
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ActionBinding MakeCreateCubeEntityAction() {
|
inline ActionBinding MakeCreateCubeEntityAction() {
|
||||||
|
|||||||
@@ -180,6 +180,18 @@ inline void DrawHierarchyCreateActions(IEditorContext& context, ::XCEngine::Comp
|
|||||||
std::to_string(created ? created->GetID() : 0));
|
std::to_string(created ? created->GetID() : 0));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const auto drawTypedLightCreateAction = [&](
|
||||||
|
const ActionBinding& action,
|
||||||
|
const char* label,
|
||||||
|
auto&& createLight) {
|
||||||
|
DrawMenuAction(action, [&]() {
|
||||||
|
TraceHierarchyPopup(std::string("Hierarchy create clicked: ") + label);
|
||||||
|
auto* created = createLight();
|
||||||
|
TraceHierarchyPopup(
|
||||||
|
std::string("Hierarchy create result: ") + label + ", createdId=" +
|
||||||
|
std::to_string(created ? created->GetID() : 0));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
DrawMenuAction(MakeCreateEmptyEntityAction(), [&]() {
|
DrawMenuAction(MakeCreateEmptyEntityAction(), [&]() {
|
||||||
TraceHierarchyPopup("Hierarchy create clicked: Empty Object");
|
TraceHierarchyPopup("Hierarchy create clicked: Empty Object");
|
||||||
@@ -198,6 +210,21 @@ inline void DrawHierarchyCreateActions(IEditorContext& context, ::XCEngine::Comp
|
|||||||
drawPrimitiveCreateAction(MakeCreateQuadEntityAction(), ::XCEngine::Resources::BuiltinPrimitiveType::Quad);
|
drawPrimitiveCreateAction(MakeCreateQuadEntityAction(), ::XCEngine::Resources::BuiltinPrimitiveType::Quad);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
UI::DrawContextSubmenu("Light", [&]() {
|
||||||
|
drawTypedLightCreateAction(
|
||||||
|
MakeCreateDirectionalLightEntityAction(),
|
||||||
|
"Directional Light",
|
||||||
|
[&]() { return Commands::CreateDirectionalLightEntity(context, parent); });
|
||||||
|
drawTypedLightCreateAction(
|
||||||
|
MakeCreatePointLightEntityAction(),
|
||||||
|
"Point Light",
|
||||||
|
[&]() { return Commands::CreatePointLightEntity(context, parent); });
|
||||||
|
drawTypedLightCreateAction(
|
||||||
|
MakeCreateSpotLightEntityAction(),
|
||||||
|
"Spot Light",
|
||||||
|
[&]() { return Commands::CreateSpotLightEntity(context, parent); });
|
||||||
|
});
|
||||||
|
|
||||||
DrawMenuSeparator();
|
DrawMenuSeparator();
|
||||||
DrawMenuAction(MakeCreateCameraEntityAction(), [&]() {
|
DrawMenuAction(MakeCreateCameraEntityAction(), [&]() {
|
||||||
TraceHierarchyPopup("Hierarchy create clicked: Camera");
|
TraceHierarchyPopup("Hierarchy create clicked: Camera");
|
||||||
@@ -206,13 +233,6 @@ inline void DrawHierarchyCreateActions(IEditorContext& context, ::XCEngine::Comp
|
|||||||
std::string("Hierarchy create result: Camera, createdId=") +
|
std::string("Hierarchy create result: Camera, createdId=") +
|
||||||
std::to_string(created ? created->GetID() : 0));
|
std::to_string(created ? created->GetID() : 0));
|
||||||
});
|
});
|
||||||
DrawMenuAction(MakeCreateLightEntityAction(), [&]() {
|
|
||||||
TraceHierarchyPopup("Hierarchy create clicked: Light");
|
|
||||||
auto* created = Commands::CreateLightEntity(context, parent);
|
|
||||||
TraceHierarchyPopup(
|
|
||||||
std::string("Hierarchy create result: Light, createdId=") +
|
|
||||||
std::to_string(created ? created->GetID() : 0));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void HandleHierarchyItemContextRequest(
|
inline void HandleHierarchyItemContextRequest(
|
||||||
|
|||||||
Reference in New Issue
Block a user