This commit is contained in:
Tanasart 2023-11-30 19:07:08 +07:00
parent ce9006cd23
commit fd3d21b001
10 changed files with 247 additions and 15 deletions

View file

@ -242,6 +242,7 @@
{"name":"button","order":34,"path":"folders/widgets/button.yy",},
{"name":"rotator","order":35,"path":"folders/widgets/rotator.yy",},
{"name":"text","order":36,"path":"folders/widgets/text.yy",},
{"name":"MK effects","order":151,"path":"folders/nodes/icons/MK effects.yy",},
],
"ResourceOrderSettings": [
{"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",},
@ -1226,6 +1227,7 @@
{"name":"node_text","order":4,"path":"scripts/node_text/node_text.yy",},
{"name":"panel_collection","order":3,"path":"scripts/panel_collection/panel_collection.yy",},
{"name":"node_string_trim","order":4,"path":"scripts/node_string_trim/node_string_trim.yy",},
{"name":"node_mk_rain","order":1,"path":"scripts/node_mk_rain/node_mk_rain.yy",},
{"name":"Obj_FirebaseFirestore_Collection_Query_OrderBy","order":13,"path":"objects/Obj_FirebaseFirestore_Collection_Query_OrderBy/Obj_FirebaseFirestore_Collection_Query_OrderBy.yy",},
{"name":"d3d_material","order":9,"path":"scripts/d3d_material/d3d_material.yy",},
{"name":"lerp_float","order":1,"path":"scripts/lerp_float/lerp_float.yy",},

View file

@ -277,6 +277,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"button","folderPath":"folders/widgets/button.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"rotator","folderPath":"folders/widgets/rotator.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"text","folderPath":"folders/widgets/text.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"MK effects","folderPath":"folders/nodes/icons/MK effects.yy",},
],
"IncludedFiles": [
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",},
@ -1805,6 +1806,7 @@
{"id":{"name":"node_random","path":"scripts/node_random/node_random.yy",},},
{"id":{"name":"Obj_FirebaseFirestore_Collection_Query_LessThan","path":"objects/Obj_FirebaseFirestore_Collection_Query_LessThan/Obj_FirebaseFirestore_Collection_Query_LessThan.yy",},},
{"id":{"name":"sh_channel_A","path":"shaders/sh_channel_A/sh_channel_A.yy",},},
{"id":{"name":"s_node_mk_rain","path":"sprites/s_node_mk_rain/s_node_mk_rain.yy",},},
{"id":{"name":"node_atlas","path":"scripts/node_atlas/node_atlas.yy",},},
{"id":{"name":"sh_blend_sat","path":"shaders/sh_blend_sat/sh_blend_sat.yy",},},
{"id":{"name":"s_node_feedback","path":"sprites/s_node_feedback/s_node_feedback.yy",},},
@ -1924,6 +1926,7 @@
{"id":{"name":"panel_collection","path":"scripts/panel_collection/panel_collection.yy",},},
{"id":{"name":"contextMenu_controller","path":"scripts/contextMenu_controller/contextMenu_controller.yy",},},
{"id":{"name":"node_string_trim","path":"scripts/node_string_trim/node_string_trim.yy",},},
{"id":{"name":"node_mk_rain","path":"scripts/node_mk_rain/node_mk_rain.yy",},},
{"id":{"name":"Obj_FirebaseFirestore_Collection_Query_OrderBy","path":"objects/Obj_FirebaseFirestore_Collection_Query_OrderBy/Obj_FirebaseFirestore_Collection_Query_OrderBy.yy",},},
{"id":{"name":"d3d_material","path":"scripts/d3d_material/d3d_material.yy",},},
{"id":{"name":"lerp_float","path":"scripts/lerp_float/lerp_float.yy",},},

View file

@ -110,15 +110,20 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
static updateKeyMap = function() { #region
if(!prop.is_anim && !LOADING && !APPENDING) return;
if(array_length(key_map) != TOTAL_FRAMES)
if(ds_list_empty(values)) {
array_resize(key_map, TOTAL_FRAMES);
if(ds_list_size(values) < 2) {
array_fill(key_map, 0, TOTAL_FRAMES, 0);
return;
}
//print($"Update key map {prop.node.name} - {prop.name}");
var _len = max(TOTAL_FRAMES, values[| ds_list_size(values) - 1].time);
if(array_length(key_map) != _len)
array_resize(key_map, _len);
if(ds_list_size(values) < 2) {
array_fill(key_map, 0, _len, 0);
return;
}
var _firstKey = values[| 0].time;
array_fill(key_map, 0, _firstKey, -1);
@ -130,7 +135,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
_keyIndex = _k1;
}
array_fill(key_map, _keyIndex, TOTAL_FRAMES, 999_999);
array_fill(key_map, _keyIndex, _len, 999_999);
} #endregion
static interpolate = function(from, to, rat) { #region
@ -250,7 +255,8 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
if(prop.type == VALUE_TYPE.path) return processType(values[| 0].value);
if(!prop.is_anim) return processType(values[| 0].value);
if(array_length(key_map) != TOTAL_FRAMES) updateKeyMap();
var _len = max(TOTAL_FRAMES, values[| ds_list_size(values) - 1].time);
if(array_length(key_map) != _len) updateKeyMap();
var _time_first = prop.loop_range == -1? values[| 0].time : values[| ds_list_size(values) - 1 - prop.loop_range].time;
var _time_last = values[| ds_list_size(values) - 1].time;
@ -271,8 +277,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
}
} #endregion
var _keyIndex = key_map[_time];
//print(_keyIndex);
var _keyIndex = _time >= _len? 999_999 : key_map[_time];
if(_keyIndex == -1) { #region Before first key
if(prop.on_end == KEYFRAME_END.wrap) {

View file

@ -505,9 +505,6 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
surface_reset_target();
#endregion
//print($"Processing line {global.__debug_runner} = {get_timer() - __debug_timer} ms");
//printCallStack();
return _outSurf;
}
}

View file

@ -0,0 +1,138 @@
function Node_MK_Rain(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "MK Rain";
update_on_frame = true;
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 1] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 45)
.setDisplay(VALUE_DISPLAY.rotation);
inputs[| 2] = nodeValue("Density", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 5);
inputs[| 3] = nodeValue("Raindrop width", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 2 ])
.setDisplay(VALUE_DISPLAY.vector_range);
inputs[| 4] = nodeValue("Raindrop length", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 5, 10 ])
.setDisplay(VALUE_DISPLAY.vector_range);
inputs[| 5] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white));
inputs[| 6] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 7] = nodeValue("Velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 2 ])
.setDisplay(VALUE_DISPLAY.vector_range);
inputs[| 8] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom_range(100_000, 999_999));
inputs[| 9] = nodeValue("Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Rain", "Snow" ]);
inputs[| 10] = nodeValue("Snow size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 3, 4 ])
.setDisplay(VALUE_DISPLAY.vector_range);
input_display_list = [ 0, 8,
["Shape", false], 9, 3, 4, 10,
["Effect", false], 1, 2, 7,
["Render", false], 5, 6,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
drops = [];
static step = function() {
var _shap = getSingleValue(9);
inputs[| 3].setVisible(_shap == 0);
inputs[| 4].setVisible(_shap == 0);
inputs[| 10].setVisible(_shap == 1);
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var _surf = _data[0];
var _dirr = _data[1];
var _dens = _data[2];
var _rwid = _data[3];
var _rhei = _data[4];
var _colr = _data[5];
var _alph = _data[6];
var _velo = _data[7];
var _seed = _data[8];
var _shap = _data[9];
var _snws = _data[10];
if(!is_surface(_surf)) return _outSurf;
random_set_seed(_seed);
var _sw = surface_get_width_safe(_surf);
var _sh = surface_get_height_safe(_surf);
var _rad = sqrt(_sw * _sw + _sh * _sh) / 2;
var _rx = _sw / 2;
var _ry = _sh / 2;
var _tr_span_x = lengthdir_x(1, _dirr);
var _tr_span_y = lengthdir_y(1, _dirr);
surface_set_target(_outSurf);
DRAW_CLEAR
draw_surface(_surf, 0, 0);
BLEND_ALPHA_MULP
for( var i = 0; i < _dens; i++ ) {
var _r_shf = random_range(-_rad, _rad);
var _y_shf = random(1);
var _rmx = _rx + lengthdir_x(_r_shf, _dirr + 90);
var _rmy = _ry + lengthdir_y(_r_shf, _dirr + 90);
var _drpW, _drpH;
switch(_shap) {
case 0 :
_drpW = irandom_range(_rwid[0], _rwid[1]);
_drpH = irandom_range(_rhei[0], _rhei[1]);
break;
case 1 :
_drpW = random_range(_snws[0], _snws[1]);
_drpH = _drpW;
break;
}
var _t0x = _rmx + (_tr_span_x * (_rad + _drpH));
var _t0y = _rmy + (_tr_span_y * (_rad + _drpH));
var _vel = irandom_range(_velo[0], _velo[1]);
var _prg = _y_shf + _vel * (CURRENT_FRAME / TOTAL_FRAMES);
_prg = frac(_prg);
var _drpX = _t0x - _prg * _tr_span_x * ((_rad + _drpH) * 2);
var _drpY = _t0y - _prg * _tr_span_y * ((_rad + _drpH) * 2);
draw_set_color(_colr.eval(random(1)));
draw_set_alpha(random_range(_alph[0], _alph[1]));
switch(_shap) {
case 0 :
draw_line_width(
_drpX - _tr_span_x * _drpH,
_drpY - _tr_span_y * _drpH,
_drpX + _tr_span_x * _drpH,
_drpY + _tr_span_y * _drpH,
_drpW
);
break;
case 1 :
draw_circle(_drpX, _drpY, _drpW, false);
break;
}
}
draw_set_alpha(1);
BLEND_NORMAL
surface_reset_target();
return _outSurf;
}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_mk_rain",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "MK effects",
"path": "folders/nodes/data/MK effects.yy",
},
}

View file

@ -569,6 +569,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
addNodeObject(generator, "Interpret Number", s_node_interpret_number, "Node_Interpret_Number", [1, Node_Interpret_Number],, "Convert array of number into surface.").setVersion(11530);
addNodeObject(generator, "Random Shape", s_node_random_shape, "Node_Random_Shape", [1, Node_Random_Shape],, "Generate random shape, use for testing purposes.").setVersion(1147);
addNodeObject(generator, "Pixel Builder", s_node_pixel_builder, "Node_Pixel_Builder", [1, Node_Pixel_Builder]).setVersion(11540);
addNodeObject(generator, "Bar / Graph", s_node_bar_graph, "Node_Plot_Linear", [1, Node_Plot_Linear], ["graph", "waveform", "bar chart", "plot"], "Plot graph or bar chart from array of number.").setVersion(1144);
ds_list_add(generator, "Noises");
addNodeObject(generator, "Noise", s_node_noise, "Node_Noise", [1, Node_Noise],, "Generate white noise.");
@ -606,10 +607,10 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
ds_list_add(generator, "Region");
addNodeObject(generator, "Separate Shape", s_node_sepearte_shape, "Node_Seperate_Shape", [1, Node_Seperate_Shape],, "Separate disconnected pixel each into an image in an image array.");
addNodeObject(generator, "Region Fill", s_node_region_fill, "Node_Region_Fill", [1, Node_Region_Fill],, "Fill connected pixel with colors.").setVersion(1147);
ds_list_add(generator, "Others");
addNodeObject(generator, "Flood Fill", s_node_flood_fill, "Node_Flood_Fill", [1, Node_Flood_Fill],, "Filled connected pixel given position and color.").setVersion(1133);
addNodeObject(generator, "Bar / Graph", s_node_bar_graph, "Node_Plot_Linear", [1, Node_Plot_Linear], ["graph", "waveform", "bar chart", "plot"], "Plot graph or bar chart from array of number.").setVersion(1144);
ds_list_add(generator, "MK Effects");
addNodeObject(generator, "MK Rains", s_node_mk_rain, "Node_MK_Rain", [1, Node_MK_Rain]).setVersion(11600);
#endregion
var compose = ds_list_create(); #region
@ -970,6 +971,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
addNodeObject(hid, "Onion Skin", s_node_cache, "Node_Onion_Skin", [1, Node_Onion_Skin]).setVersion(1147).hideRecent();
//addNodeObject(hid, "Pixel Builder", s_node_pixel_builder, "Node_Pixel_Builder", [1, Node_Pixel_Builder]).setVersion(1150).hideRecent();
ds_list_add(values, "DynaSurf");
addNodeObject(hid, "Input", s_node_pixel_builder, "Node_DynaSurf_In", [1, Node_DynaSurf_In]).hideRecent();
addNodeObject(hid, "Output", s_node_pixel_builder, "Node_DynaSurf_Out", [1, Node_DynaSurf_Out]).hideRecent();
addNodeObject(hid, "getWidth", s_node_pixel_builder, "Node_DynaSurf_Out_Width", [1, Node_DynaSurf_Out_Width]).hideRecent();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,74 @@
{
"resourceType": "GMSprite",
"resourceVersion": "1.0",
"name": "s_node_mk_rain",
"bbox_bottom": 63,
"bbox_left": 0,
"bbox_right": 63,
"bbox_top": 0,
"bboxMode": 0,
"collisionKind": 1,
"collisionTolerance": 0,
"DynamicTexturePage": false,
"edgeFiltering": false,
"For3D": false,
"frames": [
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"18e0d307-8a22-4660-8d07-94154effe0c4",},
],
"gridX": 0,
"gridY": 0,
"height": 64,
"HTile": false,
"layers": [
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"7d4701da-57f9-4127-8e80-c019bcffa559","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
],
"nineSlice": null,
"origin": 4,
"parent": {
"name": "MK effects",
"path": "folders/nodes/icons/MK effects.yy",
},
"preMultiplyAlpha": false,
"sequence": {
"resourceType": "GMSequence",
"resourceVersion": "1.4",
"name": "s_node_mk_rain",
"autoRecord": true,
"backdropHeight": 768,
"backdropImageOpacity": 0.5,
"backdropImagePath": "",
"backdropWidth": 1366,
"backdropXOffset": 0.0,
"backdropYOffset": 0.0,
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"eventStubScript": null,
"eventToFunction": {},
"length": 1.0,
"lockOrigin": false,
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"playback": 1,
"playbackSpeed": 30.0,
"playbackSpeedType": 0,
"showBackdrop": true,
"showBackdropImage": false,
"timeUnits": 1,
"tracks": [
{"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"18e0d307-8a22-4660-8d07-94154effe0c4","path":"sprites/s_node_mk_rain/s_node_mk_rain.yy",},},},"Disabled":false,"id":"ad66282b-c136-4710-9ff3-39b80920e02a","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,},
],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange": null,
"volume": 1.0,
"xorigin": 32,
"yorigin": 32,
},
"swatchColours": null,
"swfPrecision": 2.525,
"textureGroupId": {
"name": "Default",
"path": "texturegroups/Default",
},
"type": 0,
"VTile": false,
"width": 64,
}