mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
Fix node in group not rendering.
This commit is contained in:
parent
c3b20864a5
commit
70c9a6f61c
17 changed files with 67 additions and 63 deletions
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
function draw_line_connect(x0, y0, x1, y1, _s = 1, thick = 1, c1 = c_white, c2 = c_white, params = {}) {
|
||||
var extend = params.extend;
|
||||
var corner = min(extend, params.corner);
|
||||
var corner = min(extend, params.corner, min(abs(x0 - x1), abs(y0 - y1)) / 2);
|
||||
var type = params.type;
|
||||
|
||||
var sample = clamp(corner / 4, 1, 8);
|
||||
|
|
|
@ -399,5 +399,6 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
if(!file_exists_empty(path)) return;
|
||||
|
||||
inputs[0].setValue(path);
|
||||
check_directory_redirector(path);
|
||||
}
|
||||
}
|
|
@ -80,5 +80,6 @@ function Node_Byte_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
if(!file_exists_empty(path)) return;
|
||||
|
||||
inputs[0].setValue(path);
|
||||
check_directory_redirector(path);
|
||||
}
|
||||
}
|
|
@ -131,5 +131,6 @@ function Node_CSV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
if(!file_exists_empty(path)) return;
|
||||
|
||||
inputs[0].setValue(path);
|
||||
check_directory_redirector(path);
|
||||
}
|
||||
}
|
|
@ -1279,8 +1279,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
|
||||
static getNextNodes = function(checkLoop = false) {
|
||||
if(checkLoop) {
|
||||
if(__nextNodesToLoop != noone && __nextNodesToLoop.bypassNextNode())
|
||||
__nextNodesToLoop.getNextNodes();
|
||||
if(__nextNodesToLoop != noone && __nextNodesToLoop.bypassNextNode()) __nextNodesToLoop.getNextNodes();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1306,35 +1305,31 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
var _ot = outputs[i];
|
||||
if(!_ot.forward) continue;
|
||||
|
||||
var _tos = _ot.getJunctionTo();
|
||||
for( var j = 0; j < array_length(_tos); j++ ) {
|
||||
var _to = _tos[j];
|
||||
array_push(nodes, _to.node);
|
||||
}
|
||||
var arr = _ot.getJunctionTo();
|
||||
array_map_ext(arr, function(t) /*=>*/ {return t.node});
|
||||
nodes = array_concat(nodes, arr);
|
||||
}
|
||||
|
||||
for(var i = 0; i < array_length(junc_meta); i++) {
|
||||
var _ot = junc_meta[i];
|
||||
var _tos = _ot.getJunctionTo();
|
||||
|
||||
for( var j = 0; j < array_length(_tos); j++ ) {
|
||||
var _to = _tos[j];
|
||||
array_push(nodes, _to.node);
|
||||
}
|
||||
var arr = _ot.getJunctionTo();
|
||||
array_map_ext(arr, function(t) /*=>*/ {return t.node});
|
||||
nodes = array_concat(nodes, arr);
|
||||
}
|
||||
|
||||
for(var i = 0; i < array_length(inputs); i++) {
|
||||
var _in = inputs[i];
|
||||
if(_in.bypass_junc == noone) continue;
|
||||
|
||||
var _tos = _in.bypass_junc.getJunctionTo();
|
||||
for( var j = 0; j < array_length(_tos); j++ ) {
|
||||
var _to = _tos[j];
|
||||
array_push(nodes, _to.node);
|
||||
}
|
||||
var arr = _in.bypass_junc.getJunctionTo();
|
||||
array_map_ext(arr, function(t) /*=>*/ {return t.node});
|
||||
nodes = array_concat(nodes, arr);
|
||||
}
|
||||
|
||||
array_unique_ext(nodes);
|
||||
__nextNodes = nodes;
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
|
|
|
@ -186,5 +186,6 @@ function Node_Directory_Search(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
if(!directory_exists(path)) return;
|
||||
|
||||
inputs[0].setValue(path);
|
||||
check_directory_redirector(path);
|
||||
}
|
||||
}
|
|
@ -156,5 +156,6 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
if(!file_exists_empty(path)) return;
|
||||
|
||||
inputs[0].setValue(path);
|
||||
check_directory_redirector(path);
|
||||
}
|
||||
}
|
|
@ -111,5 +111,6 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
if(!file_exists_empty(path)) return;
|
||||
|
||||
inputs[0].setValue(path);
|
||||
check_directory_redirector(path);
|
||||
}
|
||||
}
|
|
@ -109,5 +109,6 @@ function Node_Text_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
if(!file_exists_empty(path)) return;
|
||||
|
||||
inputs[0].setValue(path);
|
||||
check_directory_redirector(path);
|
||||
}
|
||||
}
|
|
@ -1796,19 +1796,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
static hasJunctionFrom = function() { INLINE return value_from != noone || value_from_loop != noone; }
|
||||
|
||||
static getJunctionTo = function() {
|
||||
var _junc_to = [];
|
||||
|
||||
for(var i = 0; i < array_length(value_to); i++) {
|
||||
var _to = value_to[i];
|
||||
if(!_to.node.active || _to.value_from == noone) continue;
|
||||
if(_to.value_from != self) continue;
|
||||
|
||||
array_push(_junc_to, _to);
|
||||
}
|
||||
|
||||
return _junc_to;
|
||||
}
|
||||
static getJunctionTo = function() { return array_filter(value_to, function(v) /*=>*/ {return v.value_from == self && v.node.active}); }
|
||||
|
||||
/////DRAW
|
||||
|
||||
|
|
|
@ -273,5 +273,6 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
if(!file_exists_empty(path)) return;
|
||||
|
||||
inputs[0].setValue(path);
|
||||
check_directory_redirector(path);
|
||||
}
|
||||
}
|
|
@ -111,5 +111,6 @@ function Node_XML_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
if(!file_exists_empty(path)) return;
|
||||
|
||||
inputs[0].setValue(path);
|
||||
check_directory_redirector(path);
|
||||
}
|
||||
}
|
|
@ -268,7 +268,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
#region // ---- display ----
|
||||
display_parameter = {
|
||||
show_grid : true,
|
||||
show_grid : true,
|
||||
show_dimension : true,
|
||||
show_compute : true,
|
||||
|
||||
|
|
|
@ -85,7 +85,8 @@ function __sortNode(_arr, _node) {
|
|||
|
||||
if(!_node.topoSorted) {
|
||||
array_push(_arr, _node);
|
||||
_node.topoSorted = true;
|
||||
_node.topoSorted = true;
|
||||
_node.__nextNodes = noone;
|
||||
|
||||
// print($" > Adding > {_node.name}");
|
||||
}
|
||||
|
@ -221,23 +222,19 @@ function Render(partial = false, runAction = false) {
|
|||
// get leaf node
|
||||
LOG_IF(global.FLAG.render == 1, $"----- Finding leaf from {array_length(PROJECT.nodeTopo)} nodes -----");
|
||||
RENDER_QUEUE.clear();
|
||||
for( var i = 0, n = array_length(PROJECT.nodeTopo); i < n; i++ ) {
|
||||
var _node = PROJECT.nodeTopo[i];
|
||||
_node.passiveDynamic = false;
|
||||
_node.__nextNodes = noone;
|
||||
}
|
||||
array_foreach(PROJECT.nodeTopo, function(n) /*=>*/ {
|
||||
n.passiveDynamic = false;
|
||||
n.__nextNodes = noone;
|
||||
n.render_time = 0;
|
||||
});
|
||||
|
||||
for( var i = 0, n = array_length(PROJECT.nodeTopo); i < n; i++ ) {
|
||||
var _node = PROJECT.nodeTopo[i];
|
||||
_node.render_time = 0;
|
||||
array_foreach(PROJECT.nodeTopo, function(n) /*=>*/ {
|
||||
if(!__nodeIsRenderLeaf(n)) return;
|
||||
|
||||
if(!__nodeIsRenderLeaf(_node))
|
||||
continue;
|
||||
|
||||
LOG_IF(global.FLAG.render == 1, $" Found leaf [{_node.internalName}]");
|
||||
RENDER_QUEUE.enqueue(_node);
|
||||
_node.forwardPassiveDynamic();
|
||||
}
|
||||
LOG_IF(global.FLAG.render == 1, $" Found leaf [{n.internalName}]");
|
||||
RENDER_QUEUE.enqueue(n);
|
||||
n.forwardPassiveDynamic();
|
||||
});
|
||||
|
||||
_leaf_time = get_timer() - t;
|
||||
LOG_IF(global.FLAG.render >= 1, $"Get leaf complete: found {RENDER_QUEUE.size()} leaves in {(get_timer() - t) / 1000} ms."); t = get_timer();
|
||||
|
@ -265,9 +262,7 @@ function Render(partial = false, runAction = false) {
|
|||
|
||||
for( var i = 0, n = array_length(nextNodes); i < n; i++ ) {
|
||||
var nextNode = nextNodes[i];
|
||||
|
||||
if(!is(nextNode, __Node_Base)) continue;
|
||||
if(!nextNode.isRenderable()) continue;
|
||||
if(!is(nextNode, __Node_Base) || !nextNode.isRenderable()) continue;
|
||||
|
||||
// LOG_IF(global.FLAG.render == 1, $"→→ Push {nextNode.internalName} to queue.");
|
||||
RENDER_QUEUE.enqueue(nextNode);
|
||||
|
|
|
@ -3,6 +3,9 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
|
|||
scroll_y_raw = 0;
|
||||
scroll_y_to = 0;
|
||||
|
||||
whover = false;
|
||||
wactive = false;
|
||||
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = _w;
|
||||
|
@ -34,6 +37,11 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
|
|||
scroll_s = sprite_get_width(THEME.ui_scrollbar);
|
||||
scroll_w = scroll_s;
|
||||
|
||||
scroll_color_bg = COLORS.scrollbar_bg;
|
||||
scroll_color_bar = COLORS.scrollbar_idle;
|
||||
scroll_color_bar_hover = COLORS.scrollbar_hover;
|
||||
scroll_color_bar_active = COLORS.scrollbar_active;
|
||||
|
||||
static resize = function(_w, _h) {
|
||||
w = _w;
|
||||
h = _h;
|
||||
|
@ -47,12 +55,15 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
|
|||
self.x = x;
|
||||
self.y = y;
|
||||
|
||||
whover = hover;
|
||||
wactive = active;
|
||||
|
||||
hover &= point_in_rectangle( mx, my, 0, 0, surface_w, surface_h);
|
||||
hover &= pen_scrolling != 2;
|
||||
surface = surface_verify(surface, surface_w, surface_h);
|
||||
hover_content = false;
|
||||
|
||||
//// Draw
|
||||
/// Draw
|
||||
|
||||
surface_set_target(surface);
|
||||
draw_clear(COLORS.panel_bg_clear);
|
||||
|
@ -65,7 +76,7 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
|
|||
is_scroll = hh > surface_h;
|
||||
if(sc != is_scroll) resize(w, h);
|
||||
|
||||
//// Scrolling
|
||||
/// Scrolling
|
||||
|
||||
scroll_y_to = clamp(scroll_y_to, -content_h, 0);
|
||||
scroll_y_raw = lerp_float(scroll_y_raw, scroll_y_to, 4);
|
||||
|
@ -77,7 +88,7 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
|
|||
if(mouse_wheel_up()) scroll_y_to += scroll_step * SCROLL_SPEED;
|
||||
}
|
||||
|
||||
//// Pen scroll
|
||||
/// Pen scroll
|
||||
|
||||
if(pen_scrolling == 0 && mouse_press(mb_left, !hover_content && hover && PEN_USE)) {
|
||||
pen_scrolling = 1;
|
||||
|
@ -109,14 +120,13 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
|
|||
var _p = PEN_USE && (is_scrolling || point_in_rectangle(x + mx, y + my, x + w - scroll_w - 2, y, x + w, y + surface_h));
|
||||
scroll_w = lerp_float(scroll_w, _p? 12 : scroll_s, 5);
|
||||
|
||||
draw_scroll(x + w - scroll_w, y + ui(6), true, surface_h - ui(12), -scroll_y / content_h, surface_h / (surface_h + content_h),
|
||||
COLORS.scrollbar_bg, COLORS.scrollbar_idle, COLORS.scrollbar_hover, x + mx, y + my, scroll_w);
|
||||
draw_scroll(x + w - scroll_w, y + ui(6), true, surface_h - ui(12), -scroll_y / content_h, surface_h / (surface_h + content_h), x + mx, y + my, scroll_w);
|
||||
}
|
||||
|
||||
scroll_lock = false;
|
||||
}
|
||||
|
||||
static draw_scroll = function(scr_x, scr_y, is_vert, scr_s, scr_prog, scr_ratio, bg_col, bar_col, bar_hcol, mx, my, bar_spr_w) {
|
||||
static draw_scroll = function(scr_x, scr_y, is_vert, scr_s, scr_prog, scr_ratio, mx, my, bar_spr_w) {
|
||||
var scr_scale_s = scr_s * scr_ratio;
|
||||
var scr_prog_s = scr_prog * (scr_s - scr_scale_s);
|
||||
var scr_w, scr_h, bar_w, bar_h, bar_x, bar_y;
|
||||
|
@ -160,16 +170,21 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
|
|||
var by1 = clamp(bar_y + bar_h, scr_y, scr_y + scr_h);
|
||||
var hh = by1 - by0;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, scr_y, scr_w, scr_h, bg_col, 1);
|
||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, bx0, by0, ww, hh, bar_col, 1);
|
||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, scr_x, scr_y, scr_w, scr_h, scroll_color_bg, 1);
|
||||
|
||||
if(active && point_in_rectangle(mx, my, scr_x - 2, scr_y - 2, scr_x + scr_w + 2, scr_y + scr_h + 2) || is_scrolling) {
|
||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, bar_x, bar_y, bar_w, bar_h, bar_hcol, 1);
|
||||
if(mouse_press(mb_left, active)) {
|
||||
var cc = scroll_color_bar;
|
||||
|
||||
if(whover && point_in_rectangle(mx, my, scr_x - 2, scr_y - 2, scr_x + scr_w + 2, scr_y + scr_h + 2)) {
|
||||
cc = scroll_color_bar_hover;
|
||||
|
||||
if(mouse_press(mb_left, wactive)) {
|
||||
is_scrolling = true;
|
||||
scroll_ms = is_vert? my : mx;
|
||||
}
|
||||
}
|
||||
|
||||
if(is_scrolling) cc = scroll_color_bar_active;
|
||||
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, bx0, by0, ww, hh, cc, 1);
|
||||
}
|
||||
|
||||
static free = function() {
|
||||
|
|
|
@ -391,6 +391,7 @@ function ThemeColorDef() constructor {
|
|||
main_dark = #4da6ff;
|
||||
main_grey = #6d6d81;
|
||||
main_ltgrey = #7e7e8f;
|
||||
main_mdwhite = #9f9fb5;
|
||||
main_white = #d6d6e8;
|
||||
main_bg = #1c1c23;
|
||||
|
||||
|
@ -490,8 +491,9 @@ function ThemeColor() constructor {
|
|||
node_border_file_drop = CDEF.cyan;
|
||||
|
||||
scrollbar_bg = CDEF.main_dkblack;
|
||||
scrollbar_hover = CDEF.main_white;
|
||||
scrollbar_idle = CDEF.main_grey;
|
||||
scrollbar_hover = CDEF.main_mdwhite;
|
||||
scrollbar_active = CDEF.main_white;
|
||||
|
||||
panel_animation_frame_divider = CDEF.main_black;
|
||||
panel_animation_keyframe_ease_line = CDEF.main_dkgrey;
|
||||
|
|
Loading…
Reference in a new issue