curveBox, rotatorRange fix

This commit is contained in:
Tanasart 2023-09-19 12:53:24 +02:00
parent c9b4e2d18b
commit 67844f8d6b
24 changed files with 221 additions and 32 deletions

View file

@ -603,6 +603,7 @@
{"name":"node_scatter_points","order":6,"path":"scripts/node_scatter_points/node_scatter_points.yy",},
{"name":"pack_bottom_left","order":2,"path":"scripts/pack_bottom_left/pack_bottom_left.yy",},
{"name":"o_dialog_lua_reference","order":5,"path":"objects/o_dialog_lua_reference/o_dialog_lua_reference.yy",},
{"name":"__node_custom","order":14,"path":"scripts/__node_custom/__node_custom.yy",},
{"name":"node_strand_gravity","order":4,"path":"scripts/node_strand_gravity/node_strand_gravity.yy",},
{"name":"load_palette","order":3,"path":"scripts/load_palette/load_palette.yy",},
{"name":"luaHighlight","order":1,"path":"scripts/luaHighlight/luaHighlight.yy",},

View file

@ -284,6 +284,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"UI.json","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"words.json","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"nodes.json","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Custom",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"default.zip","CopyToMask":-1,"filePath":"datafiles/data/themes",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"FiraCode-Medium.ttf","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"fonts.json","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",},
@ -1190,6 +1191,7 @@
{"id":{"name":"s_node_surface_to_buffer","path":"sprites/s_node_surface_to_buffer/s_node_surface_to_buffer.yy",},},
{"id":{"name":"node_PCX_fn_math","path":"scripts/node_PCX_fn_math/node_PCX_fn_math.yy",},},
{"id":{"name":"o_dialog_lua_reference","path":"objects/o_dialog_lua_reference/o_dialog_lua_reference.yy",},},
{"id":{"name":"__node_custom","path":"scripts/__node_custom/__node_custom.yy",},},
{"id":{"name":"node_surface_data","path":"scripts/node_surface_data/node_surface_data.yy",},},
{"id":{"name":"node_strand_gravity","path":"scripts/node_strand_gravity/node_strand_gravity.yy",},},
{"id":{"name":"load_palette","path":"scripts/load_palette/load_palette.yy",},},

View file

View file

@ -0,0 +1,141 @@
function Node_create_Custom(_x, _y, _group = noone, _param = {}) {
if(!struct_has(_param, "path")) return noone;
var path = _param.path;
var node = new Node_Custom(_x, _y, _group);
node.setPath(path);
return node;
}
function Node_create_Custom_path(_x, _y, path) {
if(!file_exists(path)) return noone;
var node = new Node_Custom(_x, _y, PANEL_GRAPH.getCurrentContext());
node.setPath(path);
return node;
}
function Node_Custom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Custom";
path = "";
inputs[| 0] = nodeValue("Base Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone );
static setPath = function(path) {
self.path = path;
}
static createNewInput = function() {
var index = ds_list_size(inputs);
inputs[| index] = nodeValue("Uniform", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 )
.setVisible(true, true);
}
static onValueUpdate = function(index) { #region
var _refresh = index == 0 || index == 1 ||
(index >= input_fix_len && (index - input_fix_len) % data_length != 2);
if(_refresh) {
refreshShader();
refreshDynamicInput();
}
} #endregion
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
var _surf = _data[2];
if(!is_surface(_surf)) return noone;
if(!d3d11_shader_exists(shader.vs)) return noone;
if(!d3d11_shader_exists(shader.fs)) return noone;
_output = surface_verify(_output, surface_get_width_safe(_surf), surface_get_height_safe(_surf));
surface_set_target(_output);
DRAW_CLEAR
d3d11_shader_override_vs(shader.vs);
d3d11_shader_override_ps(shader.fs);
var uTypes = array_create(8, 0);
var sampler_slot = 1;
d3d11_cbuffer_begin();
var _buffer = buffer_create(1, buffer_grow, 1);
var _cbSize = 0;
for( var i = input_fix_len, n = array_length(_data); i < n; i += data_length ) {
var _arg_name = _data[i + 0];
var _arg_type = _data[i + 1];
var _arg_valu = _data[i + 2];
if(_arg_name == "") continue;
var _uni = shader_get_uniform(shader.fs, _arg_name);
switch(_arg_type) {
case 1 :
d3d11_cbuffer_add_int(1);
_cbSize++;
buffer_write(_buffer, buffer_s32, _arg_valu);
break;
case 0 :
d3d11_cbuffer_add_float(1);
_cbSize++;
buffer_write(_buffer, buffer_f32, _arg_valu);
break;
case 2 :
case 3 :
case 4 :
case 5 :
case 6 :
if(is_array(_arg_valu)) {
d3d11_cbuffer_add_float(array_length(_arg_valu));
_cbSize += array_length(_arg_valu);
for( var j = 0, m = array_length(_arg_valu); j < m; j++ )
buffer_write(_buffer, buffer_f32, _arg_valu[j]);
}
break;
case 8 :
var _clr = colToVec4(_arg_valu);
d3d11_cbuffer_add_float(4);
_cbSize += 4;
for( var j = 0, m = 4; j < m; j++ )
buffer_write(_buffer, buffer_f32, _clr[i]);
break;
case 7 :
if(is_surface(_arg_valu))
d3d11_texture_set_stage_ps(sampler_slot, surface_get_texture(_arg_valu));
sampler_slot++;
break;
}
}
d3d11_cbuffer_add_float(4 - _cbSize % 4);
var cbuff = d3d11_cbuffer_end();
d3d11_cbuffer_update(cbuff, _buffer);
buffer_delete(_buffer);
d3d11_shader_set_cbuffer_ps(10, cbuff);
matrix_set(matrix_world, matrix_build(0, 0, 0, 0, 0, 0,
surface_get_width_safe(_surf), surface_get_height_safe(_surf), 1));
vertex_submit(global.HLSL_VB, pr_trianglestrip, surface_get_texture(_surf));
matrix_set(matrix_world, matrix_build_identity());
d3d11_shader_override_vs(-1);
d3d11_shader_override_ps(-1);
surface_reset_target();
return _output;
} #endregion
static postConnect = function() {
refreshShader();
refreshDynamicInput();
}
}

View file

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

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "generator",
"path": "folders/nodes/data/generator.yy",
},
"resourceVersion": "1.0",
"name": "node_checkerboard",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "generator",
"path": "folders/nodes/data/generator.yy",
},
"resourceVersion": "1.0",
"name": "node_stripe",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -4,8 +4,10 @@ function angle_random_eval(range, seed = undefined) {
if(seed != undefined) random_set_seed(seed);
if(array_empty(range)) return 0;
if(array_length(range) < 2)
return range
return range[0]
else if(array_length(range) == 2)
return irandom_range(range[0], range[1]);
else if(array_length(range) > 2) {
@ -17,5 +19,5 @@ function angle_random_eval(range, seed = undefined) {
}
}
return range;
return array_safe_get(range, 0);
}

View file

@ -22,12 +22,10 @@ function curveBox(_onModify) : widget() constructor {
w = _w;
h = _h;
if(!is_array(_data) || array_length(_data) == 0)
return 0;
var _is_array = is_array(_data[0]);
var points = array_length(_data) / 6;
if(!is_array(_data) || array_length(_data) == 0) return 0;
if(is_array(_data[0])) return 0;
if(!_is_array) return 0;
var points = array_length(_data) / 6;
curve_surface = surface_verify(curve_surface, _w, _h);
@ -198,7 +196,7 @@ function curveBox(_onModify) : widget() constructor {
}
#endregion
if(!_is_array && hover) { #region
if(hover) { #region
if(point_in_rectangle(_m[0], _m[1], _x + _w - ui(6 + 24 * 2 + 4), _y + _h - ui(6 + 24), _x + _w + ui(5), _y + _h + ui(5))) {
} else if(point_in_rectangle(msx, msy, -ui(5), -ui(5), _w + ui(5), _h + ui(5))) {
if(mouse_press(mb_left, active)) {

View file

@ -38,7 +38,7 @@ function draw_surface_blend(background, foreground, blend = 0, alpha = 1, _pre_a
shader_set_i("tile_type", tile);
}
BLEND_ALPHA
BLEND_OVERRIDE
draw_surface_stretched_safe(background, 0, 0, surf_w, surf_h);
BLEND_NORMAL
shader_reset();

View file

@ -101,10 +101,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
VERSION = 11520;
VERSION = 11521;
SAVE_VERSION = 11500;
VERSION_STRING = "1.15.2.0";
BUILD_NUMBER = 11520;
VERSION_STRING = "1.15.2.1";
BUILD_NUMBER = 11521;
globalvar APPEND_MAP;
APPEND_MAP = ds_map_create();

View file

@ -100,7 +100,7 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
surface_set_target(temp_surface[0]);
DRAW_CLEAR
BLEND_ALPHA
BLEND_OVERRIDE
draw_surface_safe(_fore, sx, sy);
BLEND_NORMAL
surface_reset_target();

View file

@ -683,7 +683,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
//var vct = ds_list_create();
//addNodeCatagory("VCT", vct);
// addNodeObject(vct, "Biterator", s_node_print, "Node_Biterator", [1, Node_Biterator]);
//////////////////////////////////////////////////////////////// PIXEL BUILDER ////////////////////////////////////////////////////////////////
var pb_draw = ds_list_create(); #region

View file

@ -12,7 +12,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
inputs[| 3] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1, 1 ] )
.setDisplay(VALUE_DISPLAY.vector_range);
inputs[| 4] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0, 0 ])
inputs[| 4] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0, 0 ] )
.setDisplay(VALUE_DISPLAY.rotation_random);
inputs[| 5] = nodeValue("Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ DEF_SURF_W / 2, DEF_SURF_H / 2, DEF_SURF_W / 2, DEF_SURF_H / 2, AREA_SHAPE.rectangle ])

View file

@ -39,9 +39,7 @@ function Node_Time_Remap(_x, _y, _group = noone) : Node(_x, _y, _group) construc
var ste = 1 / _life;
surface_set_target(_surf);
DRAW_CLEAR
shader_set(shader);
surface_set_shader(_surf, shader);
texture_set_stage(uniform_map, surface_get_texture(_map));
for(var i = 0; i <= _life; i++) {
@ -59,8 +57,7 @@ function Node_Time_Remap(_x, _y, _group = noone) : Node(_x, _y, _group) construc
draw_surface_safe(s, 0, 0);
}
shader_reset();
surface_reset_target();
surface_reset_shader();
cacheCurrentFrame(_inSurf);
} #endregion

View file

@ -246,6 +246,7 @@ function typeArray(_type) { #region
case VALUE_DISPLAY.range :
case VALUE_DISPLAY.vector_range :
case VALUE_DISPLAY.rotation_range :
case VALUE_DISPLAY.rotation_random :
case VALUE_DISPLAY.slider_range :
case VALUE_DISPLAY.vector :

View file

@ -34,7 +34,9 @@ void main() {
_col1.a *= opacity * sampleMask();
_col1.rgb *= _col1.a;
float al = _col1.a + _col0.a * (1. - _col1.a);
vec4 res = _col0 + _col1;
if(preserveAlpha == 1) res.a = _col0.a;
res.rgb /= al;
res.a = preserveAlpha == 1? _col0.a : res.a;
gl_FragColor = res;
}

View file

@ -49,8 +49,10 @@ void main() {
vec3 _hsv1 = rgb2hsv(_col1.rgb);
_hsv1.yz = _hsv0.yz;
float al = _col1.a + _col0.a * (1. - _col1.a);
vec4 res = vec4(mix(_col0.rgb, hsv2rgb(_hsv1), _col1.a * opacity * sampleMask()), _col0.a);
if(preserveAlpha == 1) res.a = _col0.a;
res.rgb /= al;
res.a = preserveAlpha == 1? _col0.a : res.a;
gl_FragColor = res;
}

View file

@ -102,8 +102,10 @@ void main() {
_hsl0.z = mix(_hsl0.z, _hsl1.z, _col1.a * opacity * sampleMask());
float al = _col1.a + _col0.a * (1. - _col1.a);
vec4 res = vec4(hsl2rgb(_hsl0), _col0.a);
if(preserveAlpha == 1) res.a = _col0.a;
res.rgb /= al;
res.a = preserveAlpha == 1? _col0.a : res.a;
gl_FragColor = res;
}

View file

@ -35,9 +35,10 @@ void main() {
vec4 blend = (_col0 * (1. - opacity)) + (_col0 * _col1 * opacity);
float po = preserveAlpha == 1? _col1.a : opacity;
float al = _col1.a + _col0.a * (1. - _col1.a);
vec4 res = mix(_col0, blend, po);
if(preserveAlpha == 1) res.a = _col0.a;
res.rgb /= al;
res.a = preserveAlpha == 1? _col0.a : res.a;
gl_FragColor = res;
}

View file

@ -36,9 +36,10 @@ void main() {
vec4 blend = lum > 0.5? (1. - (1. - 2. * (_col1 - 0.5)) * (1. - _col0)) : ((2. * _col1) * _col0);
float po = preserveAlpha == 1? _col1.a : opacity;
float al = _col1.a + _col0.a * (1. - _col1.a);
vec4 res = mix(_col0, blend, po);
if(preserveAlpha == 1) res.a = _col0.a;
res.rgb /= al;
res.a = preserveAlpha == 1? _col0.a : res.a;
gl_FragColor = res;
}

View file

@ -50,8 +50,10 @@ void main() {
_hsv0.y = mix(_hsv0.y, _hsv1.y, _col1.a * opacity * sampleMask());
float al = _col1.a + _col0.a * (1. - _col1.a);
vec4 res = vec4(hsv2rgb(_hsv0), _col0.a);
if(preserveAlpha == 1) res.a = _col0.a;
res.rgb /= al;
res.a = preserveAlpha == 1? _col0.a : res.a;
gl_FragColor = res;
}

View file

@ -39,9 +39,10 @@ void main() {
vec4 blend = vec4(1.) - (vec4(1.) - _col0) * (vec4(1.) - _col1);
float po = preserveAlpha == 1? _col1.a : opacity;
float al = _col1.a + _col0.a * (1. - _col1.a);
vec4 res = mix(_col0, blend, po);
if(preserveAlpha == 1) res.a = _col0.a;
res.rgb /= al;
res.a = preserveAlpha == 1? _col0.a : res.a;
gl_FragColor = res;
}

View file

@ -37,9 +37,10 @@ void main() {
vec4 blend = _col0 - _col1;
float po = preserveAlpha == 1? _col1.a : opacity;
float al = _col1.a + _col0.a * (1. - _col1.a);
vec4 res = mix(_col0, blend, po);
if(preserveAlpha == 1) res.a = _col0.a;
res.rgb /= al;
res.a = preserveAlpha == 1? _col0.a : res.a;
gl_FragColor = res;
}