Gradient, palette interpolation

This commit is contained in:
Tanasart 2023-07-11 14:18:23 +02:00
parent c81ba8c88d
commit 920c6dc1a7
34 changed files with 1639 additions and 79 deletions

View file

@ -561,6 +561,12 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"0 introduction.pxc","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"1 image import.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"1 image import.pxc","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"10 RigidSim.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"11 Fluid sim.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"12 Strand sim.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"13 Expression.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"14 Audio.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"15 Optimization.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"2 animation.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"2 animation.pxc","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"3 Group and collection.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
@ -569,12 +575,20 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"4 Looping operation.pxc","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"5 Particle and effectors.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"5 Particle and effectors.pxc","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"6 Camera.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"6 Camera.pxc","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"7 Path.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"8 Batch processing.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"9 Armature.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"arrowRight.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"card_back.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"card_clubs_02.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"card_clubs_03.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"card_clubs_04.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"card_clubs_05.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"back-buildings.png","CopyToMask":-1,"filePath":"datafiles/Getting started/cyberpunk street",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"far-buildings.png","CopyToMask":-1,"filePath":"datafiles/Getting started/cyberpunk street",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"foreground.png","CopyToMask":-1,"filePath":"datafiles/Getting started/cyberpunk street",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"dice_1.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"dice_2.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"dice_3.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

View file

@ -292,6 +292,15 @@ event_inherited();
} else if(ADD_NODE_PAGE == NODE_PAGE_DEFAULT) {
_list = ds_list_create();
if(node_called != noone) {
var sug = ds_map_try_get(global.VALUE_SUGGESTION, node_called.type, []);
if(array_length(sug)) {
ds_list_add(_list, "Related");
for( var i = 0; i < array_length(sug); i++ )
ds_list_add(_list, ALL_NODES[? sug[i]]);
}
}
ds_list_add(_list, "Favourites");
for( var i = 0; i < array_length(global.FAV_NODES); i++ ) {
var _nodeIndex = global.FAV_NODES[i];

View file

@ -167,7 +167,7 @@ event_inherited();
var sw = sprite_get_width(spr);
var sh = sprite_get_height(spr);
var s = min(gw / sw, gh / sh);
var s = 1;
var ox = (sprite_get_xoffset(spr) - sw / 2) * s / 2;
var oy = (sprite_get_yoffset(spr) - sh / 2) * s / 2;

View file

@ -62,6 +62,17 @@ function array_push_create(arr, val) {
return arr;
}
function array_get_decimal(arr, index, color = false) {
if(frac(index) == 0) return array_safe_get(arr, index);
var v0 = array_safe_get(arr, floor(index));
var v1 = array_safe_get(arr, floor(index) + 1);
return color?
merge_color(v0, v1, frac(index)) :
lerp(v0, v1, frac(index));
}
function array_exists(arr, val) {
for( var i = 0; i < array_length(arr); i++ ) {
if(isEqual(arr[i], val)) return true;

View file

@ -11,7 +11,7 @@ function buttonGradient(_onApply, dialog = noone) : widget() constructor {
static trigger = function() {
var dialog = dialogCall(o_dialog_gradient, WIN_W / 2, WIN_H / 2);
dialog.setDefault(current_gradient);
dialog.setDefault(current_gradient.clone());
dialog.onApply = apply;
dialog.interactable = interactable;

View file

@ -69,7 +69,7 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
VERSION = 1147;
SAVE_VERSION = 1440;
SAVE_VERSION = 1447;
VERSION_STRING = "1.14.6n3";
BUILD_NUMBER = 114600;

View file

@ -10,7 +10,7 @@ function gradientKey(time, value) constructor {
static clone = function() { return new gradientKey(time, value); }
static serialize = function() { return self; }
static serialize = function() { return {time, value}; }
}
function gradientObject(color = c_black) constructor {
@ -126,8 +126,46 @@ function gradientObject(color = c_black) constructor {
return [ _grad_color, _grad_time ];
}
static lerpTo = function(target, amount) {
var grad = new gradientObject();
grad.keys = [];
grad.type = type;
var key_count = ceil(lerp(array_length(keys), array_length(target.keys), amount));
for( var i = 0; i < key_count; i++ ) {
var rat = i / (key_count - 1);
var kf = keys[rat * (array_length(keys) - 1)];
var kt = target.keys[rat * (array_length(target.keys) - 1)];
var time = lerp(kf.time, kt.time, amount);
var value = merge_color(eval(time), target.eval(time), amount);
grad.keys[i] = new gradientKey(time, value);
}
return grad;
}
static clone = function() {
var g = new gradientObject();
g.keys = [];
g.type = type;
for( var i = 0; i < array_length(keys); i++ )
g.keys[i] = keys[i].clone();
return g;
}
static serialize = function() {
return json_stringify(self, false);
var s = {type};
s.keys = [];
for( var i = 0; i < array_length(keys); i++ )
s.keys[i] = keys[i].serialize();
return json_stringify(s, false);
}
static deserialize = function(str) {

View file

@ -14,44 +14,47 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
uni_fix_bg = shader_get_uniform(shader, "fixBG");
inputs[| 0] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 1] = nodeValue("Focus area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ])
inputs[| 1] = nodeValue("Focus area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 16, 16, AREA_SHAPE.rectangle ])
.setDisplay(VALUE_DISPLAY.area, function() { return getDimension(0); });
inputs[| 2] = nodeValue("Zoom", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, [ 0.01, 4, 0.01 ]);
inputs[| 3] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.")
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]);
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Repeat" ]);
inputs[| 4] = nodeValue("Fix background", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [
["Output", true], 0, 4,
["Camera", false], 1, 2,
["Elements", true],
["Background", true], 0, 4, 3,
["Camera", false], 1, 2,
["Elements", true],
];
attribute_surface_depth();
attribute_oversample();
input_display_len = array_length(input_display_list);
input_fix_len = ds_list_size(inputs);
data_length = 2;
input_fix_len = ds_list_size(inputs);
data_length = 3;
temp_surface = [ noone, noone ];
function createNewInput() {
var index = ds_list_size(inputs);
var _s = floor((index - input_fix_len) / data_length);
inputs[| index + 0] = nodeValue("Element " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| index + 0] = nodeValue($"Element {_s}", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| index + 1] = nodeValue("Parallax " + string(_s), self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ] )
inputs[| index + 1] = nodeValue($"Parallax {_s}", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ] )
.setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); });
array_push(input_display_list, index + 0);
array_push(input_display_list, index + 1);
inputs[| index + 2] = nodeValue($"Oversample {_s}", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Repeat" ]);
array_append(input_display_list, [ index + 0, index + 1, index + 2 ]);
}
if(!LOADING && !APPENDING) createNewInput();
@ -67,12 +70,15 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
if(inputs[| i].value_from) {
ds_list_add(_in, inputs[| i + 0]);
ds_list_add(_in, inputs[| i + 1]);
ds_list_add(_in, inputs[| i + 2]);
array_push(input_display_list, i + 0);
array_push(input_display_list, i + 1);
array_push(input_display_list, i + 2);
} else {
delete inputs[| i + 0];
delete inputs[| i + 1];
delete inputs[| i + 2];
}
}
@ -101,15 +107,15 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
var _area = current_data[1];
var _zoom = current_data[2];
var _px = _x + (_area[0] - _area[2] * _zoom) * _s;
var _py = _y + (_area[1] - _area[3] * _zoom) * _s;
var _cam_x = _x + (_area[0] - _area[2] * _zoom) * _s;
var _cam_y = _y + (_area[1] - _area[3] * _zoom) * _s;
draw_surface_ext_safe(_out, _px, _py, _s * _zoom, _s * _zoom);
draw_surface_ext_safe(_out, _cam_x, _cam_y, _s * _zoom, _s * _zoom);
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
draw_set_color(COLORS._main_accent);
var x0 = _px;
var y0 = _py;
var x0 = _cam_x;
var y0 = _cam_y;
var x1 = x0 + _area[2] * 2 * _zoom * _s;
var y1 = y0 + _area[3] * 2 * _zoom * _s;
@ -120,23 +126,26 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
if(!is_surface(_data[0])) return;
var _area = _data[1];
var _zoom = _data[2];
var _samp = struct_try_get(attributes, "oversample");
var _samp = _data[3];
var _fix = _data[4];
var cDep = attrDepth();
var _dw = round(surface_valid_size(_area[2]) * 2);
var _dh = round(surface_valid_size(_area[3]) * 2);
_outSurf = surface_verify(_outSurf, _dw, _dh, cDep);
var pingpong = [ surface_create_valid(_dw, _dh, cDep), surface_create_valid(_dw, _dh, cDep) ];
var ppInd = 0;
var _cam_x = round(_area[0]);
var _cam_y = round(_area[1]);
var _cam_w = round(_area[2]);
var _cam_h = round(_area[3]);
var _surf_w = round(surface_valid_size(_cam_w * 2));
var _surf_h = round(surface_valid_size(_cam_h * 2));
var ppInd = 0;
_outSurf = surface_verify(_outSurf, _surf_w, _surf_h, cDep);
temp_surface[0] = surface_verify(temp_surface[0], _surf_w, _surf_h, cDep);
temp_surface[1] = surface_verify(temp_surface[1], _surf_w, _surf_h, cDep);
var _px = round(_area[0]);
var _py = round(_area[1]);
var _pw = round(_area[2]);
var _ph = round(_area[3]);
var amo = (ds_list_size(inputs) - input_fix_len) / data_length - 1;
surface_set_target(pingpong[0]);
surface_set_target(temp_surface[0]);
DRAW_CLEAR
BLEND_OVERRIDE;
if(amo <= 0) {
@ -144,14 +153,14 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
if(_samp) draw_surface_tiled_safe(_data[0], 0, 0);
else draw_surface_safe(_data[0], 0, 0);
} else {
var sx = _px / _zoom - _pw;
var sy = _py / _zoom - _ph;
var sx = _cam_x / _zoom - _cam_w;
var sy = _cam_y / _zoom - _cam_h;
if(_samp) draw_surface_tiled_ext_safe(_data[0], -sx, -sy, 1 / _zoom, 1 / _zoom, c_white, 1);
else draw_surface_ext_safe(_data[0], -sx, -sy, 1 / _zoom, 1 / _zoom, 0, c_white, 1);
}
} else {
var sx = _px / _zoom - _pw;
var sy = _py / _zoom - _ph;
var sx = _cam_x / _zoom - _cam_w;
var sy = _cam_y / _zoom - _cam_h;
if(_fix) draw_surface_safe(_data[0], 0, 0);
else draw_surface_tiled_ext_safe(_data[0], sx, sy, 1 / _zoom, 1 / _zoom, c_white, 1);
@ -159,36 +168,38 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
BLEND_NORMAL;
surface_reset_target();
surface_set_target(pingpong[1]);
surface_set_target(temp_surface[1]);
DRAW_CLEAR
surface_reset_target();
shader_set(shader);
shader_set_uniform_f(uni_dim_cam, _dw, _dh);
shader_set_uniform_f(uni_dim_cam, _surf_w, _surf_h);
shader_set_uniform_f(uni_zom, _zoom);
shader_set_uniform_i(uni_sam_mod, _samp);
for( var i = 0; i < amo; i++ ) {
ppInd = !ppInd;
surface_set_target(pingpong[ppInd]);
surface_set_target(temp_surface[ppInd]);
var ind = input_fix_len + i * data_length;
var sz = _data[ind + 1][2];
var sx = _data[ind + 1][0] * sz * _px;
var sy = _data[ind + 1][1] * sz * _py;
var _surface = _data[ind];
var sz = _data[ind + 1][2];
var sx = _data[ind + 1][0] * sz * _cam_x;
var sy = _data[ind + 1][1] * sz * _cam_y;
var _samp = _data[ind + 2];
var _scnW = surface_get_width(_surface);
var _scnH = surface_get_height(_surface);
shader_set_uniform_i(uni_sam_mod, _samp);
shader_set_uniform_f(uni_dim_scn, _scnW, _scnH);
shader_set_uniform_f(uni_blur, sz);
shader_set_uniform_f(uni_pos, (_px + sx) / _scnW, (_py + sy) / _scnH);
shader_set_uniform_f(uni_pos, (_cam_x + sx) / _scnW, (_cam_y + sy) / _scnH);
shader_set_uniform_i(uni_fix_bg, !i && _fix);
texture_set_stage(uni_backg, surface_get_texture(pingpong[!ppInd])); //prev surface
texture_set_stage(uni_backg, surface_get_texture(temp_surface[!ppInd])); //prev surface
texture_set_stage(uni_scene, surface_get_texture(_surface)); //surface to draw
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dw, _dh, 0, c_white, 1);
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _surf_w, _surf_h, 0, c_white, 1);
surface_reset_target();
}
@ -197,13 +208,10 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
draw_surface_safe(pingpong[ppInd], 0, 0);
draw_surface_safe(temp_surface[ppInd], 0, 0);
BLEND_NORMAL;
surface_reset_target();
surface_free(pingpong[0]);
surface_free(pingpong[1]);
return _outSurf;
}

View file

@ -104,6 +104,9 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 11] = nodeValue("Sequence begin", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
inputs[| 12] = nodeValue("Frame range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, -1])
.setDisplay(VALUE_DISPLAY.slider_range, [0, PROJECT.animator.frames_total, 1])
outputs[| 0] = nodeValue("Loop exit", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0);
outputs[| 1] = nodeValue("Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone)
@ -112,7 +115,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
input_display_list = [
["Export", false], 0, 1, 2, 4,
["Format ", false], 3, 9,
["Settings", false], 8, 5, 6, 7, 10, 11,
["Settings", false], 12, 8, 5, 6, 7, 10, 11,
];
directory = DIRECTORY + "temp/" + string(irandom_range(100000, 999999));
@ -369,13 +372,22 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
static export = function() {
var surf = inputs[| 0].getValue();
var path = inputs[| 1].getValue();
var suff = inputs[| 2].getValue();
var form = inputs[| 3].getValue();
var surf = inputs[| 0].getValue();
var path = inputs[| 1].getValue();
var suff = inputs[| 2].getValue();
var form = inputs[| 3].getValue();
var rang = inputs[| 12].getValue();
var _ts = current_time;
if(form >= 1) {
var rng_s = rang[0];
var rng_e = rang[1] == -1? PROJECT.animator.frames_total : rang[1];
if(PROJECT.animator.current_frame < rng_s) return;
if(PROJECT.animator.current_frame > rng_e) return;
}
if(is_array(surf)) {
var p = "";
for(var i = 0; i < array_length(surf); i++) {
@ -484,6 +496,8 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 7].setVisible(anim == 2);
inputs[| 8].setVisible(anim == 2);
inputs[| 11].setVisible(anim == 1);
inputs[| 12].setVisible(anim >= 1);
inputs[| 12].editWidget.maxx = PROJECT.animator.frames_total;
if(anim == NODE_EXPORT_FORMAT.gif) {
inputs[| 9].display_data = format_animation;
@ -521,12 +535,13 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
if(anim != NODE_EXPORT_FORMAT.gif)
return;
var surf = inputs[| 0].getValue();
var path = inputs[| 1].getValue();
var suff = inputs[| 2].getValue();
var extd = inputs[| 9].getValue();
var surf = inputs[| 0].getValue();
var path = inputs[| 1].getValue();
var suff = inputs[| 2].getValue();
var extd = inputs[| 9].getValue();
var rang = inputs[| 12].getValue();
var temp_path, target_path;
if(is_array(surf)) {
for(var i = 0; i < array_length(surf); i++) {
temp_path = directory + "/" + string(i) + "/" + "*.png";

View file

@ -97,13 +97,28 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
static lerpValue = function(from, to, _lrp) {
var _f = from.value;
var _t = to.value;
if(is_struct(_f)) {
if(!struct_has(_f, "lerpTo")) return _f;
return _f.lerpTo(_t, _lrp);
}
if(prop.type == VALUE_TYPE.color) {
if(is_array(_f)) {
var amo = max(array_length(_f), array_length(_t));
var res = array_create(amo);
for( var i = 0; i < amo; i++ )
res[i] = merge_color(array_safe_get(_f, i, 0), array_safe_get(_t, i, 0), _lrp);
if(is_array(_f) && is_array(_t)) {
var _len = ceil(lerp(array_length(_f), array_length(_t), _lrp));
var res = array_create(_len);
for( var i = 0; i < _len; i++ ) {
var rat = i / (_len - 1);
var rf = rat * (array_length(_f) - 1);
var rt = rat * (array_length(_t) - 1);
var cf = array_get_decimal(_f, rf, true);
var ct = array_get_decimal(_t, rt, true);
res[i] = merge_color(cf, ct, _lrp);
}
return res;
}
@ -148,9 +163,6 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
if(ds_list_size(values) == 1)
return processType(values[| 0].value);
if(prop.type == VALUE_TYPE.gradient)
return values[| 0].value;
if(prop.type == VALUE_TYPE.path)
return processType(values[| 0].value);

View file

@ -47,7 +47,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
function nodeBuild(_name, _x, _y, _group = PANEL_GRAPH.getCurrentContext()) {
if(!ds_map_exists(ALL_NODES, _name)) {
log_warning("LOAD", "Node type " + _name + " not found");
log_warning("LOAD", $"Node type {_name} not found");
return noone;
}
@ -553,7 +553,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
addNodeObject(color, "Palette Replace", s_node_palette_replace, "Node_Palette_Replace", [1, Node_Palette_Replace]).setVersion(1120);
ds_list_add(color, "Gradient");
addNodeObject(color, "Gradient", s_node_gradient_out, "Node_6radient_Out", [1, Node_Gradient_Out]);
addNodeObject(color, "Gradient", s_node_gradient_out, "Node_Gradient_Out", [1, Node_Gradient_Out]);
addNodeObject(color, "Palette to Gradient", s_node_gradient_palette, "Node_Gradient_Palette", [1, Node_Gradient_Palette],, "Create gradient from palette.").setVersion(1135);
addNodeObject(color, "Gradient Shift", s_node_gradient_shift, "Node_Gradient_Shift", [1, Node_Gradient_Shift],, "Move gradients keys.");
addNodeObject(color, "Gradient Replace", s_node_gradient_replace, "Node_Gradient_Replace_Color", [1, Node_Gradient_Replace_Color]).setVersion(1135);
@ -619,10 +619,46 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
addNodeObject(hid, "Hexagonal Noise", s_node_grid_hex_noise, "Node_Noise_Hex", [1, Node_Noise_Hex]).setVersion(1090);
addNodeObject(hid, "Sort Input", s_node_grid_hex_noise, "Node_Iterator_Sort_Input", [1, Node_Iterator_Sort_Input]);
addNodeObject(hid, "Sort Output", s_node_grid_hex_noise, "Node_Iterator_Sort_Output", [1, Node_Iterator_Sort_Output]);
addNodeObject(node, "Onion Skin", s_node_cache, "Node_Onion_Skin", [1, Node_Onion_Skin]).setVersion(1147);
addNodeObject(hid, "Onion Skin", s_node_cache, "Node_Onion_Skin", [1, Node_Onion_Skin]).setVersion(1147);
}
#endregion
#region node suggestion
global.VALUE_SUGGESTION = ds_map_create();
global.VALUE_SUGGESTION[? VALUE_TYPE.integer] = [ "Node_Math", "Node_Equation", "Node_To_Text" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.float] = [ "Node_Math", "Node_Equation", "Node_To_Text" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.boolean] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.color] = [ "Node_Solid", "Node_Color_Data", "Node_Color_Mix" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.surface] = [ "Node_Transform", "Node_Blend", "Node_Composite", "Node_Export" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.path] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.curve] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.text] = [ "Node_Text", "Node_To_Number" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.object] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.node] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.d3object] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.any] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.pathnode] = [ "Node_Line", "Node_Mesh_Create_Path" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.particle] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.rigid] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.fdomain] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.struct] = [ "Node_Struct_Get" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.strands] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.mesh] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.trigger] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.atlas] = [ "Node_Atlas_Draw", "Node_Atlas_Get", "Node_Atlas_Set" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.d3vertex] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.gradient] = [ "Node_Gradient", "Node_Gradient_Extract" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.armature] = [ "Node_Armature_Pose", "Node_Armature_Bind" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.buffer] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.action] = [ ];
#endregion
#region node function
function nodeLoad(_data, scale = false, _group = PANEL_GRAPH.getCurrentContext()) {
if(!is_struct(_data)) return;
@ -691,8 +727,8 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
var splt = string_splice(strs[0], "[");
var inp = PROJECT.globalNode.getInput(strs[0]);
_val = inp == noone? 0 : inp.getValueRecursive()[0];
} else if(strs[0] == "Project") {
switch(strs[1]) {
} else if(string_lower(strs[0]) == "project") {
switch(string_lower(strs[1])) {
case "frame" : return PROJECT.animator.current_frame;
case "frameTotal" : return PROJECT.animator.frames_total;
case "fps" : return PROJECT.animator.framerate;

View file

@ -515,7 +515,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
static isAnimable = function() {
if(type == VALUE_TYPE.gradient) return false;
//if(type == VALUE_TYPE.gradient) return false;
if(display_type == VALUE_DISPLAY.text_array) return false;
return true;
}

View file

@ -21,8 +21,6 @@ vec4 sampleTexture(sampler2D samp, vec2 pos) {
if(sampleMode == 0)
return vec4(0.);
if(sampleMode == 1)
return texture2D(samp, clamp(pos, 0., 1.));
if(sampleMode == 2)
return texture2D(samp, fract(pos));
return vec4(0.);