mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-02-27 04:04:48 +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));
|
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);
|
ADD_NODE_PAGE = min(pageIndex, array_length(category) - 1);
|
||||||
subgroups = [];
|
subgroups = [];
|
||||||
subgroup_index = 0;
|
subgroup_index = 0;
|
||||||
|
@ -192,11 +192,13 @@ event_inherited();
|
||||||
|
|
||||||
array_push(subgroups, _node);
|
array_push(subgroups, _node);
|
||||||
}
|
}
|
||||||
setSubgroup(0);
|
|
||||||
|
setSubgroup(subPageIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSubgroup(_subg) {
|
function setSubgroup(_subg) {
|
||||||
subgroup_index = _subg;
|
subgroup_index = _subg;
|
||||||
|
ADD_NODE_SUBPAGE = _subg;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -326,6 +328,7 @@ event_inherited();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -872,11 +875,13 @@ event_inherited();
|
||||||
if(PREFERENCES.add_node_remember) {
|
if(PREFERENCES.add_node_remember) {
|
||||||
content_pane.scroll_y_raw = ADD_NODE_SCROLL;
|
content_pane.scroll_y_raw = ADD_NODE_SCROLL;
|
||||||
content_pane.scroll_y_to = ADD_NODE_SCROLL;
|
content_pane.scroll_y_to = ADD_NODE_SCROLL;
|
||||||
} else
|
|
||||||
ADD_NODE_PAGE = 0;
|
|
||||||
|
|
||||||
setPage(ADD_NODE_PAGE);
|
} else {
|
||||||
run_in(1, function() /*=>*/ { setPage(ADD_NODE_PAGE) });
|
ADD_NODE_PAGE = 0;
|
||||||
|
ADD_NODE_SUBPAGE = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
setPage(ADD_NODE_PAGE, ADD_NODE_SUBPAGE);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region resize
|
#region resize
|
||||||
|
|
|
@ -83,9 +83,10 @@
|
||||||
|
|
||||||
DIALOG_CLICK = true;
|
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_PAGE = 0;
|
||||||
|
ADD_NODE_SUBPAGE = 0;
|
||||||
ADD_NODE_SCROLL = 0;
|
ADD_NODE_SCROLL = 0;
|
||||||
WINDOW_ACTIVE = noone;
|
WINDOW_ACTIVE = noone;
|
||||||
TOOLTIP_WINDOW = noone;
|
TOOLTIP_WINDOW = noone;
|
||||||
|
|
|
@ -49,6 +49,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
];
|
];
|
||||||
|
|
||||||
output_display_list = [ 1, 0, 2 ];
|
output_display_list = [ 1, 0, 2 ];
|
||||||
|
_path_preview_surface = noone;
|
||||||
path_preview_surface = noone;
|
path_preview_surface = noone;
|
||||||
|
|
||||||
setDynamicInput(1, false);
|
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 maxx = boundary.maxx + pad, maxy = boundary.maxy + pad;
|
||||||
var rngx = maxx - minx, rngy = maxy - miny;
|
var rngx = maxx - minx, rngy = maxy - miny;
|
||||||
var prev_s = 128;
|
var prev_s = 128;
|
||||||
var _surf = surface_create(prev_s, prev_s);
|
|
||||||
|
|
||||||
_surf = surface_verify(_surf, prev_s, prev_s);
|
_path_preview_surface = surface_verify(_path_preview_surface, prev_s, prev_s);
|
||||||
surface_set_target(_surf);
|
surface_set_target(_path_preview_surface);
|
||||||
DRAW_CLEAR
|
DRAW_CLEAR
|
||||||
|
|
||||||
var ox, oy, nx, ny;
|
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("cornerDis", 0.5);
|
||||||
shader_set_f("mixAmo", 1);
|
shader_set_f("mixAmo", 1);
|
||||||
|
|
||||||
draw_surface_safe(_surf);
|
draw_surface_safe(_path_preview_surface);
|
||||||
surface_reset_shader();
|
surface_reset_shader();
|
||||||
|
|
||||||
surface_free(_surf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static getLineCount = function() { return 1; }
|
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 getPreviewBoundingBox = function() { return BBOX().fromBoundingBox(boundary); }
|
||||||
|
|
||||||
|
static onCleanUp = function() {
|
||||||
|
surface_free(_path_preview_surface);
|
||||||
|
surface_free( path_preview_surface);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -35,6 +35,7 @@ function Node_Path_Smooth(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
||||||
|
|
||||||
cached_pos = ds_map_create();
|
cached_pos = ds_map_create();
|
||||||
path_preview_surface = noone;
|
path_preview_surface = noone;
|
||||||
|
_path_preview_surface = noone;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ---- editor ----
|
#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 maxx = boundary.maxx + pad, maxy = boundary.maxy + pad;
|
||||||
var rngx = maxx - minx, rngy = maxy - miny;
|
var rngx = maxx - minx, rngy = maxy - miny;
|
||||||
var prev_s = 128;
|
var prev_s = 128;
|
||||||
var _surf = surface_create(prev_s, prev_s);
|
|
||||||
|
|
||||||
_surf = surface_verify(_surf, prev_s, prev_s);
|
_path_preview_surface = surface_verify(_path_preview_surface, prev_s, prev_s);
|
||||||
surface_set_target(_surf);
|
surface_set_target(_path_preview_surface);
|
||||||
DRAW_CLEAR
|
DRAW_CLEAR
|
||||||
|
|
||||||
var ox, oy, nx, ny;
|
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("cornerDis", 0.5);
|
||||||
shader_set_f("mixAmo", 1);
|
shader_set_f("mixAmo", 1);
|
||||||
|
|
||||||
draw_surface_safe(_surf);
|
draw_surface_safe(_path_preview_surface);
|
||||||
surface_reset_shader();
|
surface_reset_shader();
|
||||||
|
|
||||||
surface_free(_surf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static getLineCount = function() { return 1; }
|
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,
|
["Filter", false], 1, 2, 3,
|
||||||
];
|
];
|
||||||
|
|
||||||
path_preview_surface = noone;
|
|
||||||
|
|
||||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||||
var _segs = outputs[0].getValue();
|
var _segs = outputs[0].getValue();
|
||||||
var ox, oy, nx, ny;
|
var ox, oy, nx, ny;
|
||||||
|
|
Loading…
Add table
Reference in a new issue