Skip to content

Commit

Permalink
Fade master - Zero Arguments Dialog (#15)
Browse files Browse the repository at this point in the history
* May now omit "Page" or "Sequence" Argument
* Added Dialog for no arguments
* Better input checking
  • Loading branch information
hossimo authored May 17, 2020
1 parent db8a49b commit cc8b73e
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Download the latest release [here](https://github.com/hossimo/GMA3Plugins/releas
* [Copy Screenshots 1.0.0.3](https://github.com/hossimo/GMA3Plugins/tree/master/grandMA3/shared/resource/lib_plugins/Copy%20Screenshots)
* [Assign AutoStart Fix 1.0.0.3](https://github.com/hossimo/GMA3Plugins/tree/master/grandMA3/shared/resource/lib_plugins/Assign%20AutoStart%20Fix)
* [Rem Dim 1.1.0.1](https://github.com/hossimo/GMA3Plugins/tree/master/grandMA3/shared/resource/lib_plugins/Rem%20Dim)
* [Fade Master 1.1.0.1](https://github.com/hossimo/GMA3Plugins/tree/master/grandMA3/shared/resource/lib_plugins/Fade%20Master)
* [Fade Master 1.1.0.2](https://github.com/hossimo/GMA3Plugins/tree/master/grandMA3/shared/resource/lib_plugins/Fade%20Master)

### Source not released
* [Kinetic Set 1.0.0.1](https://github.com/hossimo/GMA3Plugins/tree/master/grandMA3/shared/resource/lib_plugins/KineticSet)
Expand Down
128 changes: 112 additions & 16 deletions grandMA3/shared/resource/lib_plugins/Fade Master.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ local my_handle = select(4,...);
local function Main (display_handle, argument)
local arguments = Drt.split(argument, ",")
local tick = 1/30 -- updates / second
local MAXTIME = 3600.0 -- the max number of seconds
local MAXPOOL = 9999 -- the max number of pool items
local op = "" -- the object we are operating on
local destPage -- the page asked for
local destExec -- the executor on the page
Expand All @@ -56,31 +58,125 @@ local function Main (display_handle, argument)
local v = UserVars()
local gVarName = ""

-- Grab inputs based on the number of arguments
-- we will validate them later.
if argument == nil then
-- ask through dialog
local messageBoxInputs = {
"Page.Exec # or\nSequence #",
"Level (%)",
"Time (S)"
}

local messageBoxOptions = {
title="Fade Master Options",
message="",
commands = {
{value=0, name="Cancel"},
{value=1, name="OK"}
},
inputs = {
{name=messageBoxInputs[1], vkPlugin="TextInputNumOnlyRange"},
{name=messageBoxInputs[2], vkPlugin="TextInputNumOnlyRange"},
{name=messageBoxInputs[3], vkPlugin="TextInputNumOnlyRange"}
}
}
local result = MessageBox(messageBoxOptions)
if result.result == 0 then
return
end

local x = Drt.split(result.inputs[messageBoxInputs[1]], ".")
if #x == 1 then
op = "Sequence"
destSeq = tonumber(x[1])
elseif #x == 2 then
op = "Page"
destPage = tonumber(x[1])
destExec = tonumber(x[2])
else
ErrPrintf("Incorrect Sequence/Page Identifier")
return
end

faderEnd = result.inputs[messageBoxInputs[2]]
faderTime = result.inputs[messageBoxInputs[3]]

elseif #arguments == 3 then
-- [1]page/seq [2]level [3]time
faderEnd = tonumber(arguments[2])
faderTime = tonumber(arguments[3])

if argument == nil or #arguments ~= 4 then
local x = Drt.split(arguments[1], ".")
if #x == 1 then
op = "Sequence"
destSeq = tonumber(x[1])
elseif #x == 2 then
op = "Page"
destPage = tonumber(x[1])
destExec = tonumber(x[2])
else
ErrPrintf("Incorrect Sequence/Page Identifier")
return
end
elseif #arguments == 4 then
-- [1]"Page"/"Seq" [2]page/seqID [3]level [4]time
faderEnd = tonumber(arguments[3])
faderTime = tonumber(arguments[4])

if string.lower(arguments[1]):sub(1, 3) == "seq" then -- Operate on a Sequence
op = "Sequence"
destSeq = tonumber(arguments[2])
elseif string.lower(arguments[1]):sub(1, 3) == "pag" then -- Operate on a Page
op = "Page"
local x = Drt.split(arguments[2], ".")
if #x == 2 then
destPage = tonumber(x[1])
destExec = tonumber(x[2])
else
ErrPrintf("Incorrect Page Identifier; Page.Ecexutor")
return
end
end
else
ErrPrintf("Incorrect number of arguments")
ErrPrintf("Plugin \"Fade Master\" \"<Page|Sequence>, <Page#.Executor# | Sequence#>, <Level>, <Seconds> \"")
return
end

faderEnd = Drt.clamp(tonumber(arguments[3]), 0.0, 100.0)
faderTime = Drt.clamp(tonumber(arguments[4]), 0.0, 3600.0)

if string.lower(arguments[1]):sub(1, 3) == "seq" then -- Operate on a Sequence
op = "Sequence"
destSeq = tonumber(arguments[2])
elseif string.lower(arguments[1]):sub(1, 3) == "pag" then -- Operate on a Page
op = "Page"
local x = Drt.split(arguments[2], ".")
if #x == 2 then
destPage = tonumber(x[1])
destExec = tonumber(x[2])
-- check our inputs
if tonumber(faderEnd) == nil then
ErrPrintf("Incorrect level, Enter a value between 0.0 and 100.0")
return
else
faderEnd = Drt.clamp(tonumber(faderEnd), 0.0, 100.0)
end
if tonumber(faderEnd) == nil then
ErrPrintf("Incorrect time, Enter Seconds between 0.0 and " .. MAXTIME)
return
else
faderTime = Drt.clamp(tonumber(faderTime), 0.0, MAXTIME)
end

if op == "Sequence" then
if destSeq == nil then
Printf("Invalid Page Number, Enter a number between 1 and " .. MAXPOOL)
else
ErrPrintf("Incorrect Page Identifier; Page.Ecexutor")
destSeq = Drt.clamp(destSeq, 1, MAXPOOL)
end
elseif op == "Page" then
if destPage == nil then
Printf("Invalid Sequence Number, Enter a number between 1 and " .. MAXPOOL)
else
destPage = Drt.clamp(destPage, 1, MAXPOOL)
end
if destExec == nil then
Printf("Invalid Executor Number, Enter a Page.Executor, e.g: 1.201")
end
end


-- setup exec and UserVars
if op == "Sequence" then
gVarName = "FM".."S"..destSeq
execObject = DataPool().sequences:Children()[destSeq]
Expand Down Expand Up @@ -122,9 +218,9 @@ local function Main (display_handle, argument)

if faderTime > 0 and math.abs(distance) > 0 then
if op == "Sequence" then
Printf("Running Fade Master on Sequence %d for %d Seconds. To abort fade execute - DelUserVar \"%s\"", destSeq, faderTime, gVarName)
Printf("Running Fade Master on Sequence %d for %d Seconds. To abort - DelUserVar \"%s\"", destSeq, faderTime, gVarName)
elseif op == "Page" then
Printf("Running Fade Master on Page %d.%d for %d Seconds. To abort fade execute - DelUserVar \"%s\"", destPage, destExec, faderTime, gVarName)
Printf("Running Fade Master on Page %d.%d for %d Seconds. To abort - DelUserVar \"%s\"", destPage, destExec, faderTime, gVarName)
end
local interval = (distance * tick)/faderTime
repeat
Expand Down
2 changes: 1 addition & 1 deletion grandMA3/shared/resource/lib_plugins/Fade Master.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<GMA3 DataVersion="1.0.0.3">
<Plugin Name="Fade Master" Author="Hoss" Version="1.1.0.1">
<Plugin Name="Fade Master" Author="Hoss" Version="1.1.0.2">
<ComponentLua Name="Fade Master" FileName="Fade Master.lua" Installed="Yes" LoadOnDemand="Yes" />
<ComponentLua Name="DRT-Utilities" FileName="DRT-Utilities.lua" Installed="Yes" LoadOnDemand="Yes" />
</Plugin>
Expand Down
11 changes: 8 additions & 3 deletions grandMA3/shared/resource/lib_plugins/Fade Master/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Fade Master
*v1.1.0.1*
*v1.1.0.2*
Please note that this will likly break in future version of the console. and to use at your own risk.

![Fade Master Example](../../../../../Images/FadeMaster.gif)
Expand All @@ -9,10 +9,14 @@ Allows you to automate a Executor or Sequence Fader movement over time.
In grandMA 2 you could do `ExecButton 1.1 At 100 Fade 3`

With this plugin you can do:
'Plugin "Fade Master" "Page,1.201,100,3"' Which fade executor 1.201 from its current value to 100% over 3 seconds.
`Plugin "Fade Master" "Page,1.201,100,3"` Which fade executor 1.201 from its current value to 100% over 3 seconds.

You also can do the following:
'Plugin "Fade Master" "Sequence,4,100,3"' Which Sequence 4 from its current value to 100% over 3 seconds. The executor does not even need to be assigned to an executor or an executor with a master.
`Plugin "Fade Master" "Sequence,4,100,3"` Which Sequence 4 from its current value to 100% over 3 seconds. The executor does not even need to be assigned to an executor or an executor with a master.

Added in v1.1.0.2:
* `Plugin "Fade Master"` (without arguments) and a dialog with options will be displayed
* No longer need `Page` or `Sequence` arguments, if you enter a number with a `.` it will be a page and without a sequence.


Additionally, if you have a long running fade that you need to abort you can delete the User Vraiable and the fade will stop.
Expand Down Expand Up @@ -46,3 +50,4 @@ Additionally, if you have a long running fade that you need to abort you can del

### Releases:
- 1.1.0.1 - Inital Release
- 1.1.0.2 - Added no argument dialog, and some additional sanity checking.

6 comments on commit cc8b73e

@priyadersan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THIS NOT WORKNG

@hossimo
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priyadersan From the readme: As of console version 1.6.1.3 the built-in FaderMaster command with Fade keyword is working. for example, to Fade Executor 201 on Page 1 to 100% at 5 seconds you can type: FaderMaster Page 1.201 at 100 Fade 5

@priyadersan
Copy link

@priyadersan priyadersan commented on cc8b73e May 27, 2023 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hossimo
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't understand the question.

@priyadersan
Copy link

@priyadersan priyadersan commented on cc8b73e Jun 8, 2023 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hossimo
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never did release the code to the Kinetic Set plugin for a few reasons:

  • It was on an old version of the desk
  • it just barely worked and I was not happy with the solution
  • it was buggy
  • and MA released MArker Fixtures that does this built in.

Not sure if this is what you were looking for.

Also, if there were any other conversations you would like to have you can use the Discussions pages or perhaps the main MA Forums

Please sign in to comment.