mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +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.node.active || !junc_out.node.active) return noone;
|
||||
|
||||
params.dashed = true;
|
||||
var sel = drawJuncConnection(junc_out, junc_in, params);
|
||||
params.dashed = false;
|
||||
params.dashed = true; params.loop = true;
|
||||
var sel = drawJuncConnection(junc_out, junc_in, params);
|
||||
params.dashed = false; params.loop = false;
|
||||
|
||||
if(sel) return self;
|
||||
return noone;
|
||||
|
|
|
@ -2269,6 +2269,8 @@ function drawJuncConnection(from, to, params) { #region
|
|||
var fromIndex = from.drawLineIndex;
|
||||
var toIndex = to.drawLineIndex;
|
||||
|
||||
var _loop = struct_try_get(params, "loop");
|
||||
|
||||
if(params.minx != 0 && params.maxx != 0) {
|
||||
var minx = params.minx;
|
||||
var miny = params.miny;
|
||||
|
@ -2300,7 +2302,7 @@ function drawJuncConnection(from, to, params) { #region
|
|||
var hovDist = max(th * 2, 6);
|
||||
|
||||
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;
|
||||
} else {
|
||||
switch(PREFERENCES.curve_connection_line) {
|
||||
|
@ -2349,7 +2351,7 @@ function drawJuncConnection(from, to, params) { #region
|
|||
var ty = LINE_STYLE.solid;
|
||||
if(to.type == VALUE_TYPE.node || struct_try_get(params, "dashed"))
|
||||
ty = LINE_STYLE.dashed;
|
||||
|
||||
|
||||
var c0, c1;
|
||||
var _selc = to.node.branch_drawing && from.node.branch_drawing;
|
||||
|
||||
|
@ -2386,7 +2388,7 @@ function drawJuncConnection(from, to, params) { #region
|
|||
|
||||
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);
|
||||
} else {
|
||||
switch(PREFERENCES.curve_connection_line) {
|
||||
|
|
|
@ -36,12 +36,16 @@ function graph_export_image(allList, nodeList, settings = {}) {
|
|||
bbox_y1 = max(bbox_y1, _y + _h + padding);
|
||||
}
|
||||
|
||||
var bbox_w = bbox_x1 - bbox_x0;
|
||||
var bbox_h = bbox_y1 - bbox_y0;
|
||||
var _lim_s = 16384 - borderPad * 2;
|
||||
|
||||
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 cs = surface_create(bbox_w * aa, bbox_h * aa);
|
||||
var cs = surface_create(bbox_w, bbox_h);
|
||||
|
||||
var gr_x = -bbox_x0;
|
||||
var gr_y = -bbox_y0;
|
||||
|
@ -50,7 +54,7 @@ function graph_export_image(allList, nodeList, settings = {}) {
|
|||
surface_set_target(s); //draw nodes
|
||||
if(bgEnable) draw_clear(bgColor);
|
||||
else draw_clear_alpha(0, 0);
|
||||
|
||||
|
||||
if(gridEnable) {
|
||||
var gls = 32;
|
||||
var gr_ls = gls * scale;
|
||||
|
@ -93,7 +97,7 @@ function graph_export_image(allList, nodeList, settings = {}) {
|
|||
|
||||
param.setPos(gr_x, gr_y, scale, mx, my);
|
||||
param.setProp(1, false);
|
||||
param.setDraw(aa, c_black);
|
||||
param.setDraw(1, c_black);
|
||||
|
||||
param.show_dimension = true;
|
||||
param.show_compute = true;
|
||||
|
@ -104,11 +108,7 @@ function graph_export_image(allList, nodeList, settings = {}) {
|
|||
nodeList[i].drawConnections(param, true);
|
||||
surface_reset_target();
|
||||
|
||||
shader_set(sh_downsample);
|
||||
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();
|
||||
draw_surface(cs, 0, 0);
|
||||
#endregion
|
||||
|
||||
#region draw node
|
||||
|
|
Loading…
Reference in a new issue