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);
|
||||
|
||||
data = [];
|
||||
data = array_clone(RECENT_COMMANDS, 1);
|
||||
keys = variable_struct_get_names(FUNCTIONS);
|
||||
|
||||
hk_editing = noone;
|
||||
|
@ -41,6 +41,11 @@ event_inherited();
|
|||
keyboard_trigger = false;
|
||||
|
||||
function searchMenu() {
|
||||
if(search_string == "") {
|
||||
data = array_clone(RECENT_COMMANDS, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
data = [];
|
||||
var pr_list = ds_priority_create();
|
||||
var search_lower = string_lower(search_string);
|
||||
|
@ -97,6 +102,7 @@ event_inherited();
|
|||
if(sc_content.active) {
|
||||
if((!keyboard_trigger && mouse_press(mb_left)) || keyboard_check_pressed(vk_enter)) {
|
||||
_menu.action();
|
||||
array_push(RECENT_COMMANDS, _menu);
|
||||
instance_destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -658,6 +658,7 @@ event_inherited();
|
|||
for(var i = 0; i < ds_list_size(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 });
|
||||
|
||||
var _title = ctx == ""? "Global" : ctx;
|
||||
|
@ -683,8 +684,9 @@ event_inherited();
|
|||
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(hotkeyArray, $" - {ctx}");
|
||||
array_push(hotkeyArray, $" {ctx}");
|
||||
}
|
||||
|
||||
hk_page = 0;
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
}
|
||||
|
||||
function __fnInit() {
|
||||
globalvar CMD_FUNCTIONS, MENU_ITEMS, FUNCTIONS;
|
||||
globalvar CMD_FUNCTIONS, MENU_ITEMS, FUNCTIONS, RECENT_COMMANDS;
|
||||
|
||||
FUNCTIONS = {};
|
||||
CMD_FUNCTIONS = {};
|
||||
MENU_ITEMS = {};
|
||||
RECENT_COMMANDS = [];
|
||||
|
||||
__fnInit_Global();
|
||||
__fnInit_Panels();
|
||||
|
|
|
@ -36,11 +36,11 @@
|
|||
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
|
||||
globalvar HOTKEYS, HOTKEY_CONTEXT;
|
||||
|
||||
LATEST_VERSION = 11700;
|
||||
VERSION = 11790;
|
||||
SAVE_VERSION = 11700;
|
||||
LATEST_VERSION = 1_17_00_0;
|
||||
VERSION = 1_17_10_0;
|
||||
SAVE_VERSION = 1_17_10_0;
|
||||
VERSION_STRING = "1.17.10.006";
|
||||
BUILD_NUMBER = 11790;
|
||||
BUILD_NUMBER = 1_17_10_0;
|
||||
|
||||
HOTKEYS = ds_map_create();
|
||||
HOTKEY_CONTEXT = ds_list_create();
|
||||
|
|
|
@ -1,79 +1,59 @@
|
|||
globalvar HOTKEYS_CUSTOM;
|
||||
|
||||
function __initHotKey() {
|
||||
HOTKEYS_CUSTOM = {
|
||||
"Node_Canvas": {
|
||||
"Selection": new hotkeySimple("S"),
|
||||
"Magic Selection": new hotkeySimple("W"),
|
||||
"Pencil": new hotkeySimple("B"),
|
||||
"Eraser": new hotkeySimple("E"),
|
||||
"Rectangle": new hotkeySimple("N"),
|
||||
"Ellipse": new hotkeySimple("M"),
|
||||
"Iso Cube": new hotkeySimple(""),
|
||||
"Curve": new hotkeySimple(""),
|
||||
"Freeform": new hotkeySimple("Q"),
|
||||
"Fill": new hotkeySimple("G"),
|
||||
HOTKEYS_CUSTOM = {};
|
||||
|
||||
"Outline": new hotkeySimple("O", MOD_KEY.alt),
|
||||
"Extrude": new hotkeySimple("E", MOD_KEY.alt),
|
||||
"Inset": new hotkeySimple("I", MOD_KEY.alt),
|
||||
"Skew": new hotkeySimple("S", MOD_KEY.alt),
|
||||
"Corner": new hotkeySimple("C", MOD_KEY.alt),
|
||||
},
|
||||
hotkeySimple("Node_Canvas", "Selection", "S");
|
||||
hotkeySimple("Node_Canvas", "Magic Selection", "W");
|
||||
hotkeySimple("Node_Canvas", "Pencil", "B");
|
||||
hotkeySimple("Node_Canvas", "Eraser", "E");
|
||||
hotkeySimple("Node_Canvas", "Rectangle", "N");
|
||||
hotkeySimple("Node_Canvas", "Ellipse", "M");
|
||||
hotkeySimple("Node_Canvas", "Iso Cube", "");
|
||||
hotkeySimple("Node_Canvas", "Curve", "");
|
||||
hotkeySimple("Node_Canvas", "Freeform", "Q");
|
||||
hotkeySimple("Node_Canvas", "Fill", "G");
|
||||
hotkeySimple("Node_Canvas", "Outline", "O", MOD_KEY.alt);
|
||||
hotkeySimple("Node_Canvas", "Extrude", "E", MOD_KEY.alt);
|
||||
hotkeySimple("Node_Canvas", "Inset", "I", MOD_KEY.alt);
|
||||
hotkeySimple("Node_Canvas", "Skew", "S", MOD_KEY.alt);
|
||||
hotkeySimple("Node_Canvas", "Corner", "C", MOD_KEY.alt);
|
||||
|
||||
"Node_Mesh_Warp": {
|
||||
"Edit control point": new hotkeySimple("V"),
|
||||
"Pin mesh": new hotkeySimple("P"),
|
||||
"Mesh edit": new hotkeySimple("M"),
|
||||
"Anchor remove": new hotkeySimple("E"),
|
||||
},
|
||||
hotkeySimple("Node_Mesh_Warp", "Edit control point", "V");
|
||||
hotkeySimple("Node_Mesh_Warp", "Pin mesh", "P");
|
||||
hotkeySimple("Node_Mesh_Warp", "Mesh edit", "M");
|
||||
hotkeySimple("Node_Mesh_Warp", "Anchor remove", "E");
|
||||
|
||||
"Node_Armature": {
|
||||
"Move": new hotkeySimple("V"),
|
||||
"Scale": new hotkeySimple("S"),
|
||||
"Add bones": new hotkeySimple("A"),
|
||||
"Remove bones": new hotkeySimple("E"),
|
||||
"Detach bones": new hotkeySimple("D"),
|
||||
"IK": new hotkeySimple("K"),
|
||||
},
|
||||
hotkeySimple("Node_Armature", "Move", "V");
|
||||
hotkeySimple("Node_Armature", "Scale", "S");
|
||||
hotkeySimple("Node_Armature", "Add bones", "A");
|
||||
hotkeySimple("Node_Armature", "Remove bones", "E");
|
||||
hotkeySimple("Node_Armature", "Detach bones", "D");
|
||||
hotkeySimple("Node_Armature", "IK", "K");
|
||||
|
||||
"Node_Path": {
|
||||
"Transform": new hotkeySimple("T"),
|
||||
"Anchor add / remove": new hotkeySimple("A"),
|
||||
"Edit Control point": new hotkeySimple("C"),
|
||||
"Draw path": new hotkeySimple("B"),
|
||||
"Rectangle path": new hotkeySimple("N"),
|
||||
"Circle path": new hotkeySimple("M"),
|
||||
},
|
||||
hotkeySimple("Node_Path", "Transform", "T");
|
||||
hotkeySimple("Node_Path", "Anchor add / remove", "A");
|
||||
hotkeySimple("Node_Path", "Edit Control point", "C");
|
||||
hotkeySimple("Node_Path", "Draw path", "B");
|
||||
hotkeySimple("Node_Path", "Rectangle path", "N");
|
||||
hotkeySimple("Node_Path", "Circle path", "M");
|
||||
|
||||
"Node_Rigid_Object": {
|
||||
"Mesh edit": new hotkeySimple("A"),
|
||||
"Anchor remove": new hotkeySimple("E"),
|
||||
},
|
||||
hotkeySimple("Node_Rigid_Object", "Mesh edit", "A");
|
||||
hotkeySimple("Node_Rigid_Object", "Anchor remove", "E");
|
||||
|
||||
"Node_Strand_Create": {
|
||||
"Push": new hotkeySimple("P"),
|
||||
"Comb": new hotkeySimple("C"),
|
||||
"Stretch": new hotkeySimple("S"),
|
||||
"Shorten": new hotkeySimple("D"),
|
||||
"Grab": new hotkeySimple("G"),
|
||||
},
|
||||
hotkeySimple("Node_Strand_Create", "Push", "P");
|
||||
hotkeySimple("Node_Strand_Create", "Comb", "C");
|
||||
hotkeySimple("Node_Strand_Create", "Stretch", "S");
|
||||
hotkeySimple("Node_Strand_Create", "Shorten", "D");
|
||||
hotkeySimple("Node_Strand_Create", "Grab", "G");
|
||||
|
||||
"Node_Path_Anchor": {
|
||||
"Adjust control point": new hotkeySimple("A"),
|
||||
},
|
||||
hotkeySimple("Node_Path_Anchor", "Adjust control point", "A");
|
||||
|
||||
"Node_3D_Object": {
|
||||
"Transform": new hotkeySimple("G"),
|
||||
"Rotate": new hotkeySimple("R"),
|
||||
"Scale": new hotkeySimple("S"),
|
||||
},
|
||||
hotkeySimple("Node_3D_Object", "Transform", "G");
|
||||
hotkeySimple("Node_3D_Object", "Rotate", "R");
|
||||
hotkeySimple("Node_3D_Object", "Scale", "S");
|
||||
|
||||
"Node_3D_Camera": {
|
||||
"Move Target": new hotkeySimple("T"),
|
||||
},
|
||||
|
||||
};
|
||||
hotkeySimple("Node_3D_Camera", "Move Target", "T");
|
||||
}
|
||||
|
||||
function getToolHotkey(_group, _key) {
|
||||
|
@ -87,13 +67,20 @@ function getToolHotkey(_group, _key) {
|
|||
return _grp[$ _key];
|
||||
}
|
||||
|
||||
function hotkeySimple(_key, modi = MOD_KEY.none) constructor {
|
||||
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;
|
||||
|
||||
self.key = key_get_index(_key);
|
||||
self.modi = modi;
|
||||
|
||||
dKey = key;
|
||||
dModi = modi;
|
||||
|
||||
if(!struct_has(HOTKEYS_CUSTOM, context)) HOTKEYS_CUSTOM[$ context] = {};
|
||||
HOTKEYS_CUSTOM[$ context][$ name] = self;
|
||||
|
||||
static isPressing = function() {
|
||||
if(is_string(key)) key = key_get_index(key);
|
||||
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);
|
||||
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 {
|
||||
|
@ -115,18 +108,13 @@ function hotkeyObject(_context, _name, _key, _mod = MOD_KEY.none, _action = noon
|
|||
dKey = _key;
|
||||
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 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]);
|
||||
if(struct_has(HOTKEYS_DATA, _loadKey)) deserialize(HOTKEYS_DATA[$ _loadKey]);
|
||||
}
|
||||
|
||||
function addHotkey(_context, _name, _key, _mod, _action) {
|
||||
|
@ -246,3 +234,67 @@ 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_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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -210,3 +210,12 @@ function node_auto_align(nodeList) {
|
|||
if(h_var < v_var) { node_halign(nodeList); node_vdistribute(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[3] = nodeValue_Float("Arrival Speed", self, 4);
|
||||
|
||||
slide_title = "";
|
||||
slide_anchor = 0;
|
||||
slide_speed = 32;
|
||||
|
||||
static step = function() {
|
||||
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_anchor = inputs[2].getValue();
|
||||
slide_speed = max(1, 100 / inputs[3].getValue());
|
||||
|
||||
setDisplayName($"Slide-{slide_title}");
|
||||
}
|
||||
|
|
|
@ -126,14 +126,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
runInUI = false;
|
||||
|
||||
fullUpdate = false;
|
||||
|
||||
attributes = {};
|
||||
|
||||
node.inputs_data[index] = _value;
|
||||
node.input_value_map[$ internalName] = _value;
|
||||
|
||||
__curr_get_val = [ 0, 0 ];
|
||||
|
||||
validator = noone;
|
||||
#endregion
|
||||
|
||||
|
@ -1474,7 +1472,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
}
|
||||
} #endregion
|
||||
|
||||
static setValueInspector = function(_val = 0, index = noone, time = CURRENT_FRAME) { #region
|
||||
static setValueInspector = function(_val = 0, index = noone, time = CURRENT_FRAME) {
|
||||
INLINE
|
||||
|
||||
var res = false;
|
||||
|
@ -1487,15 +1485,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var _node = PANEL_INSPECTOR.inspectings[i];
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
res = setValueDirect(val, index, time);
|
||||
}
|
||||
} else
|
||||
res = setValueDirect(val, index, true, time);
|
||||
|
||||
return res;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setValueDirect = function(val = 0, index = noone, record = true, time = CURRENT_FRAME, _update = true) {
|
||||
is_modified = true;
|
||||
|
@ -1503,14 +1500,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var _val = val;
|
||||
var _inp = connect_type == JUNCTION_CONNECT.input;
|
||||
|
||||
record &= record_value;
|
||||
record &= record_value & _inp;
|
||||
|
||||
if(sep_axis) {
|
||||
if(index == noone) {
|
||||
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
|
||||
updated = animators[index].setValue(val, _inp && record, time);
|
||||
updated = animators[index].setValue(val, record, time);
|
||||
|
||||
} else {
|
||||
if(index != noone) {
|
||||
|
@ -1520,7 +1517,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
_val[index] = val;
|
||||
}
|
||||
|
||||
updated = animator.setValue(_val, _inp && record, time);
|
||||
updated = animator.setValue(_val, record, time);
|
||||
}
|
||||
|
||||
if(type == VALUE_TYPE.gradient) updated = true;
|
||||
|
|
|
@ -482,7 +482,7 @@
|
|||
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("", "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("", "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_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_toggle_minimap() { CALL("graph_toggle_minimap"); PANEL_GRAPH.minimap_show = !PANEL_GRAPH.minimap_show; }
|
||||
|
||||
|
@ -92,11 +93,10 @@
|
|||
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", "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", "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 (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", "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", "Toggle Minimap", "M", MOD_KEY.ctrl, panel_graph_toggle_minimap ).setMenu("graph_toggle_minimap")
|
||||
|
||||
|
@ -294,6 +295,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
graph_autopan = false;
|
||||
graph_pan_x_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 ];
|
||||
graph_s = 1;
|
||||
|
@ -735,7 +737,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
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) {
|
||||
__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; });
|
||||
}
|
||||
|
||||
menu_node_color = MENU_ITEMS.graph_group_node_color;
|
||||
|
||||
|
||||
// junction color
|
||||
__junction_hovering = noone;
|
||||
|
||||
function setSelectingJuncColor(color) {
|
||||
if(__junction_hovering == noone) return;
|
||||
__junction_hovering.setColor(color);
|
||||
|
@ -763,9 +763,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
menu_junc_color = MENU_ITEMS.graph_group_junction_color;
|
||||
|
||||
#endregion
|
||||
|
||||
//// ============ Project ============
|
||||
|
||||
|
@ -782,14 +780,14 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
//// ============ Views ============
|
||||
|
||||
function onFocusBegin() { //
|
||||
function onFocusBegin() {
|
||||
PANEL_GRAPH = self;
|
||||
PROJECT = project;
|
||||
|
||||
nodes_select_drag = 0;
|
||||
}
|
||||
|
||||
function focusNode(_node) { //
|
||||
function focusNode(_node) {
|
||||
if(_node == noone) {
|
||||
nodes_selecting = [];
|
||||
return;
|
||||
|
@ -799,15 +797,12 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
fullView();
|
||||
}
|
||||
|
||||
function fullView() {
|
||||
INLINE
|
||||
toCenterNode(array_empty(nodes_selecting)? nodes_list : nodes_selecting);
|
||||
}
|
||||
function fullView() { INLINE toCenterNode(array_empty(nodes_selecting)? nodes_list : nodes_selecting); }
|
||||
|
||||
function dragGraph() {
|
||||
if(graph_autopan) {
|
||||
graph_x = lerp_float(graph_x, graph_pan_x_to, 32, 1);
|
||||
graph_y = lerp_float(graph_y, graph_pan_y_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, graph_pan_speed, 1);
|
||||
|
||||
if(graph_x == graph_pan_x_to && graph_y == graph_pan_y_to)
|
||||
graph_autopan = false;
|
||||
|
@ -937,10 +932,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
graph_y = round(graph_y);
|
||||
}
|
||||
|
||||
function autoPanTo(_x, _y) {
|
||||
function autoPanTo(_x, _y, _speed = 32) {
|
||||
graph_autopan = true;
|
||||
graph_pan_x_to = _x;
|
||||
graph_pan_y_to = _y;
|
||||
graph_pan_speed = _speed;
|
||||
}
|
||||
|
||||
function setSlideShow(index, skip = false) {
|
||||
|
@ -973,7 +969,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
graph_y = _ty;
|
||||
|
||||
} else
|
||||
autoPanTo(_tx, _ty, skip);
|
||||
autoPanTo(_tx, _ty, _targ.slide_speed);
|
||||
}
|
||||
|
||||
//// =========== Context ==========
|
||||
|
@ -3119,6 +3115,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
_ti.inputs[1].setFrom(_jo);
|
||||
_ji.setFrom(_to.outputs[0]);
|
||||
|
||||
_to.inputs[0].updateColor();
|
||||
_ti.inputs[1].updateColor();
|
||||
}
|
||||
|
||||
function createAction() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
function Panel_History() : PanelContent() constructor {
|
||||
title = __txt("History");
|
||||
padding = ui(8);
|
||||
w = ui(400);
|
||||
h = ui(480);
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
function Panel_Nodes() : PanelContent() constructor {
|
||||
title = __txt("Nodes");
|
||||
padding = 8;
|
||||
|
||||
padding = ui(8);
|
||||
w = ui(320);
|
||||
h = ui(480);
|
||||
|
||||
|
|
|
@ -249,24 +249,13 @@
|
|||
PREFERENCES.window_height = max(600, window_minimize_size[1]);
|
||||
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 + "hotkeys.json", _hotkey);
|
||||
json_save_struct(DIRECTORY + "Nodes/fav.json", global.FAV_NODES);
|
||||
json_save_struct(DIRECTORY + "Nodes/recent.json", global.RECENT_NODES);
|
||||
json_save_struct(DIRECTORY + "key_nodes.json", HOTKEYS_CUSTOM);
|
||||
json_save_struct(DIRECTORY + "default_project.json", PROJECT_ATTRIBUTES);
|
||||
|
||||
hotkey_serialize();
|
||||
}
|
||||
|
||||
function PREF_LOAD() {
|
||||
|
@ -277,20 +266,6 @@
|
|||
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}"))
|
||||
PREFERENCES.theme = "default";
|
||||
|
||||
|
@ -308,6 +283,7 @@
|
|||
var f = json_load_struct(DIRECTORY + "default_project.json");
|
||||
struct_override(PROJECT_ATTRIBUTES, f);
|
||||
|
||||
hotkey_deserialize();
|
||||
}
|
||||
|
||||
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_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) {
|
||||
if(!is_array(arr)) return string(arr);
|
||||
if(array_empty(arr)) return "[]";
|
||||
|
|
Loading…
Reference in a new issue