mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
refactor video file create and save
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
+3
-17
@@ -14,6 +14,7 @@ from scripts.xyz_grid_classes import axis_options, AxisOption, SharedSettingsSta
|
||||
from scripts.xyz_grid_draw import draw_xyz_grid # pylint: disable=no-name-in-module
|
||||
from modules import shared, errors, scripts, images, processing
|
||||
from modules.ui_components import ToolButton
|
||||
from modules.ui_sections import create_video_inputs
|
||||
import modules.ui_symbols as symbols
|
||||
|
||||
|
||||
@@ -70,23 +71,8 @@ class Script(scripts.Script):
|
||||
create_video = gr.Checkbox(label='Create video', value=False, elem_id=self.elem_id("xyz_create_video"), container=False)
|
||||
|
||||
with gr.Row(visible=False) as ui_video:
|
||||
def video_type_change(video_type):
|
||||
return [
|
||||
gr.update(visible=video_type != 'None'),
|
||||
gr.update(visible=video_type == 'GIF' or video_type == 'PNG'),
|
||||
gr.update(visible=video_type == 'MP4'),
|
||||
gr.update(visible=video_type == 'MP4'),
|
||||
]
|
||||
|
||||
with gr.Column():
|
||||
video_type = gr.Dropdown(label='Video type', choices=['None', 'GIF', 'PNG', 'MP4'], value='None')
|
||||
with gr.Column():
|
||||
video_duration = gr.Slider(label='Duration', minimum=0.25, maximum=300, step=0.25, value=2, visible=False)
|
||||
video_loop = gr.Checkbox(label='Loop', value=True, visible=False, elem_id="control_video_loop")
|
||||
video_pad = gr.Slider(label='Pad frames', minimum=0, maximum=24, step=1, value=1, visible=False)
|
||||
video_interpolate = gr.Slider(label='Interpolate frames', minimum=0, maximum=24, step=1, value=0, visible=False)
|
||||
video_type.change(fn=video_type_change, inputs=[video_type], outputs=[video_duration, video_loop, video_pad, video_interpolate])
|
||||
create_video.change(fn=lambda x: gr.update(visible=x), inputs=[create_video], outputs=[ui_video])
|
||||
video_type, video_duration, video_loop, video_pad, video_interpolate = create_video_inputs()
|
||||
create_video.change(fn=lambda x: gr.update(visible=x), inputs=[create_video], outputs=[ui_video])
|
||||
|
||||
with gr.Row():
|
||||
margin_size = gr.Slider(label="Grid margins", minimum=0, maximum=500, value=0, step=2, elem_id=self.elem_id("margin_size"))
|
||||
|
||||
Reference in New Issue
Block a user