mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
hotkey fix
This commit is contained in:
parent
132c06e2dc
commit
c440edec6b
14 changed files with 258 additions and 190 deletions
|
@ -14,7 +14,7 @@ event_inherited();
|
||||||
|
|
||||||
setFocus(self.id);
|
setFocus(self.id);
|
||||||
|
|
||||||
data = [];
|
data = array_clone(RECENT_COMMANDS, 1);
|
||||||
keys = variable_struct_get_names(FUNCTIONS);
|
keys = variable_struct_get_names(FUNCTIONS);
|
||||||
|
|
||||||
hk_editing = noone;
|
hk_editing = noone;
|
||||||
|
@ -41,6 +41,11 @@ event_inherited();
|
||||||
keyboard_trigger = false;
|
keyboard_trigger = false;
|
||||||
|
|
||||||
function searchMenu() {
|
function searchMenu() {
|
||||||
|
if(search_string == "") {
|
||||||
|
data = array_clone(RECENT_COMMANDS, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
data = [];
|
data = [];
|
||||||
var pr_list = ds_priority_create();
|
var pr_list = ds_priority_create();
|
||||||
var search_lower = string_lower(search_string);
|
var search_lower = string_lower(search_string);
|
||||||
|
@ -97,6 +102,7 @@ event_inherited();
|
||||||
if(sc_content.active) {
|
if(sc_content.active) {
|
||||||
if((!keyboard_trigger && mouse_press(mb_left)) || keyboard_check_pressed(vk_enter)) {
|
if((!keyboard_trigger && mouse_press(mb_left)) || keyboard_check_pressed(vk_enter)) {
|
||||||
_menu.action();
|
_menu.action();
|
||||||
|
array_push(RECENT_COMMANDS, _menu);
|
||||||
instance_destroy();
|
instance_destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -658,6 +658,7 @@ event_inherited();
|
||||||
for(var i = 0; i < ds_list_size(ll); i++)
|
for(var i = 0; i < ds_list_size(ll); i++)
|
||||||
array_push(_lst, ll[| i]);
|
array_push(_lst, ll[| i]);
|
||||||
|
|
||||||
|
array_sort(_lst, function(s1, s2) /*=>*/ {return string_compare(s1.name, s2.name)});
|
||||||
array_push(hotkeyContext, { context: ctx, list: _lst });
|
array_push(hotkeyContext, { context: ctx, list: _lst });
|
||||||
|
|
||||||
var _title = ctx == ""? "Global" : ctx;
|
var _title = ctx == ""? "Global" : ctx;
|
||||||
|
@ -683,8 +684,9 @@ event_inherited();
|
||||||
array_push(_lst, _k);
|
array_push(_lst, _k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
array_sort(_lst, function(s1, s2) /*=>*/ {return string_compare(s1.name, s2.name)});
|
||||||
array_push(hotkeyContext, { context: ctx, list: _lst });
|
array_push(hotkeyContext, { context: ctx, list: _lst });
|
||||||
array_push(hotkeyArray, $" - {ctx}");
|
array_push(hotkeyArray, $" {ctx}");
|
||||||
}
|
}
|
||||||
|
|
||||||
hk_page = 0;
|
hk_page = 0;
|
||||||
|
|
|
@ -11,11 +11,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function __fnInit() {
|
function __fnInit() {
|
||||||
globalvar CMD_FUNCTIONS, MENU_ITEMS, FUNCTIONS;
|
globalvar CMD_FUNCTIONS, MENU_ITEMS, FUNCTIONS, RECENT_COMMANDS;
|
||||||
|
|
||||||
FUNCTIONS = {};
|
FUNCTIONS = {};
|
||||||
CMD_FUNCTIONS = {};
|
CMD_FUNCTIONS = {};
|
||||||
MENU_ITEMS = {};
|
MENU_ITEMS = {};
|
||||||
|
RECENT_COMMANDS = [];
|
||||||
|
|
||||||
__fnInit_Global();
|
__fnInit_Global();
|
||||||
__fnInit_Panels();
|
__fnInit_Panels();
|
||||||
|
|
|
@ -36,11 +36,11 @@
|
||||||
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
|
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
|
||||||
globalvar HOTKEYS, HOTKEY_CONTEXT;
|
globalvar HOTKEYS, HOTKEY_CONTEXT;
|
||||||
|
|
||||||
LATEST_VERSION = 11700;
|
LATEST_VERSION = 1_17_00_0;
|
||||||
VERSION = 11790;
|
VERSION = 1_17_10_0;
|
||||||
SAVE_VERSION = 11700;
|
SAVE_VERSION = 1_17_10_0;
|
||||||
VERSION_STRING = "1.17.10.006";
|
VERSION_STRING = "1.17.10.006";
|
||||||
BUILD_NUMBER = 11790;
|
BUILD_NUMBER = 1_17_10_0;
|
||||||
|
|
||||||
HOTKEYS = ds_map_create();
|
HOTKEYS = ds_map_create();
|
||||||
HOTKEY_CONTEXT = ds_list_create();
|
HOTKEY_CONTEXT = ds_list_create();
|
||||||
|
|
|
@ -1,79 +1,59 @@
|
||||||
globalvar HOTKEYS_CUSTOM;
|
globalvar HOTKEYS_CUSTOM;
|
||||||
|
|
||||||
function __initHotKey() {
|
function __initHotKey() {
|
||||||
HOTKEYS_CUSTOM = {
|
HOTKEYS_CUSTOM = {};
|
||||||
"Node_Canvas": {
|
|
||||||
"Selection": new hotkeySimple("S"),
|
hotkeySimple("Node_Canvas", "Selection", "S");
|
||||||
"Magic Selection": new hotkeySimple("W"),
|
hotkeySimple("Node_Canvas", "Magic Selection", "W");
|
||||||
"Pencil": new hotkeySimple("B"),
|
hotkeySimple("Node_Canvas", "Pencil", "B");
|
||||||
"Eraser": new hotkeySimple("E"),
|
hotkeySimple("Node_Canvas", "Eraser", "E");
|
||||||
"Rectangle": new hotkeySimple("N"),
|
hotkeySimple("Node_Canvas", "Rectangle", "N");
|
||||||
"Ellipse": new hotkeySimple("M"),
|
hotkeySimple("Node_Canvas", "Ellipse", "M");
|
||||||
"Iso Cube": new hotkeySimple(""),
|
hotkeySimple("Node_Canvas", "Iso Cube", "");
|
||||||
"Curve": new hotkeySimple(""),
|
hotkeySimple("Node_Canvas", "Curve", "");
|
||||||
"Freeform": new hotkeySimple("Q"),
|
hotkeySimple("Node_Canvas", "Freeform", "Q");
|
||||||
"Fill": new hotkeySimple("G"),
|
hotkeySimple("Node_Canvas", "Fill", "G");
|
||||||
|
hotkeySimple("Node_Canvas", "Outline", "O", MOD_KEY.alt);
|
||||||
"Outline": new hotkeySimple("O", MOD_KEY.alt),
|
hotkeySimple("Node_Canvas", "Extrude", "E", MOD_KEY.alt);
|
||||||
"Extrude": new hotkeySimple("E", MOD_KEY.alt),
|
hotkeySimple("Node_Canvas", "Inset", "I", MOD_KEY.alt);
|
||||||
"Inset": new hotkeySimple("I", MOD_KEY.alt),
|
hotkeySimple("Node_Canvas", "Skew", "S", MOD_KEY.alt);
|
||||||
"Skew": new hotkeySimple("S", MOD_KEY.alt),
|
hotkeySimple("Node_Canvas", "Corner", "C", MOD_KEY.alt);
|
||||||
"Corner": new hotkeySimple("C", MOD_KEY.alt),
|
|
||||||
},
|
hotkeySimple("Node_Mesh_Warp", "Edit control point", "V");
|
||||||
|
hotkeySimple("Node_Mesh_Warp", "Pin mesh", "P");
|
||||||
"Node_Mesh_Warp": {
|
hotkeySimple("Node_Mesh_Warp", "Mesh edit", "M");
|
||||||
"Edit control point": new hotkeySimple("V"),
|
hotkeySimple("Node_Mesh_Warp", "Anchor remove", "E");
|
||||||
"Pin mesh": new hotkeySimple("P"),
|
|
||||||
"Mesh edit": new hotkeySimple("M"),
|
hotkeySimple("Node_Armature", "Move", "V");
|
||||||
"Anchor remove": new hotkeySimple("E"),
|
hotkeySimple("Node_Armature", "Scale", "S");
|
||||||
},
|
hotkeySimple("Node_Armature", "Add bones", "A");
|
||||||
|
hotkeySimple("Node_Armature", "Remove bones", "E");
|
||||||
"Node_Armature": {
|
hotkeySimple("Node_Armature", "Detach bones", "D");
|
||||||
"Move": new hotkeySimple("V"),
|
hotkeySimple("Node_Armature", "IK", "K");
|
||||||
"Scale": new hotkeySimple("S"),
|
|
||||||
"Add bones": new hotkeySimple("A"),
|
hotkeySimple("Node_Path", "Transform", "T");
|
||||||
"Remove bones": new hotkeySimple("E"),
|
hotkeySimple("Node_Path", "Anchor add / remove", "A");
|
||||||
"Detach bones": new hotkeySimple("D"),
|
hotkeySimple("Node_Path", "Edit Control point", "C");
|
||||||
"IK": new hotkeySimple("K"),
|
hotkeySimple("Node_Path", "Draw path", "B");
|
||||||
},
|
hotkeySimple("Node_Path", "Rectangle path", "N");
|
||||||
|
hotkeySimple("Node_Path", "Circle path", "M");
|
||||||
"Node_Path": {
|
|
||||||
"Transform": new hotkeySimple("T"),
|
hotkeySimple("Node_Rigid_Object", "Mesh edit", "A");
|
||||||
"Anchor add / remove": new hotkeySimple("A"),
|
hotkeySimple("Node_Rigid_Object", "Anchor remove", "E");
|
||||||
"Edit Control point": new hotkeySimple("C"),
|
|
||||||
"Draw path": new hotkeySimple("B"),
|
hotkeySimple("Node_Strand_Create", "Push", "P");
|
||||||
"Rectangle path": new hotkeySimple("N"),
|
hotkeySimple("Node_Strand_Create", "Comb", "C");
|
||||||
"Circle path": new hotkeySimple("M"),
|
hotkeySimple("Node_Strand_Create", "Stretch", "S");
|
||||||
},
|
hotkeySimple("Node_Strand_Create", "Shorten", "D");
|
||||||
|
hotkeySimple("Node_Strand_Create", "Grab", "G");
|
||||||
"Node_Rigid_Object": {
|
|
||||||
"Mesh edit": new hotkeySimple("A"),
|
hotkeySimple("Node_Path_Anchor", "Adjust control point", "A");
|
||||||
"Anchor remove": new hotkeySimple("E"),
|
|
||||||
},
|
hotkeySimple("Node_3D_Object", "Transform", "G");
|
||||||
|
hotkeySimple("Node_3D_Object", "Rotate", "R");
|
||||||
"Node_Strand_Create": {
|
hotkeySimple("Node_3D_Object", "Scale", "S");
|
||||||
"Push": new hotkeySimple("P"),
|
|
||||||
"Comb": new hotkeySimple("C"),
|
hotkeySimple("Node_3D_Camera", "Move Target", "T");
|
||||||
"Stretch": new hotkeySimple("S"),
|
|
||||||
"Shorten": new hotkeySimple("D"),
|
|
||||||
"Grab": new hotkeySimple("G"),
|
|
||||||
},
|
|
||||||
|
|
||||||
"Node_Path_Anchor": {
|
|
||||||
"Adjust control point": new hotkeySimple("A"),
|
|
||||||
},
|
|
||||||
|
|
||||||
"Node_3D_Object": {
|
|
||||||
"Transform": new hotkeySimple("G"),
|
|
||||||
"Rotate": new hotkeySimple("R"),
|
|
||||||
"Scale": new hotkeySimple("S"),
|
|
||||||
},
|
|
||||||
|
|
||||||
"Node_3D_Camera": {
|
|
||||||
"Move Target": new hotkeySimple("T"),
|
|
||||||
},
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getToolHotkey(_group, _key) {
|
function getToolHotkey(_group, _key) {
|
||||||
|
@ -86,14 +66,21 @@ function getToolHotkey(_group, _key) {
|
||||||
|
|
||||||
return _grp[$ _key];
|
return _grp[$ _key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hotkeySimple(_context, _name, _key, modi = MOD_KEY.none) { return new HotkeySimple(_context, _name, _key, modi); }
|
||||||
|
function HotkeySimple(_context, _name, _key, modi = MOD_KEY.none) constructor {
|
||||||
|
context = _context;
|
||||||
|
name = _name;
|
||||||
|
|
||||||
function hotkeySimple(_key, modi = MOD_KEY.none) constructor {
|
|
||||||
self.key = key_get_index(_key);
|
self.key = key_get_index(_key);
|
||||||
self.modi = modi;
|
self.modi = modi;
|
||||||
|
|
||||||
dKey = key;
|
dKey = key;
|
||||||
dModi = modi;
|
dModi = modi;
|
||||||
|
|
||||||
|
if(!struct_has(HOTKEYS_CUSTOM, context)) HOTKEYS_CUSTOM[$ context] = {};
|
||||||
|
HOTKEYS_CUSTOM[$ context][$ name] = self;
|
||||||
|
|
||||||
static isPressing = function() {
|
static isPressing = function() {
|
||||||
if(is_string(key)) key = key_get_index(key);
|
if(is_string(key)) key = key_get_index(key);
|
||||||
return key == noone? false : key_press(key, modi);
|
return key == noone? false : key_press(key, modi);
|
||||||
|
@ -103,6 +90,12 @@ function hotkeySimple(_key, modi = MOD_KEY.none) constructor {
|
||||||
if(is_string(key)) key = key_get_index(key);
|
if(is_string(key)) key = key_get_index(key);
|
||||||
return key_get_name(key, modi);
|
return key_get_name(key, modi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static serialize = function() { return { context, name, key, modi } }
|
||||||
|
static deserialize = function(ll) { if(!is_struct(ll)) return; key = ll.key; modi = ll.modi; }
|
||||||
|
|
||||||
|
var _loadKey = $"{context}_{name}";
|
||||||
|
if(struct_has(HOTKEYS_DATA, _loadKey)) deserialize(HOTKEYS_DATA[$ _loadKey]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hotkeyObject(_context, _name, _key, _mod = MOD_KEY.none, _action = noone) constructor {
|
function hotkeyObject(_context, _name, _key, _mod = MOD_KEY.none, _action = noone) constructor {
|
||||||
|
@ -115,18 +108,13 @@ function hotkeyObject(_context, _name, _key, _mod = MOD_KEY.none, _action = noon
|
||||||
dKey = _key;
|
dKey = _key;
|
||||||
dModi = _mod;
|
dModi = _mod;
|
||||||
|
|
||||||
static serialize = function() { return { context, name, key, modi }; }
|
|
||||||
|
|
||||||
static deserialize = function(ll) {
|
|
||||||
key = is_struct(ll)? ll.key : ll[2];
|
|
||||||
modi = is_struct(ll)? ll.modi : ll[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
static full_name = function() { return string_to_var(context == ""? $"global.{name}" : $"{context}.{name}"); }
|
static full_name = function() { return string_to_var(context == ""? $"global.{name}" : $"{context}.{name}"); }
|
||||||
|
|
||||||
|
static serialize = function() { return { context, name, key, modi } }
|
||||||
|
static deserialize = function(ll) { if(!is_struct(ll)) return; key = ll.key; modi = ll.modi; }
|
||||||
|
|
||||||
var _loadKey = $"{context}_{name}";
|
var _loadKey = $"{context}_{name}";
|
||||||
if(struct_has(HOTKEYS_DATA, _loadKey))
|
if(struct_has(HOTKEYS_DATA, _loadKey)) deserialize(HOTKEYS_DATA[$ _loadKey]);
|
||||||
deserialize(HOTKEYS_DATA[$ _loadKey]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addHotkey(_context, _name, _key, _mod, _action) {
|
function addHotkey(_context, _name, _key, _mod, _action) {
|
||||||
|
@ -245,4 +233,68 @@ function hotkey_draw(keyStr, _x, _y, _status = 0) {
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, _x - _tw - ui(4), _y - _th / 2 - ui(3), _tw + ui(8), _th + ui(3), bc);
|
draw_sprite_stretched_ext(THEME.ui_panel, 1, _x - _tw - ui(4), _y - _th / 2 - ui(3), _tw + ui(8), _th + ui(3), bc);
|
||||||
draw_text(_x, _y, keyStr);
|
draw_text(_x, _y, keyStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hotkey_serialize() {
|
||||||
|
|
||||||
|
var _context = [];
|
||||||
|
for(var i = 0, n = ds_list_size(HOTKEY_CONTEXT); i < n; i++) {
|
||||||
|
var ll = HOTKEYS[? HOTKEY_CONTEXT[| i]];
|
||||||
|
|
||||||
|
for(var j = 0, m = ds_list_size(ll); j < m; j++) {
|
||||||
|
var _hk = ll[| j];
|
||||||
|
if(_hk.dKey == _hk.key && _hk.dModi == _hk.modi) continue;
|
||||||
|
array_push(_context, _hk.serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _node = [];
|
||||||
|
var _cust = variable_struct_get_names(HOTKEYS_CUSTOM);
|
||||||
|
for(var i = 0, n = array_length(_cust); i < n; i++) {
|
||||||
|
|
||||||
|
var nd = _cust[i];
|
||||||
|
var nl = HOTKEYS_CUSTOM[$ nd];
|
||||||
|
var kk = variable_struct_get_names(nl);
|
||||||
|
|
||||||
|
for (var j = 0, m = array_length(kk); j < m; j++) {
|
||||||
|
var _nm = kk[j];
|
||||||
|
var _hk = nl[$ _nm];
|
||||||
|
|
||||||
|
if(_hk.dKey == _hk.key && _hk.dModi == _hk.modi) continue;
|
||||||
|
array_push(_node, _hk.serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
json_save_struct(DIRECTORY + "hotkeys.json", { context: _context, node: _node });
|
||||||
|
}
|
||||||
|
|
||||||
|
function hotkey_deserialize() {
|
||||||
|
HOTKEYS_DATA = {};
|
||||||
|
var path = DIRECTORY + "hotkeys.json";
|
||||||
|
if(!file_exists(path)) return;
|
||||||
|
|
||||||
|
var map = json_load_struct(path);
|
||||||
|
if(!is_struct(map)) return;
|
||||||
|
|
||||||
|
if(struct_has(map, "context")) {
|
||||||
|
var _ctx = map.context;
|
||||||
|
for(var i = 0; i < array_length(_ctx); i++) {
|
||||||
|
var key_list = _ctx[i];
|
||||||
|
var _context = key_list.context;
|
||||||
|
var name = key_list.name;
|
||||||
|
|
||||||
|
HOTKEYS_DATA[$ $"{_context}_{name}"] = key_list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(struct_has(map, "node")) {
|
||||||
|
var _ctx = map.node;
|
||||||
|
for(var i = 0; i < array_length(_ctx); i++) {
|
||||||
|
var key_list = _ctx[i];
|
||||||
|
var _context = key_list.context;
|
||||||
|
var name = key_list.name;
|
||||||
|
|
||||||
|
HOTKEYS_DATA[$ $"{_context}_{name}"] = key_list;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -209,4 +209,13 @@ function node_auto_align(nodeList) {
|
||||||
|
|
||||||
if(h_var < v_var) { node_halign(nodeList); node_vdistribute(nodeList); }
|
if(h_var < v_var) { node_halign(nodeList); node_vdistribute(nodeList); }
|
||||||
else if(v_var < h_var) { node_valign(nodeList); node_hdistribute(nodeList); }
|
else if(v_var < h_var) { node_valign(nodeList); node_hdistribute(nodeList); }
|
||||||
|
}
|
||||||
|
|
||||||
|
function node_snap_grid(nodeList, spacing = 16) {
|
||||||
|
for (var i = 0, n = array_length(nodeList); i < n; i++) {
|
||||||
|
var _node = nodeList[i];
|
||||||
|
|
||||||
|
_node.x = value_snap(_node.x, spacing);
|
||||||
|
_node.y = value_snap(_node.y, spacing);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -12,8 +12,11 @@ function Node_Slideshow(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
|
|
||||||
inputs[2] = nodeValue_Enum_Scroll("Anchor", self, 0, [ "Center", "Top left" ]);
|
inputs[2] = nodeValue_Enum_Scroll("Anchor", self, 0, [ "Center", "Top left" ]);
|
||||||
|
|
||||||
|
inputs[3] = nodeValue_Float("Arrival Speed", self, 4);
|
||||||
|
|
||||||
slide_title = "";
|
slide_title = "";
|
||||||
slide_anchor = 0;
|
slide_anchor = 0;
|
||||||
|
slide_speed = 32;
|
||||||
|
|
||||||
static step = function() {
|
static step = function() {
|
||||||
var _ord = inputs[0].getValue();
|
var _ord = inputs[0].getValue();
|
||||||
|
@ -21,6 +24,7 @@ function Node_Slideshow(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
|
|
||||||
slide_title = inputs[1].getValue();
|
slide_title = inputs[1].getValue();
|
||||||
slide_anchor = inputs[2].getValue();
|
slide_anchor = inputs[2].getValue();
|
||||||
|
slide_speed = max(1, 100 / inputs[3].getValue());
|
||||||
|
|
||||||
setDisplayName($"Slide-{slide_title}");
|
setDisplayName($"Slide-{slide_title}");
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,37 +104,35 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
#region ---- value ----
|
#region ---- value ----
|
||||||
|
|
||||||
def_val = array_clone(_value);
|
def_val = array_clone(_value);
|
||||||
def_length = is_array(def_val)? array_length(def_val) : 0;
|
def_length = is_array(def_val)? array_length(def_val) : 0;
|
||||||
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();
|
dyna_depo = ds_list_create();
|
||||||
value_tag = "";
|
value_tag = "";
|
||||||
|
|
||||||
type_array = 0;
|
type_array = 0;
|
||||||
|
|
||||||
is_modified = false;
|
is_modified = false;
|
||||||
cache_value = [ false, false, undefined, undefined ];
|
cache_value = [ false, false, undefined, undefined ];
|
||||||
cache_array = [ false, false ];
|
cache_array = [ false, false ];
|
||||||
use_cache = true;
|
use_cache = true;
|
||||||
record_value = true;
|
record_value = true;
|
||||||
|
|
||||||
process_array = true;
|
process_array = true;
|
||||||
dynamic_array = false;
|
dynamic_array = false;
|
||||||
validateValue = true;
|
validateValue = true;
|
||||||
runInUI = false;
|
runInUI = false;
|
||||||
|
|
||||||
fullUpdate = false;
|
fullUpdate = false;
|
||||||
|
attributes = {};
|
||||||
|
|
||||||
attributes = {};
|
node.inputs_data[index] = _value;
|
||||||
|
|
||||||
node.inputs_data[index] = _value;
|
|
||||||
node.input_value_map[$ internalName] = _value;
|
node.input_value_map[$ internalName] = _value;
|
||||||
|
|
||||||
__curr_get_val = [ 0, 0 ];
|
__curr_get_val = [ 0, 0 ];
|
||||||
|
validator = noone;
|
||||||
validator = noone;
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ---- draw ----
|
#region ---- draw ----
|
||||||
|
@ -1474,7 +1472,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static setValueInspector = function(_val = 0, index = noone, time = CURRENT_FRAME) { #region
|
static setValueInspector = function(_val = 0, index = noone, time = CURRENT_FRAME) {
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
var res = false;
|
var res = false;
|
||||||
|
@ -1487,30 +1485,29 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
var _node = PANEL_INSPECTOR.inspectings[i];
|
var _node = PANEL_INSPECTOR.inspectings[i];
|
||||||
if(ind >= array_length(_node.inputs)) continue;
|
if(ind >= array_length(_node.inputs)) continue;
|
||||||
|
|
||||||
var r = _node.inputs[ind].setValueDirect(val, index);
|
var r = _node.inputs[ind].setValueDirect(val, index, true, time);
|
||||||
if(_node == node) res = r;
|
if(_node == node) res = r;
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
res = setValueDirect(val, index, time);
|
res = setValueDirect(val, index, true, time);
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setValueDirect = function(val = 0, index = noone, record = true, time = CURRENT_FRAME, _update = true) {
|
static setValueDirect = function(val = 0, index = noone, record = true, time = CURRENT_FRAME, _update = true) {
|
||||||
is_modified = true;
|
is_modified = true;
|
||||||
var updated = false;
|
var updated = false;
|
||||||
var _val = val;
|
var _val = val;
|
||||||
var _inp = connect_type == JUNCTION_CONNECT.input;
|
var _inp = connect_type == JUNCTION_CONNECT.input;
|
||||||
|
|
||||||
record &= record_value;
|
record &= record_value & _inp;
|
||||||
|
|
||||||
if(sep_axis) {
|
if(sep_axis) {
|
||||||
if(index == noone) {
|
if(index == noone) {
|
||||||
for( var i = 0, n = array_length(animators); i < n; i++ )
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
||||||
updated |= animators[i].setValue(val[i], _inp && record, time);
|
updated |= animators[i].setValue(val[i], record, time);
|
||||||
} else
|
} else
|
||||||
updated = animators[index].setValue(val, _inp && record, time);
|
updated = animators[index].setValue(val, record, time);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(index != noone) {
|
if(index != noone) {
|
||||||
|
@ -1520,7 +1517,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
_val[index] = val;
|
_val[index] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
updated = animator.setValue(_val, _inp && record, time);
|
updated = animator.setValue(_val, record, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type == VALUE_TYPE.gradient) updated = true;
|
if(type == VALUE_TYPE.gradient) updated = true;
|
||||||
|
|
|
@ -482,7 +482,7 @@
|
||||||
registerFunction("", "Preferences", "", MOD_KEY.none, call_dialog_preference ).setMenu("preference", THEME.gear)
|
registerFunction("", "Preferences", "", MOD_KEY.none, call_dialog_preference ).setMenu("preference", THEME.gear)
|
||||||
registerFunction("", "Splash screen", "", MOD_KEY.none, call_dialog_splash ).setMenu("splash_screen")
|
registerFunction("", "Splash screen", "", MOD_KEY.none, call_dialog_splash ).setMenu("splash_screen")
|
||||||
registerFunction("", "Release note", "", MOD_KEY.none, call_dialog_release_note ).setMenu("release_note")
|
registerFunction("", "Release note", "", MOD_KEY.none, call_dialog_release_note ).setMenu("release_note")
|
||||||
registerFunction("", "Command Palette", "T", MOD_KEY.ctrl | MOD_KEY.shift, call_dialog_command_palette).setMenu("command_palette")
|
registerFunction("", "Command Palette", vk_space, MOD_KEY.ctrl, call_dialog_command_palette ).setMenu("command_palette")
|
||||||
registerFunction("", "Open Autosave Folder", "", MOD_KEY.none, open_autosave_folder ).setMenu("autosave_folder", THEME.save_auto)
|
registerFunction("", "Open Autosave Folder", "", MOD_KEY.none, open_autosave_folder ).setMenu("autosave_folder", THEME.save_auto)
|
||||||
|
|
||||||
registerFunction("", "Addons", "", MOD_KEY.none, call_panel_addon ).setMenu("addons")
|
registerFunction("", "Addons", "", MOD_KEY.none, call_panel_addon ).setMenu("addons")
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
function panel_graph_paste() { CALL("graph_paste"); PANEL_GRAPH.doPaste(); }
|
function panel_graph_paste() { CALL("graph_paste"); PANEL_GRAPH.doPaste(); }
|
||||||
|
|
||||||
function panel_graph_auto_align() { CALL("graph_auto_align"); node_auto_align(PANEL_GRAPH.nodes_selecting); }
|
function panel_graph_auto_align() { CALL("graph_auto_align"); node_auto_align(PANEL_GRAPH.nodes_selecting); }
|
||||||
|
function panel_graph_snap_nodes() { CALL("graph_snap_nodes"); node_snap_grid(PANEL_GRAPH.nodes_selecting, PANEL_GRAPH.project.graphGrid.size); }
|
||||||
function panel_graph_search() { CALL("graph_search"); PANEL_GRAPH.toggleSearch(); }
|
function panel_graph_search() { CALL("graph_search"); PANEL_GRAPH.toggleSearch(); }
|
||||||
function panel_graph_toggle_minimap() { CALL("graph_toggle_minimap"); PANEL_GRAPH.minimap_show = !PANEL_GRAPH.minimap_show; }
|
function panel_graph_toggle_minimap() { CALL("graph_toggle_minimap"); PANEL_GRAPH.minimap_show = !PANEL_GRAPH.minimap_show; }
|
||||||
|
|
||||||
|
@ -92,12 +93,11 @@
|
||||||
registerFunction("Graph", "Array", "A", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_array ).setMenu("graph_array")
|
registerFunction("Graph", "Array", "A", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_array ).setMenu("graph_array")
|
||||||
registerFunction("Graph", "Frame", "F", MOD_KEY.shift, panel_graph_frame ).setMenu("graph_frame")
|
registerFunction("Graph", "Frame", "F", MOD_KEY.shift, panel_graph_frame ).setMenu("graph_frame")
|
||||||
|
|
||||||
registerFunction("Graph", "Canvas", "", MOD_KEY.none,
|
|
||||||
function(_dat) { return submenuCall(_dat, [ MENU_ITEMS.graph_canvas_copy, MENU_ITEMS.graph_canvas_blend ]); } ).setMenu("graph_canvas",, true)
|
|
||||||
registerFunction("Graph", "Copy to Canvas", "C", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_canvas_copy ).setMenu("graph_canvas_copy")
|
registerFunction("Graph", "Copy to Canvas", "C", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_canvas_copy ).setMenu("graph_canvas_copy")
|
||||||
registerFunction("Graph", "Blend Canvas", "C", MOD_KEY.ctrl | MOD_KEY.alt, panel_graph_canvas_blend ).setMenu("graph_canvas_blend")
|
registerFunction("Graph", "Blend Canvas", "C", MOD_KEY.ctrl | MOD_KEY.alt, panel_graph_canvas_blend ).setMenu("graph_canvas_blend")
|
||||||
|
registerFunction("Graph", "Canvas", "", MOD_KEY.none,
|
||||||
|
function(_dat) { return submenuCall(_dat, [ MENU_ITEMS.graph_canvas_copy, MENU_ITEMS.graph_canvas_blend ]); } ).setMenu("graph_canvas",, true)
|
||||||
|
|
||||||
registerFunction("Graph", "Delete (break)", vk_delete, MOD_KEY.shift, panel_graph_delete_break ).setMenu("graph_delete_break", THEME.cross)
|
registerFunction("Graph", "Delete (break)", vk_delete, MOD_KEY.shift, panel_graph_delete_break ).setMenu("graph_delete_break", THEME.cross)
|
||||||
registerFunction("Graph", "Delete (merge)", vk_delete, MOD_KEY.none, panel_graph_delete_merge ).setMenu("graph_delete_merge", THEME.cross)
|
registerFunction("Graph", "Delete (merge)", vk_delete, MOD_KEY.none, panel_graph_delete_merge ).setMenu("graph_delete_merge", THEME.cross)
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@
|
||||||
registerFunction("Graph", "Zoom", "", MOD_KEY.alt | MOD_KEY.ctrl, panel_graph_zoom ).setMenu("graph_zoom")
|
registerFunction("Graph", "Zoom", "", MOD_KEY.alt | MOD_KEY.ctrl, panel_graph_zoom ).setMenu("graph_zoom")
|
||||||
|
|
||||||
registerFunction("Graph", "Auto Align", "L", MOD_KEY.none, panel_graph_auto_align ).setMenu("graph_auto_align")
|
registerFunction("Graph", "Auto Align", "L", MOD_KEY.none, panel_graph_auto_align ).setMenu("graph_auto_align")
|
||||||
|
registerFunction("Graph", "Snap Nodes", "", MOD_KEY.none, panel_graph_snap_nodes ).setMenu("graph_snap_nodes")
|
||||||
registerFunction("Graph", "Search", "F", MOD_KEY.ctrl, panel_graph_search ).setMenu("graph_search")
|
registerFunction("Graph", "Search", "F", MOD_KEY.ctrl, panel_graph_search ).setMenu("graph_search")
|
||||||
registerFunction("Graph", "Toggle Minimap", "M", MOD_KEY.ctrl, panel_graph_toggle_minimap ).setMenu("graph_toggle_minimap")
|
registerFunction("Graph", "Toggle Minimap", "M", MOD_KEY.ctrl, panel_graph_toggle_minimap ).setMenu("graph_toggle_minimap")
|
||||||
|
|
||||||
|
@ -291,9 +292,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
graph_cx = 0;
|
graph_cx = 0;
|
||||||
graph_cy = 0;
|
graph_cy = 0;
|
||||||
|
|
||||||
graph_autopan = false;
|
graph_autopan = false;
|
||||||
graph_pan_x_to = 0;
|
graph_pan_x_to = 0;
|
||||||
graph_pan_y_to = 0;
|
graph_pan_y_to = 0;
|
||||||
|
graph_pan_speed = 32;
|
||||||
|
|
||||||
scale = [ 0.01, 0.02, 0.05, 0.10, 0.15, 0.20, 0.25, 0.33, 0.50, 0.65, 0.80, 1, 1.2, 1.35, 1.5, 2.0 ];
|
scale = [ 0.01, 0.02, 0.05, 0.10, 0.15, 0.20, 0.25, 0.33, 0.50, 0.65, 0.80, 1, 1.2, 1.35, 1.5, 2.0 ];
|
||||||
graph_s = 1;
|
graph_s = 1;
|
||||||
|
@ -735,7 +737,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
|
|
||||||
menu_connection_tunnel = MENU_ITEMS.graph_create_tunnel;
|
menu_connection_tunnel = MENU_ITEMS.graph_create_tunnel;
|
||||||
|
|
||||||
// node color
|
#region colors setters
|
||||||
|
__junction_hovering = noone;
|
||||||
|
menu_node_color = MENU_ITEMS.graph_group_node_color;
|
||||||
|
menu_junc_color = MENU_ITEMS.graph_group_junction_color;
|
||||||
|
|
||||||
function setSelectingNodeColor(color) {
|
function setSelectingNodeColor(color) {
|
||||||
__temp_color = color;
|
__temp_color = color;
|
||||||
|
|
||||||
|
@ -743,12 +749,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
array_foreach(nodes_selecting, function(node) { node.attributes.color = __temp_color; });
|
array_foreach(nodes_selecting, function(node) { node.attributes.color = __temp_color; });
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_node_color = MENU_ITEMS.graph_group_node_color;
|
|
||||||
|
|
||||||
|
|
||||||
// junction color
|
|
||||||
__junction_hovering = noone;
|
|
||||||
|
|
||||||
function setSelectingJuncColor(color) {
|
function setSelectingJuncColor(color) {
|
||||||
if(__junction_hovering == noone) return;
|
if(__junction_hovering == noone) return;
|
||||||
__junction_hovering.setColor(color);
|
__junction_hovering.setColor(color);
|
||||||
|
@ -763,9 +763,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
menu_junc_color = MENU_ITEMS.graph_group_junction_color;
|
|
||||||
|
|
||||||
|
|
||||||
//// ============ Project ============
|
//// ============ Project ============
|
||||||
|
|
||||||
|
@ -782,14 +780,14 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
|
|
||||||
//// ============ Views ============
|
//// ============ Views ============
|
||||||
|
|
||||||
function onFocusBegin() { //
|
function onFocusBegin() {
|
||||||
PANEL_GRAPH = self;
|
PANEL_GRAPH = self;
|
||||||
PROJECT = project;
|
PROJECT = project;
|
||||||
|
|
||||||
nodes_select_drag = 0;
|
nodes_select_drag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusNode(_node) { //
|
function focusNode(_node) {
|
||||||
if(_node == noone) {
|
if(_node == noone) {
|
||||||
nodes_selecting = [];
|
nodes_selecting = [];
|
||||||
return;
|
return;
|
||||||
|
@ -799,15 +797,12 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
fullView();
|
fullView();
|
||||||
}
|
}
|
||||||
|
|
||||||
function fullView() {
|
function fullView() { INLINE toCenterNode(array_empty(nodes_selecting)? nodes_list : nodes_selecting); }
|
||||||
INLINE
|
|
||||||
toCenterNode(array_empty(nodes_selecting)? nodes_list : nodes_selecting);
|
|
||||||
}
|
|
||||||
|
|
||||||
function dragGraph() {
|
function dragGraph() {
|
||||||
if(graph_autopan) {
|
if(graph_autopan) {
|
||||||
graph_x = lerp_float(graph_x, graph_pan_x_to, 32, 1);
|
graph_x = lerp_float(graph_x, graph_pan_x_to, graph_pan_speed, 1);
|
||||||
graph_y = lerp_float(graph_y, graph_pan_y_to, 32, 1);
|
graph_y = lerp_float(graph_y, graph_pan_y_to, graph_pan_speed, 1);
|
||||||
|
|
||||||
if(graph_x == graph_pan_x_to && graph_y == graph_pan_y_to)
|
if(graph_x == graph_pan_x_to && graph_y == graph_pan_y_to)
|
||||||
graph_autopan = false;
|
graph_autopan = false;
|
||||||
|
@ -937,10 +932,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
graph_y = round(graph_y);
|
graph_y = round(graph_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
function autoPanTo(_x, _y) {
|
function autoPanTo(_x, _y, _speed = 32) {
|
||||||
graph_autopan = true;
|
graph_autopan = true;
|
||||||
graph_pan_x_to = _x;
|
graph_pan_x_to = _x;
|
||||||
graph_pan_y_to = _y;
|
graph_pan_y_to = _y;
|
||||||
|
graph_pan_speed = _speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSlideShow(index, skip = false) {
|
function setSlideShow(index, skip = false) {
|
||||||
|
@ -973,7 +969,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
graph_y = _ty;
|
graph_y = _ty;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
autoPanTo(_tx, _ty, skip);
|
autoPanTo(_tx, _ty, _targ.slide_speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//// =========== Context ==========
|
//// =========== Context ==========
|
||||||
|
@ -3119,6 +3115,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
|
|
||||||
_ti.inputs[1].setFrom(_jo);
|
_ti.inputs[1].setFrom(_jo);
|
||||||
_ji.setFrom(_to.outputs[0]);
|
_ji.setFrom(_to.outputs[0]);
|
||||||
|
|
||||||
|
_to.inputs[0].updateColor();
|
||||||
|
_ti.inputs[1].updateColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
function createAction() {
|
function createAction() {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
function Panel_History() : PanelContent() constructor {
|
function Panel_History() : PanelContent() constructor {
|
||||||
title = __txt("History");
|
title = __txt("History");
|
||||||
w = ui(400);
|
padding = ui(8);
|
||||||
h = ui(480);
|
w = ui(400);
|
||||||
|
h = ui(480);
|
||||||
|
|
||||||
anchor = ANCHOR.left | ANCHOR.top;
|
anchor = ANCHOR.left | ANCHOR.top;
|
||||||
hold = false;
|
hold = false;
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
function Panel_Nodes() : PanelContent() constructor {
|
function Panel_Nodes() : PanelContent() constructor {
|
||||||
title = __txt("Nodes");
|
title = __txt("Nodes");
|
||||||
padding = 8;
|
padding = ui(8);
|
||||||
|
w = ui(320);
|
||||||
w = ui(320);
|
h = ui(480);
|
||||||
h = ui(480);
|
|
||||||
|
|
||||||
search_string = "";
|
search_string = "";
|
||||||
|
|
||||||
|
|
|
@ -249,24 +249,13 @@
|
||||||
PREFERENCES.window_height = max(600, window_minimize_size[1]);
|
PREFERENCES.window_height = max(600, window_minimize_size[1]);
|
||||||
PREFERENCES.window_monitor = window_monitor;
|
PREFERENCES.window_monitor = window_monitor;
|
||||||
|
|
||||||
var _hotkey = [];
|
|
||||||
for(var j = 0; j < ds_list_size(HOTKEY_CONTEXT); j++) {
|
|
||||||
var ll = HOTKEYS[? HOTKEY_CONTEXT[| j]];
|
|
||||||
|
|
||||||
for(var i = 0; i < ds_list_size(ll); i++) {
|
|
||||||
var _hk = ll[| i];
|
|
||||||
if(_hk.dKey == _hk.key && _hk.dModi == _hk.modi) continue;
|
|
||||||
|
|
||||||
array_push(_hotkey, _hk.serialize());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
json_save_struct(DIRECTORY + "keys.json", PREFERENCES);
|
json_save_struct(DIRECTORY + "keys.json", PREFERENCES);
|
||||||
json_save_struct(DIRECTORY + "hotkeys.json", _hotkey);
|
|
||||||
json_save_struct(DIRECTORY + "Nodes/fav.json", global.FAV_NODES);
|
json_save_struct(DIRECTORY + "Nodes/fav.json", global.FAV_NODES);
|
||||||
json_save_struct(DIRECTORY + "Nodes/recent.json", global.RECENT_NODES);
|
json_save_struct(DIRECTORY + "Nodes/recent.json", global.RECENT_NODES);
|
||||||
json_save_struct(DIRECTORY + "key_nodes.json", HOTKEYS_CUSTOM);
|
json_save_struct(DIRECTORY + "key_nodes.json", HOTKEYS_CUSTOM);
|
||||||
json_save_struct(DIRECTORY + "default_project.json", PROJECT_ATTRIBUTES);
|
json_save_struct(DIRECTORY + "default_project.json", PROJECT_ATTRIBUTES);
|
||||||
|
|
||||||
|
hotkey_serialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
function PREF_LOAD() {
|
function PREF_LOAD() {
|
||||||
|
@ -277,20 +266,6 @@
|
||||||
else struct_override(PREFERENCES, map);
|
else struct_override(PREFERENCES, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = DIRECTORY + "hotkeys.json";
|
|
||||||
if(file_exists(path)) {
|
|
||||||
var map = json_load_struct(path);
|
|
||||||
HOTKEYS_DATA = {};
|
|
||||||
|
|
||||||
for(var i = 0; i < array_length(map); i++) {
|
|
||||||
var key_list = map[i];
|
|
||||||
var _context = is_struct(key_list)? key_list.context : key_list[0];
|
|
||||||
var name = is_struct(key_list)? key_list.name : key_list[1];
|
|
||||||
|
|
||||||
HOTKEYS_DATA[$ $"{_context}_{name}"] = key_list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!directory_exists($"{DIRECTORY}Themes/{PREFERENCES.theme}"))
|
if(!directory_exists($"{DIRECTORY}Themes/{PREFERENCES.theme}"))
|
||||||
PREFERENCES.theme = "default";
|
PREFERENCES.theme = "default";
|
||||||
|
|
||||||
|
@ -308,6 +283,7 @@
|
||||||
var f = json_load_struct(DIRECTORY + "default_project.json");
|
var f = json_load_struct(DIRECTORY + "default_project.json");
|
||||||
struct_override(PROJECT_ATTRIBUTES, f);
|
struct_override(PROJECT_ATTRIBUTES, f);
|
||||||
|
|
||||||
|
hotkey_deserialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
function PREF_APPLY() {
|
function PREF_APPLY() {
|
||||||
|
|
|
@ -44,6 +44,28 @@ function string_to_var(str) { INLINE return string_replace_all(string
|
||||||
function string_to_var2(context, name) { INLINE return string_to_var(context == ""? name : $"{context} {name}"); }
|
function string_to_var2(context, name) { INLINE return string_to_var(context == ""? name : $"{context} {name}"); }
|
||||||
function string_quote(str) { INLINE return $"\"{str}\""; }
|
function string_quote(str) { INLINE return $"\"{str}\""; }
|
||||||
|
|
||||||
|
function string_compare(s1, s2) {
|
||||||
|
var l1 = string_length(s1);
|
||||||
|
var l2 = string_length(s2);
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
var c1, c2;
|
||||||
|
|
||||||
|
repeat(min(l1, l2)) {
|
||||||
|
c1 = string_lower(string_char_at(s1, i));
|
||||||
|
c2 = string_lower(string_char_at(s2, i));
|
||||||
|
|
||||||
|
if(c1 == c2) {
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ord(c1) - ord(c2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return l1 - l2;
|
||||||
|
}
|
||||||
|
|
||||||
function array_to_string(arr) {
|
function array_to_string(arr) {
|
||||||
if(!is_array(arr)) return string(arr);
|
if(!is_array(arr)) return string(arr);
|
||||||
if(array_empty(arr)) return "[]";
|
if(array_empty(arr)) return "[]";
|
||||||
|
|
Loading…
Reference in a new issue