Old 04-20-2019, 06:03 AM   #1
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 172
Default Which is the best way to store script data in project?

Hi, guys!
I want my script to save its data for each track it works with. For example when I click a track, it recalls height, width of GUI, last edited notes for THIS track, etc..
We can store it in some kind of ".ini" file, but these files won't copy with project if we save it to a new folder, as a new project, with "copy all data" option.
Do tracks, items, projects, effects have some kind of "user chunk", where any data can be stored? If no, what way is the best to save this data, and not loose it when copy, resave project?
kartalex is offline   Reply With Quote
Old 04-20-2019, 06:45 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by kartalex View Post
Hi, guys!
Do tracks, items, projects, effects have some kind of "user chunk", where any data can be stored?
Support for some of that was recently added, but I think you need a prerelease build of Reaper to test those out.

For example, to store per-item custom data :

Code:
local item = reaper.GetSelectedMediaItem(0,0)
reaper.GetSetMediaItemInfo_String(item, "P_EXT:testinfo", "My custom data", true)
GetSetMediaTrackInfo_String and GetSetMediaItemTakeInfo_String (and some others) also support the P_EXT: thing. Per FX custom data isn't at the moment supported.

SetProjExtState etc have existed for a long time to handle project wide script/extension plugin settings.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 04-20-2019, 01:45 PM   #3
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 172
Default

Quote:
Originally Posted by Xenakios View Post
SetProjExtState etc have existed for a long time to handle project wide script/extension plugin settings.
Thanks, I should take a closer look at this function!
kartalex is offline   Reply With Quote
Old 04-20-2019, 02:44 PM   #4
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by kartalex View Post
Thanks, I should take a closer look at this function!
Note that SetProjExtState and the related functions are not that great for dealing with item/take/track etc specific data because they don't take into account if you've deleted or duplicated the objects the custom data is referring to.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 11-25-2021, 10:00 PM   #5
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 2,630
Default

Quote:
Originally Posted by Xenakios View Post
Note that SetProjExtState and the related functions are not that great for dealing with item/take/track etc specific data because they don't take into account if you've deleted or duplicated the objects the custom data is referring to.
And also Project ExtState is outside the Undo History, so any changes made to it are not reverted/restored on undo/redo.
MonkeyBars is offline   Reply With Quote
Old 12-29-2021, 06:56 PM   #6
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 2,630
Default

As of 6.43, Master Track P_EXT has been implemented properly and changes to its values are saved with Undo Points.
MonkeyBars is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.