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:
@@ -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 {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user