Refactor node visibility

This commit is contained in:
MakhamDev 2022-01-19 12:11:17 +07:00
parent 68c9d3a909
commit ffe75f4c0c
39 changed files with 218 additions and 166 deletions

View file

@ -14,7 +14,7 @@
],
"layers": [
{"instances":[
{"properties":[],"isDnd":false,"objectId":{"name":"o_main","path":"objects/o_main/o_main.yy",},"inheritCode":false,"hasCreationCode":false,"colour":4294967295,"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"imageIndex":0,"imageSpeed":1.0,"inheritedItemId":null,"frozen":false,"ignore":false,"inheritItemSettings":false,"x":0.0,"y":0.0,"resourceVersion":"1.0","name":"inst_4C1D5EA","tags":[],"resourceType":"GMRInstance",},
{"properties":[],"isDnd":false,"objectId":{"name":"o_main","path":"objects/o_main/o_main.yy",},"inheritCode":false,"hasCreationCode":false,"colour":4294967295,"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"imageIndex":0,"imageSpeed":1.0,"inheritedItemId":null,"frozen":false,"ignore":false,"inheritItemSettings":false,"x":976.0,"y":224.0,"resourceVersion":"1.0","name":"inst_5E4E5D1","tags":[],"resourceType":"GMRInstance",},
],"visible":true,"depth":0,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":16,"gridY":16,"layers":[],"hierarchyFrozen":false,"resourceVersion":"1.0","name":"Instances","tags":[],"resourceType":"GMRInstanceLayer",},
{"spriteId":null,"colour":4280491036,"x":0,"y":0,"htiled":false,"vtiled":false,"hspeed":0.0,"vspeed":0.0,"stretch":false,"animationFPS":15.0,"animationSpeedType":0,"userdefinedAnimFPS":false,"visible":true,"depth":100,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":16,"gridY":16,"layers":[],"hierarchyFrozen":false,"resourceVersion":"1.0","name":"Background","tags":[],"resourceType":"GMRBackgroundLayer",},
],
@ -22,7 +22,7 @@
"creationCodeFile": "",
"inheritCode": false,
"instanceCreationOrder": [
{"name":"inst_4C1D5EA","path":"rooms/rm_main/rm_main.yy",},
{"name":"inst_5E4E5D1","path":"rooms/rm_main/rm_main.yy",},
],
"inheritCreationOrder": false,
"sequenceId": null,

View file

@ -13,7 +13,7 @@ enum ACTION_TYPE {
list_delete,
node_added,
node_deleted,
node_delete,
junction_connect,
group_added,
@ -57,9 +57,9 @@ function Action(_type, _object, _data) constructor {
ds_list_insert(obj, data[1], data[0]);
break;
case ACTION_TYPE.node_added :
node_delete(obj);
nodeDelete(obj);
break;
case ACTION_TYPE.node_deleted :
case ACTION_TYPE.node_delete :
ds_list_add(obj.group == -1? NODES : obj.group.nodes, obj);
break;
case ACTION_TYPE.junction_connect :
@ -105,8 +105,8 @@ function Action(_type, _object, _data) constructor {
case ACTION_TYPE.node_added :
ds_list_add(obj.group == -1? NODES : obj.group.nodes, obj);
break;
case ACTION_TYPE.node_deleted :
node_delete(obj);
case ACTION_TYPE.node_delete :
nodeDelete(obj);
break;
case ACTION_TYPE.junction_connect :
var _d = obj.value_from;
@ -140,7 +140,7 @@ function Action(_type, _object, _data) constructor {
case ACTION_TYPE.node_added :
ss = "node add: " + string(obj.name);
break;
case ACTION_TYPE.node_deleted :
case ACTION_TYPE.node_delete :
ss = "node deleted: " + string(obj.name);
break;
case ACTION_TYPE.junction_connect :

View file

@ -47,7 +47,7 @@ function LOAD_PATH(path, readonly = false) {
PANEL_MENU.addNotiExtra(warn);
}
clearNodes();
nodeCleanUp();
var create_list = ds_list_create();
if(ds_map_exists(_map, "nodes")) {

View file

@ -86,29 +86,29 @@ function Node_2D_light(_x, _y) : Node_Processor(_x, _y) constructor {
switch(_shape) {
case LIGHT_SHAPE_2D.point :
node_input_visible(inputs[| 2], true);
node_input_visible(inputs[| 3], true);
node_input_visible(inputs[| 6], false);
node_input_visible(inputs[| 7], false);
node_input_visible(inputs[| 8], false);
node_input_visible(inputs[| 9], false);
inputs[| 2].setVisible(true);
inputs[| 3].setVisible(true);
inputs[| 6].setVisible(false);
inputs[| 7].setVisible(false);
inputs[| 8].setVisible(false);
inputs[| 9].setVisible(false);
break;
case LIGHT_SHAPE_2D.line :
case LIGHT_SHAPE_2D.line_asym :
node_input_visible(inputs[| 2], false);
node_input_visible(inputs[| 3], true);
node_input_visible(inputs[| 6], true);
node_input_visible(inputs[| 7], true);
node_input_visible(inputs[| 8], true);
node_input_visible(inputs[| 9], _shape == LIGHT_SHAPE_2D.line_asym);
inputs[| 2].setVisible(false);
inputs[| 3].setVisible(true);
inputs[| 6].setVisible(true);
inputs[| 7].setVisible(true);
inputs[| 8].setVisible(true);
inputs[| 9].setVisible(_shape == LIGHT_SHAPE_2D.line_asym);
break;
case LIGHT_SHAPE_2D.spot :
node_input_visible(inputs[| 2], false);
node_input_visible(inputs[| 3], false);
node_input_visible(inputs[| 6], true);
node_input_visible(inputs[| 7], true);
node_input_visible(inputs[| 8], true);
node_input_visible(inputs[| 9], false);
inputs[| 2].setVisible(false);
inputs[| 3].setVisible(false);
inputs[| 6].setVisible(true);
inputs[| 7].setVisible(true);
inputs[| 8].setVisible(true);
inputs[| 9].setVisible(false);
break;
}

View file

@ -47,7 +47,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
function createMaterial(m_index) {
var index = ds_list_size(inputs);
inputs[| index] = nodeValue( index, "Texture " + materials[m_index], self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, tex_surface);
inputs[| index].show_in_inspector = false;
inputs[| index].setVisible(false);
input_display_list[input_display_len + m_index] = index;
}

View file

@ -145,7 +145,7 @@ function Node_3D_Cube(_x, _y) : Node(_x, _y) constructor {
var _sca = inputs[| 4].getValue();
var _usetex = inputs[| 5].getValue();
for(var i = 6; i <= 11; i++) inputs[| i].show_in_inspector = _usetex;
for(var i = 6; i <= 11; i++) inputs[| i].setVisible(_usetex);
var _outSurf = outputs[| 0].getValue();
if(!is_surface(_outSurf)) {

View file

@ -141,17 +141,17 @@ function Node_3D_Transform(_x, _y) : Node_Processor(_x, _y) constructor {
switch(_out_type) {
case OUTPUT_SCALING.same_as_input :
node_input_visible(inputs[| 5], false);
inputs[| 5].setVisible(false);
_ww = surface_get_width(_data[0]);
_hh = surface_get_height(_data[0]);
break;
case OUTPUT_SCALING.constant :
node_input_visible(inputs[| 5], true);
inputs[| 5].setVisible(true);
_ww = _out[0];
_hh = _out[1];
break;
case OUTPUT_SCALING.relative :
node_input_visible(inputs[| 5], true);
inputs[| 5].setVisible(true);
_ww = surface_get_width(_data[0]) * _out[0];
_hh = surface_get_height(_data[0]) * _out[1];
break;

View file

@ -5,34 +5,59 @@ function Node_create_Array(_x, _y) {
}
function Node_Array(_x, _y) : Node(_x, _y) constructor {
name = "Array";
name = "Array";
previewable = false;
input_size = 0;
input_max = 8;
w = 96;
min_h = 0;
for(var i = 0; i < input_max; i++) {
inputs[| i] = nodeValue(i, "Value " + string(i), self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0);
static createNewInput = function() {
var index = ds_list_size(inputs);
inputs[| index] = nodeValue( index, "Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1 )
.setVisible(true, true);
}
createNewInput();
outputs[| 0] = nodeValue(0, "Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []);
static update = function() {
var res = array_create(input_size);
input_size = 0;
for(var i = 0; i < input_max; i++) {
static updateValueFrom = function(index) {
var _l = ds_list_create();
for( var i = 0; i < ds_list_size(inputs); i++ ) {
if(inputs[| i].value_from) {
res[i] = inputs[| i].getValue();
input_size = i + 1;
ds_list_add(_l, inputs[| i]);
} else {
delete inputs[| i];
}
}
if(input_size < input_max) {
inputs[| input_size].show_in_inspector = true;
for( var i = 0; i < ds_list_size(_l); i++ ) {
_l[| i].index = i;
}
ds_list_destroy(inputs);
inputs = _l;
createNewInput();
}
static update = function() {
var res = array_create(ds_list_size(inputs) - 1);
for( var i = 0; i < ds_list_size(inputs) - 1; i++ ) {
res[i] = inputs[| i].getValue();
}
outputs[| 0].setValue(res);
}
doUpdate();
static postDeserialize = function() {
var _inputs = load_map[? "inputs"];
for(var i = 0; i < ds_list_size(_inputs); i++) {
createNewInput();
}
}
}

View file

@ -250,12 +250,12 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor {
switch(_dim_type) {
case COMPOSE_OUTPUT_SCALING.first :
inputs[| 2].show_in_inspector = false;
inputs[| 2].setVisible(false);
ww = surface_get_width(base);
hh = surface_get_height(base);
break;
case COMPOSE_OUTPUT_SCALING.largest :
inputs[| 2].show_in_inspector = false;
inputs[| 2].setVisible(false);
for(var i = input_fix_len; i < array_length(_data) - data_length; i += data_length) {
var _s = _data[i];
ww = max(ww, surface_get_width(_s));
@ -263,7 +263,7 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor {
}
break;
case COMPOSE_OUTPUT_SCALING.constant :
inputs[| 2].show_in_inspector = true;
inputs[| 2].setVisible(true);
ww = _dim[0];
hh = _dim[1];
break;

View file

@ -574,4 +574,17 @@ function Node(_x, _y) constructor {
static preConnect = function() {}
static postConnect = function() {}
static cleanUp = function() {
for( var i = 0; i < ds_list_size(inputs); i++ ) {
inputs[| i].cleanUp();
}
for( var i = 0; i < ds_list_size(outputs); i++ ) {
outputs[| i].cleanUp();
}
ds_list_destroy(inputs);
ds_list_destroy(outputs);
ds_map_destroy(attributes);
}
}

View file

@ -45,11 +45,11 @@ function Node_Displace(_x, _y) : Node_Processor(_x, _y) constructor {
static process_data = function(_outSurf, _data, _output_index) {
switch(_data[5]) {
case 0 :
inputs[| 2].show_in_inspector = true;
inputs[| 2].setVisible(true);
break;
case 1 :
case 2 :
inputs[| 2].show_in_inspector = false;
inputs[| 2].setVisible(false);
break;
}
var ww = surface_get_width(_data[0]);

View file

@ -83,25 +83,25 @@ function Node_Dither(_x, _y) : Node_Processor(_x, _y) constructor {
switch(_typ) {
case 0 :
node_input_visible(inputs[| 3], false);
inputs[| 3].setVisible(false);
shader_set_uniform_i(uniform_map_use, 0);
shader_set_uniform_f(uniform_dither_size, 2);
shader_set_uniform_f_array(uniform_dither, dither2);
break;
case 1 :
node_input_visible(inputs[| 3], false);
inputs[| 3].setVisible(false);
shader_set_uniform_i(uniform_map_use, 0);
shader_set_uniform_f(uniform_dither_size, 4);
shader_set_uniform_f_array(uniform_dither, dither4);
break;
case 2 :
node_input_visible(inputs[| 3], false);
inputs[| 3].setVisible(false);
shader_set_uniform_i(uniform_map_use, 0);
shader_set_uniform_f(uniform_dither_size, 8);
shader_set_uniform_f_array(uniform_dither, dither8);
break;
case 3 :
node_input_visible(inputs[| 3], true);
inputs[| 3].setVisible(true);
if(is_surface(_map)) {
shader_set_uniform_i(uniform_map_use, 1);
shader_set_uniform_f_array(uniform_map_dim, [ surface_get_width(_map), surface_get_height(_map) ]);

View file

@ -60,10 +60,10 @@ function Node_Export(_x, _y) : Node(_x, _y) constructor {
inputs[| 2].setValue("%d%n%3f");
}
inputs[| 5].show_in_inspector = form == 2;
inputs[| 6].show_in_inspector = form == 2;
inputs[| 7].show_in_inspector = form == 2;
inputs[| 8].show_in_inspector = form == 2;
inputs[| 5].setVisible(form == 2);
inputs[| 6].setVisible(form == 2);
inputs[| 7].setVisible(form == 2);
inputs[| 8].setVisible(form == 2);
}
static renderGif = function(temp_path, target_path) {

View file

@ -1,6 +1,2 @@
#macro def_surf_size PREF_MAP[? "default_surface_side"]
#macro def_surf_size2 [PREF_MAP[? "default_surface_side"], PREF_MAP[? "default_surface_side"]]
function node_input_visible(node, vis) {
node.show_in_inspector = vis;
}

View file

@ -85,11 +85,11 @@ function Node_Gradient(_x, _y) : Node(_x, _y) constructor {
}
if(_typ == 0 || _typ == 2) {
inputs[| 3].show_in_inspector = true;
inputs[| 4].show_in_inspector = false;
inputs[| 3].setVisible(true);
inputs[| 4].setVisible(false);
} else if(_typ == 1) {
inputs[| 3].show_in_inspector = false;
inputs[| 4].show_in_inspector = true;
inputs[| 3].setVisible(false);
inputs[| 4].setVisible(true);
}
surface_set_target(_outSurf);

View file

@ -79,6 +79,7 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor {
case VALUE_DISPLAY.rotation_range :
if(!is_array(_val) || array_length(_val) != 2)
inParent.value = new animValue([0, 0], inParent);
inParent.setDisplay(_dtype);
break;
case VALUE_DISPLAY.enum_button :
@ -89,11 +90,13 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor {
case VALUE_DISPLAY.padding :
if(!is_array(_val) || array_length(_val) != 4)
inParent.value = new animValue([0, 0, 0, 0], inParent);
inParent.setDisplay(_dtype);
break;
case VALUE_DISPLAY.area :
if(!is_array(_val) || array_length(_val) != 5)
inParent.value = new animValue([0, 0, 0, 0, 5], inParent);
inParent.setDisplay(_dtype);
break;
case VALUE_DISPLAY.vector :
@ -127,7 +130,9 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor {
break;
}
group.sortIO();
if(index == 5) {
group.sortIO();
}
}
static createInput = function(override_order = false) {
@ -169,23 +174,23 @@ function Node_Group_Input(_x, _y, _group) : Node(_x, _y) constructor {
var _dtype = inputs[| 0].getValue();
inputs[| 1].show_in_inspector = false;
inputs[| 3].show_in_inspector = false;
inputs[| 4].show_in_inspector = false;
inputs[| 1].setVisible(false);
inputs[| 3].setVisible(false);
inputs[| 4].setVisible(false);
switch(_dtype) {
case VALUE_DISPLAY.range :
case VALUE_DISPLAY.slider :
case VALUE_DISPLAY.slider_range :
inputs[| 1].show_in_inspector = true;
inputs[| 1].setVisible(true);
break;
case VALUE_DISPLAY.enum_button :
case VALUE_DISPLAY.enum_scroll :
inputs[| 3].show_in_inspector = true;
inputs[| 3].setVisible(true);
break;
case VALUE_DISPLAY.vector :
case VALUE_DISPLAY.vector_range :
inputs[| 4].show_in_inspector = true;
inputs[| 4].setVisible(true);
break;
}
}

View file

@ -17,7 +17,8 @@ function Node_Group_Output(_x, _y, _group) : Node(_x, _y) constructor {
h = 32 + 24;
min_h = h;
inputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1);
inputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1)
.setVisible(true, true);
inputs[| 1] = nodeValue(1, "Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0);
@ -50,6 +51,7 @@ function Node_Group_Output(_x, _y, _group) : Node(_x, _y) constructor {
outParent.setFrom(inputs[| 0]);
}
}
if(!LOADING && !APPENDING)
createOutput();

View file

@ -117,13 +117,9 @@ function Node_Image_Animated(_x, _y) : Node(_x, _y) constructor {
var pad = inputs[| 1].getValue();
var str = inputs[| 2].getValue();
if(str) {
inputs[| 3].show_in_inspector = false;
inputs[| 4].show_in_inspector = false;
} else {
inputs[| 3].show_in_inspector = true;
inputs[| 4].show_in_inspector = true;
}
inputs[| 3].setVisible(!str);
inputs[| 4].setVisible(!str);
var spd = str? (ANIMATOR.frames_total + 1) / array_length(spr) : inputs[| 3].getValue();
var _end = inputs[| 4].getValue();
if(spd == 0) spd = 1;

View file

@ -118,7 +118,7 @@ function Node_Image_Sequence(_x, _y) : Node(_x, _y) constructor {
var pad = inputs[| 1].getValue();
var can = inputs[| 2].getValue();
inputs[| 3].show_in_inspector = can != CANVAS_SIZE.individual;
inputs[| 3].setVisible(can != CANVAS_SIZE.individual);
var siz = inputs[| 3].getValue();

View file

@ -238,7 +238,7 @@ function Node_Image_Sheet(_x, _y) : Node(_x, _y) constructor {
if(_out == 0) {
update_on_frame = true;
inputs[| 8].show_in_inspector = true;
inputs[| 8].setVisible(true);
var _spd = inputs[| 8].getValue();
if(is_surface(_outSurf))
@ -259,7 +259,7 @@ function Node_Image_Sheet(_x, _y) : Node(_x, _y) constructor {
surface_reset_target();
} else if(_out == 1) {
update_on_frame = false;
inputs[| 8].show_in_inspector = false;
inputs[| 8].setVisible(false);
surf_array = array_create(_amo);
for(var i = 0; i < _amo; i++) {

View file

@ -229,4 +229,8 @@ function animValue(_val, _node) constructor {
ds_list_add(values, new valueKey(_time, _val, ease_in, ease_out));
}
}
static cleanUp = function() {
ds_list_destroy(values);
}
}

View file

@ -69,9 +69,9 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
if(_ang < 0) _ang = 360 + _ang;
if(_use_path) {
node_input_visible(inputs[| 6], false);
inputs[| 6].setVisible(false);
} else {
node_input_visible(inputs[| 6], true);
inputs[| 6].setVisible(true);
}
random_set_seed(_sed);

View file

@ -30,12 +30,12 @@ function Node_Math(_x, _y) : Node_Value_Processor(_x, _y) constructor {
case 3 :
case 4 :
case 5 :
inputs[| 2].show_in_inspector = true;
inputs[| 2].setVisible(true);
break;
case 6 :
case 7 :
case 8 :
inputs[| 2].show_in_inspector = false;
inputs[| 2].setVisible(false);
break;
}

View file

@ -58,8 +58,8 @@ function Node_Cellular(_x, _y) : Node(_x, _y) constructor {
var _pat = inputs[| 6].getValue();
var _mid = inputs[| 7].getValue();
inputs[| 8].show_in_inspector = _pat == 1;
inputs[| 9].show_in_inspector = _pat == 1;
inputs[| 8].setVisible(_pat == 1);
inputs[| 9].setVisible(_pat == 1);
var _rad = inputs[| 8].getValue();
var _sht = inputs[| 9].getValue();

View file

@ -73,6 +73,6 @@ function Node_Outline(_x, _y) : Node_Processor(_x, _y) constructor {
static step = function() {
var blend = inputs[| 3].getValue();
inputs[| 4].show_in_inspector = blend;
inputs[| 4].setVisible(blend);
}
}

View file

@ -423,15 +423,15 @@ function Node_Particle(_x, _y) : Node(_x, _y) constructor {
var _inSurf = inputs[| 0].getValue();
var _scatt = inputs[| 27].getValue();
inputs[| 25].show_in_inspector = false;
inputs[| 26].show_in_inspector = false;
inputs[| 28].show_in_inspector = _scatt == 2;
inputs[| 25].setVisible(false);
inputs[| 26].setVisible(false);
inputs[| 28].setVisible(_scatt == 2);
if(is_array(_inSurf)) {
inputs[| 25].show_in_inspector = true;
inputs[| 25].setVisible(true);
var _type = inputs[| 25].getValue();
if(_type == 2) {
inputs[| 26].show_in_inspector = true;
inputs[| 26].setVisible(true);
}
}

View file

@ -66,26 +66,26 @@ function Node_Particle_Effector(_x, _y) : Node(_x, _y) constructor {
var _type = inputs[| 5].getValue();
switch(_type) {
case FORCE_TYPE.Wind :
node_input_visible(inputs[| 6], true);
node_input_visible(inputs[| 10], false);
inputs[| 6].setVisible(true);
inputs[| 10].setVisible(false);
break;
case FORCE_TYPE.Accelerate :
node_input_visible(inputs[| 6], true);
node_input_visible(inputs[| 10], false);
inputs[| 6].setVisible(true);
inputs[| 10].setVisible(false);
break;
case FORCE_TYPE.Turbulence :
node_input_visible(inputs[| 6], true);
node_input_visible(inputs[| 10], true);
inputs[| 6].setVisible(true);
inputs[| 10].setVisible(true);
break;
case FORCE_TYPE.Destroy :
node_input_visible(inputs[| 6], false);
node_input_visible(inputs[| 8], false);
node_input_visible(inputs[| 9], false);
node_input_visible(inputs[| 10], false);
inputs[| 6].setVisible(false);
inputs[| 8].setVisible(false);
inputs[| 9].setVisible(false);
inputs[| 10].setVisible(false);
break;
default :
node_input_visible(inputs[| 6], false);
node_input_visible(inputs[| 10], false);
inputs[| 6].setVisible(false);
inputs[| 10].setVisible(false);
break;
}
}

View file

@ -35,9 +35,9 @@ function Node_Posterize(_x, _y) : Node_Processor(_x, _y) constructor {
static step = function() {
var _use_pal = inputs[| 2].getValue();
inputs[| 1].show_in_inspector = _use_pal;
inputs[| 3].show_in_inspector = !_use_pal;
inputs[| 4].show_in_inspector = !_use_pal;
inputs[| 1].setVisible(_use_pal);
inputs[| 3].setVisible(!_use_pal);
inputs[| 4].setVisible(!_use_pal);
}
static process_data = function(_outSurf, _data, _output_index) {

View file

@ -127,7 +127,7 @@ function NodeObject(_name, _spr, _create, tags = []) constructor {
var number = ds_list_create();
addNodeCatagory("Number", number);
addNodeObject(number, "Math", s_node_math, "Node_Math", Node_create_Math);
//addNodeObject(number, "Array", s_node_array, "Node_Array", Node_create_Array);
addNodeObject(number, "Array", s_node_array, "Node_Array", Node_create_Array);
addNodeObject(number, "Array length", s_node_array_length, "Node_Array_Length", Node_create_Array_Length);
addNodeObject(number, "Number", s_node_number, "Node_Number", Node_create_Number);
addNodeObject(number, "Vector2", s_node_vec2, "Node_Vector2", Node_create_Vector2);
@ -194,7 +194,7 @@ function NodeObject(_name, _spr, _create, tags = []) constructor {
NODE_CREATE_FUCTION[? "Node_Group"] = Node_create_Group;
#endregion
#region node load
#region node function
function nodeLoad(_data, scale = false) {
if(!ds_exists(_data, ds_type_map)) return noone;
@ -218,11 +218,24 @@ function NodeObject(_name, _spr, _create, tags = []) constructor {
return _node;
}
function node_delete(node) {
function nodeDelete(node) {
var list = node.group == -1? NODES : node.group.nodes;
ds_list_delete(list, ds_list_find_index(list, node));
node.destroy();
recordAction(ACTION_TYPE.node_deleted, node);
recordAction(ACTION_TYPE.node_delete, node);
}
function nodeCleanUp() {
var key = ds_map_find_first(NODE_MAP);
repeat(ds_map_size(NODE_MAP)) {
if(NODE_MAP[? key]) {
NODE_MAP[? key].cleanUp();
delete NODE_MAP[? key];
}
key = ds_map_find_next(NODE_MAP, key);
}
ds_map_clear(NODE_MAP);
ds_list_clear(NODES);
}
#endregion

View file

@ -91,6 +91,7 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
shader_set(sh_seperate_shape_counter);
texture_set_stage(shader_get_sampler_index(sh_seperate_shape_counter, "surface"), surface_get_texture(temp_surf[res_index]));
shader_set_uniform_f_array(shader_get_uniform(sh_seperate_shape_counter, "dimension"), [ ww, hh ]);
shader_set_uniform_i(shader_get_uniform(sh_seperate_shape_counter, "maxShape"), PREF_MAP[? "shape_separation_max"]);
draw_sprite_ext(s_fx_pixel, 0, 0, 0, PREF_MAP[? "shape_separation_max"], 1, 0, c_white, 1);
shader_reset();
BLEND_NORMAL

View file

@ -95,39 +95,39 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor {
switch(_shape) {
case NODE_SHAPE_TYPE.rectangle :
case NODE_SHAPE_TYPE.elipse :
node_input_visible(inputs[| 4], false);
node_input_visible(inputs[| 5], false);
node_input_visible(inputs[| 7], false);
node_input_visible(inputs[| 8], false);
node_input_visible(inputs[| 9], false);
inputs[| 4].setVisible(false);
inputs[| 5].setVisible(false);
inputs[| 7].setVisible(false);
inputs[| 8].setVisible(false);
inputs[| 9].setVisible(false);
break;
case NODE_SHAPE_TYPE.regular :
node_input_visible(inputs[| 4], true);
node_input_visible(inputs[| 5], false);
node_input_visible(inputs[| 7], true);
node_input_visible(inputs[| 8], false);
node_input_visible(inputs[| 9], true);
inputs[| 4].setVisible(true);
inputs[| 5].setVisible(false);
inputs[| 7].setVisible(true);
inputs[| 8].setVisible(false);
inputs[| 9].setVisible(true);
shader_set_uniform_i(uniform_side, _data[4]);
shader_set_uniform_f(uniform_angle, degtorad(_data[7]));
break;
case NODE_SHAPE_TYPE.star :
node_input_visible(inputs[| 4], true);
node_input_visible(inputs[| 5], true);
node_input_visible(inputs[| 7], true);
node_input_visible(inputs[| 8], false);
node_input_visible(inputs[| 9], true);
inputs[| 4].setVisible(true);
inputs[| 5].setVisible(true);
inputs[| 7].setVisible(true);
inputs[| 8].setVisible(false);
inputs[| 9].setVisible(true);
shader_set_uniform_i(uniform_side, _data[4]);
shader_set_uniform_f(uniform_angle, degtorad(_data[7]));
shader_set_uniform_f(uniform_inner, _data[5]);
break;
case NODE_SHAPE_TYPE.arc :
node_input_visible(inputs[| 4], false);
node_input_visible(inputs[| 5], true);
node_input_visible(inputs[| 7], false);
node_input_visible(inputs[| 8], true);
node_input_visible(inputs[| 9], true);
inputs[| 4].setVisible(false);
inputs[| 5].setVisible(true);
inputs[| 7].setVisible(false);
inputs[| 8].setVisible(true);
inputs[| 9].setVisible(true);
var ar = _data[8];
var center = degtorad(ar[0] + ar[1]) / 2;
@ -137,11 +137,11 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor {
shader_set_uniform_f(uniform_inner, _data[5] / 2);
break;
case NODE_SHAPE_TYPE.capsule :
node_input_visible(inputs[| 4], false);
node_input_visible(inputs[| 5], false);
node_input_visible(inputs[| 7], false);
node_input_visible(inputs[| 8], false);
node_input_visible(inputs[| 9], true);
inputs[| 4].setVisible(false);
inputs[| 5].setVisible(false);
inputs[| 7].setVisible(false);
inputs[| 8].setVisible(false);
inputs[| 9].setVisible(true);
break;
}

View file

@ -47,8 +47,8 @@ function Node_Render_Sprite_Sheet(_x, _y) : Node(_x, _y) constructor {
var pack = inputs[| 3].getValue();
var alig = inputs[| 5].getValue();
inputs[| 2].show_in_inspector = grup == SPRITE_ANIM_GROUP.animation;
inputs[| 4].show_in_inspector = pack == SPRITE_STACK.grid;
inputs[| 2].setVisible(grup == SPRITE_ANIM_GROUP.animation);
inputs[| 4].setVisible(pack == SPRITE_STACK.grid);
if(grup != SPRITE_ANIM_GROUP.animation) return;
if(safe_mod(ANIMATOR.current_frame, skip) != 0) return;

View file

@ -76,7 +76,7 @@ function Node_Text(_x, _y) : Node_Processor(_x, _y) constructor {
var _col = _data[5];
var _dim_type = _data[9];
inputs[| 6].show_in_inspector = !_dim_type;
inputs[| 6].setVisible(!_dim_type);
var _dim = _data[6];
var ww, hh;

View file

@ -152,15 +152,15 @@ function Node_Transform(_x, _y) : Node_Processor(_x, _y) constructor {
switch(out_type) {
case OUTPUT_SCALING.same_as_input :
node_input_visible(inputs[| 1], false);
inputs[| 1].setVisible(false);
break;
case OUTPUT_SCALING.constant :
node_input_visible(inputs[| 1], true);
inputs[| 1].setVisible(true);
_ww = out[0];
_hh = out[1];
break;
case OUTPUT_SCALING.relative :
node_input_visible(inputs[| 1], true);
inputs[| 1].setVisible(true);
_ww = ww * out[0];
_hh = hh * out[1];
break;

View file

@ -989,4 +989,11 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
log_warning("LOAD", "[Connect] " + txt);
return false;
}
static cleanUp = function() {
ds_list_destroy(value_to);
ds_list_destroy(extra_data);
value.cleanUp();
delete value;
}
}

View file

@ -594,7 +594,7 @@ function Panel_Graph(_panel) : PanelContent(_panel) constructor {
while(!ds_list_empty(node_focus.nodes)) {
node_focus.remove(node_focus.nodes[| 0]);
}
node_delete(node_focus);
nodeDelete(node_focus);
}
}
@ -630,10 +630,10 @@ function Panel_Graph(_panel) : PanelContent(_panel) constructor {
function doDelete() {
if(node_focus != noone)
node_delete(node_focus);
nodeDelete(node_focus);
for(var i = 0; i < ds_list_size(nodes_select_list); i++) {
node_delete(nodes_select_list[| i]);
nodeDelete(nodes_select_list[| i]);
}
ds_list_clear(nodes_select_list);
}

View file

@ -1,21 +1,10 @@
function NEW() {
clearNodes();
nodeCleanUp();
setPanel();
room_restart();
gc_collect();
setPath("");
}
function clearNodes() {
var key = ds_map_find_first(NODE_MAP);
repeat(ds_map_size(NODE_MAP)) {
if(NODE_MAP[? key])
delete NODE_MAP[? key];
key = ds_map_find_next(NODE_MAP, key);
}
ds_map_clear(NODE_MAP);
ds_list_clear(NODES);
SET_PATH("");
}
function save_serialize() {

View file

@ -37,7 +37,7 @@ void main() {
//contrast
float cont = contrast * contrast;
float c_factor = (1.004 * (1. + cont)) / (1.004 - cont);
float c_factor = (1. + cont) / (1. - cont);
vec4 col_c = c_factor * (col - .5) + .5;
col_c = clamp(col_c, vec4(0.), vec4(1.));

View file

@ -6,17 +6,18 @@ varying vec4 v_vColour;
uniform vec2 dimension;
uniform sampler2D surface;
uniform int maxShape;
void main() {
vec4 zero = vec4(0.);
vec2 pxPos = v_vTexcoord * vec2(32., 1.);
vec2 pxPos = v_vTexcoord * vec2(float(maxShape), 1.);
int amo = 0;
vec4 list[32];
vec4 list[1024];
for(float i = 0.; i <= dimension.x; i++)
for(float j = 0.; j <= dimension.y; j++) {
if(amo > 32) break;
if(amo > maxShape) break;
vec4 col = texture2D( surface, vec2(i, j) / dimension );
if(col != zero) {