mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-23 19:38:05 +01:00
- [Graph Panel] Add search function (with Shift+F since Ctrl+F is already use for framing.)
This commit is contained in:
parent
5bd39e52ae
commit
6555ce5a0f
16 changed files with 298 additions and 122 deletions
|
@ -636,6 +636,7 @@
|
|||
{"name":"json_functions","order":8,"path":"scripts/json_functions/json_functions.yy",},
|
||||
{"name":"json_minify","order":6,"path":"scripts/json_minify/json_minify.yy",},
|
||||
{"name":"json_prettify","order":7,"path":"scripts/json_prettify/json_prettify.yy",},
|
||||
{"name":"keyboard_function","order":2,"path":"scripts/keyboard_function/keyboard_function.yy",},
|
||||
{"name":"lcd_function","order":2,"path":"scripts/lcd_function/lcd_function.yy",},
|
||||
{"name":"lerp_float","order":1,"path":"scripts/lerp_float/lerp_float.yy",},
|
||||
{"name":"line_intersect","order":11,"path":"scripts/line_intersect/line_intersect.yy",},
|
||||
|
|
|
@ -988,6 +988,7 @@
|
|||
{"id":{"name":"json_minify","path":"scripts/json_minify/json_minify.yy",},},
|
||||
{"id":{"name":"json_prettify","path":"scripts/json_prettify/json_prettify.yy",},},
|
||||
{"id":{"name":"key_press","path":"scripts/key_press/key_press.yy",},},
|
||||
{"id":{"name":"keyboard_function","path":"scripts/keyboard_function/keyboard_function.yy",},},
|
||||
{"id":{"name":"lcd_function","path":"scripts/lcd_function/lcd_function.yy",},},
|
||||
{"id":{"name":"lerp_float","path":"scripts/lerp_float/lerp_float.yy",},},
|
||||
{"id":{"name":"line_intersect","path":"scripts/line_intersect/line_intersect.yy",},},
|
||||
|
|
Binary file not shown.
|
@ -735,14 +735,9 @@ event_inherited();
|
|||
#region search
|
||||
search_string = "";
|
||||
search_list = ds_list_create();
|
||||
keyboard_lastchar = "";
|
||||
KEYBOARD_STRING = "";
|
||||
keyboard_lastkey = -1;
|
||||
KEYBOARD_RESET
|
||||
|
||||
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) {
|
||||
search_string = string(str);
|
||||
searchNodes();
|
||||
});
|
||||
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { search_string = string(str); searchNodes(); });
|
||||
tb_search.align = fa_left;
|
||||
tb_search.auto_update = true;
|
||||
WIDGET_CURRENT = tb_search;
|
||||
|
|
|
@ -73,17 +73,5 @@ function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr
|
|||
|
||||
static getGraphPreviewSurface = function() { return mesh_prev_surface; }
|
||||
|
||||
// static onDrawNode = function(xx, yy, _mx, _my, _s, _hover = false, _focus = false) { #region
|
||||
// if(!is_surface(mesh_prev_surface)) return;
|
||||
// if(!previewable) return;
|
||||
|
||||
// var bbox = drawGetBbox(xx, yy, _s);
|
||||
// var aa = 0.5 + 0.5 * renderActive;
|
||||
// if(!isHighlightingInGraph()) aa *= 0.25;
|
||||
|
||||
// draw_surface_bbox(mesh_prev_surface, bbox,, aa);
|
||||
// onDrawNodeOver(xx, yy, _mx, _my, _s, _hover, _focus);
|
||||
// } #endregion
|
||||
|
||||
static onDrawNodeOver = function(xx, yy, _mx, _my, _s, _hover = false, _focus = false) { }
|
||||
}
|
|
@ -586,7 +586,7 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
|
|||
} #endregion
|
||||
} #endregion
|
||||
|
||||
static drawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) { #region
|
||||
static drawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {
|
||||
var _rot = inputs[| 1].display_data.angle_display;
|
||||
tools = _rot == QUARTERNION_DISPLAY.quarterion? tool_quate : tool_euler;
|
||||
if(_rot == QUARTERNION_DISPLAY.euler && isUsingTool("Rotate"))
|
||||
|
@ -599,19 +599,19 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
|
|||
var _pos = inputs[| 0].getValue(,,, true);
|
||||
var _vpos = new __vec3( _pos[0], _pos[1], _pos[2] );
|
||||
|
||||
if(isUsingTool("Transform")) drawGizmoPosition(0, object, _vpos, active, params, _mx, _my, _snx, _sny, _panel);
|
||||
else if(isUsingTool("Rotate")) drawGizmoRotation(1, object, _vpos, active, params, _mx, _my, _snx, _sny, _panel);
|
||||
else if(isUsingTool("Scale")) drawGizmoScale(2, object, _vpos, active, params, _mx, _my, _snx, _sny, _panel);
|
||||
if(isUsingTool("Transform")) drawGizmoPosition(0, object, _vpos, active, params, _mx, _my, _snx, _sny, _panel);
|
||||
else if(isUsingTool("Rotate")) drawGizmoRotation(1, object, _vpos, active, params, _mx, _my, _snx, _sny, _panel);
|
||||
else if(isUsingTool("Scale")) drawGizmoScale(2, object, _vpos, active, params, _mx, _my, _snx, _sny, _panel);
|
||||
|
||||
if(drag_axis != noone && mouse_release(mb_left)) {
|
||||
drag_axis = noone;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
|
||||
if(onDrawOverlay3D != 0) onDrawOverlay3D(active, params, _mx, _my, _snx, _sny, _panel);
|
||||
} #endregion
|
||||
onDrawOverlay3D(active, params, _mx, _my, _snx, _sny, _panel);
|
||||
}
|
||||
|
||||
static onDrawOverlay3D = 0;
|
||||
static onDrawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {}
|
||||
|
||||
static setTransform = function(object, _data) { #region
|
||||
if(object == noone) return;
|
||||
|
|
|
@ -90,7 +90,7 @@ function draw_text_ext_add(_x, _y, _text, _sep, _w, scale = 1, forceCut = false)
|
|||
function draw_text_bbox(bbox, text, scale = 1) {
|
||||
INLINE
|
||||
var ss = min(bbox.w / string_width(text), bbox.h / string_height(text));
|
||||
ss = max(0.5, ss);
|
||||
if(ss <= 0) return;
|
||||
|
||||
draw_set_halign(fa_center);
|
||||
draw_set_valign(fa_center);
|
||||
|
|
1
scripts/keyboard_function/keyboard_function.gml
Normal file
1
scripts/keyboard_function/keyboard_function.gml
Normal file
|
@ -0,0 +1 @@
|
|||
#macro KEYBOARD_RESET keyboard_lastchar = ""; KEYBOARD_STRING = ""; keyboard_lastkey = -1;
|
13
scripts/keyboard_function/keyboard_function.yy
Normal file
13
scripts/keyboard_function/keyboard_function.yy
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$GMScript":"",
|
||||
"%Name":"keyboard_function",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"keyboard_function",
|
||||
"parent":{
|
||||
"name":"inputs",
|
||||
"path":"folders/functions/inputs.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
function Node_3D_Mesh_Cube(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) constructor {
|
||||
name = "3D Cube";
|
||||
|
||||
name = "3D Cube";
|
||||
object_class = noone;
|
||||
|
||||
inputs[| in_mesh + 0] = nodeValue("Material per side", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||
|
@ -26,11 +25,14 @@ function Node_3D_Mesh_Cube(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group
|
|||
input_display_list = [
|
||||
__d3d_input_list_mesh,
|
||||
__d3d_input_list_transform,
|
||||
["Material", false], in_mesh + 0, in_mesh + 1, in_mesh + 2, in_mesh + 3,
|
||||
in_mesh + 4, in_mesh + 5, in_mesh + 6,
|
||||
["Material", false], in_mesh + 0, in_mesh + 1, in_mesh + 2, in_mesh + 3, in_mesh + 4, in_mesh + 5, in_mesh + 6,
|
||||
]
|
||||
|
||||
static step = function() { #region
|
||||
static onDrawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {
|
||||
|
||||
}
|
||||
|
||||
static step = function() {
|
||||
var _mat_side = getInputData(in_mesh + 0);
|
||||
|
||||
inputs[| in_mesh + 1].name = _mat_side? "Material Top" : "Material";
|
||||
|
@ -40,7 +42,7 @@ function Node_3D_Mesh_Cube(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group
|
|||
inputs[| in_mesh + 4].setVisible(_mat_side, _mat_side);
|
||||
inputs[| in_mesh + 5].setVisible(_mat_side, _mat_side);
|
||||
inputs[| in_mesh + 6].setVisible(_mat_side, _mat_side);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) {
|
||||
var _mat_side = _data[in_mesh + 0];
|
||||
|
|
|
@ -57,15 +57,15 @@ function Node_3D_Repeat(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
|
|||
inputs[| 2].setVisible(_mode == 0);
|
||||
} #endregion
|
||||
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) {
|
||||
var _object = _data[0];
|
||||
var _mode = _data[1];
|
||||
var _Spos = _data[3];
|
||||
var _Srot = _data[4];
|
||||
var _Ssca = _data[5];
|
||||
var _Rpos = _data[6];
|
||||
var _Rrot = _data[7];
|
||||
var _Rsca = _data[8];
|
||||
var _mode = _data[1];
|
||||
var _Spos = _data[3];
|
||||
var _Srot = _data[4];
|
||||
var _Ssca = _data[5];
|
||||
var _Rpos = _data[6];
|
||||
var _Rrot = _data[7];
|
||||
var _Rsca = _data[8];
|
||||
|
||||
var _Apos = _data[ 9];
|
||||
var _Arot = _data[10];
|
||||
|
@ -79,7 +79,7 @@ function Node_3D_Repeat(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
|
|||
|
||||
for( var i = 0; i < _amo; i++ ) {
|
||||
var _obj = _mode == 1? _object[i] : _object;
|
||||
if(_obj == noone) continue;
|
||||
if(!is_struct(_obj)) continue;
|
||||
|
||||
//if(!_inst) _obj = _obj.clone(false, true);
|
||||
|
||||
|
@ -121,5 +121,5 @@ function Node_3D_Repeat(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
|
|||
}
|
||||
|
||||
return _scene;
|
||||
} #endregion
|
||||
}
|
||||
}
|
|
@ -67,6 +67,7 @@ function Node_Boolean(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
if(align == 0) {
|
||||
draw_set_text(f_p2, fa_center, fa_bottom, COLORS._main_text);
|
||||
draw_text_ext_add(xx + w * _s / 2, yy - 2 + hid * ((1 - hover_state) * 8), _name, -1, 128 * _s);
|
||||
|
||||
} else if(align == 1) {
|
||||
draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text);
|
||||
draw_text_ext_add(xx + w * _s / 2, yy + h * _s - hid * ((1 - hover_state) * 8), _name, -1, 128 * _s);
|
||||
|
|
|
@ -45,6 +45,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
|
||||
modifiable = true;
|
||||
modify_parent = noone;
|
||||
search_match = -9999;
|
||||
|
||||
onDoubleClick = -1;
|
||||
#endregion
|
||||
|
@ -1226,7 +1227,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
return __draw_bbox.fromPoints(x0, y0, x1, y1);
|
||||
}
|
||||
|
||||
static drawNodeName = function(xx, yy, _s) {
|
||||
static drawNodeName = function(xx, yy, _s, _panel = noone) {
|
||||
var _name = renamed? display_name : name;
|
||||
if(_name == "") return;
|
||||
|
||||
|
@ -1252,16 +1253,25 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
tw -= _s * 4;
|
||||
}
|
||||
|
||||
if(_panel && _panel.is_searching && _panel.search_string != "" && search_match == -9999)
|
||||
aa *= .15;
|
||||
|
||||
if(icon) {
|
||||
tx += _s * 6;
|
||||
draw_sprite_ui_uniform(icon, 0, round(tx), round(yy + nh / 2), _s, c_white, aa);
|
||||
tx += _s * 12;
|
||||
|
||||
tw -= _s * (6 + 12);
|
||||
}
|
||||
|
||||
var _ts = _s * 0.275;
|
||||
var _tx = round(tx);
|
||||
var _ty = round(yy + nh / 2 + 1);
|
||||
var _txt = string_cut(_name, tw, "...", _ts);
|
||||
|
||||
draw_set_text(f_sdf, fa_left, fa_center, cc, aa);
|
||||
draw_text_cut(round(tx), round(yy + nh / 2 + 1), _name, tw, _s * 0.275);
|
||||
BLEND_ALPHA_MULP
|
||||
draw_text_transformed(_tx, _ty, _txt, _ts, _ts, 0);
|
||||
BLEND_NORMAL
|
||||
draw_set_alpha(1);
|
||||
}
|
||||
|
||||
|
@ -1683,7 +1693,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
|
||||
static groupCheck = function(_x, _y, _s, _mx, _my) {}
|
||||
|
||||
static drawNodeBG = function(_x, _y, _mx, _my, _s, display_parameter = noone) {
|
||||
static drawNodeBG = function(_x, _y, _mx, _my, _s, display_parameter = noone, _panel = noone) {
|
||||
var xx = x * _s + _x;
|
||||
var yy = y * _s + _y;
|
||||
|
||||
|
@ -1691,7 +1701,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
return false;
|
||||
}
|
||||
|
||||
static drawNode = function(_x, _y, _mx, _my, _s, display_parameter = noone) {
|
||||
static drawNodeFG = function(_x, _y, _mx, _my, _s, display_parameter = noone, _panel = noone) { }
|
||||
|
||||
static drawNode = function(_x, _y, _mx, _my, _s, display_parameter = noone, _panel = noone) {
|
||||
if(draw_graph_culled) return;
|
||||
if(!active) return;
|
||||
|
||||
|
@ -1726,7 +1738,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
if(SHOW_PARAM) drawJunctionWidget(xx, yy, _mx, _my, _s, _hover, _focus);
|
||||
|
||||
draw_name = false;
|
||||
if((previewable && _s >= 0.75) || (!previewable && h * _s >= name_height * .5)) drawNodeName(xx, yy, _s);
|
||||
if((previewable && _s >= 0.75) || (!previewable && h * _s >= name_height * .5)) drawNodeName(xx, yy, _s, _panel);
|
||||
|
||||
if(attributes.annotation != "") {
|
||||
draw_set_text(f_sdf_medium, fa_left, fa_bottom, COLORS._main_text_sub);
|
||||
|
|
|
@ -5,6 +5,7 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
w = 240;
|
||||
h = 160;
|
||||
bg_spr = THEME.node_frame_bg;
|
||||
nm_spr = THEME.node_frame_name;
|
||||
|
||||
size_dragging = false;
|
||||
size_dragging_w = w;
|
||||
|
@ -12,14 +13,21 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
size_dragging_mx = w;
|
||||
size_dragging_my = h;
|
||||
|
||||
auto_height = false;
|
||||
name_hover = false;
|
||||
hover_progress = 0;
|
||||
auto_height = false;
|
||||
name_hover = false;
|
||||
hover_progress = 0;
|
||||
|
||||
color = c_white;
|
||||
alpha = 1;
|
||||
scale = 1;
|
||||
label_color = false;
|
||||
color = c_white;
|
||||
alpha = 1;
|
||||
scale = 1;
|
||||
lcolor = false;
|
||||
|
||||
name_height = 16;
|
||||
|
||||
draw_x0 = 0;
|
||||
draw_y0 = 0;
|
||||
draw_x1 = 0;
|
||||
draw_y1 = 0;
|
||||
|
||||
inputs[| 0] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 240, 160 ] )
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
|
@ -42,43 +50,83 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
|
||||
input_display_list = [ 0, 1, 3, 4 ];
|
||||
|
||||
static onValueUpdate = function(index = 3) { #region
|
||||
static onValueUpdate = function(index = 3) {
|
||||
global.__FRAME_LABEL_SCALE = getInputData(3);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
static step = function() {
|
||||
var si = getInputData(0);
|
||||
w = si[0];
|
||||
h = si[1];
|
||||
|
||||
color = getInputData(1);
|
||||
alpha = _color_get_alpha(color);
|
||||
scale = getInputData(3);
|
||||
label_color = getInputData(4);
|
||||
} #endregion
|
||||
color = getInputData(1);
|
||||
alpha = _color_get_alpha(color);
|
||||
|
||||
scale = getInputData(3);
|
||||
lcolor = getInputData(4);
|
||||
}
|
||||
|
||||
static drawNodeBase = function(xx, yy, _s) { #region
|
||||
draw_sprite_stretched_ext(bg_spr, 0, xx, yy, w * _s, h * _s, color, alpha);
|
||||
static drawNodeBase = function(xx, yy, _s, _panel) {
|
||||
|
||||
var px0 = 3;
|
||||
var py0 = 3;
|
||||
var px1 = -3 + _panel.w;
|
||||
var py1 = -0 + _panel.h - _panel.toolbar_height;
|
||||
|
||||
var _yy = yy - name_height;
|
||||
|
||||
var x0 = xx;
|
||||
var y0 = _yy;
|
||||
var x1 = xx + w * _s;
|
||||
var y1 = _yy + name_height + h * _s;
|
||||
|
||||
draw_x0 = max(x0, px0);
|
||||
draw_x1 = min(x1, px1);
|
||||
draw_y0 = max(y0, py0);
|
||||
draw_y1 = min(y1, py1);
|
||||
|
||||
var _h = max(draw_y1 - draw_y0, name_height);
|
||||
|
||||
if(y0 > 0) draw_y1 = draw_y0 + _h;
|
||||
else draw_y0 = draw_y1 - _h;
|
||||
|
||||
if(draw_x1 - draw_x0 < 4) return;
|
||||
|
||||
draw_sprite_stretched_ext(bg_spr, 0, x0, y0, x1 - x0, y1 - y0, color, alpha);
|
||||
}
|
||||
|
||||
static drawNodeFG = function(_x, _y, _mx, _my, _s, _dparam, _panel) {
|
||||
|
||||
if(draw_x1 - draw_x0 < 4) return;
|
||||
|
||||
var _w = draw_x1 - draw_x0;
|
||||
var _h = draw_y1 - draw_y0;
|
||||
|
||||
draw_sprite_stretched_ext(bg_spr, 1, draw_x0, draw_y0, _w, _h, color, alpha * .50);
|
||||
draw_sprite_stretched_ext(nm_spr, 0, draw_x0, draw_y0, _w, name_height, color, alpha * .75);
|
||||
draw_sprite_stretched_add(bg_spr, 1, draw_x0, draw_y0, _w, _h, c_white, .20);
|
||||
|
||||
var txt = renamed? display_name : name;
|
||||
draw_set_text(f_p2, fa_center, fa_bottom, COLORS._main_text);
|
||||
draw_text_cut((draw_x0 + draw_x1) / 2, draw_y0 + name_height + 2, txt, _w - 4);
|
||||
|
||||
hover_progress = lerp_float(hover_progress, name_hover, 2);
|
||||
if(active_draw_index > -1) {
|
||||
draw_sprite_stretched_ext(bg_sel_spr, 0, draw_x0, draw_y0, _w, _h, COLORS._main_accent, 1);
|
||||
active_draw_index = -1;
|
||||
}
|
||||
|
||||
draw_set_text(f_h5, fa_left, fa_top, merge_color(COLORS._main_text, color, label_color));
|
||||
draw_set_alpha(clamp(alpha + name_hover * 0.5, 0, 1));
|
||||
draw_text_cut(xx + 8 + 16 * hover_progress, yy + 4 * _s, txt, (w - 8) * _s - 24, scale);
|
||||
draw_set_alpha(1);
|
||||
} #endregion
|
||||
drawBadge(_x, _y, _s);
|
||||
}
|
||||
|
||||
draw_scale = 1;
|
||||
static drawNodeBG = function(_x, _y, _mx, _my, _s) { #region
|
||||
draw_scale = _s;
|
||||
static drawNodeBG = function(_x, _y, _mx, _my, _s, _dparam, _panel) {
|
||||
|
||||
if(size_dragging) {
|
||||
w = size_dragging_w + (mouse_mx - size_dragging_mx) / _s;
|
||||
h = size_dragging_h + (mouse_my - size_dragging_my) / _s;
|
||||
|
||||
if(!key_mod_press(CTRL)) {
|
||||
w = round(w / 32) * 32;
|
||||
h = round(h / 32) * 32;
|
||||
w = value_snap(w, 16);
|
||||
h = value_snap(h, 16);
|
||||
}
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
|
@ -89,52 +137,44 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
|
||||
var xx = x * _s + _x;
|
||||
var yy = y * _s + _y;
|
||||
drawNodeBase(xx, yy, _s);
|
||||
drawNodeBase(xx, yy, _s, _panel);
|
||||
|
||||
if(active_draw_index > -1) {
|
||||
draw_sprite_stretched_ext(bg_sel_spr, 0, x * _s + _x, y * _s + _y, w * _s, h * _s, COLORS._main_accent, 1);
|
||||
active_draw_index = -1;
|
||||
}
|
||||
|
||||
var x1 = xx + w * _s;
|
||||
var y1 = yy + h * _s;
|
||||
var x0 = x1 - 16;
|
||||
var y0 = y1 - 16;
|
||||
var x1 = xx + w * _s;
|
||||
var y1 = yy + h * _s;
|
||||
var x0 = x1 - 16;
|
||||
var y0 = y1 - 16;
|
||||
var ics = 0.5;
|
||||
|
||||
if(name_hover) draw_sprite_ext(THEME.node_move, 0, xx + 4, yy + 4 * _s, ics, ics * scale, 0, color, 0.4);
|
||||
if(w * _s < 32 || h * _s < 32) return point_in_rectangle(_mx, _my, xx, yy, x1, y1);
|
||||
|
||||
if(point_in_rectangle(_mx, _my, xx, yy, x1, y1) || size_dragging)
|
||||
draw_sprite_ext(THEME.node_resize, 0, x1 - 4, y1 - 4, ics, ics, 0, c_white, 0.5);
|
||||
draw_sprite_ext_add(THEME.node_resize, 0, x1 - 4, y1 - 4, ics, ics, 0, c_white, 0.5);
|
||||
|
||||
if(!name_hover && point_in_rectangle(_mx, _my, x0, y0, x1, y1)) {
|
||||
draw_sprite_ext(THEME.node_resize, 0, x1 - 4, y1 - 4, ics, ics, 0, c_white, 1);
|
||||
draw_sprite_ext_add(THEME.node_resize, 0, x1 - 4, y1 - 4, ics, ics, 0, c_white, 1);
|
||||
|
||||
PANEL_GRAPH.drag_locking = true;
|
||||
|
||||
if(mouse_press(mb_left)) {
|
||||
size_dragging = true;
|
||||
size_dragging_w = w;
|
||||
size_dragging_h = h;
|
||||
size_dragging = true;
|
||||
size_dragging_w = w;
|
||||
size_dragging_h = h;
|
||||
size_dragging_mx = mouse_mx;
|
||||
size_dragging_my = mouse_my;
|
||||
}
|
||||
}
|
||||
|
||||
return point_in_rectangle(_mx, _my, xx, yy, x1, y1);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static pointIn = function(_x, _y, _mx, _my, _s) { #region
|
||||
static pointIn = function(_x, _y, _mx, _my, _s) {
|
||||
var xx = x * _s + _x;
|
||||
var yy = y * _s + _y;
|
||||
var y0 = yy - name_height;
|
||||
|
||||
var txt = renamed? display_name : name;
|
||||
draw_set_font(f_h5);
|
||||
var ww = string_width(txt) + 24 + 8;
|
||||
var hh = string_height("l") + 8;
|
||||
|
||||
var hover = point_in_rectangle(_mx, _my, xx, yy, xx + ww, yy + hh);
|
||||
var hover = point_in_rectangle(_mx, _my, xx, y0, xx + w * _s, yy);
|
||||
name_hover = hover;
|
||||
|
||||
return hover;
|
||||
} #endregion
|
||||
}
|
||||
}
|
|
@ -81,7 +81,18 @@
|
|||
function panel_graph_copy() { CALL("graph_copy"); PANEL_GRAPH.doCopy(); }
|
||||
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_search() {
|
||||
CALL("graph_search");
|
||||
PANEL_GRAPH.is_searching = !PANEL_GRAPH.is_searching;
|
||||
|
||||
if(PANEL_GRAPH.is_searching) {
|
||||
PANEL_GRAPH.search_string = "";
|
||||
WIDGET_CURRENT = PANEL_GRAPH.tb_search;
|
||||
KEYBOARD_RESET
|
||||
}
|
||||
}
|
||||
|
||||
function panel_graph_pan() {
|
||||
CALL("graph_pan");
|
||||
|
@ -313,6 +324,17 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
context_frame_sy = 0; context_frame_ey = 0;
|
||||
#endregion
|
||||
|
||||
#region ---- search ----
|
||||
is_searching = false;
|
||||
search_string = "";
|
||||
search_index = 0;
|
||||
search_result = [];
|
||||
|
||||
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { search_string = string(str); searchNodes(); });
|
||||
tb_search.align = fa_left;
|
||||
tb_search.auto_update = true;
|
||||
#endregion
|
||||
|
||||
toolbar_height = ui(40);
|
||||
|
||||
function toCenterNode(_arr = nodes_list) {
|
||||
|
@ -406,6 +428,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
addHotkey("Graph", "Zoom", "", MOD_KEY.alt | MOD_KEY.ctrl, panel_graph_zoom);
|
||||
|
||||
addHotkey("Graph", "Auto Align", "L", MOD_KEY.none, panel_graph_auto_align);
|
||||
|
||||
addHotkey("Graph", "Search", "F", MOD_KEY.shift, panel_graph_search);
|
||||
#endregion
|
||||
|
||||
#region ++++ toolbars ++++
|
||||
|
@ -605,11 +629,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
pan.content.setInspecting(node_hover);
|
||||
pan.content.locked = true;
|
||||
});
|
||||
menu_send_export = menuItem(__txtx("panel_graph_send_to_export", "Send to export"), function() { setCurrentExport(node_hover); }, noone, ["Graph", "Export"]);
|
||||
menu_toggle_preview = menuItem(__txtx("panel_graph_toggle_preview", "Toggle node preview"), function() { setTriggerPreview(); }, noone, ["Graph", "Toggle preview"]);
|
||||
menu_toggle_render = menuItem(__txtx("panel_graph_toggle_render", "Toggle node render"), function() { setTriggerRender(); }, noone, ["Graph", "Toggle render"]);
|
||||
menu_toggle_param = menuItem(__txtx("panel_graph_toggle_parameter", "Toggle node parameters"),function() { setTriggerParameter(); }, noone, ["Graph", "Toggle parameters"]);
|
||||
menu_open_group = menuItem(__txtx("panel_graph_enter_group", "Open group"), function() { PANEL_GRAPH.addContext(node_hover); }, THEME.group);
|
||||
menu_send_export = menuItem(__txtx("panel_graph_send_to_export", "Send to export"), function() { setCurrentExport(node_hover); }, noone, ["Graph", "Export"]);
|
||||
menu_toggle_preview = menuItem(__txtx("panel_graph_toggle_preview", "Toggle node preview"), function() { setTriggerPreview(); }, noone, ["Graph", "Toggle preview"]);
|
||||
menu_toggle_render = menuItem(__txtx("panel_graph_toggle_render", "Toggle node render"), function() { setTriggerRender(); }, noone, ["Graph", "Toggle render"]);
|
||||
menu_toggle_param = menuItem(__txtx("panel_graph_toggle_parameter", "Toggle node parameters"), function() { setTriggerParameter(); }, noone, ["Graph", "Toggle parameters"]);
|
||||
menu_open_group = menuItem(__txtx("panel_graph_enter_group", "Open group"), function() { PANEL_GRAPH.addContext(node_hover); }, THEME.group);
|
||||
|
||||
function openGroupTab(group) {
|
||||
var graph = new Panel_Graph(project);
|
||||
|
@ -755,7 +779,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
function fullView() { #region
|
||||
INLINE
|
||||
toCenterNode(array_empty(nodes_selecting)? nodes_list : nodes_selecting);
|
||||
graph_s_to = 1;
|
||||
} #endregion
|
||||
|
||||
function dragGraph() { #region
|
||||
|
@ -1079,7 +1102,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
for(var i = 0; i < array_length(nodes_list); i++) {
|
||||
var _nl = nodes_list[i];
|
||||
|
||||
if(_nl.drawNodeBG(gr_x, gr_y, mx, my, graph_s, display_parameter))
|
||||
if(_nl.drawNodeBG(gr_x, gr_y, mx, my, graph_s, display_parameter, self))
|
||||
frame_hovering = _nl;
|
||||
}
|
||||
#endregion
|
||||
|
@ -1407,7 +1430,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
if(is_instanceof(_node, Node_Frame)) continue;
|
||||
try {
|
||||
var val = _node.drawNode(gr_x, gr_y, mx, my, graph_s, display_parameter);
|
||||
var val = _node.drawNode(gr_x, gr_y, mx, my, graph_s, display_parameter, self);
|
||||
if(val) {
|
||||
value_focus = val;
|
||||
if(key_mod_press(SHIFT)) TOOLTIP = [ val.getValue(), val.type ];
|
||||
|
@ -1418,8 +1441,12 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
}
|
||||
|
||||
for(var i = 0; i < array_length(nodes_list); i++)
|
||||
nodes_list[i].drawBadge(gr_x, gr_y, graph_s);
|
||||
if(!is_instanceof(nodes_list[i], Node_Frame))
|
||||
nodes_list[i].drawBadge(gr_x, gr_y, graph_s);
|
||||
|
||||
for(var i = 0; i < array_length(nodes_list); i++)
|
||||
nodes_list[i].drawNodeFG(gr_x, gr_y, mx, my, graph_s, display_parameter, self);
|
||||
|
||||
if(PANEL_INSPECTOR && PANEL_INSPECTOR.prop_hover != noone)
|
||||
value_focus = PANEL_INSPECTOR.prop_hover;
|
||||
#endregion
|
||||
|
@ -1982,7 +2009,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
var mini_hover = false;
|
||||
if(pHOVER && point_in_rectangle(mx, my, mx0, my0, mx1, my1)) {
|
||||
mouse_on_graph = false;
|
||||
mini_hover = true;
|
||||
mini_hover = true;
|
||||
}
|
||||
|
||||
var hover = mini_hover && !point_in_rectangle(mx, my, mx0, my0, mx0 + ui(16), my0 + ui(16)) && !minimap_dragging;
|
||||
|
@ -2082,6 +2109,86 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(2), my0 + ui(2), 0.5, 0.5, 180, c_white, 0.3);
|
||||
} #endregion
|
||||
|
||||
function searchNodes() {
|
||||
nodes_selecting = [];
|
||||
search_result = [];
|
||||
search_index = 0;
|
||||
|
||||
if(search_string == "") return;
|
||||
|
||||
var _search = string_lower(search_string);
|
||||
|
||||
for(var i = 0; i < array_length(nodes_list); i++) {
|
||||
var _nl = nodes_list[i];
|
||||
var _name = string_lower(_nl.getDisplayName());
|
||||
|
||||
var _match = string_full_match(_name, _search);
|
||||
_nl.search_match = _match;
|
||||
|
||||
if( _match == -9999) continue;
|
||||
|
||||
array_push(nodes_selecting, _nl);
|
||||
array_push(search_result, _nl);
|
||||
}
|
||||
|
||||
if(!array_empty(nodes_selecting))
|
||||
toCenterNode(nodes_selecting);
|
||||
}
|
||||
|
||||
function drawSearch() {
|
||||
if(!is_searching) return;
|
||||
|
||||
var tw = ui(200);
|
||||
var th = line_get_height(f_p2, 6);
|
||||
|
||||
var pd = ui(6);
|
||||
var ww = tw + pd * 2 + (ui(4) + ui(24)) * 3;
|
||||
var hh = th + pd * 2;
|
||||
|
||||
var x1 = w - ui(8);
|
||||
var x0 = x1 - ww;
|
||||
|
||||
var y0 = ui(8);
|
||||
var y1 = y0 + hh;
|
||||
|
||||
draw_sprite_stretched( THEME.ui_panel_bg, 3, x0, y0, ww, hh);
|
||||
draw_sprite_stretched_add(THEME.ui_panel_fg, 0, x0, y0, ww, hh, c_white, 0.25);
|
||||
draw_sprite_stretched( THEME.button_hide_fill, 1, x0 + pd, y0 + pd, tw, th);
|
||||
|
||||
tb_search.font = f_p2;
|
||||
tb_search.setFocusHover(pFOCUS, pHOVER);
|
||||
tb_search.draw(x0 + pd, y0 + pd, tw, th, search_string, [ mx, my ]);
|
||||
|
||||
var bs = ui(24);
|
||||
var bx = x1 - bs - pd;
|
||||
var by = y0 + pd;
|
||||
if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, "", THEME.cross_16) == 2
|
||||
|| keyboard_check_pressed(vk_escape)
|
||||
|| keyboard_check_pressed(vk_enter))
|
||||
is_searching = false;
|
||||
|
||||
bx -= bs + ui(4);
|
||||
if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, "", THEME.arrow_wire_16, 0) == 2) {
|
||||
if(!array_empty(search_result)) {
|
||||
search_index = safe_mod(search_index + 1, array_length(search_result));
|
||||
nodes_selecting = [ search_result[search_index] ];
|
||||
toCenterNode(nodes_selecting);
|
||||
}
|
||||
}
|
||||
|
||||
bx -= bs + ui(4);
|
||||
if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, "", THEME.arrow_wire_16, 2) == 2) {
|
||||
if(!array_empty(search_result)) {
|
||||
search_index = safe_mod(search_index - 1 + array_length(search_result), array_length(search_result));
|
||||
nodes_selecting = [ search_result[search_index] ];
|
||||
toCenterNode(nodes_selecting);
|
||||
}
|
||||
}
|
||||
|
||||
if(point_in_rectangle(mx, my, x0, y0, x1, y1))
|
||||
mouse_on_graph = false;
|
||||
}
|
||||
|
||||
function drawContextFrame() { #region
|
||||
if(!context_framing) return;
|
||||
context_frame_progress = lerp_float(context_frame_progress, 1, 5);
|
||||
|
@ -2133,12 +2240,13 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
drawGrid();
|
||||
|
||||
var ovy = ui(8);
|
||||
if(show_view_control == 2)
|
||||
ovy += ui(36);
|
||||
draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text_sub);
|
||||
draw_text(w - ui(8), ovy, $"x{graph_s_to}");
|
||||
if(show_view_control == 2) ovy += ui(36);
|
||||
|
||||
drawNodes();
|
||||
|
||||
draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text_sub);
|
||||
draw_text_add(w - ui(8), ovy, $"x{graph_s_to}");
|
||||
|
||||
drawJunctionConnect();
|
||||
drawContextFrame();
|
||||
|
||||
|
@ -2156,6 +2264,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
graph_dragging_key = false;
|
||||
graph_zooming_key = false;
|
||||
|
||||
drawSearch()
|
||||
|
||||
if(LIVE_UPDATE) {
|
||||
draw_set_text(f_p0b, fa_right, fa_bottom, COLORS._main_value_negative);
|
||||
draw_text(w - 8, h - toolbar_height, "Live Update");
|
||||
|
|
|
@ -56,6 +56,8 @@ function array_to_string(arr) {
|
|||
return s + "]";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function string_partial_match(str, key) {
|
||||
if(str == key) return 9999;
|
||||
|
||||
|
@ -88,7 +90,7 @@ function string_partial_match(str, key) {
|
|||
return -9999;
|
||||
}
|
||||
|
||||
function draw_text_match(_x, _y, _text, _search) {
|
||||
function draw_text_match(_x, _y, _text, _search, _scale = 1) {
|
||||
INLINE
|
||||
_x = round(_x);
|
||||
_y = round(_y);
|
||||
|
@ -107,7 +109,7 @@ function draw_text_match(_x, _y, _text, _search) {
|
|||
|
||||
BLEND_ALPHA_MULP;
|
||||
var aa = string_length(_text);
|
||||
var lw = string_width(_text);
|
||||
var lw = string_width(_text) * _scale;
|
||||
var tl = string_lower(_text);
|
||||
|
||||
switch(ha) {
|
||||
|
@ -129,8 +131,9 @@ function draw_text_match(_x, _y, _text, _search) {
|
|||
} else
|
||||
draw_set_color(cc);
|
||||
|
||||
draw_text(ceil(xx), ceil(yy), ch);
|
||||
xx += string_width(ch);
|
||||
if(_scale == 1) draw_text(ceil(xx), ceil(yy), ch);
|
||||
else draw_text_transformed(ceil(xx), ceil(yy), ch, _scale, _scale, 0);
|
||||
xx += string_width(ch) * _scale;
|
||||
j++;
|
||||
}
|
||||
|
||||
|
@ -229,4 +232,13 @@ function draw_text_match_ext(_x, _y, _text, _w, _search) {
|
|||
draw_set_valign(va);
|
||||
|
||||
return hh;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function string_full_match(str, key) {
|
||||
if(string_pos(key, str)) return 1;
|
||||
return -9999;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in a new issue