mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-03-03 06:04:49 +01:00
strip duplicated serial
This commit is contained in:
parent
e842d9dc54
commit
ef8270fc1e
23 changed files with 373 additions and 371 deletions
|
@ -286,7 +286,7 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
|
|||
var _camera = params.camera;
|
||||
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 _global = _quat? tool_attribute.context : 1;
|
||||
|
||||
|
|
|
@ -818,24 +818,24 @@
|
|||
if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return undefined;
|
||||
var node = PROJECT.nodeNameMap[? nodeId];
|
||||
|
||||
if(!ds_map_exists(node.inputMap, input)) return undefined;
|
||||
return node.inputMap[? input].getValue();
|
||||
if(!struct_has(node.inputMap, input)) return undefined;
|
||||
return node.inputMap[$ input].getValue();
|
||||
}],
|
||||
|
||||
[ "node_set_input_value", function(nodeId, input, value) {
|
||||
if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return undefined;
|
||||
var node = PROJECT.nodeNameMap[? nodeId];
|
||||
|
||||
if(!ds_map_exists(node.inputMap, input)) return undefined;
|
||||
return node.inputMap[? input].setValue(value);
|
||||
if(!struct_has(node.inputMap, input)) return undefined;
|
||||
return node.inputMap[$ input].setValue(value);
|
||||
}],
|
||||
|
||||
[ "node_get_output_value", function(nodeId, input) {
|
||||
if(!ds_map_exists(PROJECT.nodeNameMap, nodeId)) return undefined;
|
||||
var node = PROJECT.nodeNameMap[? nodeId];
|
||||
|
||||
if(!ds_map_exists(node.outputMap, input)) return undefined;
|
||||
return node.outputMap[? input].getValue();
|
||||
if(!struct_has(node.outputMap, input)) return undefined;
|
||||
return node.outputMap[$ input].getValue();
|
||||
}],
|
||||
|
||||
[ "element_get", function() {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
LATEST_VERSION = 1_18_00_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";
|
||||
BUILD_NUMBER = 1_18_04_1;
|
||||
|
||||
|
|
|
@ -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))
|
||||
.setDisplay(_var.disp, _var.disp_data);
|
||||
inputs[index].display_data.key = key;
|
||||
inputs[index].attributes.key = key;
|
||||
|
||||
array_append(input_display_list, [ index ]);
|
||||
}
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
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 = {
|
||||
frame: CURRENT_FRAME
|
||||
|
@ -50,8 +50,5 @@ function Node_VCT(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) const
|
|||
|
||||
static postDeserialize = function() {
|
||||
vct.deserialize(load_map.vct);
|
||||
|
||||
//for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput(_inputs[i].display_data.key);
|
||||
}
|
||||
}
|
|
@ -40,7 +40,7 @@
|
|||
if(is_array(_setVals)) {
|
||||
for(var j = 0, m = array_length(_setVals); j < m; 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(!value_type_direct_settable(_input.type)) continue;
|
||||
|
||||
|
@ -75,8 +75,8 @@
|
|||
var _toN = _n[$ _c.to];
|
||||
if(_frN == undefined || _toN == undefined) continue;
|
||||
|
||||
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 _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];
|
||||
if(_frO == undefined || _toI == undefined) continue;
|
||||
|
||||
_toI.setFrom(_frO);
|
||||
|
|
|
@ -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 ] ))
|
||||
.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];
|
||||
|
||||
|
@ -296,9 +296,11 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
static postApplyDeserialize = function() {
|
||||
for( var i = input_fix_len; i < array_length(inputs); i += data_length ) {
|
||||
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;
|
||||
inp.attributes.bone_id = idx;
|
||||
}
|
||||
|
||||
setBone();
|
||||
|
|
|
@ -8,11 +8,11 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
newInput(2, nodeValue_Float("Location", self, 0))
|
||||
.setDisplay(VALUE_DISPLAY._default, { unit: 0, side_button: button(function() {
|
||||
inputs[2].display_data.unit = (inputs[2].display_data.unit + 1) % 3;
|
||||
inputs[2].display_data.side_button.tooltip.index = inputs[2].display_data.unit;
|
||||
inputs[2].attributes.unit = (inputs[2].attributes.unit + 1) % 3;
|
||||
inputs[2].display_data.side_button.tooltip.index = inputs[2].attributes.unit;
|
||||
update();
|
||||
}).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 _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 _ch = _aud.getChannel();
|
||||
|
||||
|
|
|
@ -106,9 +106,6 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection(_x, _y, _group) con
|
|||
array_push(canvases, _node);
|
||||
else if(is_instanceof(_node, Node_Composite))
|
||||
composite = _node;
|
||||
|
||||
_node.modifiable = false;
|
||||
_node.modify_parent = self;
|
||||
}
|
||||
|
||||
refreshLayer();
|
||||
|
@ -152,9 +149,6 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection(_x, _y, _group) con
|
|||
}
|
||||
|
||||
static onAdd = function(node) {
|
||||
node.modifiable = false;
|
||||
node.modify_parent = self;
|
||||
|
||||
if(is_instanceof(node, Node_Canvas)) {
|
||||
array_push(canvases, node);
|
||||
node.timeline_item.removeSelf();
|
||||
|
|
|
@ -172,6 +172,7 @@ function upgroupNode(collection, record = true) {
|
|||
function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
nodes = [];
|
||||
node_length = 0;
|
||||
modifiable = true;
|
||||
|
||||
ungroupable = true;
|
||||
auto_render_time = false;
|
||||
|
|
|
@ -175,7 +175,7 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c
|
|||
if(array_length(group_vertex) < 3) return;
|
||||
if(!modifiable) return;
|
||||
|
||||
var _m = [ _mx / _s - _x, _my / _s - _y ];
|
||||
var _m = [ _mx / _s - _x, _my / _s - _y ];
|
||||
|
||||
group_adding = false;
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
active = true;
|
||||
renderActive = true;
|
||||
|
||||
node_id = UUID_generate();
|
||||
group = _group;
|
||||
node_id = UUID_generate();
|
||||
group = _group;
|
||||
manual_deletable = true;
|
||||
manual_ungroupable = true;
|
||||
destroy_when_upgroup = false;
|
||||
|
@ -47,10 +47,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
inline_context = noone;
|
||||
inline_parent_object = "";
|
||||
|
||||
modifiable = true;
|
||||
modify_parent = noone;
|
||||
search_match = -9999;
|
||||
|
||||
onDoubleClick = -1;
|
||||
is_controller = false;
|
||||
#endregion
|
||||
|
@ -70,10 +67,10 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
PROJECT.nodeMap[? node_id] = self;
|
||||
PROJECT.modified = true;
|
||||
|
||||
run_in(1, function() {
|
||||
run_in(1, function() /*=>*/ {
|
||||
resetInternalName();
|
||||
|
||||
if(renamed) return;
|
||||
|
||||
display_name = __txt_node_name(instanceof(self), name);
|
||||
if(!LOCALE_DEF || TESTING) renamed = true;
|
||||
});
|
||||
|
@ -82,30 +79,29 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
}
|
||||
|
||||
#region ---- display ----
|
||||
color = c_white;
|
||||
icon = noone;
|
||||
icon_24 = noone;
|
||||
bg_spr = THEME.node_bg;
|
||||
color = c_white;
|
||||
icon = noone;
|
||||
icon_24 = noone;
|
||||
bg_spr = THEME.node_bg;
|
||||
bg_spr_add = 0.1;
|
||||
bg_spr_add_clr = c_white;
|
||||
|
||||
name = "";
|
||||
name = "";
|
||||
display_name = "";
|
||||
internalName = "";
|
||||
onSetDisplayName = noone;
|
||||
renamed = false;
|
||||
renamed = false;
|
||||
tooltip = "";
|
||||
|
||||
tooltip = "";
|
||||
x = _x;
|
||||
y = _y;
|
||||
|
||||
name_height = ui(16);
|
||||
w = 128;
|
||||
h = 128;
|
||||
min_w = w;
|
||||
con_h = 128;
|
||||
|
||||
w = 128;
|
||||
h = 128;
|
||||
min_w = w;
|
||||
con_h = 128;
|
||||
h_param = h;
|
||||
name_height = ui(16);
|
||||
|
||||
preserve_height_for_preview = false;
|
||||
|
||||
selectable = true;
|
||||
|
@ -141,8 +137,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
inputs = [];
|
||||
outputs = [];
|
||||
input_bypass = [];
|
||||
inputMap = ds_map_create();
|
||||
outputMap = ds_map_create();
|
||||
inputMap = {};
|
||||
outputMap = {};
|
||||
input_value_map = {};
|
||||
|
||||
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; }) ],
|
||||
["Output metadata", function() /*=>*/ {return attributes.outp_meta}, new checkBox(function() /*=>*/ { attributes.outp_meta = !attributes.outp_meta; setHeight(); }) ],
|
||||
];
|
||||
|
||||
bufferStore = {};
|
||||
#endregion
|
||||
|
||||
#region ---- preview ----
|
||||
|
@ -245,20 +239,20 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
show_input_name = false;
|
||||
show_output_name = false;
|
||||
|
||||
inspecting = false;
|
||||
previewing = 0;
|
||||
inspecting = false;
|
||||
previewing = 0;
|
||||
|
||||
preview_surface = noone;
|
||||
preview_amount = 0;
|
||||
previewable = true;
|
||||
preview_draw = true;
|
||||
preview_speed = 0;
|
||||
preview_index = 0;
|
||||
preview_channel = 0;
|
||||
preview_alpha = 1;
|
||||
preview_x = 0;
|
||||
preview_y = 0;
|
||||
preview_surface = noone;
|
||||
preview_amount = 0;
|
||||
previewable = true;
|
||||
preview_draw = true;
|
||||
preview_speed = 0;
|
||||
preview_index = 0;
|
||||
preview_channel = 0;
|
||||
preview_alpha = 1;
|
||||
|
||||
preview_x = 0;
|
||||
preview_y = 0;
|
||||
preview_mx = 0;
|
||||
preview_my = 0;
|
||||
|
||||
|
@ -281,11 +275,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
topoSorted = false;
|
||||
temp_surface = [];
|
||||
force_requeue = false;
|
||||
|
||||
is_simulation = false;
|
||||
is_group_io = false;
|
||||
in_VFX = false;
|
||||
|
||||
in_VFX = false;
|
||||
|
||||
is_group_io = false;
|
||||
#endregion
|
||||
|
||||
#region ---- timeline ----
|
||||
|
@ -296,8 +290,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
|
||||
#region ---- notification ----
|
||||
value_validation = array_create(3);
|
||||
|
||||
manual_updated = false;
|
||||
manual_updated = false;
|
||||
#endregion
|
||||
|
||||
#region ---- tools ----
|
||||
|
@ -2234,21 +2227,38 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
|
||||
if(!preset) {
|
||||
_map.id = node_id;
|
||||
_map.render = renderActive;
|
||||
_map.name = display_name;
|
||||
_map.iname = internalName;
|
||||
_map.x = x;
|
||||
_map.y = y;
|
||||
_map.type = instanceof(self);
|
||||
_map.group = group == noone? group : group.node_id;
|
||||
_map.tool = isTool;
|
||||
if(isTool) _map.tool = isTool;
|
||||
if(group != noone) _map.group = group.node_id;
|
||||
|
||||
_map.previewable = previewable;
|
||||
_map.show_parameter = show_parameter;
|
||||
if(!renderActive) _map.render = renderActive;
|
||||
if(!previewable) _map.previewable = previewable;
|
||||
if(show_parameter) _map.show_parameter = show_parameter;
|
||||
}
|
||||
|
||||
var _attr = attributeSerialize();
|
||||
_map.attri = struct_append(attributes, _attr);
|
||||
var _attr = attributeSerialize();
|
||||
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) {
|
||||
_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);
|
||||
|
||||
_map.inspectInputs = _trigger;
|
||||
_map.outputMeta = _outMeta;
|
||||
_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]);
|
||||
}
|
||||
if(!array_empty(_outMeta)) _map.outputMeta = _outMeta;
|
||||
if(renamed) _map.renamed = renamed;
|
||||
|
||||
doSerialize(_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");
|
||||
y = struct_try_get(load_map, "y");
|
||||
renderActive = struct_try_get(load_map, "render", true);
|
||||
previewable = struct_try_get(load_map, "previewable", previewable);
|
||||
isTool = struct_try_get(load_map, "tool");
|
||||
show_parameter = struct_try_get(load_map, "show_parameter");
|
||||
previewable = struct_try_get(load_map, "previewable", true);
|
||||
isTool = struct_try_get(load_map, "tool", false);
|
||||
show_parameter = struct_try_get(load_map, "show_parameter", false);
|
||||
}
|
||||
|
||||
if(struct_has(load_map, "attri"))
|
||||
attributeDeserialize(CLONING? variable_clone(load_map.attri) : load_map.attri);
|
||||
|
||||
if(struct_has(load_map, "buffer")) {
|
||||
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(struct_has(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);
|
||||
|
||||
attributeDeserialize(CLONING? variable_clone(_lattr) : _lattr);
|
||||
}
|
||||
|
||||
if(is_dynamic_input) {
|
||||
|
@ -2404,7 +2412,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
}
|
||||
|
||||
static attributeDeserialize = function(attr) {
|
||||
struct_append(attributes, attr);
|
||||
struct_override(attributes, attr);
|
||||
|
||||
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;
|
||||
|
@ -2520,9 +2528,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
for( var i = 0; i < array_length(outputs); i++ )
|
||||
outputs[i].cleanUp();
|
||||
|
||||
ds_map_destroy(inputMap);
|
||||
ds_map_destroy(outputMap);
|
||||
|
||||
for( var i = 0, n = array_length(temp_surface); i < n; i++ )
|
||||
surface_free(temp_surface[i]);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ function Node_DynaSurf_In(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
|
||||
if(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
|
||||
|
||||
|
|
|
@ -410,7 +410,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
|
||||
if(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) {
|
||||
|
|
|
@ -210,7 +210,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
|||
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);
|
||||
|
||||
if(prop.type == VALUE_TYPE.color) {
|
||||
|
@ -596,7 +596,8 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
|||
var _value_list = [];
|
||||
_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) {
|
||||
val = json_stringify(val);
|
||||
|
@ -617,22 +618,26 @@ 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] = _v.ease_in;
|
||||
_value_list[3] = _v.ease_out;
|
||||
_value_list[4] = _v.ease_in_type;
|
||||
_value_list[5] = _v.ease_out_type;
|
||||
_value_list[6] = _v.ease_y_lock;
|
||||
_value_list[7] = _v.drivers.type == DRIVER_TYPE.none? 0 : _v.drivers;
|
||||
|
||||
array_push(_data, _value_list);
|
||||
}
|
||||
|
||||
if(array_length(values) == 1)
|
||||
return { d: _data[0][1] };
|
||||
return _data;
|
||||
}
|
||||
|
||||
static deserialize = function(_data, scale = false) {
|
||||
values = [];
|
||||
|
||||
if(is_struct(_data)) _data = [ [ 0, _data.d ] ];
|
||||
|
||||
if(prop.type == VALUE_TYPE.gradient && LOADING_VERSION < 1340 && !CLONING) { //backward compat: Gradient
|
||||
var _val = [];
|
||||
var value = _data[0][1];
|
||||
|
@ -664,12 +669,12 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
|||
_time = round(_time * (TOTAL_FRAMES - 1));
|
||||
|
||||
var value = array_safe_get_fast(_keyframe, 1);
|
||||
var ease_in = array_safe_get_fast(_keyframe, 2);
|
||||
var ease_out = array_safe_get_fast(_keyframe, 3);
|
||||
var ease_in_type = array_safe_get_fast(_keyframe, 4);
|
||||
var ease_out_type = array_safe_get_fast(_keyframe, 5);
|
||||
var ease_y_lock = array_safe_get_fast(_keyframe, 6, true);
|
||||
var driver = array_safe_get_fast(_keyframe, 7, {});
|
||||
var ease_in = array_safe_get_fast(_keyframe, 2, [0, 1]);
|
||||
var ease_out = array_safe_get_fast(_keyframe, 3, [0, 0]);
|
||||
var ease_in_type = array_safe_get_fast(_keyframe, 4, 0);
|
||||
var ease_out_type = array_safe_get_fast(_keyframe, 5, 0);
|
||||
var ease_y_lock = array_safe_get_fast(_keyframe, 6, 1);
|
||||
var driver = array_safe_get_fast(_keyframe, 7, 0);
|
||||
|
||||
var _val = value;
|
||||
|
||||
|
@ -718,7 +723,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
|||
vk.ease_in_type = ease_in_type;
|
||||
vk.ease_out_type = ease_out_type;
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
|
||||
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_surface = -1;
|
||||
|
|
|
@ -407,14 +407,6 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
|
||||
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 /////////////////////
|
||||
|
||||
static cacheCurrentFrameIndex = function(_aindex, _surface) {
|
||||
|
|
|
@ -14,7 +14,7 @@ function nodeValueSeed(_node, _type = VALUE_TYPE.float, _name = "Seed") {
|
|||
|
||||
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 ----
|
||||
active = true;
|
||||
|
@ -38,8 +38,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
name_custom = false;
|
||||
|
||||
if(struct_has(node, "inputMap")) {
|
||||
if(_connect == CONNECT_TYPE.input) node.inputMap[? internalName] = self;
|
||||
else if(_connect == CONNECT_TYPE.output) node.outputMap[? internalName] = self;
|
||||
if(_connect == CONNECT_TYPE.input) node.inputMap[$ internalName] = self;
|
||||
else if(_connect == CONNECT_TYPE.output) node.outputMap[$ internalName] = self;
|
||||
}
|
||||
|
||||
tooltip = _tooltip;
|
||||
|
@ -65,16 +65,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
#endregion
|
||||
|
||||
#region ---- connection ----
|
||||
connect_type = _connect;
|
||||
value_from = noone;
|
||||
value_from_loop = noone;
|
||||
connect_type = _connect;
|
||||
value_from = noone;
|
||||
value_from_loop = noone;
|
||||
|
||||
value_to = [];
|
||||
value_to_loop = [];
|
||||
value_to = [];
|
||||
value_to_loop = [];
|
||||
|
||||
accept_array = true;
|
||||
array_depth = 0;
|
||||
auto_connect = true;
|
||||
accept_array = true;
|
||||
array_depth = 0;
|
||||
auto_connect = true;
|
||||
setFrom_condition = -1;
|
||||
|
||||
onSetFrom = noone;
|
||||
|
@ -87,7 +87,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
is_anim = false;
|
||||
sep_axis = false;
|
||||
animable = true;
|
||||
|
||||
on_end = KEYFRAME_END.hold;
|
||||
loop_range = -1;
|
||||
#endregion
|
||||
|
@ -112,8 +111,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
def_depth = array_get_depth(def_val);
|
||||
unit = new nodeValueUnit(self);
|
||||
def_unit = VALUE_UNIT.constant;
|
||||
dyna_depo = ds_list_create();
|
||||
value_tag = "";
|
||||
|
||||
is_modified = false;
|
||||
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); });
|
||||
|
||||
extract_node = "Node_Vector4";
|
||||
display_data.angle_display = QUARTERNION_DISPLAY.euler;
|
||||
attributes.angle_display = QUARTERNION_DISPLAY.euler;
|
||||
break; #endregion
|
||||
|
||||
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) {
|
||||
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]);
|
||||
|
||||
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) {
|
||||
var _map = {};
|
||||
|
||||
_map.visible = visible;
|
||||
_map.visible_manual = visible_manual;
|
||||
_map.color = color;
|
||||
if(visible) _map.v = real(visible);
|
||||
if(visible_manual != 0) _map.visible_manual = visible_manual;
|
||||
if(color != -1) _map.color = color;
|
||||
|
||||
if(connect_type == CONNECT_TYPE.output)
|
||||
return _map;
|
||||
if(connect_type == CONNECT_TYPE.output) return _map;
|
||||
|
||||
_map.name = name;
|
||||
_map.on_end = on_end;
|
||||
_map.loop_range = loop_range;
|
||||
_map.unit = unit.mode;
|
||||
_map.sep_axis = sep_axis;
|
||||
_map.shift_x = draw_line_shift_x;
|
||||
_map.shift_y = draw_line_shift_y;
|
||||
_map.is_modified = is_modified;
|
||||
if(name_custom) _map.name = name;
|
||||
if(unit.mode != 0) _map.unit = unit.mode;
|
||||
if(on_end != KEYFRAME_END.hold) _map.on_end = on_end;
|
||||
if(loop_range != -1) _map.loop_range = loop_range;
|
||||
if(sep_axis) _map.sep_axis = sep_axis;
|
||||
|
||||
_map.from_node = -1;
|
||||
_map.from_index = -1;
|
||||
_map.from_tag = 0;
|
||||
if(draw_line_shift_x != 0) _map.shift_x = draw_line_shift_x;
|
||||
if(draw_line_shift_y != 0) _map.shift_y = draw_line_shift_y;
|
||||
if(is_modified == true) _map.is_modified = is_modified;
|
||||
|
||||
if(!preset && value_from) {
|
||||
_map.from_node = value_from.node.node_id;
|
||||
_map.from_index = value_from.index;
|
||||
_map.from_tag = value_from.tags;
|
||||
if(value_from.tags != 0)
|
||||
_map.from_tag = value_from.tags;
|
||||
}
|
||||
|
||||
_map.global_use = expUse;
|
||||
_map.global_key = expression;
|
||||
_map.anim = is_anim;
|
||||
if(expUse) _map.global_use = expUse;
|
||||
if(expression != "") _map.global_key = expression;
|
||||
if(is_anim) _map.anim = is_anim;
|
||||
|
||||
_map.raw_value = animator.serialize(scale);
|
||||
if(is_modified) _map.raw_value = animator.serialize(scale);
|
||||
|
||||
var _anims = [];
|
||||
for( var i = 0, n = array_length(animators); i < n; i++ )
|
||||
array_push(_anims, animators[i].serialize(scale));
|
||||
_map.animators = _anims;
|
||||
_map.display_data = display_data;
|
||||
_map.attributes = attributes;
|
||||
_map.name_custom = name_custom;
|
||||
_map.bypass = bypass_junc? bypass_junc.visible : false;
|
||||
var _animLen = array_length(animators);
|
||||
if(is_modified && _animLen) {
|
||||
var _anims = array_create(_animLen);
|
||||
for( var i = 0; i < _animLen; i++ )
|
||||
_anims[i] = animators[i].serialize(scale);
|
||||
_map.animators = _anims;
|
||||
}
|
||||
|
||||
if(struct_has(display_data, "linked")) _map.linked = display_data.linked;
|
||||
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;
|
||||
}
|
||||
|
@ -2176,36 +2180,47 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(_map == noone) return;
|
||||
if(!is_struct(_map)) return;
|
||||
|
||||
visible = struct_try_get(_map, "visible", visible);
|
||||
visible_manual = struct_try_get(_map, "visible_manual", visible_manual);
|
||||
visible = struct_try_get(_map, LOADING_VERSION >= 1_18_04_0? "v" : "visible", 0);
|
||||
visible_manual = struct_try_get(_map, "visible_manual", 0);
|
||||
color = struct_try_get(_map, "color", -1);
|
||||
|
||||
if(connect_type == CONNECT_TYPE.output)
|
||||
return;
|
||||
|
||||
//print($" > Applying deserialize to junction {name} 0");
|
||||
on_end = struct_try_get(_map, "on_end");
|
||||
on_end = struct_try_get(_map, "on_end", KEYFRAME_END.hold);
|
||||
loop_range = struct_try_get(_map, "loop_range", -1);
|
||||
unit.mode = struct_try_get(_map, "unit");
|
||||
expUse = struct_try_get(_map, "global_use");
|
||||
expression = struct_try_get(_map, "global_key");
|
||||
unit.mode = struct_try_get(_map, "unit", 0);
|
||||
expUse = struct_try_get(_map, "global_use", false);
|
||||
expression = struct_try_get(_map, "global_key", "");
|
||||
expTree = evaluateFunctionList(expression);
|
||||
|
||||
sep_axis = struct_try_get(_map, "sep_axis");
|
||||
setAnim(struct_try_get(_map, "anim"));
|
||||
sep_axis = struct_try_get(_map, "sep_axis", false);
|
||||
setAnim(struct_try_get(_map, "anim", false));
|
||||
|
||||
draw_line_shift_x = struct_try_get(_map, "shift_x");
|
||||
draw_line_shift_y = struct_try_get(_map, "shift_y");
|
||||
is_modified = struct_try_get(_map, "is_modified", true);
|
||||
draw_line_shift_x = struct_try_get(_map, "shift_x", 0);
|
||||
draw_line_shift_y = struct_try_get(_map, "shift_y", 0);
|
||||
is_modified = struct_try_get(_map, "is_modified", false);
|
||||
|
||||
struct_append(attributes, struct_try_get(_map, "attributes"))
|
||||
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;
|
||||
|
||||
name_custom = struct_try_get(_map, "name_custom", false);
|
||||
if(name_custom) name = struct_try_get(_map, "name", name);
|
||||
|
||||
animator.deserialize(struct_try_get(_map, "raw_value"), scale);
|
||||
if(bypass_junc) bypass_junc.visible = struct_try_get(_map, "bypass", false);
|
||||
if(is_modified && struct_has(_map, "raw_value"))
|
||||
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(is_modified && struct_has(_map, "animators")) {
|
||||
var anims = _map.animators;
|
||||
var amo = min(array_length(anims), array_length(animators));
|
||||
for( var i = 0; i < amo; i++ )
|
||||
|
@ -2215,12 +2230,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(!preset) {
|
||||
con_node = struct_try_get(_map, "from_node", -1)
|
||||
con_index = struct_try_get(_map, "from_index", -1);
|
||||
con_tag = struct_try_get(_map, "from_tag", -1);
|
||||
}
|
||||
|
||||
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]);
|
||||
con_tag = struct_try_get(_map, "from_tag", 0);
|
||||
}
|
||||
|
||||
if(connect_type == CONNECT_TYPE.input && index >= 0) {
|
||||
|
|
|
@ -15,7 +15,7 @@ function __NodeValue_Quaternion(_name, _node, _value, _tooltip = "") : __NodeVal
|
|||
|
||||
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;
|
||||
|
||||
var _d = array_get_depth(val);
|
||||
|
|
|
@ -249,6 +249,7 @@
|
|||
|
||||
_map.composer = composer;
|
||||
_map.load_layout = load_layout;
|
||||
if(load_layout) _map.layout = panelSerialize(true);
|
||||
|
||||
_map.graph_display_parameter = graph_display_parameter;
|
||||
|
||||
|
|
|
@ -87,9 +87,9 @@ function quarternionBox(_onModify) : widget() constructor {
|
|||
if(is_array(_data[0])) return 0;
|
||||
|
||||
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[1] = array_safe_get(_data, 1);
|
||||
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) {
|
||||
clickable = false;
|
||||
_display_data.angle_display = (_disp + 1) % 2;
|
||||
attributes.angle_display = (_disp + 1) % 2;
|
||||
onModify([ 0, 0, 0, 1 ]);
|
||||
}
|
||||
_w -= _bs + ui(8);
|
||||
}
|
||||
|
||||
current_unit = _display_data.angle_display;
|
||||
current_unit = attributes.angle_display;
|
||||
|
||||
size = _disp? 3 : 4;
|
||||
var ww = _w / size;
|
||||
|
|
|
@ -15,7 +15,6 @@ function NEW() {
|
|||
|
||||
function SERIALIZE_PROJECT(project = PROJECT) {
|
||||
var _map = project.serialize();
|
||||
_map.layout = panelSerialize(true);
|
||||
|
||||
return PREFERENCES.save_file_minify? json_stringify_minify(_map) : json_stringify(_map, true);
|
||||
}
|
||||
|
|
|
@ -64,12 +64,12 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
|
||||
_cl = -1;
|
||||
|
||||
static setMaxHieght = function(height) { #region
|
||||
static setMaxHieght = function(height) {
|
||||
max_height = height;
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static activate = function() { #region
|
||||
static activate = function() {
|
||||
WIDGET_CURRENT = self;
|
||||
WIDGET_CURRENT_SCROLL = parent;
|
||||
parentFocus();
|
||||
|
@ -91,9 +91,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
undo_delay = 10;
|
||||
|
||||
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;
|
||||
|
||||
apply();
|
||||
|
@ -101,17 +101,17 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
UNDO_HOLDING = false;
|
||||
|
||||
if(PEN_USE) keyboard_virtual_hide();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
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())
|
||||
return ch == "\n" || array_exists(global.CODE_BREAK_TOKEN, ch);
|
||||
return ch == " " || ch == "\n";
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static onModified = function() { #region
|
||||
static onModified = function() {
|
||||
autocomplete_delay = 0;
|
||||
o_dialog_textbox_autocomplete.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.index = amo;
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static keyboardEnter = function() { #region
|
||||
static keyboardEnter = function() {
|
||||
if(!keyboard_check_pressed(vk_enter))
|
||||
return 0;
|
||||
|
||||
|
@ -180,9 +180,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
return 0;
|
||||
|
||||
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_mod_press(SHIFT)) {
|
||||
if(cursor_select == -1)
|
||||
|
@ -288,21 +288,21 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
onModified();
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static apply = function() { #region
|
||||
static apply = function() {
|
||||
if(onModify) onModify(_input_text);
|
||||
UNDO_HOLDING = true;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static move_cursor = function(delta) { #region
|
||||
static move_cursor = function(delta) {
|
||||
var ll = string_length(_input_text);
|
||||
cursor = clamp(cursor + delta, 0, ll);
|
||||
|
||||
onModified();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static cut_line = function() { #region
|
||||
static cut_line = function() {
|
||||
_input_text_line = [];
|
||||
_input_text_line_index = [];
|
||||
draw_set_font(font);
|
||||
|
@ -368,9 +368,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
array_push(_input_text_line_index, _iIndex); _iIndex = "";
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static editText = function() { #region
|
||||
static editText = function() {
|
||||
var _input_text_pre = _input_text;
|
||||
var modified = false;
|
||||
var undoed = true;
|
||||
|
@ -610,9 +610,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
} else if(keyboardEnter() == 1) {
|
||||
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);
|
||||
if(line_width != _prev_width) {
|
||||
_prev_width = line_width;
|
||||
|
@ -741,18 +741,18 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
if(cursor_select == cursor)
|
||||
cursor_select = -1;
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static drawParam = function(params) { #region
|
||||
static drawParam = function(params) {
|
||||
setParam(params);
|
||||
|
||||
if(format == TEXT_AREA_FORMAT.codeHLSL || format == TEXT_AREA_FORMAT.codeLUA)
|
||||
font = f_code;
|
||||
|
||||
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);
|
||||
|
||||
x = _x;
|
||||
|
@ -827,127 +827,125 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
}
|
||||
surface_reset_shader();
|
||||
|
||||
if(selecting) {
|
||||
if(selecting) { // draw selecting
|
||||
WIDGET_TAB_BLOCK = true;
|
||||
|
||||
draw_set_text(font, fa_left, fa_top, COLORS._main_text);
|
||||
editText();
|
||||
|
||||
var msx = _m[0] - _x;
|
||||
var msy = _m[1] - _y;
|
||||
|
||||
#region draw selecting
|
||||
var msx = _m[0] - _x;
|
||||
var msy = _m[1] - _y;
|
||||
surface_set_shader(text_surface, noone, false, BLEND.add);
|
||||
draw_set_text(font, fa_left, fa_top, COLORS._main_text);
|
||||
|
||||
#region draw cursor highlight
|
||||
var _l, _str;
|
||||
|
||||
surface_set_shader(text_surface, noone, false, BLEND.add);
|
||||
draw_set_text(font, fa_left, fa_top, COLORS._main_text);
|
||||
var ch_x = tx;
|
||||
var ch_y = text_y + ui(7);
|
||||
var ch_sel_min = -1;
|
||||
var ch_sel_max = -1;
|
||||
var char_line = 0;
|
||||
var curs_found = false;
|
||||
|
||||
#region draw cursor highlight
|
||||
var _l, _str;
|
||||
|
||||
var ch_x = tx;
|
||||
var ch_y = text_y + ui(7);
|
||||
var ch_sel_min = -1;
|
||||
var ch_sel_max = -1;
|
||||
var char_line = 0;
|
||||
var curs_found = false;
|
||||
|
||||
char_run = 0;
|
||||
char_run = 0;
|
||||
|
||||
if(cursor_select != -1) {
|
||||
ch_sel_min = min(cursor_select, cursor);
|
||||
ch_sel_max = max(cursor_select, cursor);
|
||||
}
|
||||
|
||||
for( var i = 0, n = array_length(_input_text_line); i < n; i++ ) {
|
||||
_str = _input_text_line[i];
|
||||
_l = string_length(_str);
|
||||
|
||||
if(cursor_select != -1) {
|
||||
ch_sel_min = min(cursor_select, cursor);
|
||||
ch_sel_max = max(cursor_select, cursor);
|
||||
}
|
||||
|
||||
for( var i = 0, n = array_length(_input_text_line); i < n; i++ ) {
|
||||
_str = _input_text_line[i];
|
||||
_l = string_length(_str);
|
||||
draw_set_color(COLORS.widget_text_highlight);
|
||||
|
||||
if(cursor_select != -1) {
|
||||
draw_set_color(COLORS.widget_text_highlight);
|
||||
if(char_line <= ch_sel_min && char_line + _l > ch_sel_min) {
|
||||
var _hstr1 = string_copy(_str, 1, ch_sel_min - char_line);
|
||||
var _hstr2 = string_copy(_str, 1, ch_sel_max - char_line);
|
||||
|
||||
if(char_line <= ch_sel_min && char_line + _l > ch_sel_min) {
|
||||
var _hstr1 = string_copy(_str, 1, ch_sel_min - char_line);
|
||||
var _hstr2 = string_copy(_str, 1, ch_sel_max - char_line);
|
||||
|
||||
if(format == TEXT_AREA_FORMAT.delimiter) {
|
||||
_hstr1 = string_replace_all(_hstr1, " ", "<space>");
|
||||
_hstr2 = string_replace_all(_hstr2, " ", "<space>");
|
||||
}
|
||||
|
||||
var x1 = tx + string_width(_hstr1);
|
||||
var x2 = tx + string_width(_hstr2);
|
||||
|
||||
draw_roundrect_ext(x1, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
|
||||
} else if(char_line >= ch_sel_min && char_line + _l < ch_sel_max) {
|
||||
var _hstr = _str;
|
||||
|
||||
if(format == TEXT_AREA_FORMAT.delimiter)
|
||||
_hstr = string_replace_all(_hstr, " ", "<space>");
|
||||
|
||||
var x2 = tx + string_width(_hstr);
|
||||
|
||||
draw_roundrect_ext(tx, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
|
||||
} else if(char_line > ch_sel_min && char_line <= ch_sel_max && char_line + _l >= ch_sel_max) {
|
||||
var _hstr = string_copy(_str, 1, ch_sel_max - char_line);
|
||||
|
||||
if(format == TEXT_AREA_FORMAT.delimiter)
|
||||
_hstr = string_replace_all(_hstr, " ", "<space>");
|
||||
|
||||
var x2 = tx + string_width(_hstr);
|
||||
|
||||
draw_roundrect_ext(tx, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if(!curs_found && char_line <= cursor && cursor < char_line + _l) {
|
||||
if(format == TEXT_AREA_FORMAT.delimiter) {
|
||||
var str_cur = string_copy(_str, 1, cursor - char_line);
|
||||
str_cur = string_replace_all(str_cur, " ", "<space>");
|
||||
cursor_pos_x_to = ch_x + string_width(str_cur);
|
||||
} else
|
||||
cursor_pos_x_to = ch_x + string_width(string_copy(_str, 1, cursor - char_line));
|
||||
cursor_pos_y_to = ch_y;
|
||||
cursor_line = i;
|
||||
char_run = char_line;
|
||||
_hstr1 = string_replace_all(_hstr1, " ", "<space>");
|
||||
_hstr2 = string_replace_all(_hstr2, " ", "<space>");
|
||||
}
|
||||
|
||||
curs_found = true;
|
||||
var x1 = tx + string_width(_hstr1);
|
||||
var x2 = tx + string_width(_hstr2);
|
||||
|
||||
draw_roundrect_ext(x1, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
|
||||
} else if(char_line >= ch_sel_min && char_line + _l < ch_sel_max) {
|
||||
var _hstr = _str;
|
||||
|
||||
if(format == TEXT_AREA_FORMAT.delimiter)
|
||||
_hstr = string_replace_all(_hstr, " ", "<space>");
|
||||
|
||||
var x2 = tx + string_width(_hstr);
|
||||
|
||||
draw_roundrect_ext(tx, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
|
||||
} else if(char_line > ch_sel_min && char_line <= ch_sel_max && char_line + _l >= ch_sel_max) {
|
||||
var _hstr = string_copy(_str, 1, ch_sel_max - char_line);
|
||||
|
||||
if(format == TEXT_AREA_FORMAT.delimiter)
|
||||
_hstr = string_replace_all(_hstr, " ", "<space>");
|
||||
|
||||
var x2 = tx + string_width(_hstr);
|
||||
|
||||
draw_roundrect_ext(tx, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
|
||||
}
|
||||
|
||||
char_line += _l;
|
||||
ch_y += line_get_height();
|
||||
}
|
||||
|
||||
cursor_pos_x = cursor_pos_x == 0? cursor_pos_x_to : lerp_float(cursor_pos_x, cursor_pos_x_to, 1);
|
||||
cursor_pos_y = cursor_pos_y == 0? cursor_pos_y_to : lerp_float(cursor_pos_y, cursor_pos_y_to, 1);
|
||||
#endregion
|
||||
if(!curs_found && char_line <= cursor && cursor < char_line + _l) {
|
||||
if(format == TEXT_AREA_FORMAT.delimiter) {
|
||||
var str_cur = string_copy(_str, 1, cursor - char_line);
|
||||
str_cur = string_replace_all(str_cur, " ", "<space>");
|
||||
cursor_pos_x_to = ch_x + string_width(str_cur);
|
||||
} else
|
||||
cursor_pos_x_to = ch_x + string_width(string_copy(_str, 1, cursor - char_line));
|
||||
cursor_pos_y_to = ch_y;
|
||||
cursor_line = i;
|
||||
char_run = char_line;
|
||||
|
||||
curs_found = true;
|
||||
}
|
||||
|
||||
display_text(tx, text_y + ui(7), _input_text, msx, msy, hover && hoverRect);
|
||||
|
||||
if(cursor_pos_y != 0 && cursor_pos_x != 0) {
|
||||
draw_set_color(COLORS._main_text_accent);
|
||||
draw_set_alpha((typing || current_time % (PREFERENCES.caret_blink * 2000) > PREFERENCES.caret_blink * 1000) * 0.75 + 0.25);
|
||||
draw_line_width(cursor_pos_x, cursor_pos_y, cursor_pos_x, cursor_pos_y + c_h, 2);
|
||||
draw_set_alpha(1);
|
||||
char_line += _l;
|
||||
ch_y += line_get_height();
|
||||
}
|
||||
surface_reset_shader();
|
||||
|
||||
cursor_pos_x = cursor_pos_x == 0? cursor_pos_x_to : lerp_float(cursor_pos_x, cursor_pos_x_to, 1);
|
||||
cursor_pos_y = cursor_pos_y == 0? cursor_pos_y_to : lerp_float(cursor_pos_y, cursor_pos_y_to, 1);
|
||||
#endregion
|
||||
|
||||
display_text(tx, text_y + ui(7), _input_text, msx, msy, hover && hoverRect);
|
||||
|
||||
if(cursor_pos_y != 0 && cursor_pos_x != 0) {
|
||||
draw_set_color(COLORS._main_text_accent);
|
||||
draw_set_alpha((typing || current_time % (PREFERENCES.caret_blink * 2000) > PREFERENCES.caret_blink * 1000) * 0.75 + 0.25);
|
||||
draw_line_width(cursor_pos_x, cursor_pos_y, cursor_pos_x, cursor_pos_y + c_h, 2);
|
||||
draw_set_alpha(1);
|
||||
}
|
||||
surface_reset_shader();
|
||||
|
||||
BLEND_ALPHA
|
||||
draw_surface(text_surface, _x, _y);
|
||||
BLEND_NORMAL
|
||||
|
||||
BLEND_ALPHA
|
||||
draw_surface(text_surface, _x, _y);
|
||||
BLEND_NORMAL
|
||||
|
||||
if(typing) typing--;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 2, _x, _y, _w, hh, COLORS._main_accent, 1);
|
||||
|
||||
if(o_dialog_textbox_autocomplete.textbox == self) {
|
||||
o_dialog_textbox_autocomplete.dialog_x = rx + _x + cursor_pos_x + 1;
|
||||
o_dialog_textbox_autocomplete.dialog_y = ry + _y + cursor_pos_y + line_get_height() + 1;
|
||||
}
|
||||
|
||||
if(o_dialog_textbox_function_guide.textbox == self) {
|
||||
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;
|
||||
}
|
||||
#endregion
|
||||
if(typing) typing--;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 2, _x, _y, _w, hh, COLORS._main_accent, 1);
|
||||
|
||||
if(o_dialog_textbox_autocomplete.textbox == self) {
|
||||
o_dialog_textbox_autocomplete.dialog_x = rx + _x + cursor_pos_x + 1;
|
||||
o_dialog_textbox_autocomplete.dialog_y = ry + _y + cursor_pos_y + line_get_height() + 1;
|
||||
}
|
||||
|
||||
if(o_dialog_textbox_function_guide.textbox == self) {
|
||||
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;
|
||||
}
|
||||
|
||||
if(autocomplete_modi && PREFERENCES.widget_autocomplete_delay >= 0 && autocomplete_delay >= PREFERENCES.widget_autocomplete_delay) {
|
||||
o_dialog_textbox_autocomplete.activate(self);
|
||||
|
@ -981,47 +979,45 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
o_dialog_textbox_autocomplete.deactivate(self);
|
||||
}
|
||||
|
||||
#region scroll height
|
||||
if(max_height) {
|
||||
var total_h = text_y_max;
|
||||
text_y_max = max(0, total_h - hh + 16);
|
||||
text_y = lerp_float(text_y, text_y_to, 5);
|
||||
if(max_height) { //scroll height
|
||||
var total_h = text_y_max;
|
||||
text_y_max = max(0, total_h - hh + 16);
|
||||
text_y = lerp_float(text_y, text_y_to, 5);
|
||||
|
||||
if(hover) {
|
||||
if(mouse_wheel_down()) text_y_to = clamp(text_y_to - ui(64) * SCROLL_SPEED, -text_y_max, 0);
|
||||
if(mouse_wheel_up()) text_y_to = clamp(text_y_to + ui(64) * SCROLL_SPEED, -text_y_max, 0);
|
||||
}
|
||||
|
||||
if(hover) {
|
||||
if(mouse_wheel_down()) text_y_to = clamp(text_y_to - ui(64) * SCROLL_SPEED, -text_y_max, 0);
|
||||
if(mouse_wheel_up()) text_y_to = clamp(text_y_to + ui(64) * SCROLL_SPEED, -text_y_max, 0);
|
||||
}
|
||||
var scr_w = ui(sprite_get_width(THEME.ui_scrollbar));
|
||||
var scr_h = hh - (ui(12) - scr_w) * 2;
|
||||
var scr_x = _x + _w - ui(12);
|
||||
var scr_y = _y + ui(12) - scr_w;
|
||||
|
||||
var scr_w = ui(sprite_get_width(THEME.ui_scrollbar));
|
||||
var scr_h = hh - (ui(12) - scr_w) * 2;
|
||||
var scr_x = _x + _w - ui(12);
|
||||
var scr_y = _y + ui(12) - scr_w;
|
||||
|
||||
var bar_h = hh / total_h * scr_h;
|
||||
var bar_y = scr_y + (scr_h - bar_h) * abs(text_y / text_y_max);
|
||||
|
||||
if(text_scrolling) {
|
||||
text_y_to = text_scroll_sy - (_m[1] - text_scroll_my) / bar_h * scr_h;
|
||||
text_y_to = clamp(text_y_to, -text_y_max, 0);
|
||||
|
||||
if(mouse_release(mb_left))
|
||||
text_scrolling = false;
|
||||
}
|
||||
var bar_h = hh / total_h * scr_h;
|
||||
var bar_y = scr_y + (scr_h - bar_h) * abs(text_y / text_y_max);
|
||||
|
||||
if(text_y_max) {
|
||||
var hov = hover && point_in_rectangle(_m[0], _m[1], scr_x - 3, _y, _x + _w, _y + _h);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, scr_y, scr_w, scr_h, COLORS.scrollbar_bg, 1);
|
||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, bar_y, scr_w, bar_h, hov || text_scrolling? COLORS.scrollbar_hover : COLORS.scrollbar_idle, 1);
|
||||
|
||||
if(mouse_press(mb_left, hov && active)) {
|
||||
text_scrolling = true;
|
||||
text_scroll_sy = text_y;
|
||||
text_scroll_my = _m[1];
|
||||
}
|
||||
if(text_scrolling) {
|
||||
text_y_to = text_scroll_sy - (_m[1] - text_scroll_my) / bar_h * scr_h;
|
||||
text_y_to = clamp(text_y_to, -text_y_max, 0);
|
||||
|
||||
if(mouse_release(mb_left))
|
||||
text_scrolling = false;
|
||||
}
|
||||
|
||||
if(text_y_max) {
|
||||
var hov = hover && point_in_rectangle(_m[0], _m[1], scr_x - 3, _y, _x + _w, _y + _h);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, scr_y, scr_w, scr_h, COLORS.scrollbar_bg, 1);
|
||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, bar_y, scr_w, bar_h, hov || text_scrolling? COLORS.scrollbar_hover : COLORS.scrollbar_idle, 1);
|
||||
|
||||
if(mouse_press(mb_left, hov && active)) {
|
||||
text_scrolling = true;
|
||||
text_scroll_sy = text_y;
|
||||
text_scroll_my = _m[1];
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -1034,7 +1030,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
resetFocus();
|
||||
|
||||
return hh;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static clone = function() {
|
||||
var cln = new textArea(input, onModify);
|
||||
|
|
|
@ -73,7 +73,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
|||
|
||||
sprite_index = -1;
|
||||
|
||||
text_surface = surface_create(1, 1);
|
||||
text_surface = noone;
|
||||
|
||||
shake_amount = 0;
|
||||
onDeactivate = -1;
|
||||
|
|
Loading…
Add table
Reference in a new issue