Pixel-Composer/objects/o_dialog_anim_time_scaler/Create_0.gml

37 lines
953 B
Text
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
event_inherited();
#region data
2022-11-03 11:44:49 +01:00
dialog_w = ui(368);
dialog_h = ui(120);
2022-01-13 05:24:03 +01:00
destroy_on_click_out = true;
#endregion
#region scaler
scale_to = ANIMATOR.frames_total;
tb_scale_frame = new textBox(TEXTBOX_INPUT.number, function(to) {
to = toNumber(to);
scale_to = to;
});
2023-01-25 06:49:00 +01:00
b_apply = button(function() {
var fac = scale_to / ANIMATOR.frames_total;
var key = ds_map_find_first(NODE_MAP);
repeat(ds_map_size(NODE_MAP)) {
var n = NODE_MAP[? key];
key = ds_map_find_next(NODE_MAP, key);
if(!n || !n.active) continue;
for(var i = 0; i < ds_list_size(n.inputs); i++) {
var in = n.inputs[| i];
if(!in.animator.is_anim) continue;
for(var j = 0; j < ds_list_size(in.animator.values); j++) {
var t = in.animator.values[| j];
t.time = t.ratio * scale_to;
}
}
}
ANIMATOR.frames_total = scale_to;
instance_destroy();
}).setIcon(THEME.accept, 0, COLORS._main_icon_dark);
2022-01-13 05:24:03 +01:00
#endregion