mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-02-26 19:55:06 +01:00
[Path] Fix node reallocate preview surface every update frame.
This commit is contained in:
parent
143ab54e7e
commit
c791220419
7 changed files with 40 additions and 28 deletions
Binary file not shown.
Binary file not shown.
|
@ -116,7 +116,7 @@ event_inherited();
|
|||
return bool(_b & value_bit(junction_called.type));
|
||||
}
|
||||
|
||||
function setPage(pageIndex) {
|
||||
function setPage(pageIndex, subPageIndex = 0) {
|
||||
ADD_NODE_PAGE = min(pageIndex, array_length(category) - 1);
|
||||
subgroups = [];
|
||||
subgroup_index = 0;
|
||||
|
@ -192,11 +192,13 @@ event_inherited();
|
|||
|
||||
array_push(subgroups, _node);
|
||||
}
|
||||
setSubgroup(0);
|
||||
|
||||
setSubgroup(subPageIndex);
|
||||
}
|
||||
|
||||
function setSubgroup(_subg) {
|
||||
subgroup_index = _subg;
|
||||
subgroup_index = _subg;
|
||||
ADD_NODE_SUBPAGE = _subg;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -326,6 +328,7 @@ event_inherited();
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -872,11 +875,13 @@ event_inherited();
|
|||
if(PREFERENCES.add_node_remember) {
|
||||
content_pane.scroll_y_raw = ADD_NODE_SCROLL;
|
||||
content_pane.scroll_y_to = ADD_NODE_SCROLL;
|
||||
} else
|
||||
ADD_NODE_PAGE = 0;
|
||||
|
||||
} else {
|
||||
ADD_NODE_PAGE = 0;
|
||||
ADD_NODE_SUBPAGE = 0;
|
||||
}
|
||||
|
||||
setPage(ADD_NODE_PAGE);
|
||||
run_in(1, function() /*=>*/ { setPage(ADD_NODE_PAGE) });
|
||||
setPage(ADD_NODE_PAGE, ADD_NODE_SUBPAGE);
|
||||
#endregion
|
||||
|
||||
#region resize
|
||||
|
|
|
@ -83,12 +83,13 @@
|
|||
|
||||
DIALOG_CLICK = true;
|
||||
|
||||
globalvar ADD_NODE_PAGE, ADD_NODE_SCROLL;
|
||||
globalvar ADD_NODE_PAGE, ADD_NODE_SCROLL, ADD_NODE_SUBPAGE;
|
||||
|
||||
ADD_NODE_PAGE = 0;
|
||||
ADD_NODE_SCROLL = 0;
|
||||
WINDOW_ACTIVE = noone;
|
||||
TOOLTIP_WINDOW = noone;
|
||||
ADD_NODE_PAGE = 0;
|
||||
ADD_NODE_SUBPAGE = 0;
|
||||
ADD_NODE_SCROLL = 0;
|
||||
WINDOW_ACTIVE = noone;
|
||||
TOOLTIP_WINDOW = noone;
|
||||
#endregion
|
||||
|
||||
#region macro
|
||||
|
|
|
@ -48,8 +48,9 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
["Anchors", false],
|
||||
];
|
||||
|
||||
output_display_list = [ 1, 0, 2 ];
|
||||
path_preview_surface = noone;
|
||||
output_display_list = [ 1, 0, 2 ];
|
||||
_path_preview_surface = noone;
|
||||
path_preview_surface = noone;
|
||||
|
||||
setDynamicInput(1, false);
|
||||
|
||||
|
@ -1149,10 +1150,9 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
var maxx = boundary.maxx + pad, maxy = boundary.maxy + pad;
|
||||
var rngx = maxx - minx, rngy = maxy - miny;
|
||||
var prev_s = 128;
|
||||
var _surf = surface_create(prev_s, prev_s);
|
||||
|
||||
_surf = surface_verify(_surf, prev_s, prev_s);
|
||||
surface_set_target(_surf);
|
||||
_path_preview_surface = surface_verify(_path_preview_surface, prev_s, prev_s);
|
||||
surface_set_target(_path_preview_surface);
|
||||
DRAW_CLEAR
|
||||
|
||||
var ox, oy, nx, ny;
|
||||
|
@ -1184,10 +1184,8 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
shader_set_f("cornerDis", 0.5);
|
||||
shader_set_f("mixAmo", 1);
|
||||
|
||||
draw_surface_safe(_surf);
|
||||
draw_surface_safe(_path_preview_surface);
|
||||
surface_reset_shader();
|
||||
|
||||
surface_free(_surf);
|
||||
}
|
||||
|
||||
static getLineCount = function() { return 1; }
|
||||
|
@ -1349,4 +1347,10 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
}
|
||||
|
||||
static getPreviewBoundingBox = function() { return BBOX().fromBoundingBox(boundary); }
|
||||
|
||||
static onCleanUp = function() {
|
||||
surface_free(_path_preview_surface);
|
||||
surface_free( path_preview_surface);
|
||||
}
|
||||
|
||||
}
|
|
@ -34,7 +34,8 @@ function Node_Path_Smooth(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
boundary = new BoundingBox();
|
||||
|
||||
cached_pos = ds_map_create();
|
||||
path_preview_surface = noone;
|
||||
path_preview_surface = noone;
|
||||
_path_preview_surface = noone;
|
||||
#endregion
|
||||
|
||||
#region ---- editor ----
|
||||
|
@ -189,10 +190,9 @@ function Node_Path_Smooth(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
var maxx = boundary.maxx + pad, maxy = boundary.maxy + pad;
|
||||
var rngx = maxx - minx, rngy = maxy - miny;
|
||||
var prev_s = 128;
|
||||
var _surf = surface_create(prev_s, prev_s);
|
||||
|
||||
_surf = surface_verify(_surf, prev_s, prev_s);
|
||||
surface_set_target(_surf);
|
||||
_path_preview_surface = surface_verify(_path_preview_surface, prev_s, prev_s);
|
||||
surface_set_target(_path_preview_surface);
|
||||
DRAW_CLEAR
|
||||
|
||||
var ox, oy, nx, ny;
|
||||
|
@ -224,10 +224,9 @@ function Node_Path_Smooth(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
shader_set_f("cornerDis", 0.5);
|
||||
shader_set_f("mixAmo", 1);
|
||||
|
||||
draw_surface_safe(_surf);
|
||||
draw_surface_safe(_path_preview_surface);
|
||||
surface_reset_shader();
|
||||
|
||||
surface_free(_surf);
|
||||
}
|
||||
|
||||
static getLineCount = function() { return 1; }
|
||||
|
@ -353,4 +352,9 @@ function Node_Path_Smooth(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
}
|
||||
}
|
||||
|
||||
static onCleanUp = function() {
|
||||
surface_free(_path_preview_surface);
|
||||
surface_free( path_preview_surface);
|
||||
}
|
||||
|
||||
}
|
|
@ -22,8 +22,6 @@ function Node_Segment_Filter(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
["Filter", false], 1, 2, 3,
|
||||
];
|
||||
|
||||
path_preview_surface = noone;
|
||||
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
var _segs = outputs[0].getValue();
|
||||
var ox, oy, nx, ny;
|
||||
|
|
Loading…
Add table
Reference in a new issue