mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-24 03:48:06 +01:00
- [Bake Path] Fix baking looped path not loop properly.
This commit is contained in:
parent
c8a8c944d1
commit
22d44588f0
9 changed files with 180 additions and 13 deletions
|
@ -2043,6 +2043,7 @@
|
||||||
{"name":"s_node_scatter_point","order":9,"path":"sprites/s_node_scatter_point/s_node_scatter_point.yy",},
|
{"name":"s_node_scatter_point","order":9,"path":"sprites/s_node_scatter_point/s_node_scatter_point.yy",},
|
||||||
{"name":"s_node_scatter","order":19,"path":"sprites/s_node_scatter/s_node_scatter.yy",},
|
{"name":"s_node_scatter","order":19,"path":"sprites/s_node_scatter/s_node_scatter.yy",},
|
||||||
{"name":"s_node_sdf","order":47,"path":"sprites/s_node_sdf/s_node_sdf.yy",},
|
{"name":"s_node_sdf","order":47,"path":"sprites/s_node_sdf/s_node_sdf.yy",},
|
||||||
|
{"name":"s_node_segment_filter","order":21,"path":"sprites/s_node_segment_filter/s_node_segment_filter.yy",},
|
||||||
{"name":"s_node_separate_file_path","order":14,"path":"sprites/s_node_separate_file_path/s_node_separate_file_path.yy",},
|
{"name":"s_node_separate_file_path","order":14,"path":"sprites/s_node_separate_file_path/s_node_separate_file_path.yy",},
|
||||||
{"name":"s_node_sepearte_shape","order":48,"path":"sprites/s_node_sepearte_shape/s_node_sepearte_shape.yy",},
|
{"name":"s_node_sepearte_shape","order":48,"path":"sprites/s_node_sepearte_shape/s_node_sepearte_shape.yy",},
|
||||||
{"name":"s_node_shadow_cast","order":50,"path":"sprites/s_node_shadow_cast/s_node_shadow_cast.yy",},
|
{"name":"s_node_shadow_cast","order":50,"path":"sprites/s_node_shadow_cast/s_node_shadow_cast.yy",},
|
||||||
|
|
|
@ -2589,6 +2589,7 @@
|
||||||
{"id":{"name":"s_node_scatter_point","path":"sprites/s_node_scatter_point/s_node_scatter_point.yy",},},
|
{"id":{"name":"s_node_scatter_point","path":"sprites/s_node_scatter_point/s_node_scatter_point.yy",},},
|
||||||
{"id":{"name":"s_node_scatter","path":"sprites/s_node_scatter/s_node_scatter.yy",},},
|
{"id":{"name":"s_node_scatter","path":"sprites/s_node_scatter/s_node_scatter.yy",},},
|
||||||
{"id":{"name":"s_node_sdf","path":"sprites/s_node_sdf/s_node_sdf.yy",},},
|
{"id":{"name":"s_node_sdf","path":"sprites/s_node_sdf/s_node_sdf.yy",},},
|
||||||
|
{"id":{"name":"s_node_segment_filter","path":"sprites/s_node_segment_filter/s_node_segment_filter.yy",},},
|
||||||
{"id":{"name":"s_node_separate_file_path","path":"sprites/s_node_separate_file_path/s_node_separate_file_path.yy",},},
|
{"id":{"name":"s_node_separate_file_path","path":"sprites/s_node_separate_file_path/s_node_separate_file_path.yy",},},
|
||||||
{"id":{"name":"s_node_sepearte_shape","path":"sprites/s_node_sepearte_shape/s_node_sepearte_shape.yy",},},
|
{"id":{"name":"s_node_sepearte_shape","path":"sprites/s_node_sepearte_shape/s_node_sepearte_shape.yy",},},
|
||||||
{"id":{"name":"s_node_shadow_cast","path":"sprites/s_node_shadow_cast/s_node_shadow_cast.yy",},},
|
{"id":{"name":"s_node_shadow_cast","path":"sprites/s_node_shadow_cast/s_node_shadow_cast.yy",},},
|
||||||
|
|
|
@ -72,7 +72,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
||||||
|
|
||||||
inputs[| 28] = nodeValue("Segments", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [[]])
|
inputs[| 28] = nodeValue("Segments", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [[]])
|
||||||
.setDisplay(VALUE_DISPLAY.vector)
|
.setDisplay(VALUE_DISPLAY.vector)
|
||||||
.setArrayDepth(1);
|
.setArrayDepth(2);
|
||||||
|
|
||||||
input_display_list = [
|
input_display_list = [
|
||||||
["Output", true], 0, 1,
|
["Output", true], 0, 1,
|
||||||
|
@ -191,7 +191,6 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
||||||
if(_dtype == 1 && _pat == noone) return _outData;
|
if(_dtype == 1 && _pat == noone) return _outData;
|
||||||
if(_dtype == 2 && (array_invalid(_segs) || array_invalid(_segs[0]))) return _outData;
|
if(_dtype == 2 && (array_invalid(_segs) || array_invalid(_segs[0]))) return _outData;
|
||||||
|
|
||||||
|
|
||||||
if(IS_FIRST_FRAME || inputs[| 11].is_anim)
|
if(IS_FIRST_FRAME || inputs[| 11].is_anim)
|
||||||
ds_map_clear(widthMap);
|
ds_map_clear(widthMap);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ function Node_Path_Bake(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
|
|
||||||
outputs[| 0] = nodeValue("Segments", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [[]])
|
outputs[| 0] = nodeValue("Segments", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [[]])
|
||||||
.setDisplay(VALUE_DISPLAY.vector)
|
.setDisplay(VALUE_DISPLAY.vector)
|
||||||
.setArrayDepth(1);
|
.setArrayDepth(2);
|
||||||
|
|
||||||
path_amount = 1;
|
path_amount = 1;
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ function Node_Path_Bake(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
if(_path == noone) return;
|
if(_path == noone) return;
|
||||||
if(_dist <= 0) return;
|
if(_dist <= 0) return;
|
||||||
|
|
||||||
|
var _loop = struct_try_get(_path, "path_loop", false);
|
||||||
var _amo = _path.getLineCount();
|
var _amo = _path.getLineCount();
|
||||||
path_amount = _amo;
|
path_amount = _amo;
|
||||||
var _segs = array_create(_amo);
|
var _segs = array_create(_amo);
|
||||||
|
@ -67,6 +68,8 @@ function Node_Path_Bake(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
_p = _path.getPointDistance(j, i, _p);
|
_p = _path.getPointDistance(j, i, _p);
|
||||||
array_push(_seg, [ _p.x, _p.y, j / _len ]);
|
array_push(_seg, [ _p.x, _p.y, j / _len ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(_loop) array_push(_seg, [ _seg[0][0], _seg[0][1], 1 ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_sped && _amo == 1) _segs = _segs[0];
|
if(_sped && _amo == 1) _segs = _segs[0];
|
||||||
|
@ -75,6 +78,6 @@ function Node_Path_Bake(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
|
|
||||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||||
var bbox = drawGetBbox(xx, yy, _s);
|
var bbox = drawGetBbox(xx, yy, _s);
|
||||||
draw_sprite_fit(THEME.node_draw_path, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
draw_sprite_bbox_uniform(THEME.node_draw_path, 0, bbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -914,6 +914,7 @@ function __initNodes() {
|
||||||
addNodeObject(values, "Map Path", s_node_path_mapp, "Node_Path_Map", [1, Node_Path_Map]).setVersion(11640);
|
addNodeObject(values, "Map Path", s_node_path_mapp, "Node_Path_Map", [1, Node_Path_Map]).setVersion(11640);
|
||||||
addNodeObject(values, "Scatter Path", s_node_path_scatter, "Node_Path_Scatter", [1, Node_Path_Scatter]).setVersion(11740);
|
addNodeObject(values, "Scatter Path", s_node_path_scatter, "Node_Path_Scatter", [1, Node_Path_Scatter]).setVersion(11740);
|
||||||
addNodeObject(values, "3D Path", s_node_path_3d, "Node_Path_3D", [1, Node_Path_3D], [ "path 3d" ]).setVersion(11750);
|
addNodeObject(values, "3D Path", s_node_path_3d, "Node_Path_3D", [1, Node_Path_3D], [ "path 3d" ]).setVersion(11750);
|
||||||
|
addNodeObject(values, "Filter Segments",s_node_segment_filter, "Node_Segment_Filter", [1, Node_Segment_Filter]).setVersion(11780);
|
||||||
|
|
||||||
ds_list_add(values, "Boolean");
|
ds_list_add(values, "Boolean");
|
||||||
addNodeObject(values, "Boolean", s_node_boolean, "Node_Boolean", [1, Node_Boolean]);
|
addNodeObject(values, "Boolean", s_node_boolean, "Node_Boolean", [1, Node_Boolean]);
|
||||||
|
|
|
@ -1,42 +1,114 @@
|
||||||
function Node_Segment_Filter(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
function Node_Segment_Filter(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
name = "Segment Filter";
|
name = "Filter Segment";
|
||||||
|
|
||||||
setDimension(96, 48);
|
setDimension(96, 48);
|
||||||
|
|
||||||
inputs[| 0] = nodeValue("Segments", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [[]])
|
inputs[| 0] = nodeValue("Segments", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [[]])
|
||||||
.setDisplay(VALUE_DISPLAY.vector)
|
.setDisplay(VALUE_DISPLAY.vector)
|
||||||
|
.setVisible(true, true)
|
||||||
.setArrayDepth(1);
|
.setArrayDepth(1);
|
||||||
|
|
||||||
inputs[| 1] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
inputs[| 1] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||||
|
.setDisplay(VALUE_DISPLAY.rotation);
|
||||||
|
|
||||||
|
inputs[| 2] = nodeValue("Spread", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 15);
|
||||||
|
|
||||||
|
inputs[| 3] = nodeValue("Both side", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||||
|
|
||||||
outputs[| 0] = nodeValue("Segments", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [[]])
|
outputs[| 0] = nodeValue("Segments", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [[]])
|
||||||
.setVisible(false)
|
.setDisplay(VALUE_DISPLAY.vector)
|
||||||
.setArrayDepth(1);
|
.setArrayDepth(2);
|
||||||
|
|
||||||
input_display_list = [
|
input_display_list = [
|
||||||
["Segments", false], 0,
|
["Segments", false], 0,
|
||||||
["Filter", false], 1,
|
["Filter", false], 1, 2, 3,
|
||||||
];
|
];
|
||||||
|
|
||||||
path_preview_surface = noone;
|
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 ox, oy, nx, ny;
|
||||||
|
|
||||||
|
if(array_invalid(_segs) || array_invalid(_segs[0])) return;
|
||||||
|
if(!is_array(_segs[0][0])) _segs = [ _segs ];
|
||||||
|
|
||||||
|
draw_set_color(COLORS._main_icon);
|
||||||
|
|
||||||
|
for( var i = 0, n = array_length(_segs); i < n; i++ ) {
|
||||||
|
var _seg = _segs[i];
|
||||||
|
var ox = _x + _seg[0][0] * _s;
|
||||||
|
var oy = _y + _seg[0][1] * _s;
|
||||||
|
|
||||||
|
for( var j = 1, m = array_length(_seg); j < m; j++ ) {
|
||||||
|
nx = _x + _seg[j][0] * _s;
|
||||||
|
ny = _y + _seg[j][1] * _s;
|
||||||
|
|
||||||
|
draw_line_width(ox, oy, nx, ny, 3);
|
||||||
|
|
||||||
|
ox = nx;
|
||||||
|
oy = ny;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static update = function(frame = CURRENT_FRAME) {
|
static update = function(frame = CURRENT_FRAME) {
|
||||||
var _segments = getInputData(0);
|
var _segments = getInputData(0);
|
||||||
|
var _angle = getInputData(1);
|
||||||
|
var _spread = getInputData(2);
|
||||||
|
var _both = getInputData(3);
|
||||||
|
|
||||||
if(!is_array(_segments) || array_empty(_segments) || !is_array(_segments[0])) return;
|
if(array_invalid(_segments) || array_invalid(_segments[0])) return;
|
||||||
|
|
||||||
if(!is_array(_segments[0][0])) //spreaded single path
|
if(!is_array(_segments[0][0])) //spreaded single path
|
||||||
_segments = [ _segments ];
|
_segments = [ _segments ];
|
||||||
|
|
||||||
|
var _amo = array_length(_segments);
|
||||||
|
var _segOut = [];
|
||||||
|
|
||||||
|
for(var i = 0; i < _amo; i++) {
|
||||||
|
var _segIn = _segments[i];
|
||||||
|
if(array_empty(_segIn)) continue;
|
||||||
|
|
||||||
|
var _ox = _segIn[0][0], _oy = _segIn[0][1], _nx, _ny;
|
||||||
|
var _inc = false;
|
||||||
|
var _dir, _drv;
|
||||||
|
var _seg = [];
|
||||||
|
|
||||||
|
for (var j = 1, n = array_length(_segIn); j < n; j++) {
|
||||||
|
_nx = _segIn[j][0];
|
||||||
|
_ny = _segIn[j][1];
|
||||||
|
|
||||||
|
_dir = point_direction(_ox, _oy, _nx, _ny);
|
||||||
|
_drv = abs(angle_difference(_dir, _angle));
|
||||||
|
if(_both) _drv = min(_drv, abs(angle_difference(_dir, _angle + 180)));
|
||||||
|
|
||||||
|
if(_drv < _spread) {
|
||||||
|
if(!_inc) array_push(_seg, [ _ox, _oy ]);
|
||||||
|
|
||||||
|
array_push(_seg, [ _nx, _ny ]);
|
||||||
|
_inc = true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(!array_empty(_seg)) {
|
||||||
|
array_push(_segOut, _seg);
|
||||||
|
_seg = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
_inc = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ox = _nx;
|
||||||
|
_oy = _ny;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!array_empty(_seg)) array_push(_segOut, _seg);
|
||||||
|
}
|
||||||
|
|
||||||
|
outputs[| 0].setValue(_segOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||||
var bbox = drawGetBbox(xx, yy, _s);
|
var bbox = drawGetBbox(xx, yy, _s);
|
||||||
|
draw_sprite_bbox_uniform(s_node_segment_filter, 0, bbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
90
sprites/s_node_segment_filter/s_node_segment_filter.yy
Normal file
90
sprites/s_node_segment_filter/s_node_segment_filter.yy
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
{
|
||||||
|
"$GMSprite":"",
|
||||||
|
"%Name":"s_node_segment_filter",
|
||||||
|
"bboxMode":0,
|
||||||
|
"bbox_bottom":59,
|
||||||
|
"bbox_left":6,
|
||||||
|
"bbox_right":57,
|
||||||
|
"bbox_top":5,
|
||||||
|
"collisionKind":1,
|
||||||
|
"collisionTolerance":0,
|
||||||
|
"DynamicTexturePage":false,
|
||||||
|
"edgeFiltering":false,
|
||||||
|
"For3D":false,
|
||||||
|
"frames":[
|
||||||
|
{"$GMSpriteFrame":"","%Name":"c1b657e5-c3da-43e5-b1e1-c9faa02ff38d","name":"c1b657e5-c3da-43e5-b1e1-c9faa02ff38d","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
|
||||||
|
],
|
||||||
|
"gridX":0,
|
||||||
|
"gridY":0,
|
||||||
|
"height":64,
|
||||||
|
"HTile":false,
|
||||||
|
"layers":[
|
||||||
|
{"$GMImageLayer":"","%Name":"10094d74-f749-4689-86f0-27a6c21d9e46","blendMode":0,"displayName":"default","isLocked":false,"name":"10094d74-f749-4689-86f0-27a6c21d9e46","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
|
||||||
|
],
|
||||||
|
"name":"s_node_segment_filter",
|
||||||
|
"nineSlice":null,
|
||||||
|
"origin":4,
|
||||||
|
"parent":{
|
||||||
|
"name":"path",
|
||||||
|
"path":"folders/nodes/icons/value/path.yy",
|
||||||
|
},
|
||||||
|
"preMultiplyAlpha":false,
|
||||||
|
"resourceType":"GMSprite",
|
||||||
|
"resourceVersion":"2.0",
|
||||||
|
"sequence":{
|
||||||
|
"$GMSequence":"",
|
||||||
|
"%Name":"s_node_segment_filter",
|
||||||
|
"autoRecord":true,
|
||||||
|
"backdropHeight":768,
|
||||||
|
"backdropImageOpacity":0.5,
|
||||||
|
"backdropImagePath":"",
|
||||||
|
"backdropWidth":1366,
|
||||||
|
"backdropXOffset":0.0,
|
||||||
|
"backdropYOffset":0.0,
|
||||||
|
"events":{
|
||||||
|
"$KeyframeStore<MessageEventKeyframe>":"",
|
||||||
|
"Keyframes":[],
|
||||||
|
"resourceType":"KeyframeStore<MessageEventKeyframe>",
|
||||||
|
"resourceVersion":"2.0",
|
||||||
|
},
|
||||||
|
"eventStubScript":null,
|
||||||
|
"eventToFunction":{},
|
||||||
|
"length":1.0,
|
||||||
|
"lockOrigin":false,
|
||||||
|
"moments":{
|
||||||
|
"$KeyframeStore<MomentsEventKeyframe>":"",
|
||||||
|
"Keyframes":[],
|
||||||
|
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
|
||||||
|
"resourceVersion":"2.0",
|
||||||
|
},
|
||||||
|
"name":"s_node_segment_filter",
|
||||||
|
"playback":1,
|
||||||
|
"playbackSpeed":30.0,
|
||||||
|
"playbackSpeedType":0,
|
||||||
|
"resourceType":"GMSequence",
|
||||||
|
"resourceVersion":"2.0",
|
||||||
|
"showBackdrop":true,
|
||||||
|
"showBackdropImage":false,
|
||||||
|
"timeUnits":1,
|
||||||
|
"tracks":[
|
||||||
|
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
|
||||||
|
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
|
||||||
|
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"c1b657e5-c3da-43e5-b1e1-c9faa02ff38d","path":"sprites/s_node_segment_filter/s_node_segment_filter.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
|
||||||
|
},"Disabled":false,"id":"7040ce2f-17fc-4079-8d86-f936121cdeab","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
|
||||||
|
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
|
||||||
|
],
|
||||||
|
"visibleRange":null,
|
||||||
|
"volume":1.0,
|
||||||
|
"xorigin":32,
|
||||||
|
"yorigin":32,
|
||||||
|
},
|
||||||
|
"swatchColours":null,
|
||||||
|
"swfPrecision":0.5,
|
||||||
|
"textureGroupId":{
|
||||||
|
"name":"Default",
|
||||||
|
"path":"texturegroups/Default",
|
||||||
|
},
|
||||||
|
"type":0,
|
||||||
|
"VTile":false,
|
||||||
|
"width":64,
|
||||||
|
}
|
Loading…
Reference in a new issue