visual tools: Add RemoveOverride function

This commit is contained in:
arch1t3cht 2023-01-14 14:16:05 +01:00
parent 8b142a05e5
commit 9cfc72bd83
2 changed files with 15 additions and 0 deletions

View file

@ -527,6 +527,20 @@ void VisualToolBase::SetSelectedOverride(std::string const& tag, std::string con
SetOverride(line, tag, value);
}
void VisualToolBase::RemoveOverride(AssDialogue *line, std::string const& tag) {
if (!line) return;
auto blocks = line->ParseTags();
for (auto ovr : blocks | agi::of_type<AssDialogueBlockOverride>()) {
for (size_t i = 0; i < ovr->Tags.size(); i++) {
if (tag == ovr->Tags[i].Name) {
ovr->Tags.erase(ovr->Tags.begin() + i);
i--;
}
}
}
line->UpdateText(blocks);
}
void VisualToolBase::SetOverride(AssDialogue* line, std::string const& tag, std::string const& value) {
if (!line) return;

View file

@ -130,6 +130,7 @@ protected:
void GetLineClip(AssDialogue *diag, Vector2D &p1, Vector2D &p2, bool &inverse);
std::string GetLineVectorClip(AssDialogue *diag, int &scale, bool &inverse);
void RemoveOverride(AssDialogue *line, std::string const& tag);
void SetOverride(AssDialogue* line, std::string const& tag, std::string const& value);
void SetSelectedOverride(std::string const& tag, std::string const& value);