Several events per trigger, built-in stop and done events
A trigger holds a list of events (Frame Properties lists them like sounds); the first stays its EventId, the rest are <Event Id> children in the editor's copy, and the Isaac warning counts the dropped ones. In extended documents, stop and done are offered as built-in events: listed in italics at the top of Events, locked from renaming, and added to the file when a trigger first uses one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4375844c84
commit
b31a28ebe9
19 files changed
+195
-101
No files matched your search
@@ -5,6 +5,7 @@
|
||||
#include "util/imgui/input.hpp"
|
||||
#include "util/imgui/layout.hpp"
|
||||
|
||||
using namespace anm2ed::resource;
|
||||
using namespace anm2ed::types;
|
||||
|
||||
namespace anm2ed::imgui
|
||||
@@ -231,9 +232,10 @@ 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, [selection]() { return selection.size() == 1; },
|
||||
ACTION_RENAME, [=]() { return selection.size() == 1 && !is_built_in(*selection.begin()); },
|
||||
[&state, selection]() { state.newId = *selection.begin(); });
|
||||
actions.add(
|
||||
ACTION_ADD, {},
|
||||
@@ -279,10 +281,31 @@ namespace anm2ed::imgui
|
||||
});
|
||||
});
|
||||
},
|
||||
.tooltip_draw = [&](int id)
|
||||
{ item_tooltip_draw(resources, model::item_get(events, id)->name, id); }};
|
||||
.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);
|
||||
list_panel_draw(panel, actions, {{ACTION_ADD, ACTION_REMOVE_UNUSED}},
|
||||
[&]() { content_list_draw(panel, SelectionKind::EVENTS, item_ids_get(events), rows); });
|
||||
[&]()
|
||||
{
|
||||
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);
|
||||
});
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user