mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 00:53:52 +00:00
feat(editor): random rotation, placed object list, quality of life
- Random Rotation checkbox: each placed object gets a random Y rotation (great for natural-looking tree/rock placement without manual tweaking) - Placed Object List: collapsible list in Object panel showing all placed objects with name and position, click to select - Both features reduce repetitive manual work when building dense zones
This commit is contained in:
parent
89312120f4
commit
5df007b7b9
3 changed files with 34 additions and 1 deletions
|
|
@ -463,6 +463,9 @@ void EditorUI::renderObjectPanel(EditorApp& app) {
|
|||
float rot = placer.getPlacementRotationY();
|
||||
if (ImGui::SliderFloat("Y Rotation", &rot, 0.0f, 360.0f, "%.0f deg"))
|
||||
placer.setPlacementRotationY(rot);
|
||||
bool randRot = placer.getRandomRotation();
|
||||
if (ImGui::Checkbox("Random Rotation", &randRot))
|
||||
placer.setRandomRotation(randRot);
|
||||
float scale = placer.getPlacementScale();
|
||||
if (ImGui::SliderFloat("Scale", &scale, 0.1f, 10.0f, "%.2f"))
|
||||
placer.setPlacementScale(scale);
|
||||
|
|
@ -513,6 +516,27 @@ void EditorUI::renderObjectPanel(EditorApp& app) {
|
|||
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Placed: %zu objects", placer.objectCount());
|
||||
if (placer.objectCount() > 0 && ImGui::CollapsingHeader("Object List")) {
|
||||
ImGui::BeginChild("ObjPlacedList", ImVec2(0, 100), true);
|
||||
for (int i = 0; i < static_cast<int>(placer.objectCount()); i++) {
|
||||
auto& o = const_cast<std::vector<PlacedObject>&>(placer.getObjects())[i];
|
||||
std::string disp = o.path;
|
||||
auto sl = disp.rfind('\\');
|
||||
if (sl != std::string::npos) disp = disp.substr(sl + 1);
|
||||
char lbl[128];
|
||||
std::snprintf(lbl, sizeof(lbl), "%s (%.0f,%.0f,%.0f)##obj%d",
|
||||
disp.c_str(), o.position.x, o.position.y, o.position.z, i);
|
||||
if (ImGui::Selectable(lbl, o.selected)) {
|
||||
placer.clearSelection();
|
||||
// Select by creating a ray through the object position
|
||||
rendering::Ray r;
|
||||
r.origin = o.position + glm::vec3(0, 0, 1);
|
||||
r.direction = glm::vec3(0, 0, -1);
|
||||
placer.selectAt(r, 1000.0f);
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
if (auto* sel = placer.getSelected()) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 0.9f, 0.3f, 1));
|
||||
ImGui::Text("Selected: %s", sel->path.c_str());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue