strip duplicated serial

This commit is contained in:
Tanasart 2024-11-23 18:08:44 +07:00
parent e842d9dc54
commit ef8270fc1e
23 changed files with 373 additions and 371 deletions

View file

@ -286,7 +286,7 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
var _camera = params.camera; var _camera = params.camera;
var _qview = new BBMOD_Quaternion().FromEuler(_camera.focus_angle_y, -_camera.focus_angle_x, 0); var _qview = new BBMOD_Quaternion().FromEuler(_camera.focus_angle_y, -_camera.focus_angle_x, 0);
var _ang = inputs[index].display_data.angle_display; var _ang = inputs[index].attributes.angle_display;
var _quat = _ang == QUARTERNION_DISPLAY.quarterion; var _quat = _ang == QUARTERNION_DISPLAY.quarterion;
var _global = _quat? tool_attribute.context : 1; var _global = _quat? tool_attribute.context : 1;

View file

@ -818,24 +818,24 @@
if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return undefined; if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return undefined;
var node = PROJECT.nodeNameMap[? nodeId]; var node = PROJECT.nodeNameMap[? nodeId];
if(!ds_map_exists(node.inputMap, input)) return undefined; if(!struct_has(node.inputMap, input)) return undefined;
return node.inputMap[? input].getValue(); return node.inputMap[$ input].getValue();
}], }],
[ "node_set_input_value", function(nodeId, input, value) { [ "node_set_input_value", function(nodeId, input, value) {
if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return undefined; if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return undefined;
var node = PROJECT.nodeNameMap[? nodeId]; var node = PROJECT.nodeNameMap[? nodeId];
if(!ds_map_exists(node.inputMap, input)) return undefined; if(!struct_has(node.inputMap, input)) return undefined;
return node.inputMap[? input].setValue(value); return node.inputMap[$ input].setValue(value);
}], }],
[ "node_get_output_value", function(nodeId, input) { [ "node_get_output_value", function(nodeId, input) {
if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return undefined; if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return undefined;
var node = PROJECT.nodeNameMap[? nodeId]; var node = PROJECT.nodeNameMap[? nodeId];
if(!ds_map_exists(node.outputMap, input)) return undefined; if(!struct_has(node.outputMap, input)) return undefined;
return node.outputMap[? input].getValue(); return node.outputMap[$ input].getValue();
}], }],
[ "element_get", function() { [ "element_get", function() {

View file

@ -43,7 +43,7 @@
LATEST_VERSION = 1_18_00_0; LATEST_VERSION = 1_18_00_0;
VERSION = 1_18_04_0; VERSION = 1_18_04_0;
SAVE_VERSION = 1_18_02_0; SAVE_VERSION = 1_18_04_0;
VERSION_STRING = MAC? "1.18.003m" : "1.18.5.003"; VERSION_STRING = MAC? "1.18.003m" : "1.18.5.003";
BUILD_NUMBER = 1_18_04_1; BUILD_NUMBER = 1_18_04_1;

View file

@ -24,14 +24,14 @@ function Node_VCT(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) const
newInput(index, nodeValue(name, self, CONNECT_TYPE.input, _var.type, 0)) newInput(index, nodeValue(name, self, CONNECT_TYPE.input, _var.type, 0))
.setDisplay(_var.disp, _var.disp_data); .setDisplay(_var.disp, _var.disp_data);
inputs[index].display_data.key = key; inputs[index].attributes.key = key;
array_append(input_display_list, [ index ]); array_append(input_display_list, [ index ]);
} }
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) {
for( var i = 1; i < array_length(_data); i++ ) for( var i = 1; i < array_length(_data); i++ )
vct[$ inputs[i].display_data.key].setDirect(_data[i]); vct[$ inputs[i].attributes.key].setDirect(_data[i]);
var params = { var params = {
frame: CURRENT_FRAME frame: CURRENT_FRAME
@ -50,8 +50,5 @@ function Node_VCT(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) const
static postDeserialize = function() { static postDeserialize = function() {
vct.deserialize(load_map.vct); vct.deserialize(load_map.vct);
//for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
// createNewInput(_inputs[i].display_data.key);
} }
} }

View file

@ -40,7 +40,7 @@
if(is_array(_setVals)) { if(is_array(_setVals)) {
for(var j = 0, m = array_length(_setVals); j < m; j++ ) { for(var j = 0, m = array_length(_setVals); j < m; j++ ) {
var _setVal = _setVals[j]; var _setVal = _setVals[j];
var _input = is_string(_setVal.index)? _node.inputMap[? _setVal.index] : _node.inputs[_setVal.index]; var _input = is_string(_setVal.index)? _node.inputMap[$ _setVal.index] : _node.inputs[_setVal.index];
if(_input == undefined) continue; if(_input == undefined) continue;
if(!value_type_direct_settable(_input.type)) continue; if(!value_type_direct_settable(_input.type)) continue;
@ -75,8 +75,8 @@
var _toN = _n[$ _c.to]; var _toN = _n[$ _c.to];
if(_frN == undefined || _toN == undefined) continue; if(_frN == undefined || _toN == undefined) continue;
var _frO = is_string(_c.fromIndex)? _frN.outputMap[? _c.fromIndex] : _frN.outputs[_c.fromIndex]; var _frO = is_string(_c.fromIndex)? _frN.outputMap[$ _c.fromIndex] : _frN.outputs[_c.fromIndex];
var _toI = is_string(_c.toIndex)? _toN.inputMap[? _c.toIndex] : _toN.inputs[_c.toIndex]; var _toI = is_string(_c.toIndex)? _toN.inputMap[$ _c.toIndex] : _toN.inputs[_c.toIndex];
if(_frO == undefined || _toI == undefined) continue; if(_frO == undefined || _toI == undefined) continue;
_toI.setFrom(_frO); _toI.setFrom(_frO);

View file

@ -29,7 +29,7 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
newInput(index, nodeValue(bone != noone? bone.name : "bone", self, CONNECT_TYPE.input, VALUE_TYPE.float, [ 0, 0, 0, 1 ] )) newInput(index, nodeValue(bone != noone? bone.name : "bone", self, CONNECT_TYPE.input, VALUE_TYPE.float, [ 0, 0, 0, 1 ] ))
.setDisplay(VALUE_DISPLAY.transform); .setDisplay(VALUE_DISPLAY.transform);
inputs[index].display_data.bone_id = bone != noone? bone.ID : noone; inputs[index].attributes.bone_id = bone != noone? bone.ID : noone;
if(bone != noone) boneMap[$ bone.ID] = inputs[index]; if(bone != noone) boneMap[$ bone.ID] = inputs[index];
@ -296,9 +296,11 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
static postApplyDeserialize = function() { static postApplyDeserialize = function() {
for( var i = input_fix_len; i < array_length(inputs); i += data_length ) { for( var i = input_fix_len; i < array_length(inputs); i += data_length ) {
var inp = inputs[i]; var inp = inputs[i];
var idx = struct_try_get(inp.display_data, "bone_id"); var idx = LOADING_VERSION < 1_18_04_0? struct_try_get(inp.display_data, "bone_id", 0) :
struct_try_get(inp.attributes, "bone_id", 0);
boneMap[$ idx] = inp; boneMap[$ idx] = inp;
inp.attributes.bone_id = idx;
} }
setBone(); setBone();

View file

@ -8,11 +8,11 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr
newInput(2, nodeValue_Float("Location", self, 0)) newInput(2, nodeValue_Float("Location", self, 0))
.setDisplay(VALUE_DISPLAY._default, { unit: 0, side_button: button(function() { .setDisplay(VALUE_DISPLAY._default, { unit: 0, side_button: button(function() {
inputs[2].display_data.unit = (inputs[2].display_data.unit + 1) % 3; inputs[2].attributes.unit = (inputs[2].attributes.unit + 1) % 3;
inputs[2].display_data.side_button.tooltip.index = inputs[2].display_data.unit; inputs[2].display_data.side_button.tooltip.index = inputs[2].attributes.unit;
update(); update();
}).setTooltip( new tooltipSelector("Unit", [ "Bit", "Second", "Progress" ]) ) }).setTooltip( new tooltipSelector("Unit", [ "Bit", "Second", "Progress" ]) )
.setIcon( THEME.unit_audio, [ function() { return inputs[2].display_data.unit; } ], COLORS._main_icon ) .setIcon( THEME.unit_audio, [ function() { return inputs[2].attributes.unit; } ], COLORS._main_icon )
} }
); );
@ -50,7 +50,7 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var _stp = getInputData(4); _stp = max(1, _stp); var _stp = getInputData(4); _stp = max(1, _stp);
var _anim = getInputData(5); var _anim = getInputData(5);
var _unit = inputs[2].display_data.unit; var _unit = inputs[2].attributes.unit;
var off = 0, st = 0, ed = 1, len = 1; var off = 0, st = 0, ed = 1, len = 1;
var _ch = _aud.getChannel(); var _ch = _aud.getChannel();

View file

@ -106,9 +106,6 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection(_x, _y, _group) con
array_push(canvases, _node); array_push(canvases, _node);
else if(is_instanceof(_node, Node_Composite)) else if(is_instanceof(_node, Node_Composite))
composite = _node; composite = _node;
_node.modifiable = false;
_node.modify_parent = self;
} }
refreshLayer(); refreshLayer();
@ -152,9 +149,6 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection(_x, _y, _group) con
} }
static onAdd = function(node) { static onAdd = function(node) {
node.modifiable = false;
node.modify_parent = self;
if(is_instanceof(node, Node_Canvas)) { if(is_instanceof(node, Node_Canvas)) {
array_push(canvases, node); array_push(canvases, node);
node.timeline_item.removeSelf(); node.timeline_item.removeSelf();

View file

@ -172,6 +172,7 @@ function upgroupNode(collection, record = true) {
function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
nodes = []; nodes = [];
node_length = 0; node_length = 0;
modifiable = true;
ungroupable = true; ungroupable = true;
auto_render_time = false; auto_render_time = false;

View file

@ -47,10 +47,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
inline_context = noone; inline_context = noone;
inline_parent_object = ""; inline_parent_object = "";
modifiable = true;
modify_parent = noone;
search_match = -9999; search_match = -9999;
onDoubleClick = -1; onDoubleClick = -1;
is_controller = false; is_controller = false;
#endregion #endregion
@ -70,10 +67,10 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
PROJECT.nodeMap[? node_id] = self; PROJECT.nodeMap[? node_id] = self;
PROJECT.modified = true; PROJECT.modified = true;
run_in(1, function() { run_in(1, function() /*=>*/ {
resetInternalName(); resetInternalName();
if(renamed) return; if(renamed) return;
display_name = __txt_node_name(instanceof(self), name); display_name = __txt_node_name(instanceof(self), name);
if(!LOCALE_DEF || TESTING) renamed = true; if(!LOCALE_DEF || TESTING) renamed = true;
}); });
@ -94,18 +91,17 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
internalName = ""; internalName = "";
onSetDisplayName = noone; onSetDisplayName = noone;
renamed = false; renamed = false;
tooltip = ""; tooltip = "";
x = _x; x = _x;
y = _y; y = _y;
name_height = ui(16);
w = 128; w = 128;
h = 128; h = 128;
min_w = w; min_w = w;
con_h = 128; con_h = 128;
h_param = h; h_param = h;
name_height = ui(16);
preserve_height_for_preview = false; preserve_height_for_preview = false;
selectable = true; selectable = true;
@ -141,8 +137,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
inputs = []; inputs = [];
outputs = []; outputs = [];
input_bypass = []; input_bypass = [];
inputMap = ds_map_create(); inputMap = {};
outputMap = ds_map_create(); outputMap = {};
input_value_map = {}; input_value_map = {};
use_display_list = true; use_display_list = true;
@ -235,8 +231,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
["Update trigger", function() /*=>*/ {return attributes.show_update_trigger}, new checkBox(function() /*=>*/ { attributes.show_update_trigger = !attributes.show_update_trigger; }) ], ["Update trigger", function() /*=>*/ {return attributes.show_update_trigger}, new checkBox(function() /*=>*/ { attributes.show_update_trigger = !attributes.show_update_trigger; }) ],
["Output metadata", function() /*=>*/ {return attributes.outp_meta}, new checkBox(function() /*=>*/ { attributes.outp_meta = !attributes.outp_meta; setHeight(); }) ], ["Output metadata", function() /*=>*/ {return attributes.outp_meta}, new checkBox(function() /*=>*/ { attributes.outp_meta = !attributes.outp_meta; setHeight(); }) ],
]; ];
bufferStore = {};
#endregion #endregion
#region ---- preview ---- #region ---- preview ----
@ -256,9 +250,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
preview_index = 0; preview_index = 0;
preview_channel = 0; preview_channel = 0;
preview_alpha = 1; preview_alpha = 1;
preview_x = 0; preview_x = 0;
preview_y = 0; preview_y = 0;
preview_mx = 0; preview_mx = 0;
preview_my = 0; preview_my = 0;
@ -281,11 +275,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
topoSorted = false; topoSorted = false;
temp_surface = []; temp_surface = [];
force_requeue = false; force_requeue = false;
is_simulation = false;
is_simulation = false;
is_group_io = false;
in_VFX = false; in_VFX = false;
is_group_io = false;
#endregion #endregion
#region ---- timeline ---- #region ---- timeline ----
@ -296,7 +290,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
#region ---- notification ---- #region ---- notification ----
value_validation = array_create(3); value_validation = array_create(3);
manual_updated = false; manual_updated = false;
#endregion #endregion
@ -2234,21 +2227,38 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(!preset) { if(!preset) {
_map.id = node_id; _map.id = node_id;
_map.render = renderActive;
_map.name = display_name; _map.name = display_name;
_map.iname = internalName; _map.iname = internalName;
_map.x = x; _map.x = x;
_map.y = y; _map.y = y;
_map.type = instanceof(self); _map.type = instanceof(self);
_map.group = group == noone? group : group.node_id; if(isTool) _map.tool = isTool;
_map.tool = isTool; if(group != noone) _map.group = group.node_id;
_map.previewable = previewable; if(!renderActive) _map.render = renderActive;
_map.show_parameter = show_parameter; if(!previewable) _map.previewable = previewable;
if(show_parameter) _map.show_parameter = show_parameter;
} }
var _attr = attributeSerialize(); var _attr = attributeSerialize();
_map.attri = struct_append(attributes, _attr); var attri = struct_append(variable_clone(attributes), _attr);
#region attribute stripping
if(struct_try_get(attri, "color_depth") == 3) struct_remove(attri, "color_depth");
if(struct_try_get(attri, "interpolate") == 1) struct_remove(attri, "interpolate");
if(struct_try_get(attri, "oversample") == 1) struct_remove(attri, "oversample");
if(struct_try_get(attri, "node_width") == 0) struct_remove(attri, "node_width");
if(struct_try_get(attri, "node_height") == 0) struct_remove(attri, "node_height");
if(struct_try_get(attri, "node_param_width") == 192) struct_remove(attri, "node_param_width");
if(struct_try_get(attri, "annotation") == "") struct_remove(attri, "annotation");
if(struct_try_get(attri, "outp_meta") == false) struct_remove(attri, "outp_meta");
if(struct_try_get(attri, "color") == -1) struct_remove(attri, "color");
if(struct_try_get(attri, "update_graph") == true) struct_remove(attri, "update_graph");
if(struct_try_get(attri, "show_update_trigger") == false) struct_remove(attri, "show_update_trigger");
if(struct_try_get(attri, "array_process") == 0) struct_remove(attri, "array_process");
if(struct_names_count(attri)) _map.attri = attri;
#endregion
if(is_dynamic_input) { if(is_dynamic_input) {
_map.input_fix_len = input_fix_len; _map.input_fix_len = input_fix_len;
@ -2276,15 +2286,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
_outData[i] = junc_meta[i].serialize(scale, preset); _outData[i] = junc_meta[i].serialize(scale, preset);
_map.inspectInputs = _trigger; _map.inspectInputs = _trigger;
_map.outputMeta = _outMeta; if(!array_empty(_outMeta)) _map.outputMeta = _outMeta;
_map.renamed = renamed; if(renamed) _map.renamed = renamed;
_map.buffer = {};
var _bufferKey = struct_key(bufferStore);
for( var i = 0, n = array_length(_bufferKey); i < n; i++ ) {
var _key = _bufferKey[i];
_map.buffer[$ _key] = buffer_serialize(bufferStore[$ _key]);
}
doSerialize(_map); doSerialize(_map);
processSerialize(_map); processSerialize(_map);
@ -2324,22 +2327,27 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
x = struct_try_get(load_map, "x"); x = struct_try_get(load_map, "x");
y = struct_try_get(load_map, "y"); y = struct_try_get(load_map, "y");
renderActive = struct_try_get(load_map, "render", true); renderActive = struct_try_get(load_map, "render", true);
previewable = struct_try_get(load_map, "previewable", previewable); previewable = struct_try_get(load_map, "previewable", true);
isTool = struct_try_get(load_map, "tool"); isTool = struct_try_get(load_map, "tool", false);
show_parameter = struct_try_get(load_map, "show_parameter"); show_parameter = struct_try_get(load_map, "show_parameter", false);
} }
if(struct_has(load_map, "attri")) if(struct_has(load_map, "attri")) {
attributeDeserialize(CLONING? variable_clone(load_map.attri) : load_map.attri); var _lattr = load_map.attri;
_lattr.color_depth = struct_try_get(_lattr, "color_depth", 3);
_lattr.interpolate = struct_try_get(_lattr, "interpolate", 1);
_lattr.oversample = struct_try_get(_lattr, "oversample", 1);
_lattr.node_width = struct_try_get(_lattr, "node_width", 0);
_lattr.node_height = struct_try_get(_lattr, "node_height", 0);
_lattr.node_param_width = struct_try_get(_lattr, "node_param_width", 192);
_lattr.annotation = struct_try_get(_lattr, "annotation", "");
_lattr.outp_meta = struct_try_get(_lattr, "outp_meta", false);
_lattr.color = struct_try_get(_lattr, "color", -1);
_lattr.update_graph = struct_try_get(_lattr, "update_graph", true);
_lattr.show_update_trigger = struct_try_get(_lattr, "show_update_trigger", false);
_lattr.array_process = struct_try_get(_lattr, "array_process", 0);
if(struct_has(load_map, "buffer")) { attributeDeserialize(CLONING? variable_clone(_lattr) : _lattr);
var _bufferKey = struct_key(bufferStore);
for( var i = 0, n = array_length(_bufferKey); i < n; i++ ) {
var _key = _bufferKey[i];
if(!struct_has(bufferStore, _key)) continue;
bufferStore[$ _key] = buffer_deserialize(load_map.buffer[$ _key]);
}
} }
if(is_dynamic_input) { if(is_dynamic_input) {
@ -2404,7 +2412,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
} }
static attributeDeserialize = function(attr) { static attributeDeserialize = function(attr) {
struct_append(attributes, attr); struct_override(attributes, attr);
if(!CLONING && LOADING_VERSION < 1_18_02_0) { if(!CLONING && LOADING_VERSION < 1_18_02_0) {
if(struct_has(attr, "color_depth")) attributes.color_depth += (!array_empty(inputs) && inputs[0].type == VALUE_TYPE.surface)? 1 : 2; if(struct_has(attr, "color_depth")) attributes.color_depth += (!array_empty(inputs) && inputs[0].type == VALUE_TYPE.surface)? 1 : 2;
@ -2520,9 +2528,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
for( var i = 0; i < array_length(outputs); i++ ) for( var i = 0; i < array_length(outputs); i++ )
outputs[i].cleanUp(); outputs[i].cleanUp();
ds_map_destroy(inputMap);
ds_map_destroy(outputMap);
for( var i = 0, n = array_length(temp_surface); i < n; i++ ) for( var i = 0, n = array_length(temp_surface); i < n; i++ )
surface_free(temp_surface[i]); surface_free(temp_surface[i]);

View file

@ -35,7 +35,7 @@ function Node_DynaSurf_In(_x, _y, _group = noone) : Node(_x, _y, _group) constru
if(inParent.name != display_name) { if(inParent.name != display_name) {
inParent.name = display_name; inParent.name = display_name;
group.inputMap[? string_replace_all(display_name, " ", "_")] = inParent; group.inputMap[$ string_replace_all(display_name, " ", "_")] = inParent;
} }
} #endregion } #endregion

View file

@ -410,7 +410,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
if(inParent.name != display_name) { if(inParent.name != display_name) {
inParent.name = display_name; inParent.name = display_name;
group.inputMap[? string_replace_all(display_name, " ", "_")] = inParent; group.inputMap[$ string_replace_all(display_name, " ", "_")] = inParent;
} }
if(inParent.type == VALUE_TYPE.trigger) { if(inParent.type == VALUE_TYPE.trigger) {

View file

@ -210,7 +210,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
return _f.lerpTo(_t, _lrp); return _f.lerpTo(_t, _lrp);
} }
if(prop.display_type == VALUE_DISPLAY.d3quarternion && prop.display_data.angle_display == QUARTERNION_DISPLAY.quarterion) if(prop.display_type == VALUE_DISPLAY.d3quarternion && prop.attributes.angle_display == QUARTERNION_DISPLAY.quarterion)
return quarternionArraySlerp(_f, _t, _lrp); return quarternionArraySlerp(_f, _t, _lrp);
if(prop.type == VALUE_TYPE.color) { if(prop.type == VALUE_TYPE.color) {
@ -596,7 +596,8 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
var _value_list = []; var _value_list = [];
_value_list[0] = scale? values[i].time / (TOTAL_FRAMES - 1) : values[i].time; _value_list[0] = scale? values[i].time / (TOTAL_FRAMES - 1) : values[i].time;
var val = values[i].value; var _v = values[i];
var val = _v.value;
if(prop.type == VALUE_TYPE.struct) { if(prop.type == VALUE_TYPE.struct) {
val = json_stringify(val); val = json_stringify(val);
@ -617,22 +618,26 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
} }
_value_list[1] = val; _value_list[1] = val;
_value_list[2] = values[i].ease_in; _value_list[2] = _v.ease_in;
_value_list[3] = values[i].ease_out; _value_list[3] = _v.ease_out;
_value_list[4] = values[i].ease_in_type; _value_list[4] = _v.ease_in_type;
_value_list[5] = values[i].ease_out_type; _value_list[5] = _v.ease_out_type;
_value_list[6] = values[i].ease_y_lock; _value_list[6] = _v.ease_y_lock;
_value_list[7] = values[i].drivers; _value_list[7] = _v.drivers.type == DRIVER_TYPE.none? 0 : _v.drivers;
array_push(_data, _value_list); array_push(_data, _value_list);
} }
if(array_length(values) == 1)
return { d: _data[0][1] };
return _data; return _data;
} }
static deserialize = function(_data, scale = false) { static deserialize = function(_data, scale = false) {
values = []; values = [];
if(is_struct(_data)) _data = [ [ 0, _data.d ] ];
if(prop.type == VALUE_TYPE.gradient && LOADING_VERSION < 1340 && !CLONING) { //backward compat: Gradient if(prop.type == VALUE_TYPE.gradient && LOADING_VERSION < 1340 && !CLONING) { //backward compat: Gradient
var _val = []; var _val = [];
var value = _data[0][1]; var value = _data[0][1];
@ -664,12 +669,12 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
_time = round(_time * (TOTAL_FRAMES - 1)); _time = round(_time * (TOTAL_FRAMES - 1));
var value = array_safe_get_fast(_keyframe, 1); var value = array_safe_get_fast(_keyframe, 1);
var ease_in = array_safe_get_fast(_keyframe, 2); var ease_in = array_safe_get_fast(_keyframe, 2, [0, 1]);
var ease_out = array_safe_get_fast(_keyframe, 3); var ease_out = array_safe_get_fast(_keyframe, 3, [0, 0]);
var ease_in_type = array_safe_get_fast(_keyframe, 4); var ease_in_type = array_safe_get_fast(_keyframe, 4, 0);
var ease_out_type = array_safe_get_fast(_keyframe, 5); var ease_out_type = array_safe_get_fast(_keyframe, 5, 0);
var ease_y_lock = array_safe_get_fast(_keyframe, 6, true); var ease_y_lock = array_safe_get_fast(_keyframe, 6, 1);
var driver = array_safe_get_fast(_keyframe, 7, {}); var driver = array_safe_get_fast(_keyframe, 7, 0);
var _val = value; var _val = value;
@ -718,7 +723,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
vk.ease_in_type = ease_in_type; vk.ease_in_type = ease_in_type;
vk.ease_out_type = ease_out_type; vk.ease_out_type = ease_out_type;
vk.ease_y_lock = ease_y_lock; vk.ease_y_lock = ease_y_lock;
struct_override(vk.drivers, driver); if(is_struct(driver)) struct_override(vk.drivers, driver);
array_push(values, vk); array_push(values, vk);
} }

View file

@ -4,7 +4,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
setDimension(96, 32 + 24 * 1); setDimension(96, 32 + 24 * 1);
wd_slider = slider(0, 1, 0.01, function(val) { inputs[0].setValue(val); } ); // wd_slider = slider(0, 1, 0.01, function(val) { inputs[0].setValue(val); } );
slider_value = -1; slider_value = -1;
slider_surface = -1; slider_surface = -1;

View file

@ -407,14 +407,6 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
static postPostProcess = function() {} static postPostProcess = function() {}
static processSerialize = function(_map) {
_map.array_process = attributes.array_process;
}
static processDeserialize = function() {
attributes.array_process = struct_try_get(load_map, "array_process", ARRAY_PROCESS.loop);
}
///////////////////// CACHE ///////////////////// ///////////////////// CACHE /////////////////////
static cacheCurrentFrameIndex = function(_aindex, _surface) { static cacheCurrentFrameIndex = function(_aindex, _surface) {

View file

@ -14,7 +14,7 @@ function nodeValueSeed(_node, _type = VALUE_TYPE.float, _name = "Seed") {
function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constructor { function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constructor {
static DISPLAY_DATA_KEYS = [ "linked", "angle_display", "bone_id", "unit", "atlas_crop" ]; static DISPLAY_DATA_KEYS = [ "atlas_crop" ];
#region ---- main ---- #region ---- main ----
active = true; active = true;
@ -38,8 +38,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
name_custom = false; name_custom = false;
if(struct_has(node, "inputMap")) { if(struct_has(node, "inputMap")) {
if(_connect == CONNECT_TYPE.input) node.inputMap[? internalName] = self; if(_connect == CONNECT_TYPE.input) node.inputMap[$ internalName] = self;
else if(_connect == CONNECT_TYPE.output) node.outputMap[? internalName] = self; else if(_connect == CONNECT_TYPE.output) node.outputMap[$ internalName] = self;
} }
tooltip = _tooltip; tooltip = _tooltip;
@ -87,7 +87,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
is_anim = false; is_anim = false;
sep_axis = false; sep_axis = false;
animable = true; animable = true;
on_end = KEYFRAME_END.hold; on_end = KEYFRAME_END.hold;
loop_range = -1; loop_range = -1;
#endregion #endregion
@ -112,8 +111,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
def_depth = array_get_depth(def_val); def_depth = array_get_depth(def_val);
unit = new nodeValueUnit(self); unit = new nodeValueUnit(self);
def_unit = VALUE_UNIT.constant; def_unit = VALUE_UNIT.constant;
dyna_depo = ds_list_create();
value_tag = "";
is_modified = false; is_modified = false;
cache_value = [ false, false, undefined, undefined ]; cache_value = [ false, false, undefined, undefined ];
@ -790,7 +787,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
editWidget = new quarternionBox(function(val, index) { return setValueInspector(val, index); }); editWidget = new quarternionBox(function(val, index) { return setValueInspector(val, index); });
extract_node = "Node_Vector4"; extract_node = "Node_Vector4";
display_data.angle_display = QUARTERNION_DISPLAY.euler; attributes.angle_display = QUARTERNION_DISPLAY.euler;
break; #endregion break; #endregion
case VALUE_DISPLAY.path_anchor : #region case VALUE_DISPLAY.path_anchor : #region
@ -1079,7 +1076,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static valueProcess = function(value, nodeFrom = undefined, applyUnit = true, arrIndex = 0) { static valueProcess = function(value, nodeFrom = undefined, applyUnit = true, arrIndex = 0) {
var typeFrom = nodeFrom == undefined? VALUE_TYPE.any : nodeFrom.type; var typeFrom = nodeFrom == undefined? VALUE_TYPE.any : nodeFrom.type;
if(applyUnit && display_type == VALUE_DISPLAY.d3quarternion && display_data.angle_display == QUARTERNION_DISPLAY.euler) if(applyUnit && display_type == VALUE_DISPLAY.d3quarternion && attributes.angle_display == QUARTERNION_DISPLAY.euler)
return quarternionFromEuler(value[0], value[1], value[2]); return quarternionFromEuler(value[0], value[1], value[2]);
if(type == VALUE_TYPE.gradient && typeFrom == VALUE_TYPE.color) { // color compatibility [ color, palette, gradient ] if(type == VALUE_TYPE.gradient && typeFrom == VALUE_TYPE.color) { // color compatibility [ color, palette, gradient ]
@ -2127,46 +2124,53 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static serialize = function(scale = false, preset = false) { static serialize = function(scale = false, preset = false) {
var _map = {}; var _map = {};
_map.visible = visible; if(visible) _map.v = real(visible);
_map.visible_manual = visible_manual; if(visible_manual != 0) _map.visible_manual = visible_manual;
_map.color = color; if(color != -1) _map.color = color;
if(connect_type == CONNECT_TYPE.output) if(connect_type == CONNECT_TYPE.output) return _map;
return _map;
_map.name = name; if(name_custom) _map.name = name;
_map.on_end = on_end; if(unit.mode != 0) _map.unit = unit.mode;
_map.loop_range = loop_range; if(on_end != KEYFRAME_END.hold) _map.on_end = on_end;
_map.unit = unit.mode; if(loop_range != -1) _map.loop_range = loop_range;
_map.sep_axis = sep_axis; if(sep_axis) _map.sep_axis = sep_axis;
_map.shift_x = draw_line_shift_x;
_map.shift_y = draw_line_shift_y;
_map.is_modified = is_modified;
_map.from_node = -1; if(draw_line_shift_x != 0) _map.shift_x = draw_line_shift_x;
_map.from_index = -1; if(draw_line_shift_y != 0) _map.shift_y = draw_line_shift_y;
_map.from_tag = 0; if(is_modified == true) _map.is_modified = is_modified;
if(!preset && value_from) { if(!preset && value_from) {
_map.from_node = value_from.node.node_id; _map.from_node = value_from.node.node_id;
_map.from_index = value_from.index; _map.from_index = value_from.index;
if(value_from.tags != 0)
_map.from_tag = value_from.tags; _map.from_tag = value_from.tags;
} }
_map.global_use = expUse; if(expUse) _map.global_use = expUse;
_map.global_key = expression; if(expression != "") _map.global_key = expression;
_map.anim = is_anim; if(is_anim) _map.anim = is_anim;
_map.raw_value = animator.serialize(scale); if(is_modified) _map.raw_value = animator.serialize(scale);
var _anims = []; var _animLen = array_length(animators);
for( var i = 0, n = array_length(animators); i < n; i++ ) if(is_modified && _animLen) {
array_push(_anims, animators[i].serialize(scale)); var _anims = array_create(_animLen);
for( var i = 0; i < _animLen; i++ )
_anims[i] = animators[i].serialize(scale);
_map.animators = _anims; _map.animators = _anims;
_map.display_data = display_data; }
_map.attributes = attributes;
_map.name_custom = name_custom; if(struct_has(display_data, "linked")) _map.linked = display_data.linked;
_map.bypass = bypass_junc? bypass_junc.visible : false; if(name_custom) _map.name_custom = name_custom;
if(bypass_junc && bypass_junc.visible) _map.bypass = true;
#region attributes
attri = variable_clone(attributes);
if(struct_try_get(attri, "mapped") == 0) struct_remove(attri, "mapped");
if(struct_names_count(attri)) _map.attri = attri;
#endregion
return _map; return _map;
} }
@ -2176,36 +2180,47 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(_map == noone) return; if(_map == noone) return;
if(!is_struct(_map)) return; if(!is_struct(_map)) return;
visible = struct_try_get(_map, "visible", visible); visible = struct_try_get(_map, LOADING_VERSION >= 1_18_04_0? "v" : "visible", 0);
visible_manual = struct_try_get(_map, "visible_manual", visible_manual); visible_manual = struct_try_get(_map, "visible_manual", 0);
color = struct_try_get(_map, "color", -1); color = struct_try_get(_map, "color", -1);
if(connect_type == CONNECT_TYPE.output) if(connect_type == CONNECT_TYPE.output)
return; return;
//print($" > Applying deserialize to junction {name} 0"); on_end = struct_try_get(_map, "on_end", KEYFRAME_END.hold);
on_end = struct_try_get(_map, "on_end");
loop_range = struct_try_get(_map, "loop_range", -1); loop_range = struct_try_get(_map, "loop_range", -1);
unit.mode = struct_try_get(_map, "unit"); unit.mode = struct_try_get(_map, "unit", 0);
expUse = struct_try_get(_map, "global_use"); expUse = struct_try_get(_map, "global_use", false);
expression = struct_try_get(_map, "global_key"); expression = struct_try_get(_map, "global_key", "");
expTree = evaluateFunctionList(expression); expTree = evaluateFunctionList(expression);
sep_axis = struct_try_get(_map, "sep_axis"); sep_axis = struct_try_get(_map, "sep_axis", false);
setAnim(struct_try_get(_map, "anim")); setAnim(struct_try_get(_map, "anim", false));
draw_line_shift_x = struct_try_get(_map, "shift_x"); draw_line_shift_x = struct_try_get(_map, "shift_x", 0);
draw_line_shift_y = struct_try_get(_map, "shift_y"); draw_line_shift_y = struct_try_get(_map, "shift_y", 0);
is_modified = struct_try_get(_map, "is_modified", true); is_modified = struct_try_get(_map, "is_modified", false);
if(struct_has(_map, "attri")) {
var _lattr = _map.attri;
_lattr.mapped = struct_try_get(_lattr, "mapped", 0);
struct_append(attri, _lattr);
}
if(struct_has(_map, "linked"))
display_data.linked = _map.linked;
struct_append(attributes, struct_try_get(_map, "attributes"))
name_custom = struct_try_get(_map, "name_custom", false); name_custom = struct_try_get(_map, "name_custom", false);
if(name_custom) name = struct_try_get(_map, "name", name); if(name_custom) name = struct_try_get(_map, "name", name);
if(is_modified && struct_has(_map, "raw_value"))
animator.deserialize(struct_try_get(_map, "raw_value"), scale); animator.deserialize(struct_try_get(_map, "raw_value"), scale);
if(bypass_junc) bypass_junc.visible = struct_try_get(_map, "bypass", false);
if(struct_has(_map, "animators")) { if(bypass_junc)
bypass_junc.visible = struct_try_get(_map, "bypass", false);
if(is_modified && struct_has(_map, "animators")) {
var anims = _map.animators; var anims = _map.animators;
var amo = min(array_length(anims), array_length(animators)); var amo = min(array_length(anims), array_length(animators));
for( var i = 0; i < amo; i++ ) for( var i = 0; i < amo; i++ )
@ -2215,12 +2230,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(!preset) { if(!preset) {
con_node = struct_try_get(_map, "from_node", -1) con_node = struct_try_get(_map, "from_node", -1)
con_index = struct_try_get(_map, "from_index", -1); con_index = struct_try_get(_map, "from_index", -1);
con_tag = struct_try_get(_map, "from_tag", -1); con_tag = struct_try_get(_map, "from_tag", 0);
}
if(struct_has(_map, "display_data")) {
for( var i = 0, n = array_length(DISPLAY_DATA_KEYS); i < n; i++ )
struct_try_override(display_data, _map.display_data, DISPLAY_DATA_KEYS[i]);
} }
if(connect_type == CONNECT_TYPE.input && index >= 0) { if(connect_type == CONNECT_TYPE.input && index >= 0) {

View file

@ -15,7 +15,7 @@ function __NodeValue_Quaternion(_name, _node, _value, _tooltip = "") : __NodeVal
if(!is_array(val)) return [ val, val, val, val ]; if(!is_array(val)) return [ val, val, val, val ];
var _convert = applyUnit && display_data.angle_display == QUARTERNION_DISPLAY.euler; var _convert = applyUnit && attributes.angle_display == QUARTERNION_DISPLAY.euler;
if(!_convert) return val; if(!_convert) return val;
var _d = array_get_depth(val); var _d = array_get_depth(val);

View file

@ -249,6 +249,7 @@
_map.composer = composer; _map.composer = composer;
_map.load_layout = load_layout; _map.load_layout = load_layout;
if(load_layout) _map.layout = panelSerialize(true);
_map.graph_display_parameter = graph_display_parameter; _map.graph_display_parameter = graph_display_parameter;

View file

@ -87,9 +87,9 @@ function quarternionBox(_onModify) : widget() constructor {
if(is_array(_data[0])) return 0; if(is_array(_data[0])) return 0;
var _bs = min(_h, ui(32)); var _bs = min(_h, ui(32));
var _disp = struct_try_get(_display_data, "angle_display"); var _disp = struct_try_get(attributes, "angle_display");
if(_display_data.angle_display == QUARTERNION_DISPLAY.quarterion || (!tb[0].sliding && !tb[1].sliding && !tb[2].sliding)) { if(attributes.angle_display == QUARTERNION_DISPLAY.quarterion || (!tb[0].sliding && !tb[1].sliding && !tb[2].sliding)) {
current_value[0] = array_safe_get(_data, 0); current_value[0] = array_safe_get(_data, 0);
current_value[1] = array_safe_get(_data, 1); current_value[1] = array_safe_get(_data, 1);
current_value[2] = array_safe_get(_data, 2); current_value[2] = array_safe_get(_data, 2);
@ -103,13 +103,13 @@ function quarternionBox(_onModify) : widget() constructor {
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, iactive, ihover, tooltip, THEME.unit_angle, _disp, c_white) == 2) { if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, iactive, ihover, tooltip, THEME.unit_angle, _disp, c_white) == 2) {
clickable = false; clickable = false;
_display_data.angle_display = (_disp + 1) % 2; attributes.angle_display = (_disp + 1) % 2;
onModify([ 0, 0, 0, 1 ]); onModify([ 0, 0, 0, 1 ]);
} }
_w -= _bs + ui(8); _w -= _bs + ui(8);
} }
current_unit = _display_data.angle_display; current_unit = attributes.angle_display;
size = _disp? 3 : 4; size = _disp? 3 : 4;
var ww = _w / size; var ww = _w / size;

View file

@ -15,7 +15,6 @@ function NEW() {
function SERIALIZE_PROJECT(project = PROJECT) { function SERIALIZE_PROJECT(project = PROJECT) {
var _map = project.serialize(); var _map = project.serialize();
_map.layout = panelSerialize(true);
return PREFERENCES.save_file_minify? json_stringify_minify(_map) : json_stringify(_map, true); return PREFERENCES.save_file_minify? json_stringify_minify(_map) : json_stringify(_map, true);
} }

View file

@ -64,12 +64,12 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
_cl = -1; _cl = -1;
static setMaxHieght = function(height) { #region static setMaxHieght = function(height) {
max_height = height; max_height = height;
return self; return self;
} #endregion }
static activate = function() { #region static activate = function() {
WIDGET_CURRENT = self; WIDGET_CURRENT = self;
WIDGET_CURRENT_SCROLL = parent; WIDGET_CURRENT_SCROLL = parent;
parentFocus(); parentFocus();
@ -91,9 +91,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
undo_delay = 10; undo_delay = 10;
if(PEN_USE) keyboard_virtual_show(kbv_type_default, kbv_returnkey_default, kbv_autocapitalize_none, true); if(PEN_USE) keyboard_virtual_show(kbv_type_default, kbv_returnkey_default, kbv_autocapitalize_none, true);
} #endregion }
static deactivate = function() { #region static deactivate = function() {
if(WIDGET_CURRENT != self) return; if(WIDGET_CURRENT != self) return;
apply(); apply();
@ -101,17 +101,17 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
UNDO_HOLDING = false; UNDO_HOLDING = false;
if(PEN_USE) keyboard_virtual_hide(); if(PEN_USE) keyboard_virtual_hide();
} #endregion }
static isCodeFormat = function() { INLINE return format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL; } static isCodeFormat = function() { INLINE return format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL; }
static breakCharacter = function(ch) { #region static breakCharacter = function(ch) {
if(isCodeFormat()) if(isCodeFormat())
return ch == "\n" || array_exists(global.CODE_BREAK_TOKEN, ch); return ch == "\n" || array_exists(global.CODE_BREAK_TOKEN, ch);
return ch == " " || ch == "\n"; return ch == " " || ch == "\n";
} #endregion }
static onModified = function() { #region static onModified = function() {
autocomplete_delay = 0; autocomplete_delay = 0;
o_dialog_textbox_autocomplete.deactivate(self); o_dialog_textbox_autocomplete.deactivate(self);
o_dialog_textbox_function_guide.deactivate(self); o_dialog_textbox_function_guide.deactivate(self);
@ -170,9 +170,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
o_dialog_textbox_function_guide.prompt = guide; o_dialog_textbox_function_guide.prompt = guide;
o_dialog_textbox_function_guide.index = amo; o_dialog_textbox_function_guide.index = amo;
} }
} #endregion }
static keyboardEnter = function() { #region static keyboardEnter = function() {
if(!keyboard_check_pressed(vk_enter)) if(!keyboard_check_pressed(vk_enter))
return 0; return 0;
@ -180,9 +180,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
return 0; return 0;
return 1 + ((shift_new_line && key_mod_press(SHIFT)) || (!shift_new_line && !key_mod_press(SHIFT))); return 1 + ((shift_new_line && key_mod_press(SHIFT)) || (!shift_new_line && !key_mod_press(SHIFT)));
} #endregion }
static onKey = function(key) { #region static onKey = function(key) {
if(key == vk_left) { if(key == vk_left) {
if(key_mod_press(SHIFT)) { if(key_mod_press(SHIFT)) {
if(cursor_select == -1) if(cursor_select == -1)
@ -288,21 +288,21 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
onModified(); onModified();
} }
} }
} #endregion }
static apply = function() { #region static apply = function() {
if(onModify) onModify(_input_text); if(onModify) onModify(_input_text);
UNDO_HOLDING = true; UNDO_HOLDING = true;
} #endregion }
static move_cursor = function(delta) { #region static move_cursor = function(delta) {
var ll = string_length(_input_text); var ll = string_length(_input_text);
cursor = clamp(cursor + delta, 0, ll); cursor = clamp(cursor + delta, 0, ll);
onModified(); onModified();
} #endregion }
static cut_line = function() { #region static cut_line = function() {
_input_text_line = []; _input_text_line = [];
_input_text_line_index = []; _input_text_line_index = [];
draw_set_font(font); draw_set_font(font);
@ -368,9 +368,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
array_push(_input_text_line_index, _iIndex); _iIndex = ""; array_push(_input_text_line_index, _iIndex); _iIndex = "";
} }
} }
} #endregion }
static editText = function() { #region static editText = function() {
var _input_text_pre = _input_text; var _input_text_pre = _input_text;
var modified = false; var modified = false;
var undoed = true; var undoed = true;
@ -610,9 +610,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
} else if(keyboardEnter() == 1) { } else if(keyboardEnter() == 1) {
deactivate(); deactivate();
} }
} #endregion }
static display_text = function(_x, _y, _text, _mx = -1, _my = -1, _hover = false) { #region static display_text = function(_x, _y, _text, _mx = -1, _my = -1, _hover = false) {
_text = string_real(_text); _text = string_real(_text);
if(line_width != _prev_width) { if(line_width != _prev_width) {
_prev_width = line_width; _prev_width = line_width;
@ -741,18 +741,18 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
if(cursor_select == cursor) if(cursor_select == cursor)
cursor_select = -1; cursor_select = -1;
} }
} #endregion }
static drawParam = function(params) { #region static drawParam = function(params) {
setParam(params); setParam(params);
if(format == TEXT_AREA_FORMAT.codeHLSL || format == TEXT_AREA_FORMAT.codeLUA) if(format == TEXT_AREA_FORMAT.codeHLSL || format == TEXT_AREA_FORMAT.codeLUA)
font = f_code; font = f_code;
return draw(params.x, params.y, params.w, params.h, params.data, params.m); return draw(params.x, params.y, params.w, params.h, params.data, params.m);
} #endregion }
static draw = function(_x, _y, _w, _h, _text, _m) { #region static draw = function(_x, _y, _w, _h, _text, _m) {
_h = max_height == -1? _h : min(_h, max_height); _h = max_height == -1? _h : min(_h, max_height);
x = _x; x = _x;
@ -827,13 +827,12 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
} }
surface_reset_shader(); surface_reset_shader();
if(selecting) { if(selecting) { // draw selecting
WIDGET_TAB_BLOCK = true; WIDGET_TAB_BLOCK = true;
draw_set_text(font, fa_left, fa_top, COLORS._main_text); draw_set_text(font, fa_left, fa_top, COLORS._main_text);
editText(); editText();
#region draw selecting
var msx = _m[0] - _x; var msx = _m[0] - _x;
var msy = _m[1] - _y; var msy = _m[1] - _y;
@ -947,7 +946,6 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
o_dialog_textbox_function_guide.dialog_x = rx + _x + cursor_pos_x + 1; o_dialog_textbox_function_guide.dialog_x = rx + _x + cursor_pos_x + 1;
o_dialog_textbox_function_guide.dialog_y = ry + _y + cursor_pos_y - 12; o_dialog_textbox_function_guide.dialog_y = ry + _y + cursor_pos_y - 12;
} }
#endregion
if(autocomplete_modi && PREFERENCES.widget_autocomplete_delay >= 0 && autocomplete_delay >= PREFERENCES.widget_autocomplete_delay) { if(autocomplete_modi && PREFERENCES.widget_autocomplete_delay >= 0 && autocomplete_delay >= PREFERENCES.widget_autocomplete_delay) {
o_dialog_textbox_autocomplete.activate(self); o_dialog_textbox_autocomplete.activate(self);
@ -981,8 +979,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
o_dialog_textbox_autocomplete.deactivate(self); o_dialog_textbox_autocomplete.deactivate(self);
} }
#region scroll height if(max_height) { //scroll height
if(max_height) {
var total_h = text_y_max; var total_h = text_y_max;
text_y_max = max(0, total_h - hh + 16); text_y_max = max(0, total_h - hh + 16);
text_y = lerp_float(text_y, text_y_to, 5); text_y = lerp_float(text_y, text_y_to, 5);
@ -1021,7 +1018,6 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
} }
} }
} }
#endregion
if(DRAGGING && (DRAGGING.type == "Text" || DRAGGING.type == "Number") && hover && hoverRect) { if(DRAGGING && (DRAGGING.type == "Text" || DRAGGING.type == "Number") && hover && hoverRect) {
draw_sprite_stretched_ext(THEME.ui_panel, 1, _x, _y, _w, hh, COLORS._main_value_positive, 1); draw_sprite_stretched_ext(THEME.ui_panel, 1, _x, _y, _w, hh, COLORS._main_value_positive, 1);
@ -1034,7 +1030,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
resetFocus(); resetFocus();
return hh; return hh;
} #endregion }
static clone = function() { static clone = function() {
var cln = new textArea(input, onModify); var cln = new textArea(input, onModify);

View file

@ -73,7 +73,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
sprite_index = -1; sprite_index = -1;
text_surface = surface_create(1, 1); text_surface = noone;
shake_amount = 0; shake_amount = 0;
onDeactivate = -1; onDeactivate = -1;