Pixel-Composer/objects/o_dialog_anim_time_scaler/Create_0.gml

37 lines
1,016 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
2023-07-06 19:49:16 +02:00
scale_to = PROJECT.animator.frames_total;
2022-01-13 05:24:03 +01:00
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() {
2023-07-06 19:49:16 +02:00
var fac = scale_to / PROJECT.animator.frames_total;
var key = ds_map_find_first(PROJECT.nodeMap);
repeat(ds_map_size(PROJECT.nodeMap)) {
2023-07-25 20:12:40 +02:00
var _node = PROJECT.nodeMap[? key];
2023-07-06 19:49:16 +02:00
key = ds_map_find_next(PROJECT.nodeMap, key);
2023-07-25 20:12:40 +02:00
if(!_node || !_node.active) continue;
2023-01-25 06:49:00 +01:00
2023-07-25 20:12:40 +02:00
for(var i = 0; i < ds_list_size(_node.inputs); i++) {
var in = _node.inputs[| i];
2023-03-21 03:01:53 +01:00
if(!in.is_anim) continue;
2023-01-25 06:49:00 +01:00
for(var j = 0; j < ds_list_size(in.animator.values); j++) {
var t = in.animator.values[| j];
t.time = t.ratio * scale_to;
}
}
}
2023-07-06 19:49:16 +02:00
PROJECT.animator.frames_total = scale_to;
2023-01-25 06:49:00 +01:00
instance_destroy();
}).setIcon(THEME.accept, 0, COLORS._main_icon_dark);
2022-01-13 05:24:03 +01:00
#endregion