resource mon

This commit is contained in:
Tanasart 2024-12-11 18:44:48 +07:00
parent f99aa637d8
commit 2621102373
11 changed files with 105 additions and 72 deletions

View file

@ -417,30 +417,30 @@ event_inherited();
new checkBox(function() /*=>*/ { PREFERENCES.add_node_remember = !PREFERENCES.add_node_remember; })
));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_connection_type", "Connection type"),
"curve_connection_line",
new buttonGroup([ THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection ],
function(val) /*=>*/ { PREFERENCES.curve_connection_line = val; PREF_SAVE(); })
));
// ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
// __txtx("pref_connection_type", "Connection type"),
// "curve_connection_line",
// new buttonGroup([ THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection ],
// (val) => { PREFERENCES.curve_connection_line = val; PREF_SAVE(); })
// ));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_connection_thickness", "Connection thickness"),
"connection_line_width",
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PREFERENCES.connection_line_width = real(str); PREF_SAVE(); })
));
// ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
// __txtx("pref_connection_thickness", "Connection thickness"),
// "connection_line_width",
// new textBox(TEXTBOX_INPUT.number, (str) => { PREFERENCES.connection_line_width = real(str); PREF_SAVE(); })
// ));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_connection_curve_smoothness", "Connection curve smoothness"),
"connection_line_sample",
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PREFERENCES.connection_line_sample = real(str); PREF_SAVE(); })
));
// ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
// __txtx("pref_connection_curve_smoothness", "Connection curve smoothness"),
// "connection_line_sample",
// new textBox(TEXTBOX_INPUT.number, (str) => { PREFERENCES.connection_line_sample = real(str); PREF_SAVE(); })
// ));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_connection_aa", "Connection anti aliasing"),
"connection_line_aa",
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PREFERENCES.connection_line_aa = max(1, real(str)); PREF_SAVE(); })
));
// ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
// __txtx("pref_connection_aa", "Connection anti aliasing"),
// "connection_line_aa",
// new textBox(TEXTBOX_INPUT.number, (str) => { PREFERENCES.connection_line_aa = max(1, real(str)); PREF_SAVE(); })
// ));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_connection_anim", "Connection line animation"),

View file

@ -91,7 +91,7 @@ function __Binder_Gamemaker(path) constructor {
resources[0].data = sprites;
resources[1].data = tileset;
resources[2].data = rooms;
}
}
refreshResources();
}

View file

@ -408,7 +408,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
dynamic_input_inspecting = 0;
static createNewInput = -1;
static setDynamicInput = function(_data_length = 1, _auto_input = true, _dummy_type = VALUE_TYPE.any, _dynamic_input_cond = DYNA_INPUT_COND.connection) {
static setDynamicInput = function(_data_length = 1, _auto_input = true, _dummy_type = VALUE_TYPE.any, _dynamic_input_cond = DYNA_INPUT_COND.connection) {
is_dynamic_input = true;
auto_input = _auto_input;
dummy_type = _dummy_type;
@ -961,7 +961,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
targ.setFrom(junctionFrom);
}
static getInputData = function(index, def = 0) { return inputs[index].getValue(); }//array_safe_get_fast(inputs_data, index, def); }
static getInputData = function(index, def = 0) { return inputs[index].getValue(); } /// array_safe_get_fast(inputs_data, index, def); }
static getInputDataForce = function(index, def = 0) { return inputs[index].getValue(); }
// static setInputData = function(index, value) {

View file

@ -37,22 +37,27 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
newInput(7, nodeValue_Float("Rotate speed", self, 1));
newInput(8, nodeValue_Bool("Show on global", self, false, "Whether to show overlay gizmo when not selecting any nodes."));
newOutput(0, nodeValue_Output("Number", self, VALUE_TYPE.float, 0));
input_display_list = [ 0, 1,
["Editor", false], 2, 6, 3, 5, 4, 7,
["Editor", false], 2, 6, 3, 5, 4, 7,
["Gizmo", false], 8,
]
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var _val = getInputData(0);
var _dsp = getInputData(2);
if(is_array(_val)) return;
if(is_array(_val)) return false;
if(_dsp == 0 || _dsp == 1) inputs[0].display_type = VALUE_DISPLAY._default;
else if(_dsp == 2) inputs[0].display_type = VALUE_DISPLAY.rotation;
inputs[0].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
var _h = inputs[0].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
inputs[0].display_type = VALUE_DISPLAY._default;
return _h;
}
static setType = function() {
@ -105,6 +110,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
return _val;
}
doUpdate = doUpdateLite;
static update = function() {
setType();
@ -331,5 +337,5 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
}
}

View file

@ -17,5 +17,25 @@ function __NodeValue_Bool(_name, _node, _value, _tooltip = "") : NodeValue(_name
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}
function nodeValue_Bool_single(_name, _node, _value, _tooltip = "") { return new __NodeValue_Bool_single(_name, _node, _value, _tooltip); }
function __NodeValue_Bool_single(_name, _node, _value, _tooltip = "") : NodeValue(_name, _node, CONNECT_TYPE.input, VALUE_TYPE.boolean, _value, _tooltip) constructor {
rejectArray();
/////============== GET =============
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
getValueRecursive(self.__curr_get_val, _time);
return bool(__curr_get_val[0]);
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(is_anim) return animator.getValue(_time);
return array_empty(animator.values)? 0 : animator.values[0].value;
}
static arrayLength = arrayLengthSimple;
}

View file

@ -81,8 +81,8 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
function resetMask() {
var tab = array_length(content) > 1;
tx = x; ty = y + tab * ui(tab_height);
tw = w; th = h - tab * ui(tab_height);
tx = x; ty = y + tab * tab_height;
tw = w; th = h - tab * tab_height;
content_surface = surface_verify(content_surface, tw, th);
mask_surface = surface_verify(mask_surface, tw, th);
@ -126,8 +126,8 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
function resizable(dw, dh, oppose = ANCHOR.left) {
var tab = array_length(content) > 1;
tx = x; ty = y + tab * ui(tab_height);
tw = w; th = h - tab * ui(tab_height);
tx = x; ty = y + tab * tab_height;
tw = w; th = h - tab * tab_height;
var hori = oppose == ANCHOR.left || oppose == ANCHOR.right;
@ -150,8 +150,8 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
function refreshSize(recur = true) { //refresh content surface after resize
//__debug_counter("refresh size");
var tab = array_length(content) > 1;
tx = x; ty = y + tab * ui(tab_height);
tw = w; th = h - tab * ui(tab_height);
tx = x; ty = y + tab * tab_height;
tw = w; th = h - tab * tab_height;
for( var i = 0, n = array_length(content); i < n; i++ ) {
content[i].w = max(tw, content[i].min_w);
@ -422,25 +422,23 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
}
static draw = function() {
if(hasContent()) {
drawPanel();
return;
}
if(hasContent()) { drawPanel(); return; }
if(array_empty(childs))
return;
if(array_empty(childs)) return;
var min_w = ui(32);
var min_h = ui(32);
if(split == "h") {
min_w = childs[0].min_w + childs[1].min_w;
min_h = max(childs[0].min_h + childs[1].min_h);
} else {
min_w = max(childs[0].min_w, childs[1].min_w);
min_h = childs[0].min_h + childs[1].min_h;
}
for(var i = 0; i < array_length(childs); i++) {
for(var i = 0, n = array_length(childs); i < n; i++) {
var _panel = childs[i];
_panel.draw();
@ -658,8 +656,8 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
if(w <= ui(16)) return;
var tab = array_length(content) > 1;
tx = x; ty = y + tab * ui(tab_height);
tw = w; th = h - tab * ui(tab_height);
tx = x; ty = y + tab * tab_height;
tw = w; th = h - tab * tab_height;
if(th < ui(16)) return;
var con = getContent();

View file

@ -246,7 +246,7 @@ function connectionParameter() constructor {
}
}
//// ========== Graph Panel ==========
////- Graph
function Panel_Graph(project = PROJECT) : PanelContent() constructor {
title = __txt("Graph");
@ -585,7 +585,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
toolbars = [ toolbars_general ];
#endregion
//// =========== Get Set ===========
////- Get
function setCurrentPreview(_node = getFocusingNode()) {
if(!_node) return;
@ -703,7 +703,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
function getFocusingNode() { return array_empty(nodes_selecting)? noone : nodes_selecting[0]; }
//// =========== Menus ===========
////- Menus
#region ++++++++++++ Actions ++++++++++++
function send_to_preview() { setCurrentPreview(node_hover); }
@ -751,7 +751,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
menu_open_group = MENU_ITEMS.graph_enter_group;
menu_open_group_tab = MENU_ITEMS.graph_open_in_new_tab;
menu_group_group = MENU_ITEMS.graph_group;
menu_group_ungroup = MENU_ITEMS.graph_ungroup;
menu_group_tool = MENU_ITEMS.graph_set_as_tool;
menu_node_delete_cut = MENU_ITEMS.graph_delete_break;
@ -795,7 +794,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
}
#endregion
//// ============ Project ============
////- Project
static setProject = function(project) {
self.project = project;
@ -809,7 +808,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
});
}
//// ============ Views ============
////- Views
function onFocusBegin() {
PANEL_GRAPH = self;
@ -1003,7 +1002,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
autoPanTo(_tx, _ty, _targ.slide_speed);
}
//// =========== Context ==========
////- Context
function getCurrentContext() { return array_empty(node_context)? noone : node_context[array_length(node_context) - 1]; }
@ -1068,7 +1067,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
context_frame_ey = context_frame_sy + node.h * graph_s;
}
//// ============ Step ============
////- Step
function stepBegin() { //
var gr_x = graph_x * graph_s;
@ -1084,7 +1083,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
setTitle();
}
//// ============ Draw ============
////- Draw
function drawGrid() { //
if(!display_parameter.show_grid) return;
@ -1451,9 +1450,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(is_instanceof(node_hover, Node_Collection))
array_push(menu, -1, menu_open_group, menu_open_group_tab, menu_group_ungroup);
if(node_hover.group != noone)
array_push(menu, menu_group_tool);
if(node_hover.group != noone)
array_push(menu, menu_group_tool);
if(array_length(nodes_selecting) >= 2)
array_push(menu, -1, menu_nodes_group, menu_nodes_frame);
@ -2547,7 +2547,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
}
}
function drawContent(panel) { // //// Main Draw
function drawContent(panel) { ////- Main Draw
if(!project.active) return;
dragGraph();
@ -2738,7 +2738,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
}
}
//// ============ Action ============
////- Action
function createNodeHotkey(_node, _param = noone) {
// if(value_dragging != noone) return;
@ -3436,7 +3436,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var dia = dialogPanelCall(pan);
}
//// =========== Serialize ===========
////- Serialize
static serialize = function() {
_map = {
@ -3493,7 +3493,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
initSize();
}
//// ========== File Drop ==========
////- File
function load_file_path(path, _x = undefined, _y = undefined) {
if(!is_array(path)) path = [ path ];

View file

@ -1,4 +1,4 @@
#region
#region function registers
function global_fullscreen() { CALL("fullscreen"); winMan_setFullscreen(!window_is_fullscreen); }
function global_project_close() { CALL("close_project"); PANEL_GRAPH.close(); }
function global_project_close_all() { CALL("close_project_all"); for( var i = array_length(PROJECTS) - 1; i >= 0; i-- ) closeProject(PROJECTS[i]); }

View file

@ -1,4 +1,4 @@
#region funtion calls
#region function calls
function panel_preview_focus_content() { CALL("preview_focus_content"); PANEL_PREVIEW.fullView(); }
function panel_preview_save_current_frame() { CALL("preview_save_current_frame"); PANEL_PREVIEW.saveCurrentFrame(); }
@ -1755,8 +1755,6 @@ function Panel_Preview() : PanelContent() constructor {
var params = { w, h, toolbar_height };
params.panel = self;
var mouse_free = false;
if(_node.is_3D == NODE_3D.none) {
if(key_mod_press(CTRL)) {
@ -1768,7 +1766,7 @@ function Panel_Preview() : PanelContent() constructor {
_sny = PROJECT.previewGrid.size[1];
}
mouse_free = _node.drawOverlay(overHover, overActive, cx, cy, canvas_s, _mx, _my, _snx, _sny, params);
_node.drawOverlay(overHover, overActive, cx, cy, canvas_s, _mx, _my, _snx, _sny, params);
} else {
@ -1777,7 +1775,7 @@ function Panel_Preview() : PanelContent() constructor {
_sny = d3_tool_snap_rotation;
}
mouse_free = _node.drawOverlay3D(overActive, d3_scene, _mx, _my, _snx, _sny, params);
_node.drawOverlay3D(overActive, d3_scene, _mx, _my, _snx, _sny, params);
}
#region node overlay
@ -1888,7 +1886,7 @@ function Panel_Preview() : PanelContent() constructor {
draw_sprite_stretched_ext(THEME.button_hide, 3, _x0 + pd, _y0 + pd, tool_size - pd * 2, tool_size - pd * 2, COLORS._main_accent, 1);
}
if(tool.subtools > 0) draw_sprite_colored(tool.spr[tool.selecting], 0, xx, yy);
if(tool.subtools > 0) draw_sprite_colored(tool.spr[tool.selecting], 0, xx, yy);
else draw_sprite_colored(tool.spr, 0, xx, yy);
}
@ -2306,12 +2304,14 @@ function Panel_Preview() : PanelContent() constructor {
canvas_mx = (mx - canvas_x) / canvas_s;
canvas_my = (my - canvas_y) / canvas_s;
if(PANEL_PREVIEW == self) {
if(PANEL_PREVIEW == self) { //only draw overlay once
if(inspect_node) {
tool = inspect_node.getTool();
if(tool) drawNodeTools(pFOCUS, tool);
} else
} else {
tool_current = noone;
}
}
if(d3_active == NODE_3D.none) drawSplitView();

View file

@ -44,7 +44,7 @@ function Panel_Resource_Monitor() : PanelContent() constructor {
draw_set_text(f_code, fa_left, fa_center, COLORS._main_text);
var _tx = ui(12);
var _ty = h / 2;
var _ty = floor(h / 2);
draw_set_color(COLORS._main_text_sub); draw_text(_tx, _ty, $"CPU usage");
draw_set_color(COLORS._main_text); draw_text(_tx + ui(80), _ty, $"{_cpu}%");

View file

@ -17,6 +17,7 @@
globalvar window_min_h; window_min_h = 600;
globalvar window_preminimize_rect; window_preminimize_rect = [ 0, 0, 1, 1 ];
globalvar __winman_to_ref; __winman_to_ref = false;
#macro DISPLAY_REFRESH CURRENT_PANEL = panelSerialize(true); display_refresh();
#endregion
@ -124,7 +125,7 @@ function winMan_setFullscreen(full) {
else winMan_Unmaximize();
}
run_in(5, function() { DISPLAY_REFRESH });
run_in(5, function() /*=>*/ { DISPLAY_REFRESH });
}
function winManStep() {
@ -172,11 +173,14 @@ function winManStep() {
if(window_drag_hold == 0 && window_is_maximized) {
if(point_distance(mx, my, _mx, _my) > 8)
window_drag_hold = 1;
} else {
if(window_is_maximized) {
winMan_Unmaximize();
window_drag_sw = window_minimize_size[0];
window_drag_sh = window_minimize_size[1];
__winman_to_ref = true;
} else {
sx = _sx + (mx - _mx);
sy = _sy + (my - _my);
@ -184,6 +188,12 @@ function winManStep() {
winMan_setRect(sx, sy, sw, sh);
}
}
if(__winman_to_ref && mouse_release(mb_left)) {
__winman_to_ref = false;
DISPLAY_REFRESH
}
} else {
if(window_drag_status & 0b0001) {
sw = _sw + (mx - _mx);
@ -205,9 +215,8 @@ function winManStep() {
winMan_setRect(sx, sy, sw, sh);
if(mouse_release(mb_left)) {
if(mouse_release(mb_left))
DISPLAY_REFRESH
}
}
if(mouse_release(mb_left)) {