Skip to content

Instantly share code, notes, and snippets.

@Jip-Hop
Last active July 4, 2019 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Jip-Hop/688253710f25d3a0ff008f908241d1b0 to your computer and use it in GitHub Desktop.
Save Jip-Hop/688253710f25d3a0ff008f908241d1b0 to your computer and use it in GitHub Desktop.
-- Crop mode toggle
-- Toggle between 3x crop mode
require('config')
-- end this script if not eosm
if camera.model_short ~= "EOSM" then
display.notify_box("Script not working on this cam");
msleep(2000);
return
end
-- warnings
while camera.mode ~= MODE.MOVIE do
display.notify_box("enable MOVIE mode");
msleep(1000);
end
function toggle_x3crop()
-- console.show();
local recording = movie.recording;
if recording == true then
display.notify_box("STOPPED RECORDING");
movie.stop();
end
-- crop mode
if menu.get("Crop mode", "x3crop") == "x3crop" then
display.notify_box("DISABLED X3CROP");
menu.set("Crop mode", "x3crop", 0);
else
display.notify_box("ENABLED X3CROP");
menu.set("Crop mode", "x3crop", "x3crop");
end
lv.pause();
lv.start();
if recording == true then
local max_tries = 40
while max_tries > 0 do
max_tries = max_tries - 1
msleep(100)
movie.start();
if(movie.recording == true) then
display.notify_box("RESTARTED RECORDING");
break
end
end
end
end
x3crop_toggle_menu = menu.new
{
parent = "Movie",
name = "x3crop toggle",
help = "Pick a button to toggle x3crop in mv1080.",
value = 0,
submenu =
{
{
select = function(this)
if x3crop_toggle_menu.value == 0 then
x3crop_toggle_menu.value = 1;
else
x3crop_toggle_menu.value = 0;
end
end,
update = function(this)
if x3crop_toggle_menu.value == 0 then
this.name = "Enable";
else
this.name = "Disable";
end
end,
},
{
name = "Button",
choices = { "SET", "INFO", "HALFSHUTTER"},
}
},
update = function(this)
if this.value == 0 then
this.help2 = "Click Enable in submenu to activate.";
return "OFF";
else
this.help2 = ""
return "ON, " .. this.submenu["Button"].value;
end
end,
};
config.create_from_menu(x3crop_toggle_menu)
event.keypress = function(key)
if key == KEY[x3crop_toggle_menu.submenu["Button"].value] and menu.visible == false and x3crop_toggle_menu.value ~= 0 then
task.create(toggle_x3crop);
return false;
end
end
console.hide();
@Jip-Hop
Copy link
Author

Jip-Hop commented Jul 4, 2019

Should now restart movie recording more or less as quick as it can when you toggle x3crop while recording.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment