2023-12-18 04:40:21 +01:00
|
|
|
enum KEY_TYPE { normal, adder }
|
|
|
|
enum CURVE_TYPE { linear, bezier, cut }
|
|
|
|
enum DRIVER_TYPE { none, linear, wiggle, sine }
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-01-09 03:14:20 +01:00
|
|
|
function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor {
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- main ----
|
|
|
|
time = _time;
|
2023-10-09 16:07:33 +02:00
|
|
|
ratio = time / (TOTAL_FRAMES - 1);
|
2023-08-19 12:42:50 +02:00
|
|
|
value = _value;
|
|
|
|
anim = _anim;
|
2022-09-23 13:28:42 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
ease_y_lock = true;
|
|
|
|
ease_in = is_array(_in)? _in : [_in, 1];
|
|
|
|
ease_out = is_array(_ot)? _ot : [_ot, 0];
|
|
|
|
|
|
|
|
var _int = anim? anim.prop.key_inter : CURVE_TYPE.linear;
|
|
|
|
ease_in_type = _int;
|
|
|
|
ease_out_type = _int;
|
2023-12-18 04:40:21 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
dopesheet_x = 0;
|
2023-12-18 04:40:21 +01:00
|
|
|
|
|
|
|
drivers = {
|
|
|
|
seed : irandom_range(100000, 999999),
|
|
|
|
type : DRIVER_TYPE.none,
|
|
|
|
speed : 1,
|
|
|
|
octave : 2,
|
|
|
|
frequency : 4,
|
|
|
|
amplitude : 1,
|
|
|
|
axis_sync : false,
|
|
|
|
phase : 0,
|
|
|
|
};
|
2023-08-19 12:42:50 +02:00
|
|
|
#endregion
|
2023-03-05 07:16:44 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static setTime = function(time) { #region
|
2022-12-10 05:06:01 +01:00
|
|
|
self.time = time;
|
2023-11-27 11:40:28 +01:00
|
|
|
ratio = time / (TOTAL_FRAMES - 1);
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-01-25 06:49:00 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static clone = function(target = noone) { #region
|
2023-01-25 06:49:00 +01:00
|
|
|
var key = new valueKey(time, value, target);
|
|
|
|
key.ease_in = ease_in;
|
|
|
|
key.ease_out = ease_out;
|
|
|
|
key.ease_in_type = ease_in_type;
|
|
|
|
key.ease_out_type = ease_out_type;
|
|
|
|
|
|
|
|
return key;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static cloneAnimator = function(shift = 0, anim = noone, removeDup = true) { #region
|
2023-03-05 07:16:44 +01:00
|
|
|
if(anim != noone) { //check value compat between animator
|
|
|
|
if(value_bit(self.anim.prop.type) & value_bit(anim.prop.type) == 0) {
|
|
|
|
noti_warning("Type incompatible");
|
|
|
|
return noone;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(typeArray(self.anim.prop.display_type) != typeArray(anim.prop.display_type)) {
|
|
|
|
noti_warning("Type incompatible");
|
|
|
|
return noone;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(anim == noone) anim = self.anim;
|
2023-03-02 07:59:14 +01:00
|
|
|
|
|
|
|
var key = new valueKey(time + shift, value, anim);
|
|
|
|
key.ease_in = ease_in;
|
|
|
|
key.ease_out = ease_out;
|
|
|
|
key.ease_in_type = ease_in_type;
|
|
|
|
key.ease_out_type = ease_out_type;
|
|
|
|
ds_list_add(anim.values, key);
|
2023-03-05 07:16:44 +01:00
|
|
|
anim.setKeyTime(key, time + shift, removeDup);
|
2023-03-02 07:59:14 +01:00
|
|
|
|
|
|
|
return key;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-10-03 07:14:28 +02:00
|
|
|
|
2023-12-18 04:40:21 +01:00
|
|
|
static getDrawIndex = function() { #region
|
|
|
|
if(anim.prop.type == VALUE_TYPE.trigger)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if(drivers.type)
|
|
|
|
return 2;
|
|
|
|
|
|
|
|
if(ease_in_type == CURVE_TYPE.cut)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
} #endregion
|
|
|
|
|
2023-10-03 07:14:28 +02:00
|
|
|
static toString = function() { return $"[Keyframe] {time}: {value}"; }
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2023-03-21 03:01:53 +01:00
|
|
|
function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- main ----
|
2024-04-01 11:10:01 +02:00
|
|
|
suffix = "";
|
|
|
|
values = ds_list_create();
|
|
|
|
//staticValue = 0;
|
|
|
|
|
2024-04-01 06:34:02 +02:00
|
|
|
length = 1;
|
2023-08-19 12:42:50 +02:00
|
|
|
sep_axis = _sep_axis;
|
|
|
|
|
2023-11-29 03:04:28 +01:00
|
|
|
index = 0;
|
|
|
|
prop = _prop;
|
|
|
|
y = 0;
|
|
|
|
key_map = array_create(TOTAL_FRAMES);
|
2023-12-02 14:30:27 +01:00
|
|
|
key_map_mode = KEYFRAME_END.hold;
|
2023-08-19 12:42:50 +02:00
|
|
|
|
2023-11-17 06:24:31 +01:00
|
|
|
animate_frames = [];
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
if(_prop.type != VALUE_TYPE.trigger)
|
|
|
|
ds_list_add(values, new valueKey(0, _val, self));
|
|
|
|
#endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-17 06:24:31 +01:00
|
|
|
static refreshAnimation = function() { #region
|
|
|
|
animate_frames = array_verify(animate_frames, TOTAL_FRAMES);
|
|
|
|
|
|
|
|
var _anim = false;
|
|
|
|
var _fr = noone;
|
|
|
|
|
|
|
|
for( var i = 0, n = ds_list_size(values); i < n; i++ ) {
|
|
|
|
var _key = values[| i];
|
|
|
|
|
|
|
|
if(_fr == noone) {
|
|
|
|
array_fill(animate_frames, 0, _key.time, 0);
|
|
|
|
} else {
|
|
|
|
if(array_equals(_fr.ease_out, [0, 0]) && array_equals(_fr.ease_in, [0, 1]) && isEqual(_fr.value, _key.value))
|
|
|
|
array_fill(animate_frames, _fr.time, _key.time, 0);
|
|
|
|
else
|
|
|
|
array_fill(animate_frames, _fr.time, _key.time, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
_fr = _key;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(_fr) array_fill(animate_frames, _fr.time, TOTAL_FRAMES, 0);
|
|
|
|
} #endregion
|
|
|
|
|
2023-11-29 03:04:28 +01:00
|
|
|
static updateKeyMap = function() { #region
|
2024-04-01 06:34:02 +02:00
|
|
|
length = ds_list_size(values);
|
|
|
|
|
2023-11-29 03:04:28 +01:00
|
|
|
if(!prop.is_anim && !LOADING && !APPENDING) return;
|
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
if(ds_list_empty(values)) {
|
|
|
|
array_resize(key_map, TOTAL_FRAMES);
|
|
|
|
return;
|
2023-11-30 13:07:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
var _len = max(TOTAL_FRAMES, values[| ds_list_size(values) - 1].time);
|
2023-12-02 14:30:27 +01:00
|
|
|
key_map_mode = prop.on_end;
|
2023-11-30 13:07:08 +01:00
|
|
|
|
|
|
|
if(array_length(key_map) != _len)
|
|
|
|
array_resize(key_map, _len);
|
2023-11-29 03:04:28 +01:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
if(prop.type == VALUE_TYPE.trigger) {
|
|
|
|
array_fill(key_map, 0, _len, 0);
|
|
|
|
for( var i = 0, n = ds_list_size(values); i < n; i++ )
|
|
|
|
key_map[values[| i].time] = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-11-29 03:04:28 +01:00
|
|
|
if(ds_list_size(values) < 2) {
|
2023-11-30 13:07:08 +01:00
|
|
|
array_fill(key_map, 0, _len, 0);
|
2023-11-29 03:04:28 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var _firstKey = values[| 0].time;
|
|
|
|
array_fill(key_map, 0, _firstKey, -1);
|
|
|
|
var _keyIndex = _firstKey;
|
|
|
|
|
|
|
|
for( var i = 1, n = ds_list_size(values); i < n; i++ ) {
|
|
|
|
var _k1 = values[| i].time;
|
|
|
|
array_fill(key_map, _keyIndex, _k1, i - 1);
|
|
|
|
_keyIndex = _k1;
|
|
|
|
}
|
|
|
|
|
2023-11-30 13:07:08 +01:00
|
|
|
array_fill(key_map, _keyIndex, _len, 999_999);
|
2023-11-29 03:04:28 +01:00
|
|
|
} #endregion
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static interpolate = function(from, to, rat) { #region
|
2023-01-25 06:49:00 +01:00
|
|
|
if(prop.type == VALUE_TYPE.boolean)
|
|
|
|
return 0;
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
if(to.ease_in_type == CURVE_TYPE.linear && from.ease_out_type == CURVE_TYPE.linear)
|
2023-01-09 03:14:20 +01:00
|
|
|
return rat;
|
2023-01-25 06:49:00 +01:00
|
|
|
if(to.ease_in_type == CURVE_TYPE.cut)
|
|
|
|
return 0;
|
|
|
|
if(from.ease_out_type == CURVE_TYPE.cut)
|
|
|
|
return 1;
|
2023-01-09 03:14:20 +01:00
|
|
|
if(rat == 0 || rat == 1)
|
2022-09-23 13:28:42 +02:00
|
|
|
return rat;
|
|
|
|
|
2023-01-09 03:14:20 +01:00
|
|
|
var eox = clamp(from.ease_out[0], 0, 0.9);
|
|
|
|
var eix = clamp(to.ease_in[0], 0, 0.9);
|
|
|
|
var eoy = from.ease_out[1];
|
|
|
|
var eiy = to.ease_in[1];
|
2022-09-23 13:28:42 +02:00
|
|
|
|
2023-01-09 03:14:20 +01:00
|
|
|
var bz = [0, eox, eoy, 1. - eix, eiy, 1];
|
2023-02-14 02:51:14 +01:00
|
|
|
return eval_curve_segment_x(bz, rat);
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static lerpValue = function(from, to, _lrp) { #region
|
2023-06-17 14:30:49 +02:00
|
|
|
var _f = from.value;
|
|
|
|
var _t = to.value;
|
2023-07-11 14:18:23 +02:00
|
|
|
|
|
|
|
if(is_struct(_f)) {
|
|
|
|
if(!struct_has(_f, "lerpTo")) return _f;
|
|
|
|
return _f.lerpTo(_t, _lrp);
|
|
|
|
}
|
2023-08-30 16:40:45 +02:00
|
|
|
|
2024-05-11 14:56:19 +02:00
|
|
|
if(prop.display_type == VALUE_DISPLAY.d3quarternion && prop.display_data.angle_display == QUARTERNION_DISPLAY.quarterion)
|
2024-05-05 04:03:07 +02:00
|
|
|
return quarternionArraySlerp(_f, _t, _lrp);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-06-17 14:30:49 +02:00
|
|
|
if(prop.type == VALUE_TYPE.color) {
|
2023-07-11 14:18:23 +02:00
|
|
|
if(is_array(_f) && is_array(_t)) {
|
|
|
|
var _len = ceil(lerp(array_length(_f), array_length(_t), _lrp));
|
|
|
|
var res = array_create(_len);
|
|
|
|
|
|
|
|
for( var i = 0; i < _len; i++ ) {
|
|
|
|
var rat = i / (_len - 1);
|
|
|
|
|
|
|
|
var rf = rat * (array_length(_f) - 1);
|
|
|
|
var rt = rat * (array_length(_t) - 1);
|
|
|
|
|
|
|
|
var cf = array_get_decimal(_f, rf, true);
|
|
|
|
var ct = array_get_decimal(_t, rt, true);
|
|
|
|
|
|
|
|
res[i] = merge_color(cf, ct, _lrp);
|
|
|
|
}
|
2023-01-09 03:14:20 +01:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
return processType(merge_color(_f, _t, _lrp));
|
|
|
|
}
|
2023-06-17 14:30:49 +02:00
|
|
|
|
2023-11-20 05:10:55 +01:00
|
|
|
if(is_array(_f) || is_array(_t)) {
|
|
|
|
var _len = max(array_safe_length(_f), array_safe_length(_t));
|
|
|
|
var _vec = array_create(_len);
|
|
|
|
|
|
|
|
for(var i = 0; i < _len; i++)
|
|
|
|
_vec[i] = processType(
|
|
|
|
lerp(
|
2024-03-31 05:36:11 +02:00
|
|
|
is_array(_f)? array_safe_get_fast(_f, i, 0) : _f,
|
|
|
|
is_array(_t)? array_safe_get_fast(_t, i, 0) : _t,
|
2023-11-20 05:10:55 +01:00
|
|
|
_lrp)
|
|
|
|
);
|
2023-01-09 03:14:20 +01:00
|
|
|
return _vec;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(prop.type == VALUE_TYPE.text)
|
2023-06-17 14:30:49 +02:00
|
|
|
return processType(_f);
|
|
|
|
|
|
|
|
return processType(lerp(_f, _t, _lrp));
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-03-21 03:01:53 +01:00
|
|
|
static getName = function() { return prop.name + suffix; }
|
|
|
|
|
2023-10-09 16:07:33 +02:00
|
|
|
static getValue = function(_time = CURRENT_FRAME) { #region
|
2024-04-01 11:10:01 +02:00
|
|
|
//if(!prop.is_anim) return staticValue;
|
2024-04-08 07:13:46 +02:00
|
|
|
length = ds_list_size(values);
|
2024-04-01 06:34:02 +02:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////// TRIGGER TYPE /////////////////////////////////////////////////////////////
|
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
if(prop.type == VALUE_TYPE.trigger) {
|
2024-04-08 07:13:46 +02:00
|
|
|
if(length == 0 || !prop.is_anim) return false;
|
2023-06-13 14:42:06 +02:00
|
|
|
|
2023-11-29 03:04:28 +01:00
|
|
|
if(array_length(key_map) != TOTAL_FRAMES) updateKeyMap();
|
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
return key_map[_time];
|
2023-03-21 03:01:53 +01:00
|
|
|
}
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2024-04-01 06:34:02 +02:00
|
|
|
///////////////////////////////////////////////////////////// OPTIMIZATION /////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
if(length == 0) return processTypeDefault();
|
|
|
|
if(length == 1) {
|
2023-12-18 04:40:21 +01:00
|
|
|
var _key = values[| 0];
|
|
|
|
|
|
|
|
if(_key.drivers.type && _time >= _key.time)
|
|
|
|
return processType(processDriver(_time, _key));
|
|
|
|
|
|
|
|
return processType(_key.value);
|
|
|
|
}
|
2023-03-28 06:58:28 +02:00
|
|
|
|
2023-10-05 06:29:20 +02:00
|
|
|
if(prop.type == VALUE_TYPE.path) return processType(values[| 0].value);
|
|
|
|
if(!prop.is_anim) return processType(values[| 0].value);
|
2024-04-01 06:34:02 +02:00
|
|
|
var _len = max(TOTAL_FRAMES, values[| length - 1].time);
|
2023-11-30 13:07:08 +01:00
|
|
|
if(array_length(key_map) != _len) updateKeyMap();
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-04-01 06:34:02 +02:00
|
|
|
var _time_first = prop.loop_range == -1? values[| 0].time : values[| length - 1 - prop.loop_range].time;
|
|
|
|
var _time_last = values[| length - 1].time;
|
2023-01-09 03:14:20 +01:00
|
|
|
var _time_dura = _time_last - _time_first;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-04-01 06:34:02 +02:00
|
|
|
////////////////////////////////////////////////////////////// LOOP TIME ///////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
if(_time > _time_last) {
|
2023-01-09 03:14:20 +01:00
|
|
|
switch(prop.on_end) {
|
|
|
|
case KEYFRAME_END.loop :
|
|
|
|
_time = _time_first + safe_mod(_time - _time_last, _time_dura + 1);
|
|
|
|
break;
|
|
|
|
case KEYFRAME_END.ping :
|
|
|
|
var time_in_loop = safe_mod(_time - _time_first, _time_dura * 2);
|
|
|
|
if(time_in_loop < _time_dura)
|
|
|
|
_time = _time_first + time_in_loop;
|
|
|
|
else
|
|
|
|
_time = _time_first + _time_dura * 2 - time_in_loop;
|
|
|
|
break;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2024-04-01 06:34:02 +02:00
|
|
|
}
|
2023-11-29 03:04:28 +01:00
|
|
|
|
2023-12-02 14:30:27 +01:00
|
|
|
var _keyIndex;
|
|
|
|
if(_time >= _len) _keyIndex = 999_999;
|
2023-12-15 12:56:36 +01:00
|
|
|
else if(_time <= 0) _keyIndex = -1;
|
2024-03-31 05:36:11 +02:00
|
|
|
else _keyIndex = array_safe_get_fast(key_map, _time);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-04-01 06:34:02 +02:00
|
|
|
//////////////////////////////////////////////////////////// BEFORE FIRST //////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
if(_keyIndex == -1) {
|
2023-01-09 03:14:20 +01:00
|
|
|
if(prop.on_end == KEYFRAME_END.wrap) {
|
2024-04-01 06:34:02 +02:00
|
|
|
var from = values[| length - 1];
|
2023-01-09 03:14:20 +01:00
|
|
|
var to = values[| 0];
|
2023-08-16 20:16:31 +02:00
|
|
|
|
|
|
|
var fTime = from.time;
|
|
|
|
var tTime = to.time;
|
|
|
|
|
2023-10-09 16:07:33 +02:00
|
|
|
var prog = TOTAL_FRAMES - fTime + _time;
|
|
|
|
var totl = TOTAL_FRAMES - fTime + tTime;
|
2023-01-09 03:14:20 +01:00
|
|
|
|
|
|
|
var rat = prog / totl;
|
|
|
|
var _lrp = interpolate(from, to, rat);
|
|
|
|
|
|
|
|
return lerpValue(from, to, _lrp);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-01-09 03:14:20 +01:00
|
|
|
|
|
|
|
return processType(values[| 0].value); //First frame
|
2024-04-01 06:34:02 +02:00
|
|
|
}
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2024-04-01 06:34:02 +02:00
|
|
|
///////////////////////////////////////////////////////////// AFTER LAST ///////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
if(_keyIndex == 999_999) {
|
|
|
|
var _lstKey = values[| length - 1];
|
2023-12-18 04:40:21 +01:00
|
|
|
|
|
|
|
if(_lstKey.drivers.type)
|
|
|
|
return processType(processDriver(_time, _lstKey));
|
|
|
|
|
2023-12-02 14:30:27 +01:00
|
|
|
if(prop.on_end == KEYFRAME_END.wrap) {
|
2023-12-18 04:40:21 +01:00
|
|
|
var from = _lstKey;
|
2023-11-29 03:04:28 +01:00
|
|
|
var to = values[| 0];
|
|
|
|
var prog = _time - from.time;
|
|
|
|
var totl = TOTAL_FRAMES - from.time + to.time;
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-11-29 03:04:28 +01:00
|
|
|
var rat = prog / totl;
|
|
|
|
var _lrp = interpolate(from, to, rat);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-11-29 03:04:28 +01:00
|
|
|
return lerpValue(from, to, _lrp);
|
|
|
|
}
|
|
|
|
|
2023-12-18 04:40:21 +01:00
|
|
|
return processType(_lstKey.value); //Last frame
|
2024-04-01 06:34:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////// INBETWEEN ////////////////////////////////////////////////////////////////
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2024-04-01 06:34:02 +02:00
|
|
|
var from = values[| _keyIndex];
|
|
|
|
var to = values[| _keyIndex + 1];
|
2023-12-18 04:40:21 +01:00
|
|
|
|
2024-04-01 06:34:02 +02:00
|
|
|
var rat = (_time - from.time) / (to.time - from.time);
|
|
|
|
var _lrp = interpolate(from, to, rat);
|
2023-11-29 03:04:28 +01:00
|
|
|
|
2024-04-01 06:34:02 +02:00
|
|
|
if(from.drivers.type)
|
|
|
|
return processDriver(_time, from, lerpValue(from, to, _lrp), rat);
|
2023-12-18 04:40:21 +01:00
|
|
|
|
2024-04-01 06:34:02 +02:00
|
|
|
return lerpValue(from, to, _lrp);
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static processTypeDefault = function() { #region
|
2023-03-21 03:01:53 +01:00
|
|
|
if(!sep_axis && typeArray(prop.display_type)) return [];
|
2023-02-14 02:51:14 +01:00
|
|
|
return 0;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-11-29 03:04:28 +01:00
|
|
|
|
2023-12-18 04:40:21 +01:00
|
|
|
static processDriver = function(_time, _key, _val = undefined, _intp = 0) { #region
|
|
|
|
|
|
|
|
static _processDriver = function(val, drivers, _t, _index = 0, _intp = 0) {
|
|
|
|
switch(drivers.type) {
|
|
|
|
case DRIVER_TYPE.linear :
|
|
|
|
return val + _t * drivers.speed;
|
|
|
|
|
|
|
|
case DRIVER_TYPE.wiggle :
|
|
|
|
var w = perlin1D(_t, drivers.seed + _index, drivers.frequency / 10, drivers.octave, -1, 1) * drivers.amplitude;
|
|
|
|
return val + w;
|
|
|
|
|
|
|
|
case DRIVER_TYPE.sine :
|
|
|
|
var w = sin((drivers.phase * (_index + 1) + _t * drivers.frequency / TOTAL_FRAMES) * pi * 2) * drivers.amplitude;
|
|
|
|
return val + w;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
var _dt = _time - _key.time;
|
|
|
|
_val = _val == undefined? _key.value : _val;
|
|
|
|
var _res = _val;
|
|
|
|
|
|
|
|
if(prop.type == VALUE_TYPE.integer || prop.type == VALUE_TYPE.float) {
|
|
|
|
if(is_array(_val)) {
|
|
|
|
_res = array_create(array_length(_val));
|
|
|
|
for( var i = 0, n = array_length(_val); i < n; i++ )
|
|
|
|
_res[i] = is_numeric(_val[i])? _processDriver(_val[i], _key.drivers, _dt, _key.drivers.axis_sync? 0 : i, _intp) : _val[i];
|
|
|
|
} else
|
|
|
|
_res = _processDriver(_val, _key.drivers, _dt, 0, _intp);
|
|
|
|
}
|
|
|
|
|
|
|
|
return _res;
|
|
|
|
} #endregion
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static processType = function(_val) { #region
|
2024-04-01 06:34:02 +02:00
|
|
|
INLINE
|
|
|
|
|
2024-04-23 14:29:26 +02:00
|
|
|
if(PROJECT.attributes.strict) return processValue(_val);
|
2023-11-29 03:04:28 +01:00
|
|
|
var _res = _val;
|
2024-04-01 06:34:02 +02:00
|
|
|
|
2023-03-21 03:01:53 +01:00
|
|
|
if(!sep_axis && typeArray(prop.display_type) && is_array(_val)) {
|
2022-01-13 05:24:03 +01:00
|
|
|
for(var i = 0; i < array_length(_val); i++)
|
2023-11-29 03:04:28 +01:00
|
|
|
_res[i] = processValue(_val[i]);
|
|
|
|
} else
|
|
|
|
_res = processValue(_val);
|
2023-11-30 08:55:33 +01:00
|
|
|
|
2023-11-29 03:04:28 +01:00
|
|
|
return _res;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-01-17 08:11:55 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static processValue = function(_val) { #region
|
2024-04-01 06:34:02 +02:00
|
|
|
INLINE
|
|
|
|
|
2023-09-14 16:29:39 +02:00
|
|
|
if(is_array(_val)) return _val;
|
2023-05-16 21:28:16 +02:00
|
|
|
if(is_struct(_val)) return _val;
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2022-09-23 13:28:42 +02:00
|
|
|
switch(prop.type) {
|
2024-04-01 06:34:02 +02:00
|
|
|
case VALUE_TYPE.integer : return prop.unit.mode == VALUE_UNIT.constant? round(_val) : _val;
|
2023-10-05 06:29:20 +02:00
|
|
|
case VALUE_TYPE.float : return _val;
|
2024-04-20 05:00:28 +02:00
|
|
|
case VALUE_TYPE.text : return is_string(_val)? _val : string_real(_val);
|
|
|
|
case VALUE_TYPE.color : return is_real(_val)? cola(_val) : _val;
|
|
|
|
case VALUE_TYPE.surface : return is_string(_val)? get_asset(_val) : _val;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return _val;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-10 11:32:46 +01:00
|
|
|
static insertKey = function(_key, _index) { ds_list_insert(values, _index, _key); }
|
|
|
|
|
2024-05-23 14:40:30 +02:00
|
|
|
function onUndo() { updateKeyMap(); prop.triggerSetFrom(); }
|
|
|
|
|
2023-10-30 14:21:34 +01:00
|
|
|
static setKeyTime = function(_key, _time, _replace = true, record = false) { #region
|
2023-11-10 11:32:46 +01:00
|
|
|
if(!ds_list_exist(values, _key)) return 0;
|
|
|
|
if(_key.time == _time && !_replace) return 0;
|
2023-10-30 14:21:34 +01:00
|
|
|
|
2023-07-06 19:49:16 +02:00
|
|
|
if(!LOADING) PROJECT.modified = true;
|
2022-09-23 13:28:42 +02:00
|
|
|
|
2023-11-10 11:32:46 +01:00
|
|
|
var _prevTime = _key.time;
|
2023-01-25 06:49:00 +01:00
|
|
|
_time = max(_time, 0);
|
2022-12-10 05:06:01 +01:00
|
|
|
_key.setTime(_time);
|
2022-09-23 13:28:42 +02:00
|
|
|
ds_list_remove(values, _key);
|
|
|
|
|
2023-10-30 14:21:34 +01:00
|
|
|
if(_replace)
|
|
|
|
for( var i = 0; i < ds_list_size(values); i++ ) {
|
|
|
|
if(values[| i].time != _time) continue;
|
|
|
|
|
2023-11-10 11:32:46 +01:00
|
|
|
if(record) {
|
|
|
|
var act = new Action(ACTION_TYPE.custom, function(data) {
|
|
|
|
if(data.undo) insertKey(data.overKey, data.index);
|
2023-12-18 04:40:21 +01:00
|
|
|
updateKeyMap();
|
|
|
|
|
|
|
|
data.undo = !data.undo;
|
2023-11-10 11:32:46 +01:00
|
|
|
}, { overKey : values[| i], index : i, undo : true });
|
|
|
|
mergeAction(act);
|
|
|
|
}
|
|
|
|
|
2023-10-30 14:21:34 +01:00
|
|
|
values[| i] = _key;
|
2023-11-29 03:04:28 +01:00
|
|
|
updateKeyMap();
|
2023-10-30 14:21:34 +01:00
|
|
|
return 2;
|
2022-09-23 13:28:42 +02:00
|
|
|
}
|
|
|
|
|
2023-12-18 04:40:21 +01:00
|
|
|
for( var i = 0; i < ds_list_size(values); i++ ) { //insert key before the last key
|
2023-10-30 14:21:34 +01:00
|
|
|
if(values[| i].time < _time) continue;
|
|
|
|
|
2023-11-10 11:32:46 +01:00
|
|
|
if(record) recordAction(ACTION_TYPE.custom, function(data) {
|
|
|
|
var _prevTime = data.key.time;
|
|
|
|
setKeyTime(data.key, data.time, false);
|
2023-12-18 04:40:21 +01:00
|
|
|
|
|
|
|
data.time = _prevTime;
|
2024-05-23 14:40:30 +02:00
|
|
|
}, { key : _key, time : _prevTime }, onUndo);
|
2023-11-10 11:32:46 +01:00
|
|
|
|
2023-10-30 14:21:34 +01:00
|
|
|
ds_list_insert(values, i, _key);
|
2023-11-29 03:04:28 +01:00
|
|
|
if(_replace) updateKeyMap();
|
2023-10-30 14:21:34 +01:00
|
|
|
return 1;
|
2022-09-23 13:28:42 +02:00
|
|
|
}
|
|
|
|
|
2023-12-18 04:40:21 +01:00
|
|
|
if(record) recordAction(ACTION_TYPE.custom, function(data) { // insert key after the last key
|
2023-11-10 11:32:46 +01:00
|
|
|
var _prevTime = data.key.time;
|
|
|
|
setKeyTime(data.key, data.time, false);
|
2023-12-18 04:40:21 +01:00
|
|
|
|
|
|
|
data.time = _prevTime;
|
2024-05-23 14:40:30 +02:00
|
|
|
}, { key : _key, time : _prevTime }, onUndo);
|
2023-11-10 11:32:46 +01:00
|
|
|
|
2022-09-23 13:28:42 +02:00
|
|
|
ds_list_add(values, _key);
|
2023-11-29 03:04:28 +01:00
|
|
|
if(_replace) updateKeyMap();
|
2022-09-23 13:28:42 +02:00
|
|
|
return 1;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-09-23 13:28:42 +02:00
|
|
|
|
2023-10-09 16:07:33 +02:00
|
|
|
static setValue = function(_val = 0, _record = true, _time = CURRENT_FRAME, ease_in = 0, ease_out = 0) { #region
|
2024-04-01 11:10:01 +02:00
|
|
|
//staticValue = _val;
|
2024-04-01 06:34:02 +02:00
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
if(prop.type == VALUE_TYPE.trigger) {
|
2023-06-13 14:42:06 +02:00
|
|
|
if(!prop.is_anim) {
|
|
|
|
values[| 0] = new valueKey(0, _val, self);
|
2023-11-29 03:04:28 +01:00
|
|
|
updateKeyMap();
|
2023-06-13 14:42:06 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
for(var i = 0; i < ds_list_size(values); i++) { //Find trigger
|
|
|
|
var _key = values[| i];
|
|
|
|
if(_key.time == _time) {
|
2023-05-22 20:31:55 +02:00
|
|
|
if(!global.FLAG.keyframe_override) return false;
|
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
_key.value = _val;
|
|
|
|
return false;
|
2024-04-08 07:13:46 +02:00
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
} else if(_key.time > _time) {
|
|
|
|
ds_list_insert(values, i, new valueKey(_time, _val, self));
|
2023-11-29 03:04:28 +01:00
|
|
|
updateKeyMap();
|
2023-03-28 06:58:28 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
//print($"{_time}: {_val} | Insert last");
|
2023-03-28 06:58:28 +02:00
|
|
|
ds_list_add(values, new valueKey(_time, _val, self));
|
2023-11-29 03:04:28 +01:00
|
|
|
updateKeyMap();
|
2023-03-28 06:58:28 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-03-21 03:01:53 +01:00
|
|
|
if(!prop.is_anim) {
|
2022-11-22 14:25:39 +01:00
|
|
|
if(isEqual(values[| 0].value, _val))
|
|
|
|
return false;
|
|
|
|
|
2024-05-23 14:40:30 +02:00
|
|
|
if(_record) recordAction(ACTION_TYPE.var_modify, values[| 0], [ values[| 0].value, "value", prop.name ], onUndo);
|
2023-08-08 18:45:00 +02:00
|
|
|
|
2022-11-22 14:25:39 +01:00
|
|
|
values[| 0].value = _val;
|
|
|
|
return true;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2023-11-10 11:32:46 +01:00
|
|
|
if(ds_list_size(values) == 0) { // Should not be called normally
|
2022-09-23 13:28:42 +02:00
|
|
|
var k = new valueKey(_time, _val, self, ease_in, ease_out);
|
2022-01-13 05:24:03 +01:00
|
|
|
ds_list_add(values, k);
|
2024-05-23 14:40:30 +02:00
|
|
|
if(_record) recordAction(ACTION_TYPE.list_insert, values, [ k, ds_list_size(values) - 1, $"add {prop.name} keyframe" ], onUndo);
|
2022-01-13 05:24:03 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(var i = 0; i < ds_list_size(values); i++) {
|
|
|
|
var _key = values[| i];
|
|
|
|
if(_key.time == _time) {
|
2023-05-22 20:31:55 +02:00
|
|
|
if(!global.FLAG.keyframe_override) return false;
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if(_key.value != _val) {
|
2024-05-23 14:40:30 +02:00
|
|
|
if(_record) recordAction(ACTION_TYPE.var_modify, _key, [ _key.value, "value", prop.name ], onUndo);
|
2022-01-13 05:24:03 +01:00
|
|
|
_key.value = _val;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
} else if(_key.time > _time) {
|
2022-09-23 13:28:42 +02:00
|
|
|
var k = new valueKey(_time, _val, self, ease_in, ease_out);
|
2022-01-13 05:24:03 +01:00
|
|
|
ds_list_insert(values, i, k);
|
2024-05-23 14:40:30 +02:00
|
|
|
if(_record) recordAction(ACTION_TYPE.list_insert, values, [k, i, $"add {prop.name} keyframe" ], onUndo);
|
2023-11-29 03:04:28 +01:00
|
|
|
updateKeyMap();
|
2022-01-13 05:24:03 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-23 13:28:42 +02:00
|
|
|
var k = new valueKey(_time, _val, self, ease_in, ease_out);
|
2024-05-23 14:40:30 +02:00
|
|
|
if(_record) recordAction(ACTION_TYPE.list_insert, values, [ k, ds_list_size(values), $"add {prop.name} keyframe" ], onUndo);
|
2022-01-13 05:24:03 +01:00
|
|
|
ds_list_add(values, k);
|
2023-11-29 03:04:28 +01:00
|
|
|
updateKeyMap();
|
2022-01-13 05:24:03 +01:00
|
|
|
return true;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static removeKey = function(key) { #region
|
2022-09-23 13:28:42 +02:00
|
|
|
if(ds_list_size(values) > 1)
|
|
|
|
ds_list_remove(values, key);
|
|
|
|
else
|
2023-03-21 03:01:53 +01:00
|
|
|
prop.is_anim = false;
|
2023-11-29 03:04:28 +01:00
|
|
|
updateKeyMap();
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-09-23 13:28:42 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static serialize = function(scale = false) { #region
|
2023-06-13 14:42:06 +02:00
|
|
|
var _data = [];
|
2022-01-13 05:24:03 +01:00
|
|
|
|
|
|
|
for(var i = 0; i < ds_list_size(values); i++) {
|
2023-06-13 14:42:06 +02:00
|
|
|
var _value_list = [];
|
2023-02-14 02:51:14 +01:00
|
|
|
if(scale)
|
2023-10-09 16:07:33 +02:00
|
|
|
_value_list[0] = values[| i].time / (TOTAL_FRAMES - 1);
|
2022-01-13 05:24:03 +01:00
|
|
|
else
|
2023-06-13 14:42:06 +02:00
|
|
|
_value_list[0] = values[| i].time;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
var val = values[| i].value;
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
if(prop.type == VALUE_TYPE.struct) {
|
|
|
|
val = json_stringify(val);
|
|
|
|
|
2024-06-15 08:02:10 +02:00
|
|
|
} else if(is_struct(val) && struct_has(val, "serialize")) {
|
2024-04-08 07:13:46 +02:00
|
|
|
val = val.serialize();
|
|
|
|
|
|
|
|
} else if(!sep_axis && typeArray(prop.display_type) && is_array(val)) {
|
2023-06-13 14:42:06 +02:00
|
|
|
var __v = [];
|
2023-02-14 02:51:14 +01:00
|
|
|
for(var j = 0; j < array_length(val); j++) {
|
2023-02-19 13:49:20 +01:00
|
|
|
if(is_struct(val[j]) && struct_has(val[j], "serialize"))
|
2023-06-13 14:42:06 +02:00
|
|
|
array_push(__v, val[j].serialize());
|
2023-02-14 02:51:14 +01:00
|
|
|
else
|
2023-06-13 14:42:06 +02:00
|
|
|
array_push(__v, val[j]);
|
2023-02-14 02:51:14 +01:00
|
|
|
}
|
2024-04-08 07:13:46 +02:00
|
|
|
val = __v;
|
|
|
|
|
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
_value_list[1] = val;
|
2023-06-13 14:42:06 +02:00
|
|
|
_value_list[2] = values[| i].ease_in;
|
|
|
|
_value_list[3] = values[| i].ease_out;
|
|
|
|
_value_list[4] = values[| i].ease_in_type;
|
|
|
|
_value_list[5] = values[| i].ease_out_type;
|
2023-07-14 20:34:35 +02:00
|
|
|
_value_list[6] = values[| i].ease_y_lock;
|
2023-12-18 04:40:21 +01:00
|
|
|
_value_list[7] = values[| i].drivers;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
array_push(_data, _value_list);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
return _data;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static deserialize = function(_data, scale = false) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
ds_list_clear(values);
|
2022-12-12 09:08:03 +01:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
if(prop.type == VALUE_TYPE.gradient && LOADING_VERSION < 1340 && !CLONING) { #region //backward compat: Gradient
|
2023-02-14 02:51:14 +01:00
|
|
|
var _val = [];
|
2023-06-13 14:42:06 +02:00
|
|
|
var value = _data[0][1];
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
if(is_array(value))
|
|
|
|
for(var i = 0; i < array_length(value); i++) {
|
|
|
|
var _keyframe = value[i];
|
|
|
|
var _t = struct_try_get(_keyframe, "time");
|
|
|
|
var _v = struct_try_get(_keyframe, "value");
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-03-02 07:59:14 +01:00
|
|
|
array_push(_val, new gradientKey(_t, _v));
|
2023-02-14 02:51:14 +01:00
|
|
|
}
|
|
|
|
|
2023-03-02 07:59:14 +01:00
|
|
|
var grad = new gradientObject();
|
|
|
|
grad.keys = _val;
|
|
|
|
ds_list_add(values, new valueKey(0, grad, self));
|
2023-11-29 03:04:28 +01:00
|
|
|
|
|
|
|
updateKeyMap();
|
2023-02-14 02:51:14 +01:00
|
|
|
return;
|
2024-04-08 07:13:46 +02:00
|
|
|
} #endregion
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-10-04 05:52:20 +02:00
|
|
|
var base = prop.def_val;
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
for(var i = 0; i < array_length(_data); i++) {
|
|
|
|
var _keyframe = _data[i];
|
2024-03-31 05:36:11 +02:00
|
|
|
var _time = array_safe_get_fast(_keyframe, 0);
|
2023-02-14 02:51:14 +01:00
|
|
|
|
|
|
|
if(scale && _time <= 1)
|
2023-10-09 16:07:33 +02:00
|
|
|
_time = round(_time * (TOTAL_FRAMES - 1));
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
var value = array_safe_get_fast(_keyframe, 1);
|
|
|
|
var ease_in = array_safe_get_fast(_keyframe, 2);
|
|
|
|
var ease_out = array_safe_get_fast(_keyframe, 3);
|
|
|
|
var ease_in_type = array_safe_get_fast(_keyframe, 4);
|
|
|
|
var ease_out_type = array_safe_get_fast(_keyframe, 5);
|
|
|
|
var ease_y_lock = array_safe_get_fast(_keyframe, 6, true);
|
|
|
|
var driver = array_safe_get_fast(_keyframe, 7, {});
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
var _val = value;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-03-11 01:40:17 +01:00
|
|
|
if(prop.type == VALUE_TYPE.struct)
|
2023-06-17 18:59:20 +02:00
|
|
|
_val = json_try_parse(value);
|
2024-03-27 11:51:14 +01:00
|
|
|
|
2023-03-11 01:40:17 +01:00
|
|
|
else if(prop.type == VALUE_TYPE.path && prop.display_type == VALUE_DISPLAY.path_array) {
|
2023-06-13 14:42:06 +02:00
|
|
|
for(var j = 0; j < array_length(value); j++)
|
|
|
|
_val[j] = value[j];
|
2024-03-27 11:51:14 +01:00
|
|
|
|
2023-05-28 20:00:51 +02:00
|
|
|
} else if(prop.type == VALUE_TYPE.gradient) {
|
2023-03-02 07:59:14 +01:00
|
|
|
var grad = new gradientObject();
|
|
|
|
_val = grad.deserialize(value);
|
2024-03-27 11:51:14 +01:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
} else if(prop.type == VALUE_TYPE.d3Material) {
|
|
|
|
var mat = new __d3dMaterial();
|
|
|
|
_val = mat.deserialize(value);
|
|
|
|
|
2024-01-16 09:56:20 +01:00
|
|
|
} else if(prop.type == VALUE_TYPE.color) {
|
|
|
|
if(is_array(_val)) {
|
|
|
|
for( var i = 0, n = array_length(_val); i < n; i++ )
|
2024-03-27 11:51:14 +01:00
|
|
|
_val[i] = LOADING_VERSION < 11640 && !is_int64(_val[i])? cola(_val[i]) : int64(_val[i]);
|
2024-01-16 09:56:20 +01:00
|
|
|
} else
|
2024-03-27 11:51:14 +01:00
|
|
|
_val = LOADING_VERSION < 11640 && !is_int64(_val)? cola(_val) : int64(_val);
|
|
|
|
|
2023-03-21 03:01:53 +01:00
|
|
|
} else if(!sep_axis && typeArray(prop.display_type)) {
|
2023-02-14 02:51:14 +01:00
|
|
|
_val = [];
|
|
|
|
|
2023-10-03 07:14:28 +02:00
|
|
|
if(is_array(value)) {
|
|
|
|
for(var j = 0; j < array_length(value); j++)
|
|
|
|
_val[j] = processValue(value[j]);
|
2023-10-04 05:52:20 +02:00
|
|
|
} else if(is_array(base)) {
|
2023-10-03 07:14:28 +02:00
|
|
|
for(var j = 0; j < array_length(base); j++)
|
|
|
|
_val[j] = processValue(value);
|
2023-10-04 05:52:20 +02:00
|
|
|
}
|
2024-04-08 07:13:46 +02:00
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-06-10 13:59:45 +02:00
|
|
|
//print($"Deserialize {prop.node.name}:{prop.name} = {_val} ");
|
2022-09-23 13:28:42 +02:00
|
|
|
var vk = new valueKey(_time, _val, self, ease_in, ease_out);
|
|
|
|
vk.ease_in_type = ease_in_type;
|
|
|
|
vk.ease_out_type = ease_out_type;
|
2023-07-14 20:34:35 +02:00
|
|
|
vk.ease_y_lock = ease_y_lock;
|
2023-12-18 04:40:21 +01:00
|
|
|
struct_override(vk.drivers, driver);
|
|
|
|
|
2022-09-23 13:28:42 +02:00
|
|
|
ds_list_add(values, vk);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-11-29 03:04:28 +01:00
|
|
|
|
2024-04-01 11:10:01 +02:00
|
|
|
//staticValue = ds_list_empty(values)? 0 : values[| 0].value;
|
2023-11-29 03:04:28 +01:00
|
|
|
updateKeyMap();
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-19 06:11:17 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static cleanUp = function() { #region
|
2022-01-19 06:11:17 +01:00
|
|
|
ds_list_destroy(values);
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|