|
|
|
08-01-2018, 05:46 AM
|
#1
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
Store custom extension data in .RPP project
hello,
Is there a way to store something in the .RPP from a custom reaper extension?
thanks!
oli
|
|
|
08-01-2018, 06:01 AM
|
#2
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Code:
int SetProjExtState(ReaProject* proj, const char* extname, const char* key, const char* value)
Save a key/value pair for a specific extension, to be restored the next time this specific project is loaded.
int GetProjExtState(ReaProject* proj, const char* extname, const char* key, char* valOutNeedBig, int valOutNeedBig_sz)
Get the value previously associated with this extname and key, the last time the project was saved.
There was also some more involved way but I don't remember the specifics at the moment. (A system that can be used handle custom undo states as well as custom project data.)
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
08-01-2018, 06:37 AM
|
#3
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
thanks!
|
|
|
08-01-2018, 06:47 AM
|
#4
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
and is there a way to know when a new project is loaded? I'm doing this in C++
|
|
|
08-01-2018, 07:26 AM
|
#5
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by olilarkin
and is there a way to know when a new project is loaded? I'm doing this in C++
|
edit : wrong answer removed.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Last edited by Xenakios; 08-01-2018 at 12:31 PM.
|
|
|
08-01-2018, 08:32 AM
|
#6
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
There is project_config_extension_t for this purpose.
Code:
#include <reaper_plugin.h>
#include <reaper_plugin_functions.h>
#include <WDL/lineparse.h>
static void BeginLoadProjectState(bool isUndo, struct project_config_extension_t *reg)
{
// called on project load/undo before any (possible) ProcessExtensionLine
}
static bool ProcessExtensionLine(const char *line, ProjectStateContext *ctx, bool isUndo, struct project_config_extension_t *reg)
{
LineParser lp(false);
if(lp.parse(line) || lp.getnumtokens() < 1)
return false;
if(!strcmp(lp.gettoken_str(0), "YOURPLUGIN_SETTING")) {
const char *value = lp.gettoken_str(1);
return true;
}
return false; // if nobody returns true for this setting, REAPER will show a popup
}
static void SaveExtensionConfig(ProjectStateContext *ctx, bool isUndo, struct project_config_extension_t *reg)
{
ctx->AddLine("YOURPLUGIN_SETTING %s", "value");
}
static project_config_extension_t s_projectconfig{
ProcessExtensionLine, SaveExtensionConfig, BeginLoadProjectState
};
YourPlugin::YourPlugin()
{
plugin_register("projectconfig", &s_projectconfig);
}
YourPlugin::~YourPlugin()
{
plugin_register("-projectconfig", &s_projectconfig);
}
Last edited by cfillion; 08-01-2018 at 08:38 AM.
|
|
|
08-01-2018, 09:15 AM
|
#7
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
perfect thanks!
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 10:22 PM.
|