Skip to content

Commit

Permalink
- Fixed flip_only_on_pitch_change feature.
Browse files Browse the repository at this point in the history
- Simplified envelope creation code.
- Made image loading more procedural.
  • Loading branch information
Zly-u committed Mar 11, 2024
1 parent 9b9e979 commit 824851b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 24 deletions.
35 changes: 11 additions & 24 deletions Video/VideoAutoFlipper/Zly_VideoAutoFlipper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,9 @@ local function hsl2rgb(H, S, L, reaper_color)
local r = math.floor((color[1]+m)*255)
local g = math.floor((color[2]+m)*255)
local b = math.floor((color[3]+m)*255)
outColor = r
outColor = (outColor << 8) | g
outColor = (outColor << 8) | b
outColor = r
outColor = (outColor << 8) | g
outColor = (outColor << 8) | b
if reaper_color then
outColor = outColor | 0x1000000
else
Expand All @@ -507,15 +507,10 @@ end

local VAF = {
VP_Presets = {},

params = {

},


preset_names = {},
presets = {},


AddPreset = function(self, name, func)
table.insert(self.preset_names, name)
self.presets[name] = func
Expand Down Expand Up @@ -548,7 +543,7 @@ local VAF = {

--[[
params = {
volumet_to_opcaity = false
volume_to_opcaity = false
add_flips = true
flip_only_on_pitch_change = false
}
Expand Down Expand Up @@ -691,18 +686,9 @@ local GUI = {
UI_Data = {
preview_index = 0,
--------------------------------------------
images_to_load = {
"img_rosn.png",
"Img_rosnBass.png",
"img_jokeguy.png",
"img_sigma.png",
"img_squid.png",
"img_timeOfSigma.png",
"img_who.png",
"img_zenkuru.png",
},
image_binaries = {},
selected_image = "",
image_names = {},
image_binaries = {},
selected_image_binary = nil,
--------------------------------------------
selected_preset = 0,
selected_preset_click = 0,
Expand Down Expand Up @@ -861,14 +847,15 @@ function GUI:Init()
for image_name, image_dir in pairs(GetFilesInDir("images")) do
local image = ImGui.CreateImage(image_dir)
reaper.ImGui_Attach(self.ctx, image)
table.insert(self.UI_Data.image_names, image_name)
self.UI_Data.image_binaries[image_name] = image
end

for _, name in pairs(VAF.preset_names) do
self.UI_Data.presets_string = self.UI_Data.presets_string .. name .. '\0'
end

self.UI_Data.selected_image = self.UI_Data.images_to_load[math.random(1, #self.UI_Data.images_to_load)]
self.UI_Data.selected_image_binary = self.UI_Data.image_binaries[self.UI_Data.image_names[math.random(1, #self.UI_Data.image_names)]]
end


Expand Down Expand Up @@ -908,7 +895,7 @@ function GUI:TAB_Flipper()
local border_col = ImGui.GetStyleColor(self.ctx, ImGui.Col_Border())
ImGui.Image(
self.ctx,
self.UI_Data.image_binaries[self.UI_Data.selected_image],
self.UI_Data.selected_image_binary,
image_size, image_size-1, -- pixel perfect to the list
uv_min_x, uv_min_y,
uv_max_x, uv_max_y,
Expand Down
Binary file removed Video/VideoAutoFlipper/images/Img_rosnBass.png
Binary file not shown.
Binary file removed Video/VideoAutoFlipper/images/img_rosn.png
Binary file not shown.

0 comments on commit 824851b

Please sign in to comment.