Fall back to focused tab when getReaperParent(3) is null

REAPER may not expose the parent project pointer during plugin creation/setState, so the instrument would silently resolve no sample roots. Only that null-parent case now falls back to EnumProjects(-1); a resolved-but-unlisted or unsaved project still resolves nothing.
This commit is contained in:
2026-09-25 14:59:07 -04:00
parent 0976ea13a8
commit cb6b63cc88
6 changed files with 62 additions and 24 deletions
+5 -3
View File
@@ -6,10 +6,12 @@
namespace reasampler::instrument::map {
std::string ownProjectDir(const void* own, const std::vector<ProjectTab>& open) {
if (!own) return {};
std::string ownProjectDir(const void* own, const std::vector<ProjectTab>& open,
const void* activeFallback) {
const void* target = own ? own : activeFallback;
if (!target) return {};
for (const ProjectTab& tab : open) {
if (tab.project == own) return capture::projectDirOfRpp(tab.rppPath);
if (tab.project == target) return capture::projectDirOfRpp(tab.rppPath);
}
return {};
}