Panel function separation

This commit is contained in:
MakhamDev 2022-01-19 10:16:28 +07:00
parent 2f17e33923
commit 084b1afb5a
11 changed files with 127 additions and 244 deletions

View file

@ -1,5 +1,6 @@
{
"resources": [
{"id":{"name":"panel_function","path":"scripts/panel_function/panel_function.yy",},"order":6,},
{"id":{"name":"node_time_remap","path":"scripts/node_time_remap/node_time_remap.yy",},"order":33,},
{"id":{"name":"s_node_blur","path":"sprites/s_node_blur/s_node_blur.yy",},"order":70,},
{"id":{"name":"sh_perlin","path":"shaders/sh_perlin/sh_perlin.yy",},"order":1,},

View file

@ -1,142 +1 @@
{
"nodes": [{
"group": -1.0,
"x": 640.0,
"id": 2.0,
"inputs": [{
"from node": 1.0,
"on end": 0,
"raw value": [
[0.0, 0.0]
],
"anim": 0.0,
"from index": 0.0
}, {
"from node": -1.0,
"on end": 0,
"raw value": [
[0.0, 0.32000000000000000666133814775094]
],
"anim": 0.0,
"from index": -1.0
}, {
"from node": -1.0,
"on end": 0,
"raw value": [
[0.0, 0.41999999999999998445687765524781]
],
"anim": 0.0,
"from index": -1.0
}],
"attri": {},
"type": "Node_Level",
"y": 288.0,
"name": "Level"
}, {
"group": -1.0,
"x": 800.0,
"id": 3.0,
"inputs": [{
"from node": 2.0,
"on end": 0,
"raw value": [
[0.0, 0.0]
],
"anim": 0.0,
"from index": 0.0
}, {
"from node": -1.0,
"on end": 0,
"raw value": [
[0.0, 22677.0],
[0.15120967741935484318638316381112, 2331102.0],
[1.0, 10475775.0]
],
"anim": 0.0,
"from index": -1.0
}],
"attri": {},
"type": "Node_Colorize",
"y": 288.0,
"name": "Colorize"
}, {
"group": -1.0,
"x": 480.0,
"id": 1.0,
"inputs": [{
"from node": 0.0,
"on end": 0,
"raw value": [
[0.0, 0.0]
],
"anim": 0.0,
"from index": 0.0
}, {
"from node": -1.0,
"on end": 0,
"raw value": [
[0.0, 8.0]
],
"anim": 0.0,
"from index": -1.0
}, {
"from node": -1.0,
"on end": 0,
"raw value": [
[0.0, [0.0, 1.0]]
],
"anim": 0.0,
"from index": -1.0
}, {
"from node": -1.0,
"on end": 0,
"raw value": [
[0.0, [6.0, 1.0]]
],
"anim": 0.0,
"from index": -1.0
}, {
"from node": -1.0,
"on end": 0,
"raw value": [
[0.0, 0.0]
],
"anim": 0.0,
"from index": -1.0
}],
"attri": {},
"type": "Node_Bevel",
"y": 288.0,
"name": "Bevel"
}, {
"group": -1.0,
"x": 320.0,
"id": 0.0,
"inputs": [{
"from node": -1.0,
"on end": 0,
"raw value": [
[0.0, "arrowRight.png"]
],
"anim": 0.0,
"from index": -1.0
}, {
"from node": -1.0,
"on end": 0,
"raw value": [
[0.0, [0.0, 0.0, 0.0, 0.0]]
],
"anim": 0.0,
"from index": -1.0
}],
"attri": {},
"type": "Node_Image",
"y": 288.0,
"name": "arrowRight"
}],
"version": 60.0,
"animator": {
"framerate": 15.0,
"frames_total": 12.0
}
}
{ "nodes": [ { "group": -1.0, "x": 64.0, "id": 2.0, "inputs": [ { "from node": 1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": true, "from index": 0.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.32000000000000000666133814775094, 0.0, 0.0 ] ], "anim": 0.0, "visible": false, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.41999999999999998445687765524781, 0.0, 0.0 ] ], "anim": 0.0, "visible": false, "from index": -1.0 } ], "attri": { }, "type": "Node_Level", "y": -96.0, "name": "Level" }, { "group": -1.0, "x": 224.0, "id": 3.0, "inputs": [ { "from node": 2.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": true, "from index": 0.0 }, { "from node": -1.0, "on end": 0.0, "data": [ 0 ], "raw value": [ [ 0.0, 22677.0, 0.0, 0.0 ], [ 0.15120967741935484318638316381112, 2331102.0, 0.0, 0.0 ], [ 1.0, 10475775.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": false, "from index": -1.0 }, { "from node": -1.0, "on end": 0, "data": [ ], "raw value": [ [ 0.0, 0.0, 0.0, 0.0 ] ], "anim": false, "visible": false, "from index": -1.0 } ], "attri": { }, "type": "Node_Colorize", "y": -96.0, "name": "Colorize" }, { "group": -1.0, "x": -96.0, "id": 1.0, "inputs": [ { "from node": 0.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": true, "from index": 0.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 8.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": false, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, [ 0.0, 1.0 ], 0.0, 0.0 ] ], "anim": 0.0, "visible": false, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, [ 6.0, 1.0 ], 0.0, 0.0 ] ], "anim": 0.0, "visible": false, "from index": -1.0 } ], "attri": { }, "type": "Node_Bevel", "y": -96.0, "name": "Bevel" }, { "group": -1.0, "x": -256.0, "id": 0.0, "inputs": [ { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, "arrowRight.png", 0.0, 0.0 ] ], "anim": 0.0, "visible": false, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, [ 0.0, 0.0, 0.0, 0.0 ], 0.0, 0.0 ] ], "anim": 0.0, "visible": false, "from index": -1.0 } ], "attri": { }, "type": "Node_Image", "y": -96.0, "name": "arrowRight" } ], "version": 82.0, "animator": { "framerate": 15.0, "frames_total": 12.0 } }

View file

@ -46,106 +46,23 @@
};
#endregion
#region panel
#region inputs
globalvar FOCUS, FOCUS_STR, HOVER, DOUBLE_CLICK, CURRENT_PATH;
globalvar TEXTBOX_ACTIVE;
CURRENT_PATH = "";
DOUBLE_CLICK = false;
FOCUS = noone;
FOCUS_STR = "";
HOVER = noone;
globalvar PANEL_MAIN, PANEL_MENU, PANEL_PREVIEW, PANEL_INSPECTOR, PANEL_GRAPH, PANEL_ANIMATION, PANEL_COLLECTION;
PANEL_MAIN = 0;
function clearPanel() {
delete PANEL_MAIN;
delete PANEL_MENU;
delete PANEL_INSPECTOR;
delete PANEL_PREVIEW;
delete PANEL_GRAPH;
PANEL_MAIN = 0;
PANEL_MENU = 0;
PANEL_INSPECTOR = 0;
PANEL_PREVIEW = 0;
PANEL_GRAPH = 0;
}
function setPanel() {
PANEL_MAIN = new Panel(noone, 0, 0, WIN_W, WIN_H);
var split_menu = PANEL_MAIN.split_v(40);
PANEL_MENU = new Panel_Menu(split_menu[0]);
var split_ins = split_menu[1].split_h(-400);
PANEL_INSPECTOR = new Panel_Inspector(split_ins[1]);
switch(PREF_MAP[? "panel_layout"]) {
case 0 :
var split_anim = split_ins[0].split_v(-48);
PANEL_ANIMATION = new Panel_Animation(split_anim[1]);
var split_prev = split_anim[0].split_v(-500);
PANEL_PREVIEW = new Panel_Preview(split_prev[0]);
PANEL_GRAPH = new Panel_Graph(split_prev[1]);
if(PREF_MAP[? "panel_collection"]) {
var pane = PANEL_GRAPH.panel.split_h(460);
pane[1].set(PANEL_GRAPH);
PANEL_COLLECTION = new Panel_Collection(pane[0]);
}
break;
case 1 :
var split_anim = split_ins[0].split_v(-240);
PANEL_ANIMATION = new Panel_Animation(split_anim[1]);
var split_prev = split_anim[0].split_h(400);
PANEL_PREVIEW = new Panel_Preview(split_prev[0]);
PANEL_GRAPH = new Panel_Graph(split_prev[1]);
if(PREF_MAP[? "panel_collection"]) {
var pane = PANEL_ANIMATION.panel.split_h(460);
pane[1].set(PANEL_ANIMATION);
PANEL_COLLECTION = new Panel_Collection(pane[0]);
}
break;
}
PANEL_ANIMATION.updatePropertyList();
PANEL_MAIN.refresh();
}
CURRENT_PATH = "";
DOUBLE_CLICK = false;
FOCUS = noone;
FOCUS_STR = "";
HOVER = noone;
TEXTBOX_ACTIVE = noone
globalvar ADD_NODE_PAGE, ADD_NODE_W, ADD_NODE_H;
ADD_NODE_PAGE = "";
ADD_NODE_W = 372 + 16 * 3 + 8;
ADD_NODE_H = 320;
function findPanel(_name, _pane, _res) {
if(instanceof(_pane) != "Panel")
return _res;
if(!ds_exists(_pane.childs, ds_type_list))
return _res;
if(ds_list_size(_pane.childs) == 0 && _pane.content && instanceof(_pane.content) == _name) {
return _pane.content;
}
for(var i = 0; i < ds_list_size(_pane.childs); i++) {
var _re = findPanel(_name, _pane.childs[| i], _res);
if(_re != noone)
_res = _re;
}
return _res;
}
ADD_NODE_PAGE = "";
ADD_NODE_W = 372 + 16 * 3 + 8;
ADD_NODE_H = 320;
globalvar AXIS_COLOR;
AXIS_COLOR = [ c_ui_red, c_ui_lime, c_ui_cyan, c_yellow, c_aqua, c_fuchsia, c_orange, c_ltgray ];
#endregion

View file

@ -67,8 +67,7 @@ function Node_Image(_x, _y) : Node(_x, _y) constructor {
case ".jpg":
case ".jpeg":
case ".gif":
name = _name;
inputs[| 0].setValue(path);
name = _name;
outputs[| 1].setValue(path);
if(spr) sprite_delete(spr);
@ -76,7 +75,7 @@ function Node_Image(_x, _y) : Node(_x, _y) constructor {
if(path_current == "")
first_update = true;
path_current = path;
path_current = path;
return true;
}

View file

@ -95,7 +95,6 @@ function Node_Image_Animated(_x, _y) : Node(_x, _y) constructor {
spr = [];
path_loaded = array_create(array_length(paths));
inputs[| 0].setValue(paths);
for( var i = 0; i < array_length(paths); i++ ) {
path_loaded[i] = paths[i];

View file

@ -71,7 +71,6 @@ function Node_Image_gif(_x, _y) : Node(_x, _y) constructor {
switch(ext) {
case ".gif":
name = _name;
inputs[| 0].setValue(path);
outputs[| 1].setValue(path);
if(spr) sprite_delete(spr);

View file

@ -95,7 +95,6 @@ function Node_Image_Sequence(_x, _y) : Node(_x, _y) constructor {
spr = [];
path_loaded = array_create(array_length(paths));
inputs[| 0].setValue(paths);
for( var i = 0; i < array_length(paths); i++ ) {
path_loaded[i] = paths[i];

View file

@ -0,0 +1,85 @@
#region data
globalvar PANEL_MAIN, PANEL_MENU, PANEL_PREVIEW, PANEL_INSPECTOR, PANEL_GRAPH, PANEL_ANIMATION, PANEL_COLLECTION;
PANEL_MAIN = 0;
#endregion
#region functions
function clearPanel() {
delete PANEL_MAIN;
delete PANEL_MENU;
delete PANEL_INSPECTOR;
delete PANEL_PREVIEW;
delete PANEL_GRAPH;
PANEL_MAIN = 0;
PANEL_MENU = 0;
PANEL_INSPECTOR = 0;
PANEL_PREVIEW = 0;
PANEL_GRAPH = 0;
}
function setPanel() {
PANEL_MAIN = new Panel(noone, 0, 0, WIN_W, WIN_H);
var split_menu = PANEL_MAIN.split_v(40);
PANEL_MENU = new Panel_Menu(split_menu[0]);
var split_ins = split_menu[1].split_h(-400);
PANEL_INSPECTOR = new Panel_Inspector(split_ins[1]);
switch(PREF_MAP[? "panel_layout"]) {
case 0 :
var split_anim = split_ins[0].split_v(-48);
PANEL_ANIMATION = new Panel_Animation(split_anim[1]);
var split_prev = split_anim[0].split_v(-500);
PANEL_PREVIEW = new Panel_Preview(split_prev[0]);
PANEL_GRAPH = new Panel_Graph(split_prev[1]);
if(PREF_MAP[? "panel_collection"]) {
var pane = PANEL_GRAPH.panel.split_h(460);
pane[1].set(PANEL_GRAPH);
PANEL_COLLECTION = new Panel_Collection(pane[0]);
}
break;
case 1 :
var split_anim = split_ins[0].split_v(-240);
PANEL_ANIMATION = new Panel_Animation(split_anim[1]);
var split_prev = split_anim[0].split_h(400);
PANEL_PREVIEW = new Panel_Preview(split_prev[0]);
PANEL_GRAPH = new Panel_Graph(split_prev[1]);
if(PREF_MAP[? "panel_collection"]) {
var pane = PANEL_ANIMATION.panel.split_h(460);
pane[1].set(PANEL_ANIMATION);
PANEL_COLLECTION = new Panel_Collection(pane[0]);
}
break;
}
PANEL_ANIMATION.updatePropertyList();
PANEL_MAIN.refresh();
}
function findPanel(_name, _pane, _res) {
if(instanceof(_pane) != "Panel")
return _res;
if(!ds_exists(_pane.childs, ds_type_list))
return _res;
if(ds_list_size(_pane.childs) == 0 && _pane.content && instanceof(_pane.content) == _name) {
return _pane.content;
}
for(var i = 0; i < ds_list_size(_pane.childs); i++) {
var _re = findPanel(_name, _pane.childs[| i], _res);
if(_re != noone)
_res = _re;
}
return _res;
}
#endregion

View file

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

View file

@ -12,7 +12,14 @@ uniform float gradient_shift;
void main() {
vec4 _col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
float prog = fract(dot(_col.rgb, vec3(0.2126, 0.7152, 0.0722)) + gradient_shift);
float prog = abs(dot(_col.rgb, vec3(0.2126, 0.7152, 0.0722)) + gradient_shift);
if(prog > 1.) {
if(prog == floor(prog))
prog = 1.;
else
prog = fract(prog);
}
vec4 col = vec4(0.);
for(int i = 0; i < 16; i++) {

View file

@ -56,9 +56,15 @@ void main() {
float _a = atan(_p.y, _p.x) + angle;
prog = (_a - floor(_a / TAU) * TAU) / TAU;
}
prog += shift;
if(gradient_loop == 1)
prog = fract(prog);
prog = abs(prog + shift);
if(gradient_loop == 1) {
if(prog > 1.) {
if(prog == floor(prog))
prog = 1.;
else
prog = fract(prog);
}
}
vec4 col = gradientEval(prog);