path, tab, perlin bugs

This commit is contained in:
Tanasart 2024-01-16 20:08:57 +07:00
parent 7dd31ce83e
commit 76a05516e5
11 changed files with 42 additions and 35 deletions

Binary file not shown.

View file

@ -6,3 +6,5 @@ WIDGET_CURRENT = noone;
ds_list_remove(DIALOGS, self);
if(parent) array_remove(parent.children, id);
MOUSE_BLOCK = true;

View file

@ -16,7 +16,7 @@ draw_clear(COLORS.bg);
#region widget scroll
if(!WIDGET_TAB_BLOCK) {
if(keyboard_check_pressed(vk_tab) && key_mod_press(SHIFT)) {
if(keyboard_check_pressed(vk_tab)) {
if(key_mod_press(SHIFT)) widget_previous();
else widget_next();
}

View file

@ -307,7 +307,7 @@ function __part(_node) constructor {
if(path != noone) {
var _div = pathDiv.get(lifeRat);
pathPos = path.getPointRatio(lifeRat, pathIndex, pathPos);
pathPos = path.getPointRatio(clamp(lifeRat, 0, 0.99), pathIndex, pathPos);
_xx = _xx * _div + pathPos.x;
_yy = _yy * _div + pathPos.y;
}
@ -358,7 +358,7 @@ function __part(_node) constructor {
draw_point(_xx, _yy - 1);
break;
default :
draw_circle(round(_xx), round(_yy), round(ss) - 2, false);
draw_circle(_xx, _yy, (exact? round(ss) : ss) - 2, false);
break;
}

View file

@ -69,7 +69,14 @@
function widget_next() {
INLINE
if(array_length(WIDGET_ACTIVE) == 0) return;
if(array_length(WIDGET_ACTIVE) == 0) {
if(WIDGET_CURRENT != noone) {
WIDGET_CURRENT.deactivate();
WIDGET_CURRENT = noone;
}
return;
}
if(WIDGET_CURRENT == noone) {
widget_start()
return;
@ -88,7 +95,14 @@
}
function widget_previous() {
if(array_length(WIDGET_ACTIVE) == 0) return;
if(array_length(WIDGET_ACTIVE) == 0) {
if(WIDGET_CURRENT != noone) {
WIDGET_CURRENT.deactivate();
WIDGET_CURRENT = noone;
}
return;
}
if(WIDGET_CURRENT == noone) {
widget_start()
return;
@ -119,9 +133,7 @@
function widget_clear() {
if(WIDGET_CURRENT == noone) return;
if(array_length(WIDGET_ACTIVE) == 0) return;
var ind = array_find(WIDGET_ACTIVE, WIDGET_CURRENT);
WIDGET_CURRENT.deactivate();
WIDGET_CURRENT = noone;
}

View file

@ -155,8 +155,8 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}); #endregion
input_display_list = [
["Output", false], 0, frame_renderer, 12, 13,
["Brush", false], 6, 15, 17, 16,
["Output", false], 0, frame_renderer, 12, 13,
["Brush", true], 6, 15, 17, 16,
["Background", true, 10], 8, 14, 9,
];

View file

@ -149,23 +149,13 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
my = transform_sy + lengthdir_y(diss, ang);
}
//var _tsx = transform_sx;
//var _tsy = transform_sy;
//draw_set_color(COLORS._main_accent);
//draw_line(_tsx, _tsy, _tsx + lengthdir_x(1000, 0), _tsy + lengthdir_y(1000, 0));
//draw_line(_tsx, _tsy, _tsx + lengthdir_x(1000, 90), _tsy + lengthdir_y(1000, 90));
//draw_line(_tsx, _tsy, _tsx + lengthdir_x(1000, 180), _tsy + lengthdir_y(1000, 180));
//draw_line(_tsx, _tsy, _tsx + lengthdir_x(1000, 270), _tsy + lengthdir_y(1000, 270));
var dx = mx - transform_mx;
var dy = my - transform_my;
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
var _p = getInputData(i);
var p = [
_p[0] + dx / _s,
_p[1] + dy / _s
];
var p = array_clone(getInputData(i));
p[0] += dx / _s;
p[1] += dy / _s;
if(inputs[| i].setValue(p))
_edited = true;

View file

@ -12,7 +12,7 @@ function Node_Perlin(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
.setDisplay(VALUE_DISPLAY.vector)
.setMappable(10);
inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2);
inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4);
inputs[| 4] = nodeValue("Tile", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);

View file

@ -3,6 +3,12 @@ function Inspector_Custom_Renderer(drawFn, registerFn = noone) : widget() constr
self.draw = drawFn;
if(registerFn != noone) register = registerFn;
else {
register = function(parent = noone) {
if(!interactable) return;
self.parent = parent;
}
}
}
function Inspector_Sprite(spr) constructor { self.spr = spr; }

View file

@ -1,6 +1,3 @@
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
@ -28,16 +25,16 @@ vec3 hsv2rgb(vec3 c) { #region
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
} #endregion
float random (in vec2 st, float seed) { return fract(sin(dot(st.xy + vec2(21.456, 46.856), vec2(12.989, 78.233))) * (43758.545 + seed)); }
float random (in vec2 st, float _seed) { return fract(sin(dot(st.xy + vec2(21.456, 46.856), vec2(12.989, 78.233))) * (43758.545 + _seed)); }
float randomFloat (in vec2 st, float seed) { #region
float sedSt = floor(seed);
float sedFr = fract(seed);
float randomFloat (in vec2 st, float _seed) { #region
float sedSt = floor(_seed);
float sedFr = fract(_seed);
return mix(random(st, sedSt), random(st, sedSt + 1.), sedFr);
} #endregion
vec2 random2 (in vec2 st, float seed) { return vec2(random(st, seed), random(st, seed + 1.864)); }
vec2 random2 (in vec2 st, float _seed) { return vec2(random(st, _seed), random(st, _seed + 1.864)); }
float noise (in vec2 st, in vec2 scale) { #region
vec2 cellMin = floor(st);
@ -68,7 +65,7 @@ float perlin(in vec2 st) { #region
for(int i = 0; i < iteration; i++) {
n += noise(pos, sc) * amp;
pos += random2(vec2(float(i), float(i)), seed + 1.574186) * sc;
//pos += random2(vec2(float(i), float(i)), seed + 1.57) * sc; //make the result goes random somehow
sc *= 2.;
amp *= .5;