Old 01-17-2021, 03:19 PM   #1
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 2,230
Default make single item script loop through multiple items?

spk77 has this script:

Create take vol envelope from active take in other takes in item.eel

can this be made to work on multiple items? this version throws an error if more than one item is selected. i'm looking for something that will loop through all selected items and perform this action.

spk77's code follows.

thanks,
babag

Code:
/*
   * ReaScript Name: Create take volume envelope from active take to other takes in item
   * EEL script for Cockos REAPER
   * Author: spk77
   * Author URI: http://forum.cockos.com/member.php?u=49553
   * Licence: GPL v3
   * Version: 1.0
   */
  
  // Paste take volume envelope from active take in selected item to other takes in item 
// EEL script by spk77 16.7.2014
//
// Version: 0.2014.7.16

function paste_take_vol_env()
(
  CountSelectedMediaItems(0) == 1 && (source_take = GetActiveTake(GetSelectedMediaItem(0, 0))) ? (
    item = GetSelectedMediaItem(0, 0);
    (source_vol_env = GetTakeEnvelopeByName(source_take, "Volume")) ? (
      GetSetEnvelopeState(source_vol_env, #source_vol_env);
      
      Undo_BeginBlock();
      i = 0;
      loop(CountTakes(item),
        source_vol_env && source_take != GetTake(item, i) ? (
          SetActiveTake(GetTake(item, i));
          (env = GetTakeEnvelopeByName(GetTake(item, i), "Volume")) ? (
            GetSetEnvelopeState(env, #source_vol_env);
          ) : (
            Main_OnCommand(NamedCommandLookup("_S&M_TAKEENV1"), 0);
            (env = GetTakeEnvelopeByName(GetTake(item, i), "Volume")) ? (
              GetSetEnvelopeState(env, #source_vol_env);
            );
          );
        );
        i += 1;
      );
      SetActiveTake(source_take);
      Undo_EndBlock("Paste take vol envelope", -1);
    );
  ) : (
    ShowConsoleMsg("Please select only one (non-empty) item.");
  );
);

paste_take_vol_env();

Last edited by babag; 01-17-2021 at 03:26 PM.
babag is offline   Reply With Quote
Old 01-18-2021, 06:11 AM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

spk77 has a copy items properties script GUI which has copy then paste item envelope if I remember well.
X-Raym is offline   Reply With Quote
Old 01-18-2021, 12:20 PM   #3
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 2,230
Default

thanks, x.

yes. that was actually something i requested and we worked on developing a long time ago. an idea based on something i used to use a lot in very old versions of final cut pro. i'll see if it works in this context. the way i'd envisioned that script was to copy an element from one item to many different items. what the script above does is to copy the volume envelope to another take in the SAME item. maybe it works, though. will try and report back.

edit:
nope. will not copy from one take to another within the same item. not here, anyway.

thanks again,
babag

Last edited by babag; 01-18-2021 at 12:26 PM.
babag is offline   Reply With Quote
Old 01-18-2021, 01:00 PM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Does that looks good to you ?


X-Raym is offline   Reply With Quote
Old 01-18-2021, 02:04 PM   #5
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 2,230
Default

generally, yes but it's a little hard to tell as it looks like the same item duplicated with the same take envelope.

in the workflow i'm using the two items pictured would have different envelopes in each item. the script would copy the item1/take1 envelope to item1/take2 and the item2/take1 envelope to item2/take2.

in the licecap it's hard to tell if that's what's happening or if the item1/take1 envelope is being copied to take2 of both items. i'm guessing it's doing what i was looking for. i just can't quite tell from the capture.

thanks,
babag
babag is offline   Reply With Quote
Old 01-19-2021, 01:24 AM   #6
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Quote:
the script would copy the item1/take1 envelope to item1/take2 and the item2/take1 envelope to item2/take2.
This is precisely what the script does, as it is just a multi selected items port of the original one ! 😎
X-Raym is offline   Reply With Quote
Old 01-19-2021, 02:28 AM   #7
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

So I have updated the script,
this required quite some changes:


https://github.com/ReaTeam/ReaScript...ea41149296022a


(not just a single line editing maintenance)


Idealy, the other spk77 script from the same set would be updated with this new code base.



Best,
X-Raym is offline   Reply With Quote
Old 01-19-2021, 05:18 PM   #8
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 2,230
Default

wow! this sounds great, x!

it's hard to see in the images below (sorry for the color scheme) but here's what happens when i run the script.

first image shows the item state BEFORE running the modded version of the script. notice the "V" shaped envelopes on take 1 and no envelope on take 2.

second image shows the item state AFTER running the script. notice the envelopes in take 1 have been removed and occasional, seemingly random, points have been added. these changes also appear in take 2 for each item.

original state of items:


after running v1.1:


thanks for the work on this and, again, sorry for the bad color scheme. also, if this can be made to work, i'd be happy to try to copy the process to the other variants, like pan, mute, etc. of this script. not sure i'm up to it but happy to try.

babag

Last edited by babag; 01-19-2021 at 05:30 PM.
babag is offline   Reply With Quote
Old 01-19-2021, 10:05 PM   #9
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 2,230
Default

i believe what the script is actually doing is copying the envelope from item1/take1 to ALL selected items and ALL takes in those items.

confirmed. just tried making a specifically shaped envelope in item1/take1 and ran the script. it copied that very identifiable envelope to ALL items and ALL takes.

it would appear that there might be something amiss in the item counting: when it should be getting the take1 envelope from item2 (and 3, and, 4, etc), it is still thinking of item1.

thanks,
babag
babag is offline   Reply With Quote
Old 01-20-2021, 03:06 AM   #10
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Can you try v1.1.1 ?


It is not a loop error, but surely a deprecated function usage.


https://github.com/ReaTeam/ReaScript...3149bea4c1c5bc
X-Raym is offline   Reply With Quote
Old 01-20-2021, 11:44 AM   #11
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 2,230
Default

that's it! thanks so much!

edit:
not to be difficult but just wondering about this last line near the end:
Code:
ShowConsoleMsg("Please select only one (non-empty) item.");
i'm sure it has nothing to do with actual functionality of the script but it does seem wrong now. am i right about that?

Last edited by babag; 01-20-2021 at 11:50 AM.
babag is offline   Reply With Quote
Old 01-20-2021, 12:48 PM   #12
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

I will surely remive it completly, opening a console for that isnt needed.
X-Raym 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 01:52 PM.


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