Hi gurus,
I wrote a script to color regions based on the underlying item's color. Except that sometimes it didn't work even if there were no takes (just an item). It seems the status of an item's default color changes depending on how it was edited or something. So a colored item may have a color value of 0.0 which is default color or none... or something. Anyway... I wrote a silly workaround that seems to satisfy all cases... but wanted to understand why this is the way it is.
Any explanation would be nice. Any ideas?
Here is the relevant piece of code....
Code:
local iRetval, bIsrgnOut, iPosOut, iRgnendOut, sNameOut, iMarkrgnindexnumberOut, iColorOur = reaper.EnumProjectMarkers3(0, region_idx)
if iRetval > 0 then
if reaper.GetMediaItemInfo_Value(item, "I_CUSTOMCOLOR") == 0 then
take_color = reaper.GetMediaItemTakeInfo_Value(take, "I_CUSTOMCOLOR")
-- Msg("take")
else
take_color =reaper.GetMediaItemInfo_Value(item, "I_CUSTOMCOLOR")
-- Msg("item")
end