mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 22:46:19 +01:00
- [Graph Export] Very large surfaec will now be cropped instead of error.
This commit is contained in:
parent
47fb7b0ce5
commit
ad543326a3
3 changed files with 19 additions and 17 deletions
|
@ -70,9 +70,9 @@ function Node_Feedback_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) con
|
||||||
if(!junc_in || !junc_out) return noone;
|
if(!junc_in || !junc_out) return noone;
|
||||||
if(!junc_in.node.active || !junc_out.node.active) return noone;
|
if(!junc_in.node.active || !junc_out.node.active) return noone;
|
||||||
|
|
||||||
params.dashed = true;
|
params.dashed = true; params.loop = true;
|
||||||
var sel = drawJuncConnection(junc_out, junc_in, params);
|
var sel = drawJuncConnection(junc_out, junc_in, params);
|
||||||
params.dashed = false;
|
params.dashed = false; params.loop = false;
|
||||||
|
|
||||||
if(sel) return self;
|
if(sel) return self;
|
||||||
return noone;
|
return noone;
|
||||||
|
|
|
@ -2269,6 +2269,8 @@ function drawJuncConnection(from, to, params) { #region
|
||||||
var fromIndex = from.drawLineIndex;
|
var fromIndex = from.drawLineIndex;
|
||||||
var toIndex = to.drawLineIndex;
|
var toIndex = to.drawLineIndex;
|
||||||
|
|
||||||
|
var _loop = struct_try_get(params, "loop");
|
||||||
|
|
||||||
if(params.minx != 0 && params.maxx != 0) {
|
if(params.minx != 0 && params.maxx != 0) {
|
||||||
var minx = params.minx;
|
var minx = params.minx;
|
||||||
var miny = params.miny;
|
var miny = params.miny;
|
||||||
|
@ -2300,7 +2302,7 @@ function drawJuncConnection(from, to, params) { #region
|
||||||
var hovDist = max(th * 2, 6);
|
var hovDist = max(th * 2, 6);
|
||||||
|
|
||||||
if(PANEL_GRAPH.pHOVER) {
|
if(PANEL_GRAPH.pHOVER) {
|
||||||
if(from.node == to.node) {
|
if(_loop || from.node == to.node) {
|
||||||
hover = distance_line_feedback(mx, my, jx, jy, frx, fry, _s) < hovDist;
|
hover = distance_line_feedback(mx, my, jx, jy, frx, fry, _s) < hovDist;
|
||||||
} else {
|
} else {
|
||||||
switch(PREFERENCES.curve_connection_line) {
|
switch(PREFERENCES.curve_connection_line) {
|
||||||
|
@ -2386,7 +2388,7 @@ function drawJuncConnection(from, to, params) { #region
|
||||||
|
|
||||||
draw_set_color(c0);
|
draw_set_color(c0);
|
||||||
|
|
||||||
if(from.node == to.node) {
|
if(_loop || from.node == to.node) {
|
||||||
draw_line_feedback(jx, jy, frx, fry, th, c1, c0, ss);
|
draw_line_feedback(jx, jy, frx, fry, th, c1, c0, ss);
|
||||||
} else {
|
} else {
|
||||||
switch(PREFERENCES.curve_connection_line) {
|
switch(PREFERENCES.curve_connection_line) {
|
||||||
|
|
|
@ -36,12 +36,16 @@ function graph_export_image(allList, nodeList, settings = {}) {
|
||||||
bbox_y1 = max(bbox_y1, _y + _h + padding);
|
bbox_y1 = max(bbox_y1, _y + _h + padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
var bbox_w = bbox_x1 - bbox_x0;
|
var _lim_s = 16384 - borderPad * 2;
|
||||||
var bbox_h = bbox_y1 - bbox_y0;
|
|
||||||
|
var bbox_w = min(_lim_s, bbox_x1 - bbox_x0);
|
||||||
|
var bbox_h = min(_lim_s, bbox_y1 - bbox_y0);
|
||||||
|
|
||||||
|
if(bbox_w == _lim_s || bbox_h == _lim_s)
|
||||||
|
noti_warning("Maximum surface size reached. Reduce scale to prevent cropping.");
|
||||||
|
|
||||||
var aa = PREFERENCES.connection_line_aa;
|
|
||||||
var s = surface_create(bbox_w, bbox_h);
|
var s = surface_create(bbox_w, bbox_h);
|
||||||
var cs = surface_create(bbox_w * aa, bbox_h * aa);
|
var cs = surface_create(bbox_w, bbox_h);
|
||||||
|
|
||||||
var gr_x = -bbox_x0;
|
var gr_x = -bbox_x0;
|
||||||
var gr_y = -bbox_y0;
|
var gr_y = -bbox_y0;
|
||||||
|
@ -93,7 +97,7 @@ function graph_export_image(allList, nodeList, settings = {}) {
|
||||||
|
|
||||||
param.setPos(gr_x, gr_y, scale, mx, my);
|
param.setPos(gr_x, gr_y, scale, mx, my);
|
||||||
param.setProp(1, false);
|
param.setProp(1, false);
|
||||||
param.setDraw(aa, c_black);
|
param.setDraw(1, c_black);
|
||||||
|
|
||||||
param.show_dimension = true;
|
param.show_dimension = true;
|
||||||
param.show_compute = true;
|
param.show_compute = true;
|
||||||
|
@ -104,11 +108,7 @@ function graph_export_image(allList, nodeList, settings = {}) {
|
||||||
nodeList[i].drawConnections(param, true);
|
nodeList[i].drawConnections(param, true);
|
||||||
surface_reset_target();
|
surface_reset_target();
|
||||||
|
|
||||||
shader_set(sh_downsample);
|
draw_surface(cs, 0, 0);
|
||||||
shader_set_f("down", aa);
|
|
||||||
shader_set_f("dimension", surface_get_width_safe(cs), surface_get_height_safe(cs));
|
|
||||||
draw_surface(cs, 0, 0);
|
|
||||||
shader_reset();
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region draw node
|
#region draw node
|
||||||
|
|
Loading…
Reference in a new issue