- [Preview Panel] Previewing node now save between sessions.

This commit is contained in:
Tanasart 2024-08-08 13:04:25 +07:00
parent 0c3173c624
commit ddae058fb9
37 changed files with 342 additions and 305 deletions

View file

@ -26,8 +26,8 @@ function NodeValue_Array(_name, _node, _value, _tooltip = "", _length = 2) : Nod
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(!is_anim) {
if(sep_axis) return array_create_ext(data_array_length, function(i) /*=>*/ {return animators[i].processType(animators[i].values[| 0].value)});
return ds_list_empty(animator.values)? 0 : animator.processType(animator.values[| 0].value);
if(sep_axis) return array_create_ext(data_array_length, function(i) /*=>*/ {return animators[i].processType(animators[i].values[0].value)});
return array_empty(animator.values)? 0 : animator.processType(animator.values[0].value);
}
if(sep_axis) {

View file

@ -13,7 +13,9 @@ function __NodeValue_Object(_name, _node, _type, _value, _tooltip = "") : NodeVa
return val;
}
static __getAnimValue = function(_time = CURRENT_FRAME) { return ds_list_empty(animator.values)? 0 : animator.values[| 0].value; }
static __getAnimValue = function(_time = CURRENT_FRAME) { return array_empty(animator.values)? 0 : animator.values[0].value; }
static arrayLength = arrayLengthSimple;
}
function NodeValue_Object(_name, _node, _value, _tooltip = "") : __NodeValue_Object(_name, _node, VALUE_TYPE.object, _value, _tooltip) constructor {

View file

@ -307,7 +307,24 @@ function array_verify(arr, length) {
array_resize(arr, length);
return arr;
}
function array_verify_ext(arr, length, generator) {
INLINE
if(!is_array(arr)) return array_create_ext(length, generator);
var _len = array_length(arr);
if(_len == length) return arr;
array_resize(arr, length);
var i = _len;
repeat(length - _len)
arr[i++] = generator();
return arr;
}
function array_insert_after(arr, before, values) {
INLINE

View file

@ -172,8 +172,8 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
if(b) cHov = true;
if(b == 2) {
for(var j = 0; j < ds_list_size(_anim.values); j++) {
var _key = _anim.values[| j];
for(var j = 0; j < array_length(_anim.values); j++) {
var _key = _anim.values[j];
if(_key.time > CURRENT_FRAME) {
PROJECT.animator.setFrame(_key.time);
break;
@ -185,8 +185,8 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
var cc = COLORS.panel_animation_keyframe_unselected;
var kfFocus = false;
for(var j = 0; j < ds_list_size(_anim.values); j++) {
if(_anim.values[| j].time == CURRENT_FRAME) {
for(var j = 0; j < array_length(_anim.values); j++) {
if(_anim.values[j].time == CURRENT_FRAME) {
cc = COLORS.panel_animation_keyframe_selected;
kfFocus = true;
break;
@ -199,8 +199,8 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
if(b) cHov = true;
if(b == 2) {
var _remv = false;
for(var j = 0; j < ds_list_size(_anim.values); j++) {
var _key = _anim.values[| j];
for(var j = 0; j < array_length(_anim.values); j++) {
var _key = _anim.values[j];
if(_key.time == CURRENT_FRAME) {
_anim.removeKey(_key);
@ -218,8 +218,8 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
if(b) cHov = true;
if(b == 2) {
var _t = -1;
for(var j = 0; j < ds_list_size(_anim.values); j++) {
var _key = _anim.values[| j];
for(var j = 0; j < array_length(_anim.values); j++) {
var _key = _anim.values[j];
if(_key.time < CURRENT_FRAME)
_t = _key.time;
}

View file

@ -348,7 +348,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
_tag_delay = 0;
for( var i = 0; i < array_length(inputs[2].animator.values); i++ ) {
var kf = inputs[2].animator.values[| i];
var kf = inputs[2].animator.values[i];
if(kf.time > CURRENT_FRAME) break;
_tag_delay = kf.time;
}

View file

@ -31,12 +31,12 @@ function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor {
};
#endregion
static setTime = function(time) { #region
static setTime = function(time) {
self.time = time;
ratio = time / (TOTAL_FRAMES - 1);
} #endregion
}
static clone = function(target = noone) { #region
static clone = function(target = noone) {
var key = new valueKey(time, value, target);
key.ease_in = ease_in;
key.ease_out = ease_out;
@ -44,9 +44,9 @@ function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor {
key.ease_out_type = ease_out_type;
return key;
} #endregion
}
static cloneAnimator = function(shift = 0, anim = noone, removeDup = true) { #region
static cloneAnimator = function(shift = 0, anim = noone, removeDup = true) {
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");
@ -66,13 +66,13 @@ function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor {
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);
array_push(anim.values, key);
anim.setKeyTime(key, time + shift, removeDup);
return key;
} #endregion
}
static getDrawIndex = function() { #region
static getDrawIndex = function() {
if(anim.prop.type == VALUE_TYPE.trigger)
return 1;
@ -83,7 +83,7 @@ function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor {
return 1;
return 0;
} #endregion
}
static toString = function() { return $"[Keyframe] {time}: {value}"; }
}
@ -91,7 +91,7 @@ function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor {
function valueAnimator(_val, _prop, _sep_axis = false) constructor {
#region ---- main ----
suffix = "";
values = ds_list_create();
values = [];
//staticValue = 0;
length = 1;
@ -106,44 +106,46 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
animate_frames = [];
if(_prop.type != VALUE_TYPE.trigger)
ds_list_add(values, new valueKey(0, _val, self));
array_push(values, new valueKey(0, _val, self));
#endregion
static refreshAnimation = function() { #region
static refreshAnimation = function() {
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];
for( var i = 0, n = array_length(values); i < n; i++ ) {
var _key = values[i];
if(_fr == noone) {
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);
else {
var frInd = 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, !frInd);
// if(frInd) 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
}
static updateKeyMap = function() { #region
length = ds_list_size(values);
static updateKeyMap = function() {
length = array_length(values);
if(!prop.is_anim && !LOADING && !APPENDING) return;
if(ds_list_empty(values)) {
if(array_empty(values)) {
array_resize(key_map, TOTAL_FRAMES);
return;
}
var _len = max(TOTAL_FRAMES, values[| ds_list_size(values) - 1].time);
var _len = max(TOTAL_FRAMES, values[array_length(values) - 1].time);
key_map_mode = prop.on_end;
if(array_length(key_map) != _len)
@ -151,39 +153,42 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
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;
for( var i = 0, n = array_length(values); i < n; i++ )
key_map[values[i].time] = true;
return;
}
if(ds_list_size(values) < 2) {
if(array_length(values) < 2) {
array_fill(key_map, 0, _len, 0);
return;
}
var _firstKey = values[| 0].time;
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;
for( var i = 1, n = array_length(values); i < n; i++ ) {
var _k1 = values[i].time;
array_fill(key_map, _keyIndex, _k1, i - 1);
_keyIndex = _k1;
}
array_fill(key_map, _keyIndex, _len, 999_999);
} #endregion
}
static interpolate = function(from, to, rat) { #region
static interpolate = function(from, to, rat) {
if(prop.type == VALUE_TYPE.boolean)
return 0;
if(to.ease_in_type == CURVE_TYPE.linear && from.ease_out_type == CURVE_TYPE.linear)
return rat;
if(to.ease_in_type == CURVE_TYPE.cut)
return 0;
if(from.ease_out_type == CURVE_TYPE.cut)
return 1;
if(rat == 0 || rat == 1)
return rat;
@ -194,9 +199,9 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
var bz = [0, eox, eoy, 1. - eix, eiy, 1];
return eval_curve_segment_x(bz, rat);
} #endregion
}
static lerpValue = function(from, to, _lrp) { #region
static lerpValue = function(from, to, _lrp) {
var _f = from.value;
var _t = to.value;
@ -249,13 +254,13 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
return processType(_f);
return processType(lerp(_f, _t, _lrp));
} #endregion
}
static getName = function() { return prop.name + suffix; }
static getValue = function(_time = CURRENT_FRAME) { #region
static getValue = function(_time = CURRENT_FRAME) {
//if(!prop.is_anim) return staticValue;
length = ds_list_size(values);
length = array_length(values);
///////////////////////////////////////////////////////////// TRIGGER TYPE /////////////////////////////////////////////////////////////
@ -271,7 +276,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
if(length == 0) return processTypeDefault();
if(length == 1) {
var _key = values[| 0];
var _key = values[0];
if(_key.drivers.type && _time >= _key.time)
return processType(processDriver(_time, _key));
@ -279,13 +284,13 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
return processType(_key.value);
}
if(prop.type == VALUE_TYPE.path) return processType(values[| 0].value);
if(!prop.is_anim) return processType(values[| 0].value);
var _len = max(TOTAL_FRAMES, values[| length - 1].time);
if(prop.type == VALUE_TYPE.path) return processType(values[0].value);
if(!prop.is_anim) return processType(values[0].value);
var _len = max(TOTAL_FRAMES, values[length - 1].time);
if(array_length(key_map) != _len) updateKeyMap();
var _time_first = prop.loop_range == -1? values[| 0].time : values[| length - 1 - prop.loop_range].time;
var _time_last = values[| length - 1].time;
var _time_first = prop.loop_range == -1? values[0].time : values[length - 1 - prop.loop_range].time;
var _time_last = values[length - 1].time;
var _time_dura = _time_last - _time_first;
////////////////////////////////////////////////////////////// LOOP TIME ///////////////////////////////////////////////////////////////
@ -314,8 +319,8 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
if(_keyIndex == -1) {
if(prop.on_end == KEYFRAME_END.wrap) {
var from = values[| length - 1];
var to = values[| 0];
var from = values[length - 1];
var to = values[0];
var fTime = from.time;
var tTime = to.time;
@ -329,20 +334,20 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
return lerpValue(from, to, _lrp);
}
return processType(values[| 0].value); //First frame
return processType(values[0].value); //First frame
}
///////////////////////////////////////////////////////////// AFTER LAST ///////////////////////////////////////////////////////////////
if(_keyIndex == 999_999) {
var _lstKey = values[| length - 1];
var _lstKey = values[length - 1];
if(_lstKey.drivers.type)
return processType(processDriver(_time, _lstKey));
if(prop.on_end == KEYFRAME_END.wrap) {
var from = _lstKey;
var to = values[| 0];
var to = values[0];
var prog = _time - from.time;
var totl = TOTAL_FRAMES - from.time + to.time;
@ -357,8 +362,8 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
///////////////////////////////////////////////////////////// INBETWEEN ////////////////////////////////////////////////////////////////
var from = values[| _keyIndex];
var to = values[| _keyIndex + 1];
var from = values[_keyIndex];
var to = values[_keyIndex + 1];
var rat = (_time - from.time) / (to.time - from.time);
var _lrp = interpolate(from, to, rat);
@ -368,14 +373,14 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
return lerpValue(from, to, _lrp);
} #endregion
}
static processTypeDefault = function() { #region
static processTypeDefault = function() {
if(!sep_axis && typeArray(prop.display_type)) return [];
return 0;
} #endregion
}
static processDriver = function(_time, _key, _val = undefined, _intp = 0) { #region
static processDriver = function(_time, _key, _val = undefined, _intp = 0) {
static _processDriver = function(val, drivers, _t, _index = 0, _intp = 0) {
switch(drivers.type) {
@ -408,9 +413,9 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
}
return _res;
} #endregion
}
static processType = function(_val) { #region
static processType = function(_val) {
INLINE
if(PROJECT.attributes.strict) return processValue(_val);
@ -423,9 +428,9 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
_res = processValue(_val);
return _res;
} #endregion
}
static processValue = function(_val) { #region
static processValue = function(_val) {
INLINE
if(is_array(_val)) return _val;
@ -440,14 +445,14 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
}
return _val;
} #endregion
}
static insertKey = function(_key, _index) { ds_list_insert(values, _index, _key); }
static insertKey = function(_key, _index) { array_push(values, _index, _key); }
function onUndo() { updateKeyMap(); prop.triggerSetFrom(); }
static setKeyTime = function(_key, _time, _replace = true, record = false) { #region
if(!ds_list_exist(values, _key)) return 0;
static setKeyTime = function(_key, _time, _replace = true, record = false) {
if(!array_exists(values, _key)) return 0;
if(_key.time == _time && !_replace) return 0;
if(!LOADING) PROJECT.modified = true;
@ -455,11 +460,11 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
var _prevTime = _key.time;
_time = max(_time, 0);
_key.setTime(_time);
ds_list_remove(values, _key);
array_remove(values, _key);
if(_replace)
for( var i = 0; i < ds_list_size(values); i++ ) {
if(values[| i].time != _time) continue;
for( var i = 0; i < array_length(values); i++ ) {
if(values[i].time != _time) continue;
if(record) {
var act = new Action(ACTION_TYPE.custom, function(data) {
@ -467,17 +472,17 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
updateKeyMap();
data.undo = !data.undo;
}, { overKey : values[| i], index : i, undo : true });
}, { overKey : values[i], index : i, undo : true });
mergeAction(act);
}
values[| i] = _key;
values[i] = _key;
updateKeyMap();
return 2;
}
for( var i = 0; i < ds_list_size(values); i++ ) { //insert key before the last key
if(values[| i].time < _time) continue;
for( var i = 0; i < array_length(values); i++ ) { //insert key before the last key
if(values[i].time < _time) continue;
if(record) recordAction(ACTION_TYPE.custom, function(data) {
var _prevTime = data.key.time;
@ -486,7 +491,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
data.time = _prevTime;
}, { key : _key, time : _prevTime }, onUndo);
ds_list_insert(values, i, _key);
array_insert(values, i, _key);
if(_replace) updateKeyMap();
return 1;
}
@ -498,23 +503,23 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
data.time = _prevTime;
}, { key : _key, time : _prevTime }, onUndo);
ds_list_add(values, _key);
array_push(values, _key);
if(_replace) updateKeyMap();
return 1;
} #endregion
}
static setValue = function(_val = 0, _record = true, _time = CURRENT_FRAME, ease_in = 0, ease_out = 0) { #region
static setValue = function(_val = 0, _record = true, _time = CURRENT_FRAME, ease_in = 0, ease_out = 0) {
//staticValue = _val;
if(prop.type == VALUE_TYPE.trigger) {
if(!prop.is_anim) {
values[| 0] = new valueKey(0, _val, self);
values[0] = new valueKey(0, _val, self);
updateKeyMap();
return true;
}
for(var i = 0; i < ds_list_size(values); i++) { //Find trigger
var _key = values[| i];
for(var i = 0; i < array_length(values); i++) { //Find trigger
var _key = values[i];
if(_key.time == _time) {
if(!global.FLAG.keyframe_override) return false;
@ -522,37 +527,37 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
return false;
} else if(_key.time > _time) {
ds_list_insert(values, i, new valueKey(_time, _val, self));
array_insert(values, i, new valueKey(_time, _val, self));
updateKeyMap();
return true;
}
}
//print($"{_time}: {_val} | Insert last");
ds_list_add(values, new valueKey(_time, _val, self));
array_push(values, new valueKey(_time, _val, self));
updateKeyMap();
return true;
}
if(!prop.is_anim) {
if(isEqual(values[| 0].value, _val))
if(isEqual(values[0].value, _val))
return false;
if(_record) recordAction(ACTION_TYPE.var_modify, values[| 0], [ values[| 0].value, "value", prop.name ], onUndo);
if(_record) recordAction(ACTION_TYPE.var_modify, values[0], [ values[0].value, "value", prop.name ], onUndo);
values[| 0].value = _val;
values[0].value = _val;
return true;
}
if(ds_list_size(values) == 0) { // Should not be called normally
if(array_length(values) == 0) { // Should not be called normally
var k = new valueKey(_time, _val, self, ease_in, ease_out);
ds_list_add(values, k);
if(_record) recordAction(ACTION_TYPE.list_insert, values, [ k, ds_list_size(values) - 1, $"add {prop.name} keyframe" ], onUndo);
array_push(values, k);
if(_record) recordAction(ACTION_TYPE.list_insert, values, [ k, array_length(values) - 1, $"add {prop.name} keyframe" ], onUndo);
return true;
}
for(var i = 0; i < ds_list_size(values); i++) {
var _key = values[| i];
for(var i = 0; i < array_length(values); i++) {
var _key = values[i];
if(_key.time == _time) {
if(!global.FLAG.keyframe_override) return false;
@ -564,7 +569,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
return false;
} else if(_key.time > _time) {
var k = new valueKey(_time, _val, self, ease_in, ease_out);
ds_list_insert(values, i, k);
array_insert(values, i, k);
if(_record) recordAction(ACTION_TYPE.list_insert, values, [k, i, $"add {prop.name} keyframe" ], onUndo);
updateKeyMap();
return true;
@ -572,31 +577,26 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
}
var k = new valueKey(_time, _val, self, ease_in, ease_out);
if(_record) recordAction(ACTION_TYPE.list_insert, values, [ k, ds_list_size(values), $"add {prop.name} keyframe" ], onUndo);
ds_list_add(values, k);
if(_record) recordAction(ACTION_TYPE.list_insert, values, [ k, array_length(values), $"add {prop.name} keyframe" ], onUndo);
array_push(values, k);
updateKeyMap();
return true;
} #endregion
}
static removeKey = function(key) { #region
if(ds_list_size(values) > 1)
ds_list_remove(values, key);
else
prop.is_anim = false;
static removeKey = function(key) {
if(array_length(values) > 1) array_remove(values, key);
else prop.is_anim = false;
updateKeyMap();
} #endregion
}
static serialize = function(scale = false) { #region
static serialize = function(scale = false) {
var _data = [];
for(var i = 0; i < ds_list_size(values); i++) {
for(var i = 0; i < array_length(values); i++) {
var _value_list = [];
if(scale)
_value_list[0] = values[| i].time / (TOTAL_FRAMES - 1);
else
_value_list[0] = values[| i].time;
_value_list[0] = scale? values[i].time / (TOTAL_FRAMES - 1) : values[i].time;
var val = values[| i].value;
var val = values[i].value;
if(prop.type == VALUE_TYPE.struct) {
val = json_stringify(val);
@ -617,23 +617,23 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
}
_value_list[1] = val;
_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;
_value_list[6] = values[| i].ease_y_lock;
_value_list[7] = values[| i].drivers;
_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;
_value_list[6] = values[i].ease_y_lock;
_value_list[7] = values[i].drivers;
array_push(_data, _value_list);
}
return _data;
} #endregion
}
static deserialize = function(_data, scale = false) { #region
ds_list_clear(values);
static deserialize = function(_data, scale = false) {
values = [];
if(prop.type == VALUE_TYPE.gradient && LOADING_VERSION < 1340 && !CLONING) { #region //backward compat: Gradient
if(prop.type == VALUE_TYPE.gradient && LOADING_VERSION < 1340 && !CLONING) { //backward compat: Gradient
var _val = [];
var value = _data[0][1];
@ -648,11 +648,11 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
var grad = new gradientObject();
grad.keys = _val;
ds_list_add(values, new valueKey(0, grad, self));
array_push(values, new valueKey(0, grad, self));
updateKeyMap();
return;
} #endregion
}
var base = prop.def_val;
@ -720,14 +720,11 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
vk.ease_y_lock = ease_y_lock;
struct_override(vk.drivers, driver);
ds_list_add(values, vk);
array_push(values, vk);
}
//staticValue = ds_list_empty(values)? 0 : values[| 0].value;
updateKeyMap();
} #endregion
}
static cleanUp = function() { #region
ds_list_destroy(values);
} #endregion
static cleanUp = function() {}
}

View file

@ -313,8 +313,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
process_amount = 1;
inputs_data = array_verify(inputs_data, _len);
inputs_is_array = array_verify(inputs_is_array, _len);
process_length = array_verify(process_length, _len);
all_inputs = array_verify(all_inputs, _len);
process_length = array_verify_ext(process_length, _len, function() /*=>*/ {return [ 0, 0 ]});
array_foreach(inputs, function(_in, i) /*=>*/ {
var raw = _in.getValue();
@ -342,7 +342,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
break;
}
process_length[i] = [ amo, process_amount ];
process_length[i][0] = amo;
process_length[i][1] = process_amount;
});
var amoMax = process_amount;

View file

@ -34,19 +34,19 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
#region //////////////////////////////// Dynamic IO ////////////////////////////////
static createNewInput = function(list = inputs) {
var index = ds_list_size(list);
var index = array_length(list);
var bDel = button(function() { node.deleteInput(index); })
.setIcon(THEME.minus_16, 0, COLORS._main_icon);
list[| index + 0] = nodeValue_Text("Case", self, "" )
list[index + 0] = nodeValue_Text("Case", self, "" )
.setDisplay(VALUE_DISPLAY.text_box, { side_button : bDel })
.setAnimable(false);
bDel.setContext(list[| index + 0]);
bDel.setContext(list[index + 0]);
list[| index + 1] = nodeValue("value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
list[index + 1] = nodeValue("value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
.setVisible(false, false);
return list[| index + 0];
return list[index + 0];
}
setDynamicInput(2, false);

View file

@ -297,9 +297,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static setDefault = function(vals) { #region
if(LOADING || APPENDING) return self;
ds_list_clear(animator.values);
animator.values = [];
for( var i = 0, n = array_length(vals); i < n; i++ )
ds_list_add(animator.values, new valueKey(vals[i][0], vals[i][1], animator));
array_push(animator.values, new valueKey(vals[i][0], vals[i][1], animator));
return self;
} #endregion
@ -451,27 +451,27 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
is_anim = anim;
if(is_anim) {
if(ds_list_empty(animator.values))
ds_list_add(animator.values, new valueKey(CURRENT_FRAME, animator.getValue(), animator));
animator.values[| 0].time = CURRENT_FRAME;
if(array_empty(animator.values))
array_push(animator.values, new valueKey(CURRENT_FRAME, animator.getValue(), animator));
animator.values[0].time = CURRENT_FRAME;
animator.updateKeyMap();
for( var i = 0, n = array_length(animators); i < n; i++ ) {
if(ds_list_empty(animators[i].values))
ds_list_add(animators[i].values, new valueKey(CURRENT_FRAME, animators[i].getValue(), animators[i]));
animators[i].values[| 0].time = CURRENT_FRAME;
if(array_length(animators[i].values))
array_push(animators[i].values, new valueKey(CURRENT_FRAME, animators[i].getValue(), animators[i]));
animators[i].values[0].time = CURRENT_FRAME;
animators[i].updateKeyMap();
}
} else {
var _val = animator.getValue();
ds_list_clear(animator.values);
animator.values[| 0] = new valueKey(0, _val, animator);
animator.values = [];
animator.values[0] = new valueKey(0, _val, animator);
animator.updateKeyMap();
for( var i = 0, n = array_length(animators); i < n; i++ ) {
var _val = animators[i].getValue();
ds_list_clear(animators[i].values);
animators[i].values[| 0] = new valueKey(0, _val, animators[i]);
animators[i].values = [];
animators[i].values[0] = new valueKey(0, _val, animators[i]);
animators[i].updateKeyMap();
}
}
@ -916,7 +916,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break;
case VALUE_DISPLAY.text_array :
editWidget = new textArrayBox(function() { return animator.values[| 0].value; }, display_data.data, function() { node.doUpdate(); });
editWidget = new textArrayBox(function() { return animator.values[0].value; }, display_data.data, function() { node.doUpdate(); });
break;
}
break; #endregion
@ -952,9 +952,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
editWidgetRaw = editWidget;
if(editWidget) graphWidget = editWidget.clone();
for( var i = 0, n = ds_list_size(animator.values); i < n; i++ ) {
animator.values[| i].ease_in_type = key_inter;
animator.values[| i].ease_out_type = key_inter;
for( var i = 0, n = array_length(animator.values); i < n; i++ ) {
animator.values[i].ease_in_type = key_inter;
animator.values[i].ease_out_type = key_inter;
}
setDropKey();
@ -1113,7 +1113,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return value;
}
static getStaticValue = function() { INLINE return ds_list_empty(animator.values)? 0 : animator.values[| 0].value; }
static getStaticValue = function() { INLINE return array_empty(animator.values)? 0 : animator.values[0].value; }
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
draw_junction_index = type;
@ -1295,13 +1295,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(sep_axis) {
var val = array_create(array_length(animators));
for( var i = 0, n = array_length(animators); i < n; i++ )
val[i] = animators[i].processType(animators[i].values[| 0].value);
val[i] = animators[i].processType(animators[i].values[0].value);
return val;
}
if(ds_list_empty(animator.values)) return 0;
if(array_empty(animator.values)) return 0;
return animator.processType(animator.values[| 0].value);
return animator.processType(animator.values[0].value);
}
if(sep_axis) {
@ -1328,10 +1328,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
else if(sep_axis) {
show_val = array_verify(show_val, array_length(animators));
for( var i = 0, n = array_length(animators); i < n; i++ )
show_val[i] = ds_list_empty(animators[i].values)? 0 : animators[i].processType(animators[i].values[| 0].value);
show_val[i] = array_empty(animators[i].values)? 0 : animators[i].processType(animators[i].values[0].value);
val = show_val;
} else
val = ds_list_empty(animator.values)? 0 : animator.processType(animator.values[| 0].value);
val = array_empty(animator.values)? 0 : animator.processType(animator.values[0].value);
return val;
}
@ -1355,12 +1355,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return false;
}
__is_array = false;
static isArray = function(val = undefined) {
val ??= getValue();
return __array_get_depth(val) > array_depth + type_array;
}
__is_array = false;
static arrayLength = function(val = undefined) {
val ??= getValue();
@ -1380,6 +1380,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return array_length(ar);
}
static arrayLengthSimple = function(val = undefined) {
val ??= getValue();
__is_array = is_array(val);
return __is_array? array_length(val) : -1;
}
/////============== SET =============
static onValidate = function() { #region
@ -1447,12 +1454,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
static overrideValue = function(_val) { #region
ds_list_clear(animator.values);
ds_list_add(animator.values, new valueKey(0, _val, animator));
animator.values = [];
array_push(animator.values, new valueKey(0, _val, animator));
for( var i = 0, n = array_length(animators); i < n; i++ ) {
ds_list_clear(animators[i].values);
ds_list_add(animators[i].values, new valueKey(0, array_safe_get_fast(_val, i), animators[i]));
animators[i].values = [];
array_push(animators[i].values, new valueKey(0, array_safe_get_fast(_val, i), animators[i]));
}
} #endregion

View file

@ -72,8 +72,8 @@ function NodeValue_Area(_name, _node, _value, _data = {}) : NodeValue(_name, _no
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(!is_anim) {
if(sep_axis) return array_create_ext(AREA_ARRAY_LENGTH, function(i) /*=>*/ {return animators[i].processType(animators[i].values[| 0].value)});
return ds_list_empty(animator.values)? 0 : animator.processType(animator.values[| 0].value);
if(sep_axis) return array_create_ext(AREA_ARRAY_LENGTH, function(i) /*=>*/ {return animators[i].processType(animators[i].values[0].value)});
return array_empty(animator.values)? 0 : animator.processType(animator.values[0].value);
}
if(sep_axis) {

View file

@ -13,6 +13,8 @@ function NodeValue_Bool(_name, _node, _value, _tooltip = "") : NodeValue(_name,
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -14,6 +14,8 @@ function NodeValue_Color(_name, _node, _value, _tooltip = "") : NodeValue(_name,
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -1,21 +1,5 @@
function nodeValue_D3Camera(_name, _node, _value, _tooltip = "") { return new NodeValue_D3Camera(_name, _node, _value, _tooltip); }
function NodeValue_D3Camera(_name, _node, _value, _tooltip = "") : NodeValue(_name, _node, JUNCTION_CONNECT.input, VALUE_TYPE.d3Camera, _value, _tooltip) constructor {
function NodeValue_D3Camera(_name, _node, _value, _tooltip = "") : __NodeValue_Object(_name, _node, VALUE_TYPE.d3Camera, _value, _tooltip) constructor {
animable = false;
/////============== GET =============
static valueProcess = function(value, nodeFrom = undefined, applyUnit = true, arrIndex = 0) { return value; }
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
getValueRecursive(self.__curr_get_val, _time);
var val = __curr_get_val[0];
var nod = __curr_get_val[1];
return val;
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
}
}

View file

@ -1,21 +1,5 @@
function nodeValue_D3Light(_name, _node, _value, _tooltip = "") { return new NodeValue_D3Light(_name, _node, _value, _tooltip); }
function NodeValue_D3Light(_name, _node, _value, _tooltip = "") : NodeValue(_name, _node, JUNCTION_CONNECT.input, VALUE_TYPE.d3Light, _value, _tooltip) constructor {
function NodeValue_D3Light(_name, _node, _value, _tooltip = "") : __NodeValue_Object(_name, _node, VALUE_TYPE.d3Light, _value, _tooltip) constructor {
animable = false;
/////============== GET =============
static valueProcess = function(value, nodeFrom = undefined, applyUnit = true, arrIndex = 0) { return value; }
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
getValueRecursive(self.__curr_get_val, _time);
var val = __curr_get_val[0];
var nod = __curr_get_val[1];
return val;
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
}
}

View file

@ -33,6 +33,8 @@ function NodeValue_D3Material(_name, _node, _value, _tooltip = "") : NodeValue(_
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -1,21 +1,5 @@
function nodeValue_D3Mesh(_name, _node, _value, _tooltip = "") { return new NodeValue_D3Mesh(_name, _node, _value, _tooltip); }
function NodeValue_D3Mesh(_name, _node, _value, _tooltip = "") : NodeValue(_name, _node, JUNCTION_CONNECT.input, VALUE_TYPE.d3Mesh, _value, _tooltip) constructor {
function NodeValue_D3Mesh(_name, _node, _value, _tooltip = "") : __NodeValue_Object(_name, _node, VALUE_TYPE.d3Mesh, _value, _tooltip) constructor {
animable = false;
/////============== GET =============
static valueProcess = function(value, nodeFrom = undefined, applyUnit = true, arrIndex = 0) { return value; }
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
getValueRecursive(self.__curr_get_val, _time);
var val = __curr_get_val[0];
var nod = __curr_get_val[1];
return val;
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
}
}

View file

@ -1,21 +1,5 @@
function nodeValue_D3Scene(_name, _node, _value, _tooltip = "") { return new NodeValue_D3Scene(_name, _node, _value, _tooltip); }
function NodeValue_D3Scene(_name, _node, _value, _tooltip = "") : NodeValue(_name, _node, JUNCTION_CONNECT.input, VALUE_TYPE.d3Scene, _value, _tooltip) constructor {
function NodeValue_D3Scene(_name, _node, _value, _tooltip = "") : __NodeValue_Object(_name, _node, VALUE_TYPE.d3Scene, _value, _tooltip) constructor {
animable = false;
/////============== GET =============
static valueProcess = function(value, nodeFrom = undefined, applyUnit = true, arrIndex = 0) { return value; }
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
getValueRecursive(self.__curr_get_val, _time);
var val = __curr_get_val[0];
var nod = __curr_get_val[1];
return val;
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
}
}

View file

@ -58,8 +58,8 @@ function NodeValue_Dimension(_node, value) : NodeValue("Dimension", _node, JUNCT
if(node.attributes.use_project_dimension) return PROJECT.attributes.surface_dimension;
if(!is_anim) {
if(sep_axis) return array_create_ext(2, function(i) /*=>*/ {return animators[i].processType(animators[i].values[| 0].value)});
return ds_list_empty(animator.values)? 0 : animator.processType(animator.values[| 0].value);
if(sep_axis) return array_create_ext(2, function(i) /*=>*/ {return animators[i].processType(animators[i].values[0].value)});
return array_empty(animator.values)? 0 : animator.processType(animator.values[0].value);
}
if(sep_axis) {

View file

@ -14,8 +14,10 @@ function NodeValue_Enum_Button(_name, _node, _value, _data) : NodeValue(_name, _
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}
//Replacement regex

View file

@ -14,6 +14,8 @@ function NodeValue_Enum_Scroll(_name, _node, _value, _data) : NodeValue(_name, _
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -47,6 +47,8 @@ function NodeValue_Float(_name, _node, _value, _tooltip = "") : NodeValue(_name,
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -30,6 +30,8 @@ function NodeValue_Gradient(_name, _node, _value, _tooltip = "") : NodeValue(_na
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -46,6 +46,8 @@ function NodeValue_Int(_name, _node, _value, _tooltip = "") : NodeValue(_name, _
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -25,8 +25,8 @@ function NodeValue_Padding(_name, _node, _value, _tooltip = "") : NodeValue(_nam
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(!is_anim) {
if(sep_axis) return array_create_ext(4, function(i) /*=>*/ {return animators[i].processType(animators[i].values[| 0].value)});
return ds_list_empty(animator.values)? 0 : animator.processType(animator.values[| 0].value);
if(sep_axis) return array_create_ext(4, function(i) /*=>*/ {return animators[i].processType(animators[i].values[0].value)});
return array_empty(animator.values)? 0 : animator.processType(animator.values[0].value);
}
if(sep_axis) {

View file

@ -17,6 +17,6 @@ function NodeValue_Palette(_name, _node, _value, _tooltip = "") : NodeValue(_nam
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
}

View file

@ -13,8 +13,16 @@ function NodeValue_Quaternion(_name, _node, _value, _tooltip = "") : NodeValue_A
var typ = nod == undefined? VALUE_TYPE.any : nod.type;
var dis = nod.display_type;
if(applyUnit && display_data.angle_display == QUARTERNION_DISPLAY.euler)
return quarternionFromEuler(val[0], val[1], val[2]);
if(!is_array(val)) return [ val, val, val, val ];
var _convert = applyUnit && display_data.angle_display == QUARTERNION_DISPLAY.euler;
if(!_convert) return val;
var _d = array_get_depth(val);
if(_d == 1) return quarternionFromEuler(val[0], val[1], val[2]);
if(_d == 2) return array_map(val, function(v) /*=>*/ {return quarternionFromEuler(v[0], v[1], v[2])});
return val;
}
}

View file

@ -16,8 +16,8 @@ function NodeValue_Range(_name, _node, _value, _data) : NodeValue(_name, _node,
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(!is_anim) {
if(sep_axis) return array_create_ext(2, function(i) /*=>*/ {return animators[i].processType(animators[i].values[| 0].value)});
return ds_list_empty(animator.values)? 0 : animator.processType(animator.values[| 0].value);
if(sep_axis) return array_create_ext(2, function(i) /*=>*/ {return animators[i].processType(animators[i].values[0].value)});
return array_empty(animator.values)? 0 : animator.processType(animator.values[0].value);
}
if(sep_axis) {

View file

@ -17,6 +17,8 @@ function NodeValue_Rotation(_name, _node, _value, _tooltip = "") : NodeValue(_na
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -19,6 +19,8 @@ function NodeValue_Surface(_name, _node, _value, _tooltip = "") : NodeValue(_nam
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
return ds_list_empty(animator.values)? noone : animator.values[| 0].value;
return array_empty(animator.values)? noone : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -13,6 +13,8 @@ function NodeValue_Text(_name, _node, _value, _tooltip = "") : NodeValue(_name,
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -14,6 +14,8 @@ function NodeValue_Toggle(_name, _node, _value, _data = {}) : NodeValue(_name, _
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -12,6 +12,8 @@ function NodeValue_Trigger(_name, _node, _value, _tooltip = "") : NodeValue(_nam
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
return ds_list_empty(animator.values)? 0 : animator.values[| 0].value;
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -150,6 +150,8 @@ enum LINE_STYLE {
}
function value_color(i) {
INLINE
static JUNCTION_COLORS = [
#ff9166, //int
#ffe478, //float
@ -195,9 +197,11 @@ function value_color(i) {
return JUNCTION_COLORS[i];
}
function value_color_bg(i) { return CDEF.main_dkgrey; }
function value_color_bg(i) { INLINE return CDEF.main_dkgrey; }
function value_color_bg_array(i) {
INLINE
static JUNCTION_COLORS = [
#e36956, //int
#ff9166, //float
@ -241,6 +245,8 @@ function value_color_bg_array(i) {
}
function value_bit(i) {
INLINE
switch(i) {
case VALUE_TYPE.integer : return 1 << 0 | 1 << 1;
case VALUE_TYPE.float : return 1 << 2 | 1 << 1;
@ -292,6 +298,8 @@ function value_bit(i) {
}
function value_type_directional(f, t) {
INLINE
if(f == VALUE_TYPE.surface && t == VALUE_TYPE.integer) return true;
if(f == VALUE_TYPE.surface && t == VALUE_TYPE.float) return true;
@ -317,6 +325,8 @@ function value_type_directional(f, t) {
}
function value_type_from_string(str) {
INLINE
switch(str) {
case "integer" : return VALUE_TYPE.integer;
case "float" : return VALUE_TYPE.float;
@ -369,6 +379,8 @@ function value_type_from_string(str) {
}
function value_type_direct_settable(type) {
INLINE
switch(type) {
case VALUE_TYPE.integer :
case VALUE_TYPE.float :
@ -383,6 +395,8 @@ function value_type_direct_settable(type) {
}
function typeNumeric(type) {
INLINE
switch(type) {
case VALUE_TYPE.integer :
case VALUE_TYPE.float :
@ -394,6 +408,8 @@ function typeNumeric(type) {
}
function typeArray(_type) {
INLINE
switch(_type) {
case VALUE_DISPLAY.range :
case VALUE_DISPLAY.vector_range :
@ -425,14 +441,20 @@ function typeArray(_type) {
}
function typeCompatible(fromType, toType, directional_cast = true) {
INLINE
if(value_bit(fromType) & value_bit(toType) != 0)
return true;
if(!directional_cast)
return false;
return value_type_directional(fromType, toType);
}
function typeIncompatible(from, to) {
INLINE
if(from.type == VALUE_TYPE.surface && (to.type == VALUE_TYPE.integer || to.type == VALUE_TYPE.float)) {
switch(to.display_type) {
case VALUE_DISPLAY.area :
@ -449,11 +471,14 @@ function typeIncompatible(from, to) {
}
function isGraphable(prop) {
INLINE
if(prop.type == VALUE_TYPE.integer || prop.type == VALUE_TYPE.float) {
if(prop.display_type == VALUE_DISPLAY.puppet_control)
return false;
return true;
}
if(prop.type == VALUE_TYPE.color && prop.display_type == VALUE_DISPLAY._default)
return true;
@ -461,6 +486,8 @@ function isGraphable(prop) {
}
function nodeValueUnit(_nodeValue) constructor {
INLINE
self._nodeValue = _nodeValue;
mode = VALUE_UNIT.constant;

View file

@ -56,8 +56,8 @@ function NodeValue_Vec2(_name, _node, _value, _data = {}) : NodeValue(_name, _no
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(!is_anim) {
if(sep_axis) return array_create_ext(2, function(i) /*=>*/ {return animators[i].processType(animators[i].values[| 0].value)});
return ds_list_empty(animator.values)? 0 : animator.processType(animator.values[| 0].value);
if(sep_axis) return array_create_ext(2, function(i) /*=>*/ {return animators[i].processType(animators[i].values[0].value)});
return array_empty(animator.values)? 0 : animator.processType(animator.values[0].value);
}
if(sep_axis) {

View file

@ -708,8 +708,8 @@ function Panel_Animation() : PanelContent() constructor {
for( var j = 0, m = array_length(_anims); j < m; j++ ) {
var _anim = _anims[j];
for(var k = 0; k < ds_list_size(_anim.values); k++) {
var _keyframe = _anim.values[| k];
for(var k = 0; k < array_length(_anim.values); k++) {
var _keyframe = _anim.values[k];
var t = (_keyframe.time + 1) * timeline_scale + timeline_shift;
_keyframe.dopesheet_x = t;
@ -830,13 +830,13 @@ function Panel_Animation() : PanelContent() constructor {
var _gy0 = key_y + ui(8);
var _gy1 = _gy0 + _gh;
var amo = ds_list_size(animator.values);
var amo = array_length(animator.values);
#region get range
var _prevDelt = [ 0, 0 ];
for(var k = 0; k < amo; k++) {
var key = animator.values[| k];
var key = animator.values[k];
var key_val = key.value;
var _minn = _gy_val_min;
@ -858,7 +858,7 @@ function Panel_Animation() : PanelContent() constructor {
switch(key.drivers.type) {
case DRIVER_TYPE.linear :
var nk = k + 1 < amo? animator.values[| k + 1].time : TOTAL_FRAMES;
var nk = k + 1 < amo? animator.values[k + 1].time : TOTAL_FRAMES;
var spd = key.drivers.speed * (nk - key.time);
_minn += min(spd, 0);
@ -878,7 +878,7 @@ function Panel_Animation() : PanelContent() constructor {
}
#endregion
var valArray = is_array(animator.values[| 0].value);
var valArray = is_array(animator.values[0].value);
var ox = 0;
var nx = 0;
var ny = noone;
@ -888,7 +888,7 @@ function Panel_Animation() : PanelContent() constructor {
var _kv, _kn;
var sy;
var _oy = animator.values[| 0].value;
var _oy = animator.values[0].value;
if(!valArray) _oy = [ _oy ];
var oy = array_create(array_length(_oy));
@ -896,9 +896,9 @@ function Panel_Animation() : PanelContent() constructor {
oy[ki] = value_map(_oy[ki], _gy_val_min, _gy_val_max, _gy1, _gy0);
for(var k = 0; k < amo - 1; k++) { // draw line in between
var key = animator.values[| k];
var key = animator.values[k];
var t = key.dopesheet_x;
var key_next = animator.values[| k + 1];
var key_next = animator.values[k + 1];
var dx = key_next.time - key.time;
if(key.drivers.type) { // driver
@ -996,8 +996,8 @@ function Panel_Animation() : PanelContent() constructor {
}
} // draw line in between
if(animator.prop.show_graph && ds_list_size(animator.values) > 0) { // draw line outside keyframe range
var key_first = animator.values[| 0];
if(animator.prop.show_graph && array_length(animator.values) > 0) { // draw line outside keyframe range
var key_first = animator.values[0];
var t_first = (key_first.time + 1) * timeline_scale + timeline_shift;
_kv = key_first.value;
@ -1014,10 +1014,10 @@ function Panel_Animation() : PanelContent() constructor {
sy = value_map(_kv[ki], _gy_val_min, _gy_val_max, _gy1, _gy0);
draw_line(0, sy, t_first, sy);
if(ds_list_size(animator.values) == 1) oy[ki] = sy;
if(array_length(animator.values) == 1) oy[ki] = sy;
}
var key_last = animator.values[| ds_list_size(animator.values) - 1];
var key_last = animator.values[array_length(animator.values) - 1];
var t_last = (key_last.time + 1) * timeline_scale + timeline_shift;
if(key_last.time < TOTAL_FRAMES) {
@ -1071,7 +1071,7 @@ function Panel_Animation() : PanelContent() constructor {
#region // draw key
for(var i = 0; i < amo; i++) {
var key = animator.values[| i];
var key = animator.values[i];
var px = key.dopesheet_x;
var v = key.value;
@ -1154,8 +1154,8 @@ function Panel_Animation() : PanelContent() constructor {
var _gy0 = key_y - ui(4);
var _gy1 = key_y + ui(4);
var amo = ds_list_size(prop.animator.values);
var _prevKey = prop.animator.values[| 0];
var amo = array_length(prop.animator.values);
var _prevKey = prop.animator.values[0];
draw_set_color(_prevKey.value);
draw_rectangle(0, _gy0, _prevKey.dopesheet_x, _gy1, 0);
@ -1163,8 +1163,8 @@ function Panel_Animation() : PanelContent() constructor {
var ox, nx, oc, nc;
for(var k = 0; k < amo - 1; k++) {
var key = prop.animator.values[| k];
var key_next = prop.animator.values[| k + 1];
var key = prop.animator.values[k];
var key_next = prop.animator.values[k + 1];
var dx = key_next.time - key.time;
var _step = 1 / dx;
@ -1180,7 +1180,7 @@ function Panel_Animation() : PanelContent() constructor {
}
}
key_next = prop.animator.values[| ds_list_size(prop.animator.values) - 1];
key_next = prop.animator.values[array_length(prop.animator.values) - 1];
if(key_next.time < TOTAL_FRAMES) {
draw_set_color(key_next.value);
draw_rectangle(key_next.dopesheet_x, _gy0, bar_show_w, _gy1, 0);
@ -1232,8 +1232,8 @@ function Panel_Animation() : PanelContent() constructor {
if(!prop.show_graphs[i]) continue;
var animator = prop.animators[i];
for(var k = 0; k < ds_list_size(animator.values); k++) {
var key_val = animator.values[| k].value;
for(var k = 0; k < array_length(animator.values); k++) {
var key_val = animator.values[k].value;
if(is_array(key_val)) {
for( var ki = 0; ki < array_length(key_val); ki++ ) {
_min = min(_min, key_val[ki]);
@ -1326,7 +1326,7 @@ function Panel_Animation() : PanelContent() constructor {
key_hover = key;
draw_sprite_ui_uniform(THEME.timeline_key_ease, 0, _tx, prop_dope_y, 1, COLORS.panel_animation_keyframe_selected);
if(mouse_press(mb_left, pFOCUS) && !key_mod_press(SHIFT)) {
keyframe_dragging = animator.values[| k];
keyframe_dragging = animator.values[k];
keyframe_drag_type = KEYFRAME_DRAG_TYPE.ease_in;
}
} else
@ -1342,7 +1342,7 @@ function Panel_Animation() : PanelContent() constructor {
key_hover = key;
draw_sprite_ui_uniform(THEME.timeline_key_ease, 1, _tx, prop_dope_y, 1, COLORS.panel_animation_keyframe_selected);
if(mouse_press(mb_left, pFOCUS) && !key_mod_press(SHIFT)) {
keyframe_dragging = animator.values[| k];
keyframe_dragging = animator.values[k];
keyframe_drag_type = KEYFRAME_DRAG_TYPE.ease_out;
}
} else
@ -1362,8 +1362,8 @@ function Panel_Animation() : PanelContent() constructor {
var anim_set = true;
var key_hover = noone;
for(var k = 0; k < ds_list_size(animator.values); k++) {
var keyframe = animator.values[| k];
for(var k = 0; k < array_length(animator.values); k++) {
var keyframe = animator.values[k];
var t = keyframe.dopesheet_x;
for( var j = 0, n = array_length(_cont.contexts); j < n; j++ ) {
@ -1382,7 +1382,7 @@ function Panel_Animation() : PanelContent() constructor {
if(k == 0)
animator.prop.loop_range = -1;
else
animator.prop.loop_range = ds_list_size(animator.values) - k;
animator.prop.loop_range = array_length(animator.values) - k;
anim_set = false;
}
@ -1519,8 +1519,8 @@ function Panel_Animation() : PanelContent() constructor {
tx = tool_width - ui(20 + 16 * 3);
if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 0, [COLORS._main_icon, COLORS._main_icon_on_inner], _tool_a) == 2) {
var _t = -1;
for(var k = 0; k < ds_list_size(animator.values); k++) {
var _key = animator.values[| k];
for(var k = 0; k < array_length(animator.values); k++) {
var _key = animator.values[k];
if(_key.time < CURRENT_FRAME)
_t = _key.time;
}
@ -1529,8 +1529,8 @@ function Panel_Animation() : PanelContent() constructor {
tx = tool_width - ui(20 + 16 * 1);
if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 2, [COLORS._main_icon, COLORS._main_icon_on_inner], _tool_a) == 2) {
for(var k = 0; k < ds_list_size(animator.values); k++) {
var _key = animator.values[| k];
for(var k = 0; k < array_length(animator.values); k++) {
var _key = animator.values[k];
if(_key.time > CURRENT_FRAME) {
PROJECT.animator.setFrame(_key.time);
break;
@ -1543,20 +1543,20 @@ function Panel_Animation() : PanelContent() constructor {
tx = tool_width - ui(20 + 16 * 2);
if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 1, [COLORS._main_accent, COLORS._main_icon_on_inner], _tool_a) == 2) {
var _add = false;
for(var k = 0; k < ds_list_size(animator.values); k++) {
var _key = animator.values[| k];
for(var k = 0; k < array_length(animator.values); k++) {
var _key = animator.values[k];
if(_key.time == CURRENT_FRAME) {
if(ds_list_size(animator.values) > 1)
ds_list_delete(animator.values, k);
if(array_length(animator.values) > 1)
array_delete(animator.values, k, 1);
_add = true;
break;
} else if(_key.time > CURRENT_FRAME) {
ds_list_insert(animator.values, k, new valueKey(CURRENT_FRAME, variable_clone(animator.getValue()), animator));
array_insert(animator.values, k, new valueKey(CURRENT_FRAME, variable_clone(animator.getValue()), animator));
_add = true;
break;
}
}
if(!_add) ds_list_add(animator.values, new valueKey(CURRENT_FRAME, variable_clone(animator.getValue(, false)), animator));
if(!_add) array_push(animator.values, new valueKey(CURRENT_FRAME, variable_clone(animator.getValue(, false)), animator));
}
#endregion
@ -2335,14 +2335,14 @@ function Panel_Animation() : PanelContent() constructor {
var in = _node.inputs[i];
if(!in.is_anim) continue;
for(var j = 0; j < ds_list_size(in.animator.values); j++) {
var t = in.animator.values[| j];
for(var j = 0; j < array_length(in.animator.values); j++) {
var t = in.animator.values[j];
t.time = t.ratio * (len - 1);
}
for( var k = 0; k < array_length(in.animators); k++ )
for(var j = 0; j < ds_list_size(in.animators[k].values); j++) {
var t = in.animators[k].values[| j];
for(var j = 0; j < array_length(in.animators[k].values); j++) {
var t = in.animators[k].values[j];
t.time = t.ratio * (len - 1);
}
}

View file

@ -31,8 +31,8 @@ function Panel_Animation_Scaler() : Panel_Linear_Setting() constructor {
for(var i = 0; i < array_length(_node.inputs); i++) {
var in = _node.inputs[i];
if(!in.is_anim) continue;
for(var j = 0; j < ds_list_size(in.animator.values); j++) {
var t = in.animator.values[| j];
for(var j = 0; j < array_length(in.animator.values); j++) {
var t = in.animator.values[j];
t.time = t.ratio * scale_to;
}
}

View file

@ -38,6 +38,7 @@
load_layout = false;
previewNode = "";
previewGrid = {
show : false,
snap : false,
@ -218,6 +219,9 @@
_map.global_node = globalNode.serialize();
_map.onion_skin = onion_skin;
var _prev_node = PANEL_PREVIEW? PANEL_PREVIEW.getNodePreview() : noone;
_map.previewNode = _prev_node? _prev_node.node_id : noone;
_map.previewGrid = previewGrid;
_map.graphGrid = graphGrid;
_map.attributes = attributes;
@ -258,7 +262,10 @@
}
if(struct_has(_map, "onion_skin")) struct_override(onion_skin, _map.onion_skin);
previewNode = struct_try_get(_map, "previewNode", noone);
if(struct_has(_map, "previewGrid")) struct_override(previewGrid, _map.previewGrid);
if(struct_has(_map, "graphGrid")) struct_override(graphGrid, _map.graphGrid);
if(struct_has(_map, "attributes")) struct_override(attributes, _map.attributes);
if(struct_has(_map, "metadata")) meta.deserialize(_map.metadata);
@ -287,6 +294,15 @@
addons = _addon;
struct_foreach(_addon, function(_name, _value) { addonLoad(_name, false); });
}
if(PANEL_PREVIEW && previewNode != "") {
var _node = nodeMap[? previewNode];
if(_node) PANEL_PREVIEW.setNodePreview(_node);
}
}
static postDeserialize = function() {
}
}