Toggle Structure and Get a Legend

This is a place for people to chare the custom macros they have written.

Moderator: Moderators

User avatar
kimwida
Posts: 250
Joined: 05 Aug 2016, 16:26
Location: Seoul

Toggle Structure and Get a Legend

Postby kimwida » 28 Feb 2018, 16:21

Hi!
I tried to reduce two buttons action to one button. For example to change two key profiles I need two macro buttons. But I want to do it just one button like toggle button.
So I tried to get a legend from a dummy chase and compare it with conditional strings. I searched Titan 10.1 API page but I could't find a method or property getting a legend from a handle. And I tried toggle structure but when I load Titan, it strip my codes. Any advice welcome!!

Code: Select all

<step condition="Math.IsEqual("Get a Legend from a handle","Latch")">
   Profiles.AssignHandleProfile(handle:"chaseHandleUN=16035",493461)
   Handles.SetSourceHandleFromHandle("chaseHandleUN=1292")
   ActionScript.SetProperty("Handles.PendingLegend", "Instant")
   Handles.SetLegend()
   Handles.ClearSelection()
</step>
<step condition="Math.IsEqual("Get a Legend from a handle","Instant")">
   Profiles.AssignHandleProfile(handle:"chaseHandleUN=16035",493448)
   Handles.SetSourceHandleFromHandle("chaseHandleUN=1292")
   ActionScript.SetProperty("Handles.PendingLegend", "Latch")
   Handles.SetLegend()
   Handles.ClearSelection()
</step>
icke_siegen
Posts: 1087
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

Re: Toggle Structure and Get a Legend

Postby icke_siegen » 28 Feb 2018, 16:32

Did you copy or did you move the macro? I found that step condition is stripped from copied macros, but moved ones work.
Also, I believe only one instruction per step would be possible.
User avatar
kimwida
Posts: 250
Joined: 05 Aug 2016, 16:26
Location: Seoul

Re: Toggle Structure and Get a Legend

Postby kimwida » 01 Mar 2018, 05:00

Thanks the advice!!!
I made it with your advice!!!
I used playbackspeed of a dummy chase to make a condition instead of using a legend.

Code: Select all

<step pause="0.01">ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", handle:"chaseHandleUN=1049")</step>
<step pause="0.01">Handles.SetSourceHandleFromHandle("chaseHandleUN=1049")</step>
<step>
   {
      if(Math.IsEqual(Playbacks.Editor.Times.PlaybackSpeed, 60.0)) <-- if dummy chase speed is 60 bpm(1 second)
      {
         Profiles.AssignHandleProfile(handle:"chaseHandleUN=19162",493461);  <-- Instant keyprofile
      }
      else
      {
         Profiles.AssignHandleProfile(handle:"chaseHandleUN=19162",493448);  <-- Latch keyprofile
      }
   }
</step>
<step>
   {
      if(Math.IsEqual(Playbacks.Editor.Times.PlaybackSpeed, 60.0))
      {
         ActionScript.SetProperty("Handles.PendingLegend", "Instant");   <-- Set dummy chase legend to show key profile info
      }
      else
      {
         ActionScript.SetProperty("Handles.PendingLegend", "Latch");
      }
   }
</step>
<step>
   {
      if(Math.IsEqual(Playbacks.Editor.Times.PlaybackSpeed, 60.0))
      {
         ActionScript.SetProperty("Playbacks.Editor.Times.PlaybackSpeed", 30.0);  <-- Toggle condition
      }
      else
      {
         ActionScript.SetProperty("Playbacks.Editor.Times.PlaybackSpeed", 60.0);
      }
   }
</step>
<step pause="0.01">Handles.SetLegend()</step>
<step pause="0.01">Handles.ClearSelection()</step>

Who is online

Users browsing this forum: No registered users and 15 guests