- Image grid/stack
|
@ -232,6 +232,7 @@
|
|||
{"name":"random shape","order":11,"path":"folders/shader/generator/random shape.yy",},
|
||||
{"name":"reaction diffusion","order":20,"path":"folders/shader/generator/reaction diffusion.yy",},
|
||||
{"name":"region","order":16,"path":"folders/shader/generator/region.yy",},
|
||||
{"name":"vector mapper","order":21,"path":"folders/shader/generator/vector mapper.yy",},
|
||||
{"name":"mask","order":10,"path":"folders/shader/mask.yy",},
|
||||
{"name":"misc","order":13,"path":"folders/shader/misc.yy",},
|
||||
{"name":"find boundary","order":9,"path":"folders/shader/misc/find boundary.yy",},
|
||||
|
@ -260,7 +261,6 @@
|
|||
{"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":"vector mapper","order":21,"path":"folders/shader/generator/vector mapper.yy",},
|
||||
],
|
||||
"ResourceOrderSettings": [
|
||||
{"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",},
|
||||
|
@ -406,7 +406,7 @@
|
|||
{"name":"s_node_gradient_data","order":17,"path":"sprites/s_node_gradient_data/s_node_gradient_data.yy",},
|
||||
{"name":"node_PCX_fn_var","order":1,"path":"scripts/node_PCX_fn_var/node_PCX_fn_var.yy",},
|
||||
{"name":"s_node_vfx_render","order":1,"path":"sprites/s_node_vfx_render/s_node_vfx_render.yy",},
|
||||
{"name":"node_stack","order":2,"path":"scripts/node_stack/node_stack.yy",},
|
||||
{"name":"node_image_stack","order":2,"path":"scripts/node_image_stack/node_image_stack.yy",},
|
||||
{"name":"sh_draw_r32","order":11,"path":"shaders/sh_draw_r32/sh_draw_r32.yy",},
|
||||
{"name":"s_node_rigidSim_object","order":3,"path":"sprites/s_node_rigidSim_object/s_node_rigidSim_object.yy",},
|
||||
{"name":"sh_blend_max","order":8,"path":"shaders/sh_blend_max/sh_blend_max.yy",},
|
||||
|
@ -528,6 +528,7 @@
|
|||
{"name":"s_node_dithering","order":21,"path":"sprites/s_node_dithering/s_node_dithering.yy",},
|
||||
{"name":"node_3d_mesh_extrude","order":8,"path":"scripts/node_3d_mesh_extrude/node_3d_mesh_extrude.yy",},
|
||||
{"name":"sh_find_boundary_stretch_x","order":1,"path":"shaders/sh_find_boundary_stretch_x/sh_find_boundary_stretch_x.yy",},
|
||||
{"name":"s_node_image_grid","order":6,"path":"sprites/s_node_image_grid/s_node_image_grid.yy",},
|
||||
{"name":"s_workshop_badge","order":1,"path":"sprites/s_workshop_badge/s_workshop_badge.yy",},
|
||||
{"name":"node_pb_fx_brick","order":12,"path":"scripts/node_pb_fx_brick/node_pb_fx_brick.yy",},
|
||||
{"name":"node_compare","order":16,"path":"scripts/node_compare/node_compare.yy",},
|
||||
|
@ -1629,6 +1630,7 @@
|
|||
{"name":"node_color_adjustment","order":1,"path":"scripts/node_color_adjustment/node_color_adjustment.yy",},
|
||||
{"name":"node_print","order":10,"path":"scripts/node_print/node_print.yy",},
|
||||
{"name":"s_node_strandSim_force","order":6,"path":"sprites/s_node_strandSim_force/s_node_strandSim_force.yy",},
|
||||
{"name":"node_image_grid","order":5,"path":"scripts/node_image_grid/node_image_grid.yy",},
|
||||
{"name":"s_node_array_reverse","order":8,"path":"sprites/s_node_array_reverse/s_node_array_reverse.yy",},
|
||||
{"name":"sh_ani_noise","order":8,"path":"shaders/sh_ani_noise/sh_ani_noise.yy",},
|
||||
{"name":"d3d_camera_object","order":1,"path":"scripts/d3d_camera_object/d3d_camera_object.yy",},
|
||||
|
@ -1737,6 +1739,7 @@
|
|||
{"name":"fd_rectangle_set_visualization_shader","order":18,"path":"scripts/fd_rectangle_set_visualization_shader/fd_rectangle_set_visualization_shader.yy",},
|
||||
{"name":"s_biterator_bg","order":2,"path":"sprites/s_biterator_bg/s_biterator_bg.yy",},
|
||||
{"name":"macMinimize","order":2,"path":"extensions/macMinimize/macMinimize.yy",},
|
||||
{"name":"s_node_image_stack","order":7,"path":"sprites/s_node_image_stack/s_node_image_stack.yy",},
|
||||
{"name":"s_node_ase_layer","order":14,"path":"sprites/s_node_ase_layer/s_node_ase_layer.yy",},
|
||||
{"name":"s_node_monitor_capture","order":38,"path":"sprites/s_node_monitor_capture/s_node_monitor_capture.yy",},
|
||||
{"name":"directory_functions","order":9,"path":"scripts/directory_functions/directory_functions.yy",},
|
||||
|
|
|
@ -264,6 +264,7 @@
|
|||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"random shape","folderPath":"folders/shader/generator/random shape.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"reaction diffusion","folderPath":"folders/shader/generator/reaction diffusion.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"region","folderPath":"folders/shader/generator/region.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"vector mapper","folderPath":"folders/shader/generator/vector mapper.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"mask","folderPath":"folders/shader/mask.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"misc","folderPath":"folders/shader/misc.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"find boundary","folderPath":"folders/shader/misc/find boundary.yy",},
|
||||
|
@ -296,7 +297,6 @@
|
|||
{"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":"vector mapper","folderPath":"folders/shader/generator/vector mapper.yy",},
|
||||
],
|
||||
"IncludedFiles": [
|
||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",},
|
||||
|
@ -617,7 +617,7 @@
|
|||
{"id":{"name":"s_node_gradient_data","path":"sprites/s_node_gradient_data/s_node_gradient_data.yy",},},
|
||||
{"id":{"name":"node_PCX_fn_var","path":"scripts/node_PCX_fn_var/node_PCX_fn_var.yy",},},
|
||||
{"id":{"name":"s_node_vfx_render","path":"sprites/s_node_vfx_render/s_node_vfx_render.yy",},},
|
||||
{"id":{"name":"node_stack","path":"scripts/node_stack/node_stack.yy",},},
|
||||
{"id":{"name":"node_image_stack","path":"scripts/node_image_stack/node_image_stack.yy",},},
|
||||
{"id":{"name":"sh_vector_diverge","path":"shaders/sh_vector_diverge/sh_vector_diverge.yy",},},
|
||||
{"id":{"name":"sh_cell_noise","path":"shaders/sh_cell_noise/sh_cell_noise.yy",},},
|
||||
{"id":{"name":"sh_draw_r32","path":"shaders/sh_draw_r32/sh_draw_r32.yy",},},
|
||||
|
@ -753,6 +753,7 @@
|
|||
{"id":{"name":"s_node_dithering","path":"sprites/s_node_dithering/s_node_dithering.yy",},},
|
||||
{"id":{"name":"node_3d_mesh_extrude","path":"scripts/node_3d_mesh_extrude/node_3d_mesh_extrude.yy",},},
|
||||
{"id":{"name":"sh_find_boundary_stretch_x","path":"shaders/sh_find_boundary_stretch_x/sh_find_boundary_stretch_x.yy",},},
|
||||
{"id":{"name":"s_node_image_grid","path":"sprites/s_node_image_grid/s_node_image_grid.yy",},},
|
||||
{"id":{"name":"s_node_boolean","path":"sprites/s_node_boolean/s_node_boolean.yy",},},
|
||||
{"id":{"name":"s_workshop_badge","path":"sprites/s_workshop_badge/s_workshop_badge.yy",},},
|
||||
{"id":{"name":"node_pb_fx_brick","path":"scripts/node_pb_fx_brick/node_pb_fx_brick.yy",},},
|
||||
|
@ -2014,6 +2015,7 @@
|
|||
{"id":{"name":"node_color_adjustment","path":"scripts/node_color_adjustment/node_color_adjustment.yy",},},
|
||||
{"id":{"name":"node_print","path":"scripts/node_print/node_print.yy",},},
|
||||
{"id":{"name":"s_node_strandSim_force","path":"sprites/s_node_strandSim_force/s_node_strandSim_force.yy",},},
|
||||
{"id":{"name":"node_image_grid","path":"scripts/node_image_grid/node_image_grid.yy",},},
|
||||
{"id":{"name":"s_node_array_reverse","path":"sprites/s_node_array_reverse/s_node_array_reverse.yy",},},
|
||||
{"id":{"name":"sh_ani_noise","path":"shaders/sh_ani_noise/sh_ani_noise.yy",},},
|
||||
{"id":{"name":"rectangle_collision","path":"scripts/rectangle_collision/rectangle_collision.yy",},},
|
||||
|
@ -2139,6 +2141,7 @@
|
|||
{"id":{"name":"s_biterator_bg","path":"sprites/s_biterator_bg/s_biterator_bg.yy",},},
|
||||
{"id":{"name":"addonPanel","path":"scripts/addonPanel/addonPanel.yy",},},
|
||||
{"id":{"name":"macMinimize","path":"extensions/macMinimize/macMinimize.yy",},},
|
||||
{"id":{"name":"s_node_image_stack","path":"sprites/s_node_image_stack/s_node_image_stack.yy",},},
|
||||
{"id":{"name":"s_node_ase_layer","path":"sprites/s_node_ase_layer/s_node_ase_layer.yy",},},
|
||||
{"id":{"name":"s_node_monitor_capture","path":"sprites/s_node_monitor_capture/s_node_monitor_capture.yy",},},
|
||||
{"id":{"name":"directory_functions","path":"scripts/directory_functions/directory_functions.yy",},},
|
||||
|
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
173
scripts/node_image_grid/node_image_grid.gml
Normal file
|
@ -0,0 +1,173 @@
|
|||
function Node_Image_Grid(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Image Grid";
|
||||
|
||||
inputs[| 0] = nodeValue("Main Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Horizontal", "Vertical" ])
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 1] = nodeValue("Column", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4)
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 2] = nodeValue("Spacing", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 3] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.padding)
|
||||
.rejectArray();
|
||||
|
||||
setIsDynamicInput(1);
|
||||
|
||||
static createNewInput = function() { #region
|
||||
var index = ds_list_size(inputs);
|
||||
inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1 )
|
||||
.setVisible(true, true);
|
||||
} if(!LOADING && !APPENDING) createNewInput(); #endregion
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, []);
|
||||
|
||||
temp_surface = [ noone, noone ];
|
||||
|
||||
attribute_surface_depth();
|
||||
|
||||
static refreshDynamicInput = function() { #region
|
||||
var _l = ds_list_create();
|
||||
for( var i = 0; i < ds_list_size(inputs); i++ ) {
|
||||
if(i < input_fix_len || inputs[| i].value_from)
|
||||
ds_list_add(_l, inputs[| i]);
|
||||
else
|
||||
delete inputs[| i];
|
||||
}
|
||||
|
||||
for( var i = 0; i < ds_list_size(_l); i++ )
|
||||
_l[| i].index = i;
|
||||
|
||||
ds_list_destroy(inputs);
|
||||
inputs = _l;
|
||||
|
||||
createNewInput();
|
||||
} #endregion
|
||||
|
||||
static onValueFromUpdate = function(index) { #region
|
||||
if(index < input_fix_len) return;
|
||||
if(LOADING || APPENDING) return;
|
||||
|
||||
refreshDynamicInput();
|
||||
} #endregion
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) { #region
|
||||
var _axis = getInputData(0);
|
||||
var _col = getInputData(1);
|
||||
var _spac = getInputData(2);
|
||||
var _padd = getInputData(3);
|
||||
|
||||
var ww = 0;
|
||||
var hh = 0;
|
||||
var surfs = [];
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
|
||||
var _surf = getInputData(i);
|
||||
if(!is_array(_surf)) _surf = [ _surf ];
|
||||
|
||||
array_append(surfs, _surf);
|
||||
}
|
||||
|
||||
var _coli = 0;
|
||||
|
||||
var _mainw = 0;
|
||||
var _subw = 0;
|
||||
|
||||
var _mains = 0;
|
||||
var _subs = 0;
|
||||
|
||||
for( var j = 0; j < array_length(surfs); j++ ) {
|
||||
var _s = surfs[j];
|
||||
if(!is_surface(_s)) continue;
|
||||
|
||||
var sw = surface_get_width_safe(_s);
|
||||
var sh = surface_get_height_safe(_s);
|
||||
|
||||
if(_axis == 0) { _mains += sw + _spac[0]; _subs = max(_subs, sh + _spac[1]); }
|
||||
else { _mains += sh + _spac[1]; _subs = max(_subs, sw + _spac[0]); }
|
||||
|
||||
_coli++;
|
||||
if(_coli >= _col) {
|
||||
_coli = 0;
|
||||
|
||||
_mainw = max(_mainw, _mains);
|
||||
_subw += _subs;
|
||||
|
||||
_mains = 0;
|
||||
_subs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
_mainw = max(_mainw, _mains);
|
||||
_subw += _subs;
|
||||
|
||||
if(_axis == 0) { ww = _mainw - _spac[0]; hh = _subw - _spac[1]; }
|
||||
else { hh = _mainw - _spac[1]; ww = _subw - _spac[0]; }
|
||||
|
||||
ww += _padd[PADDING.left] + _padd[PADDING.right];
|
||||
hh += _padd[PADDING.top] + _padd[PADDING.bottom];
|
||||
|
||||
var _outSurf = outputs[| 0].getValue();
|
||||
_outSurf = surface_verify(_outSurf, ww, hh, attrDepth());
|
||||
|
||||
temp_surface[0] = surface_verify(temp_surface[0], ww, hh, attrDepth());
|
||||
temp_surface[1] = surface_verify(temp_surface[1], ww, hh, attrDepth());
|
||||
|
||||
surface_clear(temp_surface[0]);
|
||||
surface_clear(temp_surface[1]);
|
||||
|
||||
var atlas = [];
|
||||
var ppind = 0;
|
||||
var sx = 0;
|
||||
var sy = 0;
|
||||
|
||||
var _mains = 0;
|
||||
var _subs = 0;
|
||||
var _coli = 0;
|
||||
|
||||
for( var j = 0; j < array_length(surfs); j++ ) {
|
||||
var _s = surfs[j];
|
||||
if(!is_surface(_s)) continue;
|
||||
|
||||
var sw = surface_get_width_safe(_s);
|
||||
var sh = surface_get_height_safe(_s);
|
||||
|
||||
array_push(atlas, new SurfaceAtlas(_surf[j], sx, sy));
|
||||
surface_set_shader(temp_surface[!ppind], sh_draw_surface);
|
||||
shader_set_f("dimension", ww, hh);
|
||||
|
||||
shader_set_surface("fore", _surf[j]);
|
||||
shader_set_f("fdimension", sw, sh);
|
||||
shader_set_f("position", sx + _padd[PADDING.left], sy + _padd[PADDING.top]);
|
||||
|
||||
draw_surface(temp_surface[ppind], 0, 0);
|
||||
surface_reset_shader();
|
||||
ppind = !ppind;
|
||||
|
||||
if(_axis == 0) { sx += sw + _spac[0]; _subs = max(_subs, sh); }
|
||||
else { sy += sh + _spac[1]; _subs = max(_subs, sw); }
|
||||
|
||||
_coli++;
|
||||
if(_coli >= _col) {
|
||||
_coli = 0;
|
||||
|
||||
if(_axis == 0) { sy += _subs + _spac[1]; sx = 0; }
|
||||
else { sx += _subs + _spac[0]; sy = 0; }
|
||||
}
|
||||
}
|
||||
|
||||
surface_set_shader(_outSurf, noone);
|
||||
draw_surface(temp_surface[ppind], 0, 0);
|
||||
surface_reset_shader();
|
||||
|
||||
outputs[| 0].setValue(_outSurf);
|
||||
outputs[| 1].setValue(atlas);
|
||||
} #endregion
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_stack",
|
||||
"name": "node_image_grid",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
|
@ -12,6 +12,10 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
inputs[| 2] = nodeValue("Spacing", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 3] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.padding)
|
||||
.rejectArray();
|
||||
|
||||
setIsDynamicInput(1);
|
||||
|
||||
static createNewInput = function() { #region
|
||||
|
@ -65,6 +69,7 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
var _axis = getInputData(0);
|
||||
var _alig = getInputData(1);
|
||||
var _spac = getInputData(2);
|
||||
var _padd = getInputData(3);
|
||||
|
||||
var ww = 0;
|
||||
var hh = 0;
|
||||
|
@ -79,11 +84,11 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
var sh = surface_get_height_safe(_surf[j]);
|
||||
|
||||
if(_axis == 0) {
|
||||
ww += sw + (i > input_fix_len && j == array_length(_surf) - 1) * _spac;
|
||||
hh = max(hh, sh);
|
||||
ww += sw + _spac;
|
||||
hh = max(hh, sh + _spac);
|
||||
} else if(_axis == 1) {
|
||||
ww = max(ww, sw);
|
||||
hh += sh + (i > input_fix_len && j == array_length(_surf) - 1) * _spac;
|
||||
ww = max(ww, sw + _spac);
|
||||
hh += sh + _spac;
|
||||
} else if(_axis == 2) {
|
||||
ww = max(ww, sw);
|
||||
hh = max(hh, sh);
|
||||
|
@ -91,14 +96,20 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
}
|
||||
}
|
||||
|
||||
ww -= _spac;
|
||||
hh -= _spac;
|
||||
|
||||
var ow = ww + _padd[PADDING.left] + _padd[PADDING.right];
|
||||
var oh = hh + _padd[PADDING.top] + _padd[PADDING.bottom];
|
||||
|
||||
var _outSurf = outputs[| 0].getValue();
|
||||
_outSurf = surface_verify(_outSurf, ww, hh, attrDepth());
|
||||
_outSurf = surface_verify(_outSurf, ow, oh, attrDepth());
|
||||
|
||||
temp_surface[0] = surface_verify(temp_surface[0], ww, hh, attrDepth());
|
||||
temp_surface[1] = surface_verify(temp_surface[1], ww, hh, attrDepth());
|
||||
temp_surface[0] = surface_verify(temp_surface[0], ow, oh, attrDepth());
|
||||
temp_surface[1] = surface_verify(temp_surface[1], ow, oh, attrDepth());
|
||||
|
||||
surface_set_target(temp_surface[0]); DRAW_CLEAR surface_reset_target();
|
||||
surface_set_target(temp_surface[1]); DRAW_CLEAR surface_reset_target();
|
||||
surface_clear(temp_surface[0]);
|
||||
surface_clear(temp_surface[1]);
|
||||
|
||||
var atlas = [];
|
||||
var ppind = 0;
|
||||
|
@ -134,11 +145,11 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
surface_set_shader(temp_surface[!ppind], sh_draw_surface);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE
|
||||
shader_set_f("dimension", ww, hh);
|
||||
shader_set_f("dimension", ow, oh);
|
||||
|
||||
shader_set_surface("fore", _surf[j]);
|
||||
shader_set_f("fdimension", sw, sh);
|
||||
shader_set_f("position", sx, sy);
|
||||
shader_set_f("position", sx + _padd[PADDING.left], sy + _padd[PADDING.top]);
|
||||
|
||||
draw_surface(temp_surface[ppind], 0, 0);
|
||||
|
||||
|
@ -147,10 +158,8 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
|
||||
ppind = !ppind;
|
||||
|
||||
if(_axis == 0)
|
||||
sx += sw + _spac;
|
||||
else if(_axis == 1)
|
||||
sy += sh + _spac;
|
||||
if(_axis == 0) sx += sw + _spac;
|
||||
else if(_axis == 1) sy += sh + _spac;
|
||||
}
|
||||
}
|
||||
|
11
scripts/node_image_stack/node_image_stack.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_image_stack",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "compose",
|
||||
"path": "folders/nodes/data/compose.yy",
|
||||
},
|
||||
}
|
|
@ -687,7 +687,8 @@ function __initNodes() {
|
|||
ds_list_add(compose, "Composes");
|
||||
addNodeObject(compose, "Blend", s_node_blend, "Node_Blend", [1, Node_Blend],, "Combine 2 images using different blend modes.");
|
||||
addNodeObject(compose, "Composite", s_node_compose, "Node_Composite", [1, Node_Composite],, "Combine multiple images with custom transformation.");
|
||||
addNodeObject(compose, "Stack", s_node_draw_stack, "Node_Stack", [1, Node_Stack],, "Place image next to each other linearly, or on top of each other.").setVersion(1070);
|
||||
addNodeObject(compose, "Stack", s_node_image_stack, "Node_Stack", [1, Node_Stack],, "Place image next to each other linearly, or on top of each other.").setVersion(1070);
|
||||
addNodeObject(compose, "Image Grid", s_node_image_grid, "Node_Image_Grid", [1, Node_Image_Grid],, "Place image next to each other in grid pattern.").setVersion(11640);
|
||||
addNodeObject(compose, "Camera", s_node_camera, "Node_Camera", [1, Node_Camera],, "Create camera that crop image to fix dimension with control of position, zoom. Also can be use to create parallax effect.");
|
||||
addNodeObject(compose, "Render Spritesheet", s_node_sprite_sheet, "Node_Render_Sprite_Sheet", [1, Node_Render_Sprite_Sheet],, "Create spritesheet from image array or animation.");
|
||||
addNodeObject(compose, "Pack Sprites", s_node_pack_sprite, "Node_Pack_Sprites", [1, Node_Pack_Sprites],, "Combine array of images with different dimension using different algorithms.").setVersion(1140);
|
||||
|
|
|
@ -59,27 +59,13 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
["Surfaces", false], 0, 1, 2,
|
||||
["Sprite", false], 3,
|
||||
["Packing", false], 4, 5, 6, 9, 7,
|
||||
["Rendering", false], 10,
|
||||
//["Rendering", false], 10,
|
||||
["Custom Range", true, 11], 8,
|
||||
]
|
||||
|
||||
attribute_surface_depth();
|
||||
|
||||
static onInspector1Update = function(updateAll = true) { #region
|
||||
var key = ds_map_find_first(PROJECT.nodeMap);
|
||||
|
||||
repeat(ds_map_size(PROJECT.nodeMap)) {
|
||||
var node = PROJECT.nodeMap[? key];
|
||||
key = ds_map_find_next(PROJECT.nodeMap, key);
|
||||
|
||||
if(!node.active) continue;
|
||||
if(instanceof(node) != "Node_Render_Sprite_Sheet") continue;
|
||||
|
||||
initSurface();
|
||||
}
|
||||
|
||||
PROJECT.animator.render();
|
||||
} #endregion
|
||||
static onInspector1Update = function(updateAll = true) { initSurface(true); PROJECT.animator.render(); }
|
||||
|
||||
static step = function() { #region
|
||||
var grup = getInputData(1);
|
||||
|
@ -103,21 +89,21 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
} #endregion
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) { #region
|
||||
if(IS_FIRST_FRAME) initSurface();
|
||||
|
||||
var grup = getInputData(1);
|
||||
|
||||
if(grup == SPRITE_ANIM_GROUP.animation)
|
||||
animationRender();
|
||||
else
|
||||
arrayRender();
|
||||
if(grup == SPRITE_ANIM_GROUP.animation) animationRender();
|
||||
else arrayRender();
|
||||
} #endregion
|
||||
|
||||
static initSurface = function() { #region
|
||||
static initSurface = function(clear = false) { #region
|
||||
for(var i = 0; i < TOTAL_FRAMES; i++) anim_drawn[i] = false;
|
||||
|
||||
var grup = getInputData(1);
|
||||
|
||||
if(grup == SPRITE_ANIM_GROUP.animation)
|
||||
animationInit();
|
||||
animationInit(clear);
|
||||
else
|
||||
arrayRender();
|
||||
} #endregion
|
||||
|
@ -131,7 +117,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
var padd = getInputData(7);
|
||||
var rang = getInputData(8);
|
||||
var spc2 = getInputData(9);
|
||||
var ovlp = getInputData(10);
|
||||
//var ovlp = getInputData(10);
|
||||
|
||||
var cDep = attrDepth();
|
||||
|
||||
|
@ -212,8 +198,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
surface_set_target(_surf);
|
||||
DRAW_CLEAR
|
||||
|
||||
if(ovlp) BLEND_ALPHA_MULP
|
||||
else BLEND_OVERRIDE
|
||||
BLEND_OVERRIDE
|
||||
|
||||
switch(pack) {
|
||||
case SPRITE_STACK.horizontal :
|
||||
|
@ -296,7 +281,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
outputs[| 1].setValue(_atl);
|
||||
} #endregion
|
||||
|
||||
static animationInit = function() { #region
|
||||
static animationInit = function(clear = false) { #region
|
||||
var inpt = getInputData(0);
|
||||
var skip = getInputData(2);
|
||||
var pack = getInputData(3);
|
||||
|
@ -306,9 +291,10 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
var padd = getInputData(7);
|
||||
var rang = getInputData(8);
|
||||
var spc2 = getInputData(9);
|
||||
var ovlp = getInputData(10);
|
||||
//var ovlp = getInputData(10);
|
||||
var user = getInputData(11);
|
||||
|
||||
var _out = outputs[| 0].getValue();
|
||||
var _atl = outputs[| 1].getValue();
|
||||
var cDep = attrDepth();
|
||||
|
||||
|
@ -318,6 +304,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
if(arr && array_length(inpt) == 0) return;
|
||||
if(!arr) inpt = [ inpt ];
|
||||
|
||||
if(!is_array(_out)) _out = [ _out ];
|
||||
|
||||
#region frame
|
||||
var _st = FIRST_FRAME;
|
||||
var _ed = LAST_FRAME + 1;
|
||||
|
@ -335,7 +323,6 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
#endregion
|
||||
|
||||
var skip = getInputData(2);
|
||||
var _surf = [];
|
||||
|
||||
var ww = 1, hh = 1;
|
||||
|
||||
|
@ -368,22 +355,19 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
ww += padd[0] + padd[2];
|
||||
hh += padd[1] + padd[3];
|
||||
|
||||
_surf[i] = surface_create_valid(ww, hh, cDep);
|
||||
surface_set_target(_surf[i]);
|
||||
DRAW_CLEAR
|
||||
surface_reset_target();
|
||||
_out[i] = surface_verify(array_safe_get(_out, i), ww, hh, cDep);
|
||||
|
||||
if(clear) surface_clear(_out[i]);
|
||||
}
|
||||
|
||||
if(!arr) _surf = array_safe_get(_surf, 0);
|
||||
outputs[| 0].setValue(_surf);
|
||||
if(!arr) _out = array_safe_get(_out, 0);
|
||||
outputs[| 0].setValue(_out);
|
||||
outputs[| 1].setValue(_atl);
|
||||
|
||||
printIf(log, $"Surface generated [{ww}, {hh}]");
|
||||
} #endregion
|
||||
|
||||
static animationRender = function() { #region
|
||||
if(!IS_RENDERING) return;
|
||||
|
||||
var inpt = getInputData(0);
|
||||
var skip = getInputData(2);
|
||||
var pack = getInputData(3);
|
||||
|
@ -393,7 +377,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
var padd = getInputData(7);
|
||||
var rang = getInputData(8);
|
||||
var spc2 = getInputData(9);
|
||||
var ovlp = getInputData(10);
|
||||
//var ovlp = getInputData(10);
|
||||
var user = getInputData(11);
|
||||
|
||||
var _atl = outputs[| 1].getValue();
|
||||
|
@ -475,8 +459,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
var _sy = 0;
|
||||
|
||||
surface_set_target(oo);
|
||||
if(ovlp) BLEND_ALPHA_MULP
|
||||
else BLEND_OVERRIDE
|
||||
BLEND_OVERRIDE
|
||||
|
||||
switch(pack) {
|
||||
case SPRITE_STACK.horizontal :
|
||||
|
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
74
sprites/s_node_image_grid/s_node_image_grid.yy
Normal file
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"resourceType": "GMSprite",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "s_node_image_grid",
|
||||
"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":"5d245cec-4ffc-405b-b078-00df32904d77",},
|
||||
],
|
||||
"gridX": 0,
|
||||
"gridY": 0,
|
||||
"height": 64,
|
||||
"HTile": false,
|
||||
"layers": [
|
||||
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"d6ad4b5f-e4a7-45b1-982d-6b0f161b8dce","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
|
||||
],
|
||||
"nineSlice": null,
|
||||
"origin": 4,
|
||||
"parent": {
|
||||
"name": "render",
|
||||
"path": "folders/nodes/icons/render.yy",
|
||||
},
|
||||
"preMultiplyAlpha": false,
|
||||
"sequence": {
|
||||
"resourceType": "GMSequence",
|
||||
"resourceVersion": "1.4",
|
||||
"name": "s_node_image_grid",
|
||||
"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":"5d245cec-4ffc-405b-b078-00df32904d77","path":"sprites/s_node_image_grid/s_node_image_grid.yy",},},},"Disabled":false,"id":"22750154-bd29-4e46-a9c8-c761bb0ff3a9","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,
|
||||
}
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
74
sprites/s_node_image_stack/s_node_image_stack.yy
Normal file
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"resourceType": "GMSprite",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "s_node_image_stack",
|
||||
"bbox_bottom": 63,
|
||||
"bbox_left": 14,
|
||||
"bbox_right": 49,
|
||||
"bbox_top": 0,
|
||||
"bboxMode": 0,
|
||||
"collisionKind": 1,
|
||||
"collisionTolerance": 0,
|
||||
"DynamicTexturePage": false,
|
||||
"edgeFiltering": false,
|
||||
"For3D": false,
|
||||
"frames": [
|
||||
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"e1fc0f3a-9647-4867-bf1d-1e188e1b2386",},
|
||||
],
|
||||
"gridX": 0,
|
||||
"gridY": 0,
|
||||
"height": 64,
|
||||
"HTile": false,
|
||||
"layers": [
|
||||
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"7935b134-5342-41f1-bdfa-eca76b45e581","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
|
||||
],
|
||||
"nineSlice": null,
|
||||
"origin": 4,
|
||||
"parent": {
|
||||
"name": "render",
|
||||
"path": "folders/nodes/icons/render.yy",
|
||||
},
|
||||
"preMultiplyAlpha": false,
|
||||
"sequence": {
|
||||
"resourceType": "GMSequence",
|
||||
"resourceVersion": "1.4",
|
||||
"name": "s_node_image_stack",
|
||||
"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":"e1fc0f3a-9647-4867-bf1d-1e188e1b2386","path":"sprites/s_node_image_stack/s_node_image_stack.yy",},},},"Disabled":false,"id":"346ec7b1-ad1c-47e7-8967-94d2677d991b","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,
|
||||
}
|