- Fix error when linking dimension value.

This commit is contained in:
Tanasart 2024-08-22 08:28:59 +07:00
parent 3bf08a6c73
commit 6d999c68eb
645 changed files with 1217 additions and 1136 deletions

View file

@ -400,6 +400,7 @@
{"$GMIncludedFile":"","%Name":"nodes.json","CopyToMask":-1,"filePath":"datafiles/data","name":"nodes.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Nodes.zip","CopyToMask":-1,"filePath":"datafiles/data","name":"Nodes.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"related_node.json","CopyToMask":-1,"filePath":"datafiles/data","name":"related_node.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Theme.zip","CopyToMask":-1,"filePath":"datafiles/data","name":"Theme.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Tooltip.zip","CopyToMask":-1,"filePath":"datafiles/data","name":"Tooltip.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Node_2D_light.png","CopyToMask":-1,"filePath":"datafiles/data/Tooltip","name":"Node_2D_light.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Node_9Slice.png","CopyToMask":-1,"filePath":"datafiles/data/Tooltip","name":"Node_9Slice.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},

BIN
datafiles/data/Theme.zip Normal file

Binary file not shown.

View file

@ -1,369 +1,374 @@
#region shapes
global.SHAPES = [];
global.SHAPES = [];
enum SHAPE_TYPE {
points,
triangles,
enum SHAPE_TYPE {
points,
triangles,
}
function SHAPE_rectangle(_sca) {
var triangles = [
[ new __vec2(-_sca[0], -_sca[1]), new __vec2( _sca[0], -_sca[1]), new __vec2(-_sca[0], _sca[1]) ],
[ new __vec2( _sca[0], -_sca[1]), new __vec2(-_sca[0], _sca[1]), new __vec2( _sca[0], _sca[1]) ],
];
var segment = [ new __vec2(-_sca[0], -_sca[1]), new __vec2( _sca[0], -_sca[1]),
new __vec2( _sca[0], _sca[1]), new __vec2(-_sca[0], _sca[1]),
new __vec2(-_sca[0], -_sca[1]) ];
return [
[ { type: SHAPE_TYPE.triangles, triangles: triangles } ],
segment
];
}
function SHAPE_circle(_sca, data = {}) {
var prec = max(3, data.side);
var ang = 360 / prec;
var triangles = array_create(prec);
var segment = array_create(prec + 1);
var explode = data.explode;
for( var i = 0; i < prec; i++ ) {
var d0 = (i + 0.) * ang;
var d5 = (i + .5) * ang;
var d1 = (i + 1.) * ang;
var dx = lengthdir_x(explode * _sca[0], d5);
var dy = lengthdir_y(explode * _sca[1], d5);
var x0 = lengthdir_x(_sca[0], d0) + dx;
var y0 = lengthdir_y(_sca[1], d0) + dy;
var x1 = lengthdir_x(_sca[0], d1) + dx;
var y1 = lengthdir_y(_sca[1], d1) + dy;
triangles[i] = [ new __vec2(dx, dy), new __vec2(x0, y0), new __vec2(x1, y1) ];
if(i == 0) segment[0] = new __vec2(x0, y0);
segment[i + 1] = new __vec2(x1, y1);
}
function SHAPE_rectangle(_sca) { #region
var triangles = [
[ new __vec2(-_sca[0], -_sca[1]), new __vec2( _sca[0], -_sca[1]), new __vec2(-_sca[0], _sca[1]) ],
[ new __vec2( _sca[0], -_sca[1]), new __vec2(-_sca[0], _sca[1]), new __vec2( _sca[0], _sca[1]) ],
];
var segment = [ new __vec2(-_sca[0], -_sca[1]), new __vec2( _sca[0], -_sca[1]),
new __vec2( _sca[0], _sca[1]), new __vec2(-_sca[0], _sca[1]),
new __vec2(-_sca[0], -_sca[1]) ];
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
}
return [
[ { type: SHAPE_TYPE.triangles, triangles: triangles } ],
segment
];
} #endregion
function SHAPE_star(_sca, data = {}) {
var prec = max(3, data.side);
var inner = data.inner;
var triangles = [];
var segment = [];
function SHAPE_circle(_sca, data = {}) { #region
var prec = max(3, data.side);
var triangles = [];
var ang = 360 / prec;
var segment = [];
for( var i = 0; i < prec; i++ ) {
var otx = lengthdir_x(0.5, i / prec * 360) * _sca[0] * 2;
var oty = lengthdir_y(0.5, i / prec * 360) * _sca[1] * 2;
for( var i = 0; i < prec; i++ ) {
var x0 = lengthdir_x(0.5, (i + 0) * ang) * _sca[0] * 2;
var y0 = lengthdir_y(0.5, (i + 0) * ang) * _sca[1] * 2;
var x1 = lengthdir_x(0.5, (i + 1) * ang) * _sca[0] * 2;
var y1 = lengthdir_y(0.5, (i + 1) * ang) * _sca[1] * 2;
var inx = lengthdir_x(inner / 2, (i + 0.5) / prec * 360) * _sca[0] * 2;
var iny = lengthdir_y(inner / 2, (i + 0.5) / prec * 360) * _sca[1] * 2;
array_push(triangles, [ new __vec2(0, 0), new __vec2(otx, oty), new __vec2(inx, iny) ]);
array_push(triangles, [ new __vec2(0, 0), new __vec2(x0, y0), new __vec2(x1, y1) ]);
var pi0 = new __vec2(inx, iny);
if(i == 0) array_push(segment, new __vec2(x0, y0));
array_push(segment, new __vec2(x1, y1));
var inx = lengthdir_x(inner / 2, (i - 0.5) / prec * 360) * _sca[0] * 2;
var iny = lengthdir_y(inner / 2, (i - 0.5) / prec * 360) * _sca[1] * 2;
array_push(triangles, [ new __vec2(0, 0), new __vec2(otx, oty), new __vec2(inx, iny) ]);
array_push(segment, new __vec2(inx, iny));
array_push(segment, new __vec2(otx, oty));
array_push(segment, pi0);
}
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
}
function SHAPE_capsule(_sca, data = {}) {
var rad = data.radius;
var prec = max(2, data.side);
var hh = _sca[1] * rad;
var shapes = [];
var segment = [];
array_push(segment, new __vec2(-_sca[0] + _sca[1], _sca[1]), new __vec2( _sca[0] - hh, hh));
var triangles = [
[ new __vec2(-_sca[0] + _sca[1], -_sca[1]), new __vec2( _sca[0] - hh, -hh), new __vec2(-_sca[0] + _sca[1], _sca[1]) ],
[ new __vec2( _sca[0] - hh, -hh), new __vec2(-_sca[0] + _sca[1], _sca[1]), new __vec2( _sca[0] - hh, hh) ],
];
shapes[0] = { type: SHAPE_TYPE.triangles, triangles: triangles };
var triangles = [];
var cx = -_sca[0] + _sca[1];
var cy = 0;
var ox, oy, nx, ny, oa, na;
for( var i = 0; i <= prec; i++ ) {
na = lerp(270, 90, i / prec);
nx = cx + lengthdir_x(_sca[1], na);
ny = cy + lengthdir_y(_sca[1], na);
if(i) {
array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]);
array_push(segment, new __vec2(ox, oy));
}
array_push(segment, new __vec2(nx, ny));
oa = na;
ox = nx;
oy = ny;
}
array_push(segment, new __vec2(-_sca[0] + _sca[1], -_sca[1]), new __vec2( _sca[0] - hh, -hh));
shapes[1] = { type: SHAPE_TYPE.triangles, triangles: triangles };
var triangles = [];
var cx = _sca[0] - hh;
var cy = 0;
var ox, oy, nx, ny, oa, na;
var _seg = [];
for( var i = 0; i <= prec; i++ ) {
na = lerp(-90, 90, i / prec);
nx = cx + lengthdir_x(hh, na);
ny = cy + lengthdir_y(hh, na);
if(i) {
array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]);
array_push(_seg, new __vec2(ox, oy));
}
array_push(_seg, new __vec2(nx, ny));
oa = na;
ox = nx;
oy = ny;
}
for( var i = 0, n = array_length(_seg); i < n; i++ )
array_push(segment, _seg[array_length(_seg) - i - 1]);
shapes[2] = { type: SHAPE_TYPE.triangles, triangles: triangles };
return [
shapes,
segment
];
}
function SHAPE_ring(_sca, data = {}) {
var prec = max(3, data.side);
var inner = data.inner;
var triangles = [];
var segment = [];
for( var i = 0; i < prec; i++ ) {
var ix0 = lengthdir_x(0.5 * inner, i / prec * 360) * _sca[0] * 2;
var iy0 = lengthdir_y(0.5 * inner, i / prec * 360) * _sca[1] * 2;
var nx0 = lengthdir_x(0.5, i / prec * 360) * _sca[0] * 2;
var ny0 = lengthdir_y(0.5, i / prec * 360) * _sca[1] * 2;
var ix1 = lengthdir_x(0.5 * inner, (i + 1) / prec * 360) * _sca[0] * 2;
var iy1 = lengthdir_y(0.5 * inner, (i + 1) / prec * 360) * _sca[1] * 2;
var nx1 = lengthdir_x(0.5, (i + 1) / prec * 360) * _sca[0] * 2;
var ny1 = lengthdir_y(0.5, (i + 1) / prec * 360) * _sca[1] * 2;
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]);
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx1, ny1), new __vec2(ix1, iy1) ]);
if(i == 0)
array_push(segment, new __vec2(nx0, ny0));
array_push(segment, new __vec2(nx1, ny1));
}
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
}
function SHAPE_gear(_sca, data = {}) {
var teeth = max(3, data.teeth);
var teethH = data.teethH;
var teethT = data.teethT;
var prec = teeth * 2;
var inner = data.inner;
var body = 0.5 * (1 - teethH);
var teth = 0.5 * teethH;
var triangles = [];
var segment = [];
for( var i = 0; i < prec; i++ ) {
var ix0 = lengthdir_x(body * inner, i / prec * 360) * _sca[0] * 2;
var iy0 = lengthdir_y(body * inner, i / prec * 360) * _sca[1] * 2;
var nx0 = lengthdir_x(body, i / prec * 360) * _sca[0] * 2;
var ny0 = lengthdir_y(body, i / prec * 360) * _sca[1] * 2;
var ix1 = lengthdir_x(body * inner, (i + 1) / prec * 360) * _sca[0] * 2;
var iy1 = lengthdir_y(body * inner, (i + 1) / prec * 360) * _sca[1] * 2;
var nx1 = lengthdir_x(body, (i + 1) / prec * 360) * _sca[0] * 2;
var ny1 = lengthdir_y(body, (i + 1) / prec * 360) * _sca[1] * 2;
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]);
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx1, ny1), new __vec2(ix1, iy1) ]);
if(i == 0)
array_push(segment, new __vec2(nx0, ny0));
if(i % 2) {
var tx0 = nx0 + lengthdir_x(teth, (i + 0.5 - teethT) / prec * 360) * _sca[0] * 2;
var ty0 = ny0 + lengthdir_y(teth, (i + 0.5 - teethT) / prec * 360) * _sca[1] * 2;
var tx1 = nx1 + lengthdir_x(teth, (i + 0.5 + teethT) / prec * 360) * _sca[0] * 2;
var ty1 = ny1 + lengthdir_y(teth, (i + 0.5 + teethT) / prec * 360) * _sca[1] * 2;
array_push(triangles, [ new __vec2(tx0, ty0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]);
array_push(triangles, [ new __vec2(tx0, ty0), new __vec2(nx1, ny1), new __vec2(tx1, ty1) ]);
array_push(segment, new __vec2(tx0, ty0));
array_push(segment, new __vec2(tx1, ty1));
}
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
} #endregion
array_push(segment, new __vec2(nx1, ny1));
}
function SHAPE_star(_sca, data = {}) { #region
var prec = max(3, data.side);
var inner = data.inner;
var triangles = [];
var segment = [];
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
}
for( var i = 0; i < prec; i++ ) {
var otx = lengthdir_x(0.5, i / prec * 360) * _sca[0] * 2;
var oty = lengthdir_y(0.5, i / prec * 360) * _sca[1] * 2;
function SHAPE_cross(_sca, data = {}) {
var inner = data.inner;
var triangles = [];
var segment = [];
var side = min(_sca[0], _sca[1]) * inner;
var inx = lengthdir_x(inner / 2, (i + 0.5) / prec * 360) * _sca[0] * 2;
var iny = lengthdir_y(inner / 2, (i + 0.5) / prec * 360) * _sca[1] * 2;
array_push(triangles, [ new __vec2(0, 0), new __vec2(otx, oty), new __vec2(inx, iny) ]);
array_push(triangles,
[ new __vec2(-side, -side), new __vec2( side, -side), new __vec2(-side, side) ],
[ new __vec2( side, -side), new __vec2(-side, side), new __vec2( side, side) ],
);
var pi0 = new __vec2(inx, iny);
array_push(triangles, //top
[ new __vec2(-side, -side), new __vec2( side, -side), new __vec2(-side, -_sca[1]) ],
[ new __vec2( side, -side), new __vec2(-side, -_sca[1]), new __vec2( side, -_sca[1]) ],
);
var inx = lengthdir_x(inner / 2, (i - 0.5) / prec * 360) * _sca[0] * 2;
var iny = lengthdir_y(inner / 2, (i - 0.5) / prec * 360) * _sca[1] * 2;
array_push(triangles, [ new __vec2(0, 0), new __vec2(otx, oty), new __vec2(inx, iny) ]);
array_push(triangles, //bottom
[ new __vec2(-side, _sca[1]), new __vec2( side, _sca[1]), new __vec2(-side, side) ],
[ new __vec2( side, _sca[1]), new __vec2(-side, side), new __vec2( side, side) ],
);
array_push(segment, new __vec2(inx, iny));
array_push(segment, new __vec2(otx, oty));
array_push(segment, pi0);
array_push(triangles, //left
[ new __vec2( -side, -side), new __vec2(-_sca[0], -side), new __vec2(-side, side) ],
[ new __vec2(-_sca[0], -side), new __vec2(-side, side), new __vec2(-_sca[0], side) ],
);
array_push(triangles, //right
[ new __vec2(_sca[0], -side), new __vec2( side, -side), new __vec2(_sca[0], side) ],
[ new __vec2( side, -side), new __vec2(_sca[0], side), new __vec2( side, side) ],
);
array_push(segment, new __vec2(-side, -side), new __vec2(-side, -_sca[1]), new __vec2( side, -_sca[1]), new __vec2(side, -side) );
array_push(segment, new __vec2(_sca[0], -side), new __vec2(_sca[0], side), new __vec2( side, side));
array_push(segment, new __vec2(side, _sca[1]), new __vec2(-side, _sca[1]), new __vec2(-side, side));
array_push(segment, new __vec2(-_sca[0], side), new __vec2(-_sca[0], -side), new __vec2(-side, -side));
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
}
function SHAPE_arc(_sca, data = {}) {
var prec = max(3, data.side);
var inner = data.inner;
var radRan = data.radRan;
var cap = data.cap;
var triangles = [];
var segment = [];
var oa, na;
var sgArcI = [], sgArcO = [];
for( var i = 0; i <= prec; i++ ) {
na = lerp(radRan[0], radRan[1], i / prec);
var ix1 = lengthdir_x(0.5 * inner, na) * _sca[0] * 2;
var iy1 = lengthdir_y(0.5 * inner, na) * _sca[1] * 2;
var nx1 = lengthdir_x(0.5, na) * _sca[0] * 2;
var ny1 = lengthdir_y(0.5, na) * _sca[1] * 2;
if(i) {
var ix0 = lengthdir_x(0.5 * inner, oa) * _sca[0] * 2;
var iy0 = lengthdir_y(0.5 * inner, oa) * _sca[1] * 2;
var nx0 = lengthdir_x(0.5, oa) * _sca[0] * 2;
var ny0 = lengthdir_y(0.5, oa) * _sca[1] * 2;
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]);
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx1, ny1), new __vec2(ix1, iy1) ]);
}
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
} #endregion
array_push(sgArcI, new __vec2(ix1, iy1));
array_push(sgArcO, new __vec2(nx1, ny1));
function SHAPE_capsule(_sca, data = {}) { #region
var rad = data.radius;
var prec = max(2, data.side);
var hh = _sca[1] * rad;
var shapes = [];
var segment = [];
array_push(segment, new __vec2(-_sca[0] + _sca[1], _sca[1]), new __vec2( _sca[0] - hh, hh));
oa = na;
}
var triangles = [
[ new __vec2(-_sca[0] + _sca[1], -_sca[1]), new __vec2( _sca[0] - hh, -hh), new __vec2(-_sca[0] + _sca[1], _sca[1]) ],
[ new __vec2( _sca[0] - hh, -hh), new __vec2(-_sca[0] + _sca[1], _sca[1]), new __vec2( _sca[0] - hh, hh) ],
];
shapes[0] = { type: SHAPE_TYPE.triangles, triangles: triangles };
var triangles = [];
var cx = -_sca[0] + _sca[1];
var cy = 0;
if(cap) {
var cx = lengthdir_x(0.5 * (inner + 1) / 2, radRan[0]) * _sca[0] * 2;
var cy = lengthdir_y(0.5 * (inner + 1) / 2, radRan[0]) * _sca[1] * 2;
var ox, oy, nx, ny, oa, na;
for( var i = 0; i <= prec; i++ ) {
na = lerp(270, 90, i / prec);
nx = cx + lengthdir_x(_sca[1], na);
ny = cy + lengthdir_y(_sca[1], na);
var sgCapI = [], sgCapO = [];
prec = max(ceil(prec / 2), 2);
if(i) {
array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]);
array_push(segment, new __vec2(ox, oy));
}
array_push(segment, new __vec2(nx, ny));
for( var i = 0; i <= prec; i++ ) {
na = radRan[0] - 180 * i / prec;
nx = cx + lengthdir_x((1 - inner) / 2, na) * _sca[0];
ny = cy + lengthdir_y((1 - inner) / 2, na) * _sca[1];
if(i) array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]);
array_push(sgCapI, new __vec2(nx, ny));
oa = na;
ox = nx;
oy = ny;
}
array_push(segment, new __vec2(-_sca[0] + _sca[1], -_sca[1]), new __vec2( _sca[0] - hh, -hh));
shapes[1] = { type: SHAPE_TYPE.triangles, triangles: triangles };
var triangles = [];
var cx = _sca[0] - hh;
var cy = 0;
var cx = lengthdir_x(0.5 * (inner + 1) / 2, radRan[1]) * _sca[0] * 2;
var cy = lengthdir_y(0.5 * (inner + 1) / 2, radRan[1]) * _sca[1] * 2;
var ox, oy, nx, ny, oa, na;
var _seg = [];
for( var i = 0; i <= prec; i++ ) {
na = lerp(-90, 90, i / prec);
nx = cx + lengthdir_x(hh, na);
ny = cy + lengthdir_y(hh, na);
if(i) {
array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]);
array_push(_seg, new __vec2(ox, oy));
}
array_push(_seg, new __vec2(nx, ny));
for( var i = 0; i <= prec; i++ ) {
na = radRan[1] + 180 * i / prec;
nx = cx + lengthdir_x((1 - inner) / 2, na) * _sca[0];
ny = cy + lengthdir_y((1 - inner) / 2, na) * _sca[1];
if(i) array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]);
array_push(sgCapO, new __vec2(nx, ny));
oa = na;
ox = nx;
oy = ny;
}
for( var i = 0, n = array_length(_seg); i < n; i++ )
array_push(segment, _seg[array_length(_seg) - i - 1]);
array_append(segment, sgArcI);
array_append(segment, array_reverse(sgCapO));
shapes[2] = { type: SHAPE_TYPE.triangles, triangles: triangles };
array_append(segment, array_reverse(sgArcO));
array_append(segment, sgCapI);
} else {
array_append(segment, sgArcI);
array_append(segment, array_reverse(sgArcO));
array_push(segment, sgArcI[0].clone());
}
return [
shapes,
segment
];
} #endregion
function SHAPE_ring(_sca, data = {}) { #region
var prec = max(3, data.side);
var inner = data.inner;
var triangles = [];
var segment = [];
for( var i = 0; i < prec; i++ ) {
var ix0 = lengthdir_x(0.5 * inner, i / prec * 360) * _sca[0] * 2;
var iy0 = lengthdir_y(0.5 * inner, i / prec * 360) * _sca[1] * 2;
var nx0 = lengthdir_x(0.5, i / prec * 360) * _sca[0] * 2;
var ny0 = lengthdir_y(0.5, i / prec * 360) * _sca[1] * 2;
var ix1 = lengthdir_x(0.5 * inner, (i + 1) / prec * 360) * _sca[0] * 2;
var iy1 = lengthdir_y(0.5 * inner, (i + 1) / prec * 360) * _sca[1] * 2;
var nx1 = lengthdir_x(0.5, (i + 1) / prec * 360) * _sca[0] * 2;
var ny1 = lengthdir_y(0.5, (i + 1) / prec * 360) * _sca[1] * 2;
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]);
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx1, ny1), new __vec2(ix1, iy1) ]);
if(i == 0)
array_push(segment, new __vec2(nx0, ny0));
array_push(segment, new __vec2(nx1, ny1));
}
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
} #endregion
function SHAPE_gear(_sca, data = {}) { #region
var teeth = max(3, data.teeth);
var teethH = data.teethH;
var teethT = data.teethT;
var prec = teeth * 2;
var inner = data.inner;
var body = 0.5 * (1 - teethH);
var teth = 0.5 * teethH;
var triangles = [];
var segment = [];
for( var i = 0; i < prec; i++ ) {
var ix0 = lengthdir_x(body * inner, i / prec * 360) * _sca[0] * 2;
var iy0 = lengthdir_y(body * inner, i / prec * 360) * _sca[1] * 2;
var nx0 = lengthdir_x(body, i / prec * 360) * _sca[0] * 2;
var ny0 = lengthdir_y(body, i / prec * 360) * _sca[1] * 2;
var ix1 = lengthdir_x(body * inner, (i + 1) / prec * 360) * _sca[0] * 2;
var iy1 = lengthdir_y(body * inner, (i + 1) / prec * 360) * _sca[1] * 2;
var nx1 = lengthdir_x(body, (i + 1) / prec * 360) * _sca[0] * 2;
var ny1 = lengthdir_y(body, (i + 1) / prec * 360) * _sca[1] * 2;
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]);
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx1, ny1), new __vec2(ix1, iy1) ]);
if(i == 0)
array_push(segment, new __vec2(nx0, ny0));
if(i % 2) {
var tx0 = nx0 + lengthdir_x(teth, (i + 0.5 - teethT) / prec * 360) * _sca[0] * 2;
var ty0 = ny0 + lengthdir_y(teth, (i + 0.5 - teethT) / prec * 360) * _sca[1] * 2;
var tx1 = nx1 + lengthdir_x(teth, (i + 0.5 + teethT) / prec * 360) * _sca[0] * 2;
var ty1 = ny1 + lengthdir_y(teth, (i + 0.5 + teethT) / prec * 360) * _sca[1] * 2;
array_push(triangles, [ new __vec2(tx0, ty0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]);
array_push(triangles, [ new __vec2(tx0, ty0), new __vec2(nx1, ny1), new __vec2(tx1, ty1) ]);
array_push(segment, new __vec2(tx0, ty0));
array_push(segment, new __vec2(tx1, ty1));
}
array_push(segment, new __vec2(nx1, ny1));
}
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
} #endregion
function SHAPE_cross(_sca, data = {}) { #region
var inner = data.inner;
var triangles = [];
var segment = [];
var side = min(_sca[0], _sca[1]) * inner;
array_push(triangles,
[ new __vec2(-side, -side), new __vec2( side, -side), new __vec2(-side, side) ],
[ new __vec2( side, -side), new __vec2(-side, side), new __vec2( side, side) ],
);
array_push(triangles, //top
[ new __vec2(-side, -side), new __vec2( side, -side), new __vec2(-side, -_sca[1]) ],
[ new __vec2( side, -side), new __vec2(-side, -_sca[1]), new __vec2( side, -_sca[1]) ],
);
array_push(triangles, //bottom
[ new __vec2(-side, _sca[1]), new __vec2( side, _sca[1]), new __vec2(-side, side) ],
[ new __vec2( side, _sca[1]), new __vec2(-side, side), new __vec2( side, side) ],
);
array_push(triangles, //left
[ new __vec2( -side, -side), new __vec2(-_sca[0], -side), new __vec2(-side, side) ],
[ new __vec2(-_sca[0], -side), new __vec2(-side, side), new __vec2(-_sca[0], side) ],
);
array_push(triangles, //right
[ new __vec2(_sca[0], -side), new __vec2( side, -side), new __vec2(_sca[0], side) ],
[ new __vec2( side, -side), new __vec2(_sca[0], side), new __vec2( side, side) ],
);
array_push(segment, new __vec2(-side, -side), new __vec2(-side, -_sca[1]), new __vec2( side, -_sca[1]), new __vec2(side, -side) );
array_push(segment, new __vec2(_sca[0], -side), new __vec2(_sca[0], side), new __vec2( side, side));
array_push(segment, new __vec2(side, _sca[1]), new __vec2(-side, _sca[1]), new __vec2(-side, side));
array_push(segment, new __vec2(-_sca[0], side), new __vec2(-_sca[0], -side), new __vec2(-side, -side));
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
} #endregion
function SHAPE_arc(_sca, data = {}) { #region
var prec = max(3, data.side);
var inner = data.inner;
var radRan = data.radRan;
var cap = data.cap;
var triangles = [];
var segment = [];
var oa, na;
var sgArcI = [], sgArcO = [];
for( var i = 0; i <= prec; i++ ) {
na = lerp(radRan[0], radRan[1], i / prec);
var ix1 = lengthdir_x(0.5 * inner, na) * _sca[0] * 2;
var iy1 = lengthdir_y(0.5 * inner, na) * _sca[1] * 2;
var nx1 = lengthdir_x(0.5, na) * _sca[0] * 2;
var ny1 = lengthdir_y(0.5, na) * _sca[1] * 2;
if(i) {
var ix0 = lengthdir_x(0.5 * inner, oa) * _sca[0] * 2;
var iy0 = lengthdir_y(0.5 * inner, oa) * _sca[1] * 2;
var nx0 = lengthdir_x(0.5, oa) * _sca[0] * 2;
var ny0 = lengthdir_y(0.5, oa) * _sca[1] * 2;
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]);
array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx1, ny1), new __vec2(ix1, iy1) ]);
}
array_push(sgArcI, new __vec2(ix1, iy1));
array_push(sgArcO, new __vec2(nx1, ny1));
oa = na;
}
if(cap) {
var cx = lengthdir_x(0.5 * (inner + 1) / 2, radRan[0]) * _sca[0] * 2;
var cy = lengthdir_y(0.5 * (inner + 1) / 2, radRan[0]) * _sca[1] * 2;
var ox, oy, nx, ny, oa, na;
var sgCapI = [], sgCapO = [];
prec = max(ceil(prec / 2), 2);
for( var i = 0; i <= prec; i++ ) {
na = radRan[0] - 180 * i / prec;
nx = cx + lengthdir_x((1 - inner) / 2, na) * _sca[0];
ny = cy + lengthdir_y((1 - inner) / 2, na) * _sca[1];
if(i) array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]);
array_push(sgCapI, new __vec2(nx, ny));
oa = na;
ox = nx;
oy = ny;
}
var cx = lengthdir_x(0.5 * (inner + 1) / 2, radRan[1]) * _sca[0] * 2;
var cy = lengthdir_y(0.5 * (inner + 1) / 2, radRan[1]) * _sca[1] * 2;
var ox, oy, nx, ny, oa, na;
for( var i = 0; i <= prec; i++ ) {
na = radRan[1] + 180 * i / prec;
nx = cx + lengthdir_x((1 - inner) / 2, na) * _sca[0];
ny = cy + lengthdir_y((1 - inner) / 2, na) * _sca[1];
if(i) array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]);
array_push(sgCapO, new __vec2(nx, ny));
oa = na;
ox = nx;
oy = ny;
}
array_append(segment, sgArcI);
array_append(segment, array_reverse(sgCapO));
array_append(segment, array_reverse(sgArcO));
array_append(segment, sgCapI);
} else {
array_append(segment, sgArcI);
array_append(segment, array_reverse(sgArcO));
array_push(segment, sgArcI[0].clone());
}
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
} #endregion
#endregion
return [
[{ type: SHAPE_TYPE.triangles, triangles: triangles }],
segment
];
}

View file

@ -37,10 +37,10 @@
globalvar HOTKEYS, HOTKEY_CONTEXT;
LATEST_VERSION = 1_16_00_0;
VERSION = 1_17_10_4;
VERSION = 1_17_11_0;
SAVE_VERSION = 1_17_10_0;
VERSION_STRING = "1.17.10.4";
BUILD_NUMBER = 1_17_10_4;
VERSION_STRING = "1.17.11.001";
BUILD_NUMBER = 1_17_11_0;
HOTKEYS = ds_map_create();
HOTKEY_CONTEXT = ds_list_create();
@ -59,7 +59,7 @@
globalvar DIALOG_CLICK;
DOUBLE_CLICK_POS = [ 0, 0 ];
DOUBLE_CLICK = false;
DOUBLE_CLICK = false;
FOCUS = noone;
FOCUS_CONTENT = noone;

View file

@ -1,6 +1,5 @@
function Node_Shape_Polygon(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Draw Shape Polygon";
batch_output = false;
shapesArray = [ "Rectangle", "Ellipse", "Star", "Capsule", "Ring", "Arc", "Gear", "Cross" ];
for( var i = 0, n = array_length(shapesArray); i < n; i++ )
@ -49,6 +48,11 @@ function Node_Shape_Polygon(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
newInput(16, nodeValue("Mesh", self, CONNECT_TYPE.input, VALUE_TYPE.mesh, noone))
.setVisible(true, true);
newInput(17, nodeValue_Float("Explode", self, 0))
.setDisplay(VALUE_DISPLAY.slider, { range: [-1, 1, 0.01] });
newInput(18, nodeValue_Rotation("Piece Rotation", self, 0));
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
outputs[1] = nodeValue_Output("Mesh", self, VALUE_TYPE.mesh, noone);
@ -58,7 +62,7 @@ function Node_Shape_Polygon(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
input_display_list = [ 16,
["Output", false], 0,
["Transform", false], 5, 6, 7,
["Shape", false], 4, 8, 9, 10, 11, 12, 13, 14, 15,
["Shape", false], 4, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18,
["Render", true], 3,
["Background", true, 1], 2,
];
@ -90,10 +94,7 @@ function Node_Shape_Polygon(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
mesh = new Mesh();
path = new PathSegment();
static processData = function(_outSurf, _data, _output_index, _array_index) {
if(_output_index == 1) return mesh;
if(_output_index == 2) return path;
static processData = function(_outData, _data, _output_index, _array_index) {
var _dim = _data[0];
var _bg = _data[1];
var _bgc = _data[2];
@ -111,27 +112,78 @@ function Node_Shape_Polygon(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var _aRan = _data[14];
var _cap = _data[15];
var _mesh = _data[16];
var _expld = _data[17];
var _prot = _data[18];
inputs[ 8].setVisible(_shp == 1 || _shp == 2 || _shp == 3 || _shp == 4 || _shp == 5);
inputs[ 9].setVisible(_shp == 2 || _shp == 4 || _shp == 5 || _shp == 6 || _shp == 7);
inputs[10].setVisible(_shp == 3);
inputs[11].setVisible(_shp == 6);
inputs[12].setVisible(_shp == 6);
inputs[13].setVisible(_shp == 6);
inputs[14].setVisible(_shp == 5);
inputs[15].setVisible(_shp == 5);
inputs[ 8].setVisible(false);
inputs[ 9].setVisible(false);
inputs[10].setVisible(false);
inputs[11].setVisible(false);
inputs[12].setVisible(false);
inputs[13].setVisible(false);
inputs[14].setVisible(false);
inputs[15].setVisible(false);
inputs[17].setVisible(false);
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
var _shapeName = array_safe_get_fast(shapesArray, _shp).name;
switch(_shapeName) {
case "Rectangle" : // 0
break;
case "Ellipse" : // 1
inputs[ 8].setVisible(true);
inputs[17].setVisible(true);
break;
case "Star" : // 2
inputs[ 8].setVisible(true);
inputs[ 9].setVisible(true);
break;
case "Capsule" : // 3
inputs[ 8].setVisible(true);
inputs[10].setVisible(true);
break;
case "Ring" : // 4
inputs[ 8].setVisible(true);
inputs[ 9].setVisible(true);
break;
case "Arc" : // 5
inputs[ 8].setVisible(true);
inputs[ 9].setVisible(true);
inputs[14].setVisible(true);
inputs[15].setVisible(true);
break;
case "Gear" : // 6
inputs[ 9].setVisible(true);
inputs[11].setVisible(true);
inputs[12].setVisible(true);
inputs[13].setVisible(true);
break;
case "Cross" : // 7
inputs[ 9].setVisible(true);
break;
}
var _outSurf = surface_verify(_outData[0], _dim[0], _dim[1], attrDepth());
print(attributes.use_project_dimension)
var data = {
side: _side,
inner: _inner,
radius: _rad,
radRan: _aRan,
teeth: _teeth,
teethH: _thHei,
teethT: _thTap,
cap: _cap,
side: _side,
inner: _inner,
radius: _rad,
radRan: _aRan,
teeth: _teeth,
teethH: _thHei,
teethT: _thTap,
cap: _cap,
explode: _expld,
};
surface_set_target(_outSurf);
@ -159,26 +211,49 @@ function Node_Shape_Polygon(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var shapeData = [];
switch(array_safe_get_fast(shapesArray, _shp).name) {
case "Rectangle" : shapeData = SHAPE_rectangle(_sca); break;
case "Ellipse" : shapeData = SHAPE_circle(_sca, data); break;
case "Star" : shapeData = SHAPE_star(_sca, data); break;
case "Capsule" : shapeData = SHAPE_capsule(_sca, data); break;
case "Ring" : shapeData = SHAPE_ring(_sca, data); break;
case "Arc" : shapeData = SHAPE_arc(_sca, data); break;
case "Gear" : shapeData = SHAPE_gear(_sca, data); break;
case "Cross" : shapeData = SHAPE_cross(_sca, data); break;
switch(_shapeName) {
case "Rectangle" : shapeData = SHAPE_rectangle( _sca ); break;
case "Ellipse" : shapeData = SHAPE_circle( _sca, data); break;
case "Star" : shapeData = SHAPE_star( _sca, data); break;
case "Capsule" : shapeData = SHAPE_capsule( _sca, data); break;
case "Ring" : shapeData = SHAPE_ring( _sca, data); break;
case "Arc" : shapeData = SHAPE_arc( _sca, data); break;
case "Gear" : shapeData = SHAPE_gear( _sca, data); break;
case "Cross" : shapeData = SHAPE_cross( _sca, data); break;
default:
draw_primitive_end();
draw_set_alpha(1);
surface_reset_target();
return _outSurf;
return [ _outSurf, mesh, path ];
}
var points = shapeData[0];
var segment = shapeData[1];
if(_prot != 0)
for( var i = 0, n = array_length(points); i < n; i++ ) {
if(points[i].type != SHAPE_TYPE.triangles) continue;
var _tri = points[i].triangles;
for( var j = 0; j < array_length(_tri); j++ ) {
var tri = _tri[j];
var cx = (tri[0].x + tri[1].x + tri[2].x) / 3;
var cy = (tri[0].y + tri[1].y + tri[2].y) / 3;
var p = point_rotate(tri[0].x, tri[0].y, cx, cy, _prot);
tri[0].x = p[0]; tri[0].y = p[1];
var p = point_rotate(tri[1].x, tri[1].y, cx, cy, _prot);
tri[1].x = p[0]; tri[1].y = p[1];
var p = point_rotate(tri[2].x, tri[2].y, cx, cy, _prot);
tri[2].x = p[0]; tri[2].y = p[1];
}
}
for( var i = 0, n = array_length(segment); i < n; i++ ) {
var _p = segment[i];
var p = point_rotate(_p.x, _p.y, 0, 0, _rot);
@ -218,6 +293,6 @@ function Node_Shape_Polygon(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
surface_reset_target();
return _outSurf;
return [ _outSurf, mesh, path ];
}
}

View file

@ -1,7 +1,7 @@
function nodeValue_Dimension(_node, value = DEF_SURF) { return new NodeValue_Dimension(_node, value); }
function NodeValue_Dimension(_node, value) : NodeValue("Dimension", _node, CONNECT_TYPE.input, VALUE_TYPE.integer, value, "") constructor {
setDisplay(VALUE_DISPLAY.vector, 2);
setDisplay(VALUE_DISPLAY.vector);
/////============== GET =============

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 B

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 B

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 B

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 B

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 B

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 B

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 B

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

Some files were not shown because too many files have changed in this diff Show more