Remove built-in stop and done events
Events are plain again: no built-in names offered, locked or listed in the Events window, and the game's copy of a trigger keeps its first event. The list rows' rename lock and event_id_resolve go with them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5f01e8065d
commit
4141c53681
12 files changed
+21
-112
No files matched your search
@@ -161,14 +161,10 @@ namespace anm2ed::imgui
|
||||
ImGui::PushID(i);
|
||||
if (combo_id_mapped("##Choice", &id, choices.ids, choices.labels) && frame)
|
||||
frame_edit(edit_state::COMPLETE, setEdit,
|
||||
[index = (std::size_t)i, id, member](Document& document, model::Frame& frame,
|
||||
model::Track*, const Reference&)
|
||||
[index = (std::size_t)i, id, member](Document&, model::Frame& frame, model::Track*,
|
||||
const Reference&)
|
||||
{
|
||||
auto& ids = frame.*member;
|
||||
if (index >= ids.size()) return;
|
||||
ids[index] = member == &model::Frame::eventIds
|
||||
? edit::event_id_resolve(document.model, id)
|
||||
: id;
|
||||
if (index < (frame.*member).size()) (frame.*member)[index] = id;
|
||||
});
|
||||
ImGui::SetItemTooltip("%s", localize.get(tooltip));
|
||||
ImGui::PopID();
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "util/imgui/input.hpp"
|
||||
#include "util/imgui/layout.hpp"
|
||||
|
||||
using namespace anm2ed::resource;
|
||||
using namespace anm2ed::types;
|
||||
|
||||
namespace anm2ed::imgui
|
||||
@@ -250,10 +249,9 @@ namespace anm2ed::imgui
|
||||
if (ImGui::Begin(localize.get(LABEL_EVENTS_WINDOW), &settings.windowIsEvents))
|
||||
{
|
||||
auto selection = document.selected_ids_get(SelectionKind::EVENTS);
|
||||
auto is_built_in = [&](int id) { return model::is_event_built_in(model::item_get(events, id)->name); };
|
||||
Actions actions{};
|
||||
actions.add(
|
||||
ACTION_RENAME, [=]() { return selection.size() == 1 && !is_built_in(*selection.begin()); },
|
||||
ACTION_RENAME, [selection]() { return selection.size() == 1; },
|
||||
[&state, selection]() { state.newId = *selection.begin(); });
|
||||
actions.add(
|
||||
ACTION_ADD, {},
|
||||
@@ -299,31 +297,10 @@ namespace anm2ed::imgui
|
||||
});
|
||||
});
|
||||
},
|
||||
.is_locked = is_built_in,
|
||||
.font_get = [&](int id) { return is_built_in(id) ? font::ITALICS : font::REGULAR; },
|
||||
.tooltip_draw =
|
||||
[&](int id)
|
||||
{
|
||||
item_tooltip_draw(resources, model::item_get(events, id)->name, id);
|
||||
if (is_built_in(id)) ImGui::TextUnformatted(localize.get(TOOLTIP_EVENT_BUILT_IN));
|
||||
}};
|
||||
// Built-in events come first; an extended document lists the ones it doesn't have yet above them.
|
||||
auto ids = item_ids_get(events);
|
||||
std::ranges::stable_partition(ids, is_built_in);
|
||||
.tooltip_draw = [&](int id)
|
||||
{ item_tooltip_draw(resources, model::item_get(events, id)->name, id); }};
|
||||
list_panel_draw(panel, actions, {{ACTION_ADD, ACTION_REMOVE_UNUSED}},
|
||||
[&]()
|
||||
{
|
||||
ImGui::PushFont(resources.fonts[font::ITALICS].get(), font::SIZE);
|
||||
for (auto name : model::EVENT_BUILT_INS)
|
||||
if (document.model.isExtendedFormat &&
|
||||
std::ranges::find(events, name, &model::Event::name) == events.end())
|
||||
{
|
||||
ImGui::TextDisabled("%s", std::string(name).c_str());
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_EVENT_BUILT_IN));
|
||||
}
|
||||
ImGui::PopFont();
|
||||
content_list_draw(panel, SelectionKind::EVENTS, ids, rows);
|
||||
});
|
||||
[&]() { content_list_draw(panel, SelectionKind::EVENTS, item_ids_get(events), rows); });
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace anm2ed::imgui
|
||||
if (arrowKey == key) ImGui::SetKeyboardFocusHere();
|
||||
|
||||
bool isActivated{};
|
||||
if (rows.rename && !(rows.is_locked && rows.is_locked(key)))
|
||||
if (rows.rename)
|
||||
{
|
||||
if (state.newId == key)
|
||||
{
|
||||
|
||||
@@ -71,7 +71,6 @@ namespace anm2ed::imgui
|
||||
std::function<std::string(int)> label_get{};
|
||||
std::function<std::string(int)> name_get{};
|
||||
std::function<void(int, const std::string&)> rename{};
|
||||
std::function<bool(int)> is_locked{};
|
||||
std::function<bool(int)> is_invalid{};
|
||||
std::function<resource::font::Type(int)> font_get{};
|
||||
std::function<void(int)> tooltip_draw{};
|
||||
|
||||
Reference in new issue
Block a user