trigger optim

This commit is contained in:
Tanasart 2024-11-26 11:52:57 +07:00
parent e4e98b4524
commit fc4e49517f
73 changed files with 430 additions and 518 deletions

View file

@ -12,7 +12,7 @@ if(!LOADING && PROJECT.active && !PROJECT.safeMode) { //node step
if(PANEL_MAIN != 0) PANEL_MAIN.step();
array_foreach(PROJECT.allNodes, function(_node) /*=>*/ {
if(!_node.active) return;
_node.triggerCheck();
if(_node.input_button_length || _node.use_trigger) _node.triggerCheck();
_node.step();
});
} catch(e) {

View file

@ -172,7 +172,7 @@ switch(load_process) {
if(!IS_CMD) {
PANEL_GRAPH.toCenterNode();
PANEL_GRAPH.connection_draw_update = true;
PANEL_GRAPH.draw_refresh = true;
}
log_message("FILE", $"load {path} completed in {(get_timer() - t0) / 1000} ms", THEME.noti_icon_file_load);

View file

@ -13,10 +13,7 @@ function __Node_3D_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constru
["Export", false], 1, 2,
];
insp1UpdateTooltip = "Export";
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
static onInspector1Update = function() { export(); }
setTrigger(1, "Export", [ THEME.sequence_control, 1, COLORS._main_value_positive ], function() /*=>*/ {return export()});
static export = function() {
var vert = getInputData(0);
@ -25,8 +22,8 @@ function __Node_3D_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constru
if(array_length(vert) == 0) return;
var oPath = path + ".obj";
var mPath = path + ".mtl";
var oPath = $"{path}.obj";
var mPath = $"{path}.mtl";
var fObj = file_text_open_write(oPath);
var fMtl = file_text_open_write(mPath);
@ -35,7 +32,7 @@ function __Node_3D_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constru
var _t = 1;
var _n = 1;
file_text_write_string(fObj, "mtllib " + filename_name(mPath) + "\n");
file_text_write_string(fObj, $"mtllib {filename_name(mPath)}\n");
for( var i = 0, n = array_length(vert); i < n; i++ ) {
file_text_write_string(fObj, "\n");
@ -43,22 +40,22 @@ function __Node_3D_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constru
var v = vert[i];
for( var j = 0; j < array_length(v.positions); j++ )
file_text_write_string(fObj, "v " + string_format(v.positions[j][0], 0, 5) + " " + string_format(-v.positions[j][1], 0, 5) + " " + string_format(v.positions[j][2], 0, 5) + "\n");
file_text_write_string(fObj, $"v {string_format(v.positions[j][0], 0, 5)} {string_format(-v.positions[j][1], 0, 5)} {string_format(v.positions[j][2], 0, 5)}\n");
for( var j = 0; j < array_length(v.textures); j++ )
file_text_write_string(fObj, "vt " + string_format(v.textures[j][0], 0, 5) + " " + string_format(1 - v.textures[j][1], 0, 5) + "\n");
file_text_write_string(fObj, $"vt {string_format(v.textures[j][0], 0, 5)} {string_format(1 - v.textures[j][1], 0, 5)}\n");
for( var j = 0; j < array_length(v.normals); j++ )
file_text_write_string(fObj, "vn " + string(v.normals[j][0]) + " " + string(v.normals[j][1]) + " " + string(v.normals[j][2]) + "\n");
file_text_write_string(fObj, $"vn {string(v.normals[j][0])} {string(v.normals[j][1])} {string(v.normals[j][2])}\n");
var mtlName = "material_" + string(i);
var mtlPath = filename_dir(mPath) + "/" + filename_name_only(oPath) + "_material_" + string(i) + ".png";
var mtlName = $"material_{i}";
var mtlPath = $"{filename_dir(mPath)}/{filename_name_only(oPath)}_material_{i}.png";
file_text_write_string(fObj, "\nusemtl " + mtlName + "\n");
file_text_write_string(fMtl, "newmtl " + mtlName + "\n");
file_text_write_string(fObj, $"\nusemtl {mtlName}\n");
file_text_write_string(fMtl, $"newmtl {mtlName}\n");
if(text) {
file_text_write_string(fMtl, "map_Kd " + filename_name(mtlPath) + "\n");
file_text_write_string(fMtl, $"map_Kd {filename_name(mtlPath)}\n");
surface_save_safe(v.renderSurface, mtlPath);
}
@ -67,10 +64,7 @@ function __Node_3D_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constru
var f1 = v.faces[j + 1];
var f2 = v.faces[j + 2];
file_text_write_string( fObj, "f " + string(_p + f0[0]) + "/" + string(_t + f0[2]) + "/" + string(_n + f0[1]) + " " +
string(_p + f1[0]) + "/" + string(_t + f1[2]) + "/" + string(_n + f1[1]) + " " +
string(_p + f2[0]) + "/" + string(_t + f2[2]) + "/" + string(_n + f2[1]) + " " + "\n"
);
file_text_write_string( fObj, $"f {_p + f0[0]}/{_t + f0[2]}/{_n + f0[1]} {_p + f1[0]}/{_t + f1[2]}/{_n + f1[1]} {_p + f2[0]}/{_t + f2[2]}/{_n + f2[1]} \n");
}
_p += array_length(v.positions);

View file

@ -4,6 +4,8 @@
#macro draw_clear draw_clear_ext_override
#macro __draw_clear draw_clear
function draw_set_color_alpha(col, alpha = 1) { draw_set_color(col); draw_set_alpha(alpha); }
function draw_set_color_ext(col) {
INLINE

View file

@ -348,7 +348,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
if(_focus) wid.register(_scrollPane);
if(is_instanceof(jun, __NodeValue_Dimension)) {
var _proj = jun.node.attributes.use_project_dimension;
var _proj = jun.attributes.use_project_dimension;
wid.side_button.icon_index = _proj;
wid.side_button.icon_blend = _proj? c_white : COLORS._main_icon;

View file

@ -16,10 +16,7 @@ function Node_3D_Mesh_Export(_x, _y, _group = noone) : Node(_x, _y, _group) cons
["Export", false], 1, 2, 3,
];
insp1UpdateTooltip = "Export";
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
static onInspector1Update = function() { export(); }
setTrigger(1, "Export", [ THEME.sequence_control, 1, COLORS._main_value_positive ], function() /*=>*/ {return export()});
static export = function() {
var _mesh = getInputData(0);

View file

@ -32,15 +32,7 @@ function Node_3D_Mesh_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
temp_surface = [ noone, noone ];
insp1UpdateTooltip = "Refresh";
insp1UpdateIcon = [ THEME.refresh_20, 0, COLORS._main_value_positive ];
static onInspector1Update = function(_fromValue = false) {
for(var i = 0; i < process_amount; i++) {
var _object = getObject(i);
_object.initModel();
}
}
setTrigger(1, "Refresh", [ THEME.refresh_20, 0, COLORS._main_value_positive ], function() /*=>*/ { for(var i = 0; i < process_amount; i++) getObject(i).initModel(); });
static step = function() {
var _double = getSingleValue(in_mesh + 4);

View file

@ -60,14 +60,8 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group)
materialIndex = [];
use_normal = false;
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { current_path = ""; outputs[0].setValue(noone); });
static onInspector1Update = function() {
current_path = "";
outputs[0].setValue(noone);
}
function setPath(path) { inputs[in_mesh + 0].setValue(path); }
static createNewInput = function(index = -1) { #region

View file

@ -22,9 +22,6 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
["Slices", false], 1, 3,
];
insp1UpdateTooltip = "Export";
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
params = {
mesh : noone,
dim : noone,
@ -56,13 +53,7 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
start_time = 0;
end_time = 0;
insp1UpdateTooltip = "Splice";
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
static onInspector1Update = function(_fromValue = false) {
meshInit();
spliceInit(true);
}
setTrigger(1, "Splice", [ THEME.sequence_control, 1, COLORS._main_value_positive ], function() /*=>*/ { meshInit(); spliceInit(true); });
static meshInit = function() {
start_time = get_timer();

View file

@ -30,8 +30,7 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group
static getNextNodes = function() { return allCached? getNextNodesExternal() : getNextNodesInternal(); }
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { #region
for( var i = 0, n = array_length(nodes); i < n; i++ ) {

View file

@ -44,8 +44,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }

View file

@ -26,8 +26,7 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
attribute_surface_depth();
attribute_interpolation();
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }

View file

@ -34,8 +34,7 @@ function Node_VFX_Triangulate(_x, _y, _group = noone) : Node(_x, _y, _group) con
[ "Rendering", false], 4, 2, 5, 3,
]
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }

View file

@ -303,13 +303,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
return true;
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
updatePaths(path_get(getInputData(0)));
triggerRender();
}
setTrigger(1, __txt("Refresh"), [THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { updatePaths(path_get(getInputData(0))); triggerRender(); });
static step = function() {
if(!attributes.file_checker) return;

View file

@ -33,13 +33,7 @@ function Node_Byte_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
array_push(attributeEditors, [ "File Watcher", function() { return attributes.file_checker; },
new checkBox(function() { attributes.file_checker = !attributes.file_checker; }) ]);
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
updatePaths(path_get(getInputData(0)));
triggerRender();
}
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { updatePaths(path_get(getInputData(0))); triggerRender(); });
function updatePaths(path = path_current) {
if(path == -1) return false;

View file

@ -21,8 +21,9 @@ function Node_Byte_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
buffer_save(cont, path);
}
setTrigger(1,,, function() /*=>*/ { getInputs(); writeFile(); });
static update = function(frame = CURRENT_FRAME) { writeFile(); }
static onInspector1Update = function() { getInputs(); writeFile(); }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);

View file

@ -14,13 +14,7 @@ function Node_Cache(_x, _y, _group = noone) : __Node_Cache(_x, _y, _group) const
cache_content = "";
cache_loading_progress = 0;
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
static onInspector2Update = function() {
clearCache(true);
enableNodeGroup();
}
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ], function() /*=>*/ { clearCache(true); enableNodeGroup(); });
static step = function() {
if(!cache_loading) return;

View file

@ -21,13 +21,7 @@ function Node_Cache_Array(_x, _y, _group = noone) : __Node_Cache(_x, _y, _group)
cache_content = "";
cache_loading_progress = 0;
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
static onInspector2Update = function() {
clearCache();
enableNodeGroup();
}
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ], function() /*=>*/ { clearCache(); enableNodeGroup(); });
static step = function() {
if(!cache_loading) return;

View file

@ -11,21 +11,20 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
group_alpha = 0;
vertex_hash = "";
insp1UpdateTooltip = "Generate cache group";
insp1UpdateIcon = [ THEME.cache_group, 0, COLORS._main_icon ];
setTrigger(1, "Generate cache group", [ THEME.cache_group, 0, COLORS._main_icon ]);
if(NOT_LOAD) run_in(1, function() { onInspector1Update(); });
static removeNode = function(node) { #region
static removeNode = function(node) {
if(node.cache_group != self) return;
array_remove(attributes.cache_group, node.node_id);
array_remove(cache_group_members, node);
node.cache_group = noone;
} #endregion
}
static addNode = function(node) { #region
static addNode = function(node) {
if(node.cache_group == self) return;
if(node.cache_group != noone)
node.cache_group.removeNode(node);
@ -34,15 +33,15 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
array_push(cache_group_members, node);
node.cache_group = self;
} #endregion
}
static enableNodeGroup = function() { #region
static enableNodeGroup = function() {
if(LOADING || APPENDING) return;
for( var i = 0, n = array_length(cache_group_members); i < n; i++ )
cache_group_members[i].renderActive = true;
clearCache(true);
} #endregion
}
static disableNodeGroup = function() {
if(LOADING || APPENDING) return;
@ -52,7 +51,7 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
cache_group_members[i].renderActive = false;
}
static refreshCacheGroup = function() { #region
static refreshCacheGroup = function() {
cache_group_members = [];
for( var i = 0, n = array_length(attributes.cache_group); i < n; i++ ) {
@ -65,9 +64,9 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
array_push(cache_group_members, _node);
_node.cache_group = self;
}
} #endregion
}
static getCacheGroup = function(node) { #region
static getCacheGroup = function(node) {
if(node != self) addNode(node);
for( var i = 0, n = array_length(node.inputs); i < n; i++ ) {
@ -78,19 +77,19 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
if(array_exists(attributes.cache_group, _from.node.node_id)) continue;
getCacheGroup(_from.node);
}
} #endregion
}
static onInspector1Update = function() { #region
setTrigger(1,,, function() /*=>*/ {
attributes.cache_group = [];
cache_group_members = [];
getCacheGroup(self);
refreshCacheGroup();
} #endregion
});
static ccw = function(a, b, c) { return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]); }
static getNodeBorder = function(_i, _vertex, _node) { #region
static getNodeBorder = function(_i, _vertex, _node) {
var _rad = 4;
var _stp = 15;
@ -104,9 +103,9 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
for( var i = 90; i <= 180; i += _stp ) _vertex[_i * 7 * 4 + _ind++] = [ _nx0 + lengthdir_x(_rad, i), _ny0 + lengthdir_y(_rad, i) ];
for( var i = 180; i <= 270; i += _stp ) _vertex[_i * 7 * 4 + _ind++] = [ _nx0 + lengthdir_x(_rad, i), _ny1 + lengthdir_y(_rad, i) ];
for( var i = 270; i <= 360; i += _stp ) _vertex[_i * 7 * 4 + _ind++] = [ _nx1 + lengthdir_x(_rad, i), _ny1 + lengthdir_y(_rad, i) ];
} #endregion
}
static refreshGroupBG = function() { #region
static refreshGroupBG = function() {
var _hash = "";
for( var i = -1, n = array_length(cache_group_members); i < n; i++ ) {
var _node = i == -1? self : cache_group_members[i];
@ -159,9 +158,9 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
array_pop(group_vertex);
array_push(group_vertex, _v);
}
} #endregion
}
static groupCheck = function(_x, _y, _s, _mx, _my) { #region
static groupCheck = function(_x, _y, _s, _mx, _my) {
if(array_length(group_vertex) < 3) return;
var _inGroup = true;
var _m = [ _mx / _s - _x, _my / _s - _y ];
@ -205,9 +204,9 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
group_dragging = false;
}
} #endregion
}
static drawNodeBG = function(_x, _y, _mx, _my, _s) { #region
static drawNodeBG = function(_x, _y, _mx, _my, _s) {
refreshGroupBG();
if(array_length(group_vertex) < 3) return;
@ -243,7 +242,7 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
draw_primitive_end();
draw_set_alpha(1);
} #endregion
}
static onDestroy = function() { enableNodeGroup(); }
}

View file

@ -237,20 +237,17 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
/////========== INSPECTOR ===========
hasInsp1 = false;
insp1UpdateTooltip = __txtx("panel_inspector_execute", "Execute node contents");
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
setTrigger(1, __txtx("panel_inspector_execute", "Execute node contents"), [ THEME.sequence_control, 1, COLORS._main_value_positive ], function() /*=>*/ {
array_foreach(NodeListSort(nodes), function(n) /*=>*/ { if(n.hasInspector1Update()) n.inspector1Update(); });
});
hasInsp2 = false;
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ], function() /*=>*/ {
array_foreach(NodeListSort(nodes), function(n) /*=>*/ { if(n.hasInspector2Update()) n.inspector2Update(); });
});
static inspector1Update = function() { onInspector1Update(); }
static onInspector1Update = function() { array_foreach(NodeListSort(nodes), function(n) { if(n.hasInspector1Update()) n.inspector1Update(); }); }
static hasInspector1Update = function() { INLINE return hasInsp1; }
static inspector2Update = function() { onInspector2Update(); }
static onInspector2Update = function() { array_foreach(NodeListSort(nodes), function(n) { if(n.hasInspector2Update()) n.inspector2Update(); }); }
static hasInspector2Update = function() { INLINE return hasInsp2; }
static hasInspector1Update = function() /*=>*/ {return hasInsp1};
static hasInspector2Update = function() /*=>*/ {return hasInsp2};
/////============ GROUP =============
@ -331,10 +328,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
}
static step = function() {
if(combine_render_time) {
render_time = 0;
array_foreach(getNodeList(), function(node) /*=>*/ { render_time += node.render_time; });
}
if(combine_render_time) render_time = array_reduce(getNodeList(), function(val, node) /*=>*/ { val += node.render_time; return val; }, 0);
onStep();
}

View file

@ -876,9 +876,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
static attributeDeserialize = function(attr) {
struct_append(attributes, attr);
if(struct_has(attributes, "use_project_dimension") && !struct_has(attr, "use_project_dimension"))
attributes.use_project_dimension = false;
if(struct_has(attr, "layer_visible"))
attributes.layer_visible = attr.layer_visible;

View file

@ -96,13 +96,7 @@ function Node_CSV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
return true;
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
updatePaths(path_get(getInputData(0)));
triggerRender();
}
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { updatePaths(path_get(getInputData(0))); triggerRender(); });
static step = function() {
if(attributes.file_checker && file_exists_empty(path_current)) {

View file

@ -21,7 +21,7 @@ function Node_CSV_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) cons
newInput(1, nodeValue("Content", self, CONNECT_TYPE.input, VALUE_TYPE.any, ""))
.setVisible(true, true);
static writeFile = function() { #region
static writeFile = function() {
var path = getInputData(0);
if(path == "") return;
if(filename_ext(path) != ".csv")
@ -45,12 +45,12 @@ function Node_CSV_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) cons
var f = file_text_open_write(path);
file_text_write_string(f, str);
file_text_close(f);
} #endregion
}
static update = function(frame = CURRENT_FRAME) { writeFile(); }
static onInspector1Update = function() { writeFile(); }
setTrigger(1,,, function() /*=>*/ {return writeFile()});
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
var str = filename_name(getInputData(0));
@ -60,5 +60,5 @@ function Node_CSV_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) cons
draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text);
var ss = string_scale(str, bbox.w, bbox.h);
draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0);
} #endregion
}
}

View file

@ -217,9 +217,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
attributes.node_param_width = PREFERENCES.node_param_width;
attributes.node_width = 0;
attributes.node_height = 0;
attributes.annotation = "";
attributes.outp_meta = false;
attributes.annotation = "";
attributes.annotation_size = .4;
attributes.annotation_color = COLORS._main_text_sub;
attributeEditors = [
"Display",
["Annotation", function() /*=>*/ {return attributes.annotation}, new textArea(TEXTBOX_INPUT.text, function(val) /*=>*/ { attributes.annotation = val; }) ],
@ -279,6 +282,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
is_group_io = false;
in_VFX = false;
use_trigger = false;
#endregion
#region ---- timeline ----
@ -543,19 +547,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static inspector2Update = function() { INLINE onInspector2Update(); }
static hasInspector2Update = function() { INLINE return onInspector2Update != noone; }
static setInspector = function(index, _tooltip, _icon, _function) {
if(index == 1) {
insp1UpdateTooltip = _tooltip;
insp1UpdateIcon = _icon;
onInspector1Update = _function;
} else if(index == 2) {
insp2UpdateTooltip = _tooltip;
insp2UpdateIcon = _icon;
onInspector2Update = _function;
}
}
/////============= STEP =============
static stepBegin = function() {
@ -564,9 +555,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
doStepBegin();
if(hasInspector1Update()) inspectInput1.name = insp1UpdateTooltip;
if(hasInspector2Update()) inspectInput2.name = insp2UpdateTooltip;
if(attributes.show_update_trigger) {
if(updatedInTrigger.getValue()) {
@ -589,26 +577,52 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static doStepBegin = function() {}
static triggerCheck = function() {
var i = 0;
static setTrigger = function(index, tooltip = __txtx("panel_inspector_execute", "Execute"), icon = [ THEME.sequence_control, 1, COLORS._main_value_positive ], _function = undefined) {
use_trigger = true;
repeat( input_button_length ) {
var _in = input_buttons[i++];
if(index == 1) {
insp1UpdateTooltip = tooltip;
insp1UpdateIcon = icon;
if(!is_undefined(_function)) onInspector1Update = _function;
if(_in.getStaticValue()) {
_in.editWidget.onClick();
_in.setValue(false);
} else if(index == 2) {
insp2UpdateTooltip = tooltip;
insp2UpdateIcon = icon;
if(!is_undefined(_function)) onInspector2Update = _function;
}
}
static triggerCheck = function() {
if(input_button_length) {
var i = 0;
repeat( input_button_length ) {
var _in = input_buttons[i++];
if(_in.getStaticValue()) {
_in.editWidget.onClick();
_in.setValue(false);
}
}
}
if(hasInspector1Update() && inspectInput1.getStaticValue()) {
onInspector1Update();
inspectInput1.setValue(false);
if(!use_trigger) return;
if(hasInspector1Update()) {
inspectInput1.name = insp1UpdateTooltip;
if(inspectInput1.getStaticValue()) {
onInspector1Update();
inspectInput1.setValue(false);
}
}
if(hasInspector2Update() && inspectInput2.getStaticValue()) {
onInspector2Update();
inspectInput2.setValue(false);
if(hasInspector2Update()) {
inspectInput2.name = insp2UpdateTooltip;
if(inspectInput2.getStaticValue()) {
onInspector2Update();
inspectInput2.setValue(false);
}
}
}
@ -1330,16 +1344,31 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}
__s = _s;
_ix = xx;
_iy = _junSy;
_ix = xx; _rix = x;
_iy = _junSy; _riy = y + _junRy;
_ox = xx + w * _s;
_oy = _junSy;
_ox = xx + w * _s; _rox = x + w;
_oy = _junSy; _roy = y + _junRy;
array_foreach(inputs, function(jun) /*=>*/ { jun.x = _ix; jun.y = _iy; });
array_foreach(inputDisplayList, function(jun) /*=>*/ { jun.x = _ix; jun.y = _iy; _iy += junction_draw_hei_y * __s; });
array_foreach(outputs_index, function(jun) /*=>*/ { jun = outputs[jun]; jun.x = _ox; jun.y = _oy; _oy += junction_draw_hei_y * jun.isVisible() * __s; });
array_foreach(inputDisplayList, function(jun) /*=>*/ {
jun.x = _ix; jun.rx = _rix;
jun.y = _iy; jun.ry = _riy;
_riy += junction_draw_hei_y;
_iy += junction_draw_hei_y * __s;
});
array_foreach(outputs_index, function(jun) /*=>*/ {
jun = outputs[jun];
jun.x = _ox; jun.rx = _rox;
jun.y = _oy; jun.ry = _roy;
var __vis = jun.isVisible();
_roy += junction_draw_hei_y * __vis
_oy += junction_draw_hei_y * __vis * __s;
});
array_foreach(inputs, function(jun) /*=>*/ { jun = jun.bypass_junc; if(!jun.visible) return;
jun.x = _ox; jun.y = _oy; _oy += junction_draw_hei_y * jun.visible * __s; });
@ -1937,8 +1966,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if((previewable && _s >= 0.75) || (!previewable && h * _s >= name_height * .5)) drawNodeName(xx, yy, _s, _panel);
if(attributes.annotation != "") {
draw_set_text(f_sdf_medium, fa_left, fa_bottom, COLORS._main_text_sub);
var _ts = _s * 0.4;
draw_set_text(f_sdf_medium, fa_left, fa_bottom, attributes.annotation_color);
var _ts = _s * attributes.annotation_size;
BLEND_ADD
draw_text_ext_transformed(xx, yy - 4 * _s, attributes.annotation, -1, (w + 8) * _s / _ts, _ts, _ts, 0);
BLEND_NORMAL
@ -2260,13 +2290,19 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(struct_try_get(attri, "node_width") == 0) struct_remove(attri, "node_width");
if(struct_try_get(attri, "node_height") == 0) struct_remove(attri, "node_height");
if(struct_try_get(attri, "node_param_width") == 192) struct_remove(attri, "node_param_width");
if(struct_try_get(attri, "annotation") == "") struct_remove(attri, "annotation");
if(struct_try_get(attri, "outp_meta") == false) struct_remove(attri, "outp_meta");
if(struct_try_get(attri, "annotation") == "") struct_remove(attri, "annotation");
if(struct_try_get(attri, "annotation_size") == .4) struct_remove(attri, "annotation_size");
if(struct_try_get(attri, "annotation_color") == COLORS._main_text_sub) struct_remove(attri, "annotation_color");
if(struct_try_get(attri, "color") == -1) struct_remove(attri, "color");
if(struct_try_get(attri, "update_graph") == true) struct_remove(attri, "update_graph");
if(struct_try_get(attri, "show_update_trigger") == false) struct_remove(attri, "show_update_trigger");
if(struct_try_get(attri, "array_process") == 0) struct_remove(attri, "array_process");
if(struct_has(attri, "use_project_dimension")) struct_remove(attri, "use_project_dimension");
if(struct_names_count(attri)) _map.attri = attri;
#endregion
@ -2350,8 +2386,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
_lattr.node_width = struct_try_get(_lattr, "node_width", 0);
_lattr.node_height = struct_try_get(_lattr, "node_height", 0);
_lattr.node_param_width = struct_try_get(_lattr, "node_param_width", 192);
_lattr.annotation = struct_try_get(_lattr, "annotation", "");
_lattr.outp_meta = struct_try_get(_lattr, "outp_meta", false);
_lattr.color = struct_try_get(_lattr, "color", -1);
_lattr.update_graph = struct_try_get(_lattr, "update_graph", true);
_lattr.show_update_trigger = struct_try_get(_lattr, "show_update_trigger", false);

View file

@ -122,13 +122,7 @@ function Node_Directory_Search(_x, _y, _group = noone) : Node(_x, _y, _group) co
setDisplayName(filename_name_only(_p));
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
updatePaths();
triggerRender();
}
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { updatePaths(); triggerRender(); });
static step = function() {
if(attributes.file_checker) {

View file

@ -68,12 +68,12 @@ function Node_Display_Image(_x, _y, _group = noone) : Node(_x, _y, _group) const
UNDO_HOLDING = true;
}
static onInspector1Update = function() {
setTrigger(1,,, function() /*=>*/ {
var path = getInputData(0);
if(path == "") return;
updatePaths(path);
update();
}
});
function updatePaths(path) {
path = path_get(path);

View file

@ -705,13 +705,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
CLI_EXPORT_AMOUNT++;
}
insp1UpdateTooltip = "Export";
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
insp2UpdateTooltip = "Export All";
insp2UpdateIcon = [ THEME.play_all, 0, COLORS._main_value_positive ];
static onInspector1Update = function(_fromValue = false) {
setTrigger(1, "Export", [ THEME.sequence_control, 1, COLORS._main_value_positive ], function(_fromValue = false) /*=>*/ {
if(IS_RENDERING) return;
if(_fromValue) {
@ -721,12 +715,12 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
if(isInLoop()) RENDER_ALL
else doInspectorAction();
}
});
static onInspector2Update = function(_fromValue = false) {
setTrigger(2, "Export All", [ THEME.play_all, 0, COLORS._main_value_positive ], function() /*=>*/ {
if(IS_RENDERING) return;
exportAll();
}
});
static doInspectorAction = function() {
if(!IS_CMD && (LOADING || APPENDING)) return;

View file

@ -3,20 +3,16 @@ function Node_Gradient_Points(_x, _y, _group = noone) : Node_Processor(_x, _y, _
newInput(0, nodeValue_Dimension(self));
newInput(1, nodeValue_Vec2("Center 1", self, [ 0, 0 ] ))
.setUnitRef(function(index) { return getDimension(index); });
newInput(1, nodeValue_Vec2("Center 1", self, [ 0, 0 ])).setUnitRef(function(index) /*=>*/ {return getDimension(index)});
newInput(2, nodeValue_Color("Color 1", self, cola(c_white) ));
newInput(3, nodeValue_Vec2("Center 2", self, [ DEF_SURF_W, 0 ] ))
.setUnitRef(function(index) { return getDimension(index); });
newInput(3, nodeValue_Vec2("Center 2", self, [ DEF_SURF_W, 0 ])).setUnitRef(function(index) /*=>*/ {return getDimension(index)});
newInput(4, nodeValue_Color("Color 2", self, cola(c_white) ));
newInput(5, nodeValue_Vec2("Center 3", self, [ 0, DEF_SURF_H ] ))
.setUnitRef(function(index) { return getDimension(index); });
newInput(5, nodeValue_Vec2("Center 3", self, [ 0, DEF_SURF_H ])).setUnitRef(function(index) /*=>*/ {return getDimension(index)});
newInput(6, nodeValue_Color("Color 3", self, cola(c_white) ));
newInput(7, nodeValue_Vec2("Center 4", self, DEF_SURF , { useGlobal : false }))
.setUnitRef(function(index) { return getDimension(index); });
newInput(7, nodeValue_Vec2("Center 4", self, [ DEF_SURF_W, DEF_SURF_H ])).setUnitRef(function(index) /*=>*/ {return getDimension(index)});
newInput(8, nodeValue_Color("Color 4", self, cola(c_white) ));
newInput(9, nodeValue_Bool("Use palette", self, false ));

View file

@ -25,43 +25,43 @@ globalvar GROUP_IO_TYPE_NAME, GROUP_IO_TYPE_MAP, GROUP_IO_DISPLAY;
/*Integer*/ [ "Default", "Range", "Rotation", "Rotation range", "Slider", "Slider range", "Padding", "Vector", "Vector range", "Area", "Enum button", "Menu scroll" ],
/*Float*/ [ "Default", "Range", "Rotation", "Rotation range", "Slider", "Slider range", "Padding", "Vector", "Vector range", "Area" ],
/*Boolean*/ 0,
/*Boolean*/ [ "Default" ],
/*Color*/ [ "Default", "Gradient", "Palette" ],
/*Surface*/ 0,
/*Surface*/ [ "Default" ],
/*Path*/ 0,
/*Curve*/ [ "Curve", ],
/*Text*/ 0,
/*Object*/ 0,
/*Node*/ 0,
/*Path*/ [ "Default" ],
/*Curve*/ [ "Curve", ],
/*Text*/ [ "Default" ],
/*Object*/ [ "Default" ],
/*Node*/ [ "Default" ],
/*3D*/ 0,
/*Any*/ 0,
/*Pathnode*/ 0,
/*Particle*/ 0,
/*Rigid*/ 0,
/*3D*/ [ "Default" ],
/*Any*/ [ "Default" ],
/*Pathnode*/ [ "Default" ],
/*Particle*/ [ "Default" ],
/*Rigid*/ [ "Default" ],
/*Sdomain*/ 0,
/*Struct*/ 0,
/*Strand*/ 0,
/*Mesh*/ 0,
/*Trigger*/ 0,
/*Sdomain*/ [ "Default" ],
/*Struct*/ [ "Default" ],
/*Strand*/ [ "Default" ],
/*Mesh*/ [ "Default" ],
/*Trigger*/ [ "Default" ],
//=========================//
/*Noone*/ 0,
/*3D Mesh*/ 0,
/*3D Light*/ 0,
/*3D Camera*/ 0,
/*3D Scene*/ 0,
/*Noone*/ [ "Default" ],
/*3D Mesh*/ [ "Default" ],
/*3D Light*/ [ "Default" ],
/*3D Camera*/ [ "Default" ],
/*3D Scene*/ [ "Default" ],
/*3D Material*/ 0,
/*noone*/ 0,
/*PCX*/ 0,
/*Audio*/ 0,
/*Fdomain*/ 0,
/*3D Material*/ [ "Default" ],
/*noone*/ [ "Default" ],
/*PCX*/ [ "Default" ],
/*Audio*/ [ "Default" ],
/*Fdomain*/ [ "Default" ],
/*SDF*/ 0,
/*SDF*/ [ "Default" ],
];
#endregion
@ -401,27 +401,23 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
static step = function() {
if(is_undefined(inParent)) return;
var _type = getInputData(2);
var _dsList = array_safe_get_fast(GROUP_IO_DISPLAY, _type);
if(_dsList == 0) _dsList = [ "Default" ];
inputs[0].display_data.data = _dsList;
inputs[0].editWidget.data_list = _dsList;
if(inParent.name != display_name) {
inParent.name = display_name;
group.inputMap[$ string_replace_all(display_name, " ", "_")] = inParent;
}
if(inParent.type == VALUE_TYPE.trigger) {
if(doTrigger == 1) {
if(inParent.type != VALUE_TYPE.trigger) return;
switch(doTrigger) {
case 1 :
outputs[0].setValue(true);
doTrigger = -1;
} else if(doTrigger == -1) {
break;
case -1 :
outputs[0].setValue(false);
doTrigger = 0;
}
break;
}
}
@ -431,7 +427,12 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
var _dstype = getInputData(0);
var _data = getInputData(2);
var _dsList = array_safe_get_fast(GROUP_IO_DISPLAY, _data);
_dstype = _dsList == 0? "Default" : array_safe_get_fast(_dsList, _dstype);
if(!is_array(_dsList)) _dsList = [ "Default" ];
inputs[0].display_data.data = _dsList;
inputs[0].editWidget.data_list = _dsList;
_dstype = array_safe_get_fast(_dsList, _dstype);
var _datype = array_safe_get_fast(GROUP_IO_TYPE_MAP, _data, VALUE_TYPE.any);
@ -468,8 +469,36 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
outputs[0].setValue(inParent.getValue());
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static getGraphPreviewSurface = function() { var _in = array_safe_get(inputs, 0, noone); return _in == noone? noone : _in.getValue(); }
static drawNodeDef = drawNode;
static drawNode = function(_draw, _x, _y, _mx, _my, _s, display_parameter = noone, _panel = noone) {
if(_s >= .75) return drawNodeDef(_draw, _x, _y, _mx, _my, _s, display_parameter, _panel);
var xx = x * _s + _x;
var yy = y * _s + _y;
var _name = renamed? display_name : name;
var _ts = _s * 0.5;
var _tx = round(xx + (w - 6) * _s - 2);
var _ty = round(outputs[0].y);
draw_set_text(f_sdf, fa_right, fa_center);
BLEND_ALPHA_MULP
draw_set_color(0); draw_text_transformed(_tx + 1, _ty + 1, _name, _ts, _ts, 0);
draw_set_color(COLORS._main_text); draw_text_transformed(_tx, _ty, _name, _ts, _ts, 0);
BLEND_NORMAL
return _s > 0.5? drawJunctions(_draw, xx, yy, _mx, _my, _s) : drawJunctions_fast(_draw, xx, yy, _mx, _my, _s);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static postDeserialize = function() { createInput(false); }
static postApplyDeserialize = function() {
@ -483,6 +512,8 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
group.sortIO();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static onDestroy = function() {
if(is_undefined(inParent)) return;

View file

@ -99,7 +99,36 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
outParent.setValue(inputs[0].getValue());
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static getGraphPreviewSurface = function() { var _in = array_safe_get(inputs, 0, noone); return _in == noone? noone : _in.getValue(); }
static drawNodeDef = drawNode;
static drawNode = function(_draw, _x, _y, _mx, _my, _s, display_parameter = noone, _panel = noone) {
if(_s >= .75) return drawNodeDef(_draw, _x, _y, _mx, _my, _s, display_parameter, _panel);
var xx = x * _s + _x;
var yy = y * _s + _y;
var _name = renamed? display_name : name;
var _ts = _s * 0.5;
var _tx = round(xx + 6 * _s + 2);
var _ty = round(inputs[0].y);
draw_set_text(f_sdf, fa_left, fa_center);
BLEND_ALPHA_MULP
draw_set_color(0); draw_text_transformed(_tx + 1, _ty + 1, _name, _ts, _ts, 0);
draw_set_color(COLORS._main_text); draw_text_transformed(_tx, _ty, _name, _ts, _ts, 0);
BLEND_NORMAL
return _s > 0.5? drawJunctions(_draw, xx, yy, _mx, _my, _s) : drawJunctions_fast(_draw, xx, yy, _mx, _my, _s);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static postDeserialize = function() { if(group == noone) return; createOutput(false); }
static postApplyDeserialize = function() {}

View file

@ -222,13 +222,7 @@ void main(in VertexShaderOutput _input, out PixelShaderOutput output) {
} if(!LOADING && !APPENDING) refreshDynamicInput();
insp1UpdateTooltip = __txt("Compile");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
refreshShader();
triggerRender();
}
setTrigger(1, __txt("Compile"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { refreshShader(); triggerRender(); });
static step = function() { argument_renderer.showValue = input_display_list[9][1]; }

View file

@ -13,17 +13,12 @@ function Node_HTTP_request(_x, _y, _group = noone) : Node(_x, _y, _group) constr
address_domain = "";
downloaded_size = 0;
insp1UpdateTooltip = "Trigger";
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
setTrigger(1, "Trigger", [ THEME.sequence_control, 1, COLORS._main_value_positive ], function() /*=>*/ {return request()});
attributes.max_file_size = 10000;
array_push(attributeEditors, "HTTP");
array_push(attributeEditors, ["Max request size", function() { return attributes.max_file_size; }, new textBox(TEXTBOX_INPUT.number, function(val) { attributes.max_file_size = val; }) ]);
static onInspector1Update = function() {
request();
}
static request = function() {
var _addr = getInputData(0);
var _type = getInputData(1);

View file

@ -88,13 +88,7 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
spr = createSprite(path);
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
updatePaths(path_get(getInputData(0)));
triggerRender();
}
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { updatePaths(path_get(getInputData(0))); triggerRender(); });
static step = function() {
var path = path_get(getInputData(0));

View file

@ -146,13 +146,7 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons
return true;
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() { #region
updatePaths(path_get(getInputData(0)));
triggerRender();
} #endregion
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { updatePaths(path_get(getInputData(0))); triggerRender(); });
static step = function() { #region
var str = getInputData(2);

View file

@ -90,12 +90,7 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
return false;
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
updatePaths(path_get(getInputData(0)));
}
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { updatePaths(path_get(getInputData(0))); });
function updatePaths(path = path_current) {
if(path == -1) return false;

View file

@ -88,13 +88,7 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons
return false;
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
updatePaths();
triggerRender();
}
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { updatePaths(); triggerRender(); });
function updatePaths() {
var _paths = getInputData(0);

View file

@ -39,10 +39,7 @@ function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
attribute_surface_depth();
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
static onInspector2Update = function() { clearCache(); }
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ], function() /*=>*/ { clearCache(); });
static step = function() {
__step_mask_modifier();

View file

@ -57,13 +57,7 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
return false;
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
updatePaths(path_get(getInputData(0)));
triggerRender();
}
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { updatePaths(path_get(getInputData(0))); triggerRender(); });
function updatePaths(path) {
if(path == -1) return false;

View file

@ -32,7 +32,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
writeFile();
}
static onInspector1Update = function() { writeFile(); }
setTrigger(1,,, function() /*=>*/ {return writeFile()});
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);

View file

@ -628,8 +628,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
array_push(_data, _value_list);
}
if(array_length(values) == 1)
return { d: _data[0][1] };
if(array_length(values) == 1) return { d: _data[0][1] };
return _data;
}

View file

@ -287,12 +287,9 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
];
#endregion
insp1UpdateTooltip = "Generate";
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
setTrigger(1, "Generate", [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ {return Mesh_build()});
will_triangluate = false;
static onInspector1Update = function() { Mesh_build(); }
static onValueFromUpdate = function(index) {
if(LOADING || APPENDING) return;

View file

@ -29,8 +29,7 @@ function Node_MK_Delay_Machine(_x, _y, _group = noone) : Node(_x, _y, _group) co
["Render", false], 3, 5, 6, 4, 7, 8,
];
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }

View file

@ -25,8 +25,7 @@ function Node_Onion_Skin(_x, _y, _group = noone) : Node(_x, _y, _group) construc
["Render", false], 2, 3, 4, 6,
];
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }

View file

@ -37,8 +37,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
curr_dimension = [ 0, 0 ];
render_amount = 0;
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }

View file

@ -63,7 +63,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
attribute_surface_depth();
static onInspector1Update = function(updateAll = true) { initSurface(true); PROJECT.animator.render(); }
setTrigger(1,,, function() /*=>*/ { initSurface(true); PROJECT.animator.render(); });
static step = function() {
var inpt = getInputData(0);

View file

@ -10,8 +10,7 @@ function Node_Revert(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
["Surfaces", true], 0,
];
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() {
clearCache(true);

View file

@ -23,8 +23,7 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
attributes.show_objects = !attributes.show_objects;
})]);
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }

View file

@ -379,8 +379,8 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
surface_set_target(_outSurf);
gpu_set_tex_filter(getAttribute("interpolate") > 1);
DRAW_CLEAR
switch(blend) {
case 0 :
if(mulpA) BLEND_ALPHA_MULP
@ -501,7 +501,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
case NODE_SCATTER_DIST.tile :
if(_scat == 0) {
var _acol = i % uniAmo[0];
var _acol = i % uniAmo[0];
var _arow = floor(i / uniAmo[0]);
_x = uniAmo[0] == 1? _dim[0] / 2 : (_acol + 0.5) * _dim[0] / ( uniAmo[0] );
@ -615,18 +615,11 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
_y = round(_y);
}
if(_useAtl) {
if(!is(_atl, SurfaceAtlasFast)) _atl = new SurfaceAtlasFast(surf, _x, _y, _r, _scx, _scy, clr, alp);
else _atl.set(surf, _x, _y, _r, _scx, _scy, clr, alp);
_atl.w = sw;
_atl.h = sh;
} else {
if(!is(_atl, SurfaceAtlasFast)) _atl = new SurfaceAtlasFast(surf, _x, _y, _r, _scx, _scy, clr, alp);
_atl.w = sw;
_atl.h = sh;
}
if(!is(_atl, SurfaceAtlasFast)) _atl = new SurfaceAtlasFast(surf, _x, _y, _r, _scx, _scy, clr, alp);
else _atl.set(surf, _x, _y, _r, _scx, _scy, clr, alp);
_atl.w = sw;
_atl.h = sh;
_sct[_sct_len] = _atl;
_sct_len++;

View file

@ -35,7 +35,7 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons
_prev_type = -1;
static onInspector1Update = function() { separateShape(); }
setTrigger(1,,, function() /*=>*/ {return separateShape()});
static update = function() {
separateShape();

View file

@ -6,14 +6,13 @@ function Node_Shell(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
newInput(1, nodeValue_Text("Script", self, ""));
insp1UpdateTooltip = "Run";
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
setTrigger(1, "Run", [ THEME.sequence_control, 1, COLORS._main_value_positive ]);
trusted = PROGRAM_ARGUMENTS._trusted;
static onValueUpdate = function() { trusted = false; }
static onInspector1Update = function() { update(); }
setTrigger(1,,, function() /*=>*/ {return update()});
static update = function() {
var _pro = getInputData(0);

View file

@ -28,8 +28,7 @@ function Node_Smoke_Render(_x, _y, _group = noone) : Node_Smoke(_x, _y, _group)
attribute_surface_depth();
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }

View file

@ -28,8 +28,7 @@ function Node_Smoke_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
onSetDisplayName = noone;
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }

View file

@ -33,8 +33,7 @@ function Node_Strand_Render(_x, _y, _group = noone) : Node(_x, _y, _group) const
["Color", false], 4, 5,
];
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }

View file

@ -27,8 +27,7 @@ function Node_Strand_Render_Texture(_x, _y, _group = noone) : Node(_x, _y, _grou
["Texture", false], 4, 3,
];
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }

View file

@ -65,13 +65,7 @@ function Node_SVG(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
return;
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
readFile(path_get(getInputData(0)));
triggerRender();
}
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { readFile(path_get(getInputData(0))); triggerRender(); });
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var _scale = getInputData(1);

View file

@ -56,13 +56,7 @@ function Node_Text_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
return false;
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
updatePaths(path_get(getInputData(0)));
triggerRender();
}
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { updatePaths(path_get(getInputData(0))); triggerRender(); });
function updatePaths(path = path_current) {
if(path == -1) return false;

View file

@ -24,8 +24,9 @@ function Node_Text_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
file_text_close(f);
}
setTrigger(1,,, function() /*=>*/ { getInputs(); writeFile(); });
static update = function(frame = CURRENT_FRAME) { writeFile(); }
static onInspector1Update = function() { getInputs(); writeFile(); }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);

View file

@ -33,10 +33,7 @@ function Node_Tile_Tilemap_Export(_x, _y, _group = noone) : Node(_x, _y, _group)
["Godot", true], 8,
];
insp1UpdateTooltip = "Export";
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
static onInspector1Update = function(_fromValue = false) { export(); }
setTrigger(1, "Export", [ THEME.sequence_control, 1, COLORS._main_value_positive ], function() /*=>*/ {return export()});
static export = function() {
var tilemap = inputs[0].getValue();

View file

@ -34,8 +34,7 @@ function Node_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
attribute_surface_depth();
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() {
clearCache(true);

View file

@ -7,8 +7,7 @@ function Node_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
newOutput(0, nodeValue_Output("Trigger", self, VALUE_TYPE.trigger, false ));
insp2UpdateTooltip = "Trigger";
insp2UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
setTrigger(2, "Trigger", [ THEME.sequence_control, 1, COLORS._main_value_positive ]);
static onInspector2Update = function() { inputs[0].setAnim(true); inputs[0].setValue(true); }

View file

@ -26,8 +26,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
error_notification = noone;
insp2UpdateTooltip = "Create tunnel out";
insp2UpdateIcon = [ THEME.tunnel, 0, c_white ];
setTrigger(2, "Create tunnel out", [ THEME.tunnel, 0, c_white ]);
static onInspector2Update = function() {
var _node = nodeBuild("Node_Tunnel_Out", x + 128, y).skipDefault();

View file

@ -25,8 +25,7 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
newOutput(0, nodeValue_Output("Value out", self, VALUE_TYPE.any, noone ));
insp2UpdateTooltip = "Goto tunnel in";
insp2UpdateIcon = [ THEME.tunnel, 1, c_white ];
setTrigger(2, "Goto tunnel in", [ THEME.tunnel, 1, c_white ]);
static onInspector2Update = function() {
var _key = inputs[0].getValue();

View file

@ -17,12 +17,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static DISPLAY_DATA_KEYS = [ "atlas_crop" ];
#region ---- main ----
active = true;
from = noone;
node = _node;
x = node.x;
y = node.y;
tags = VALUE_TAG.none;
active = true;
from = noone;
node = _node;
tags = VALUE_TAG.none;
x = node.x; rx = node.x;
y = node.y; ry = node.y;
index = array_length(node.inputs);
type = _type;
@ -568,17 +569,17 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var _txt = TEXTBOX_INPUT.number;
switch(display_type) {
case VALUE_DISPLAY._default : #region
editWidget = new textBox(_txt, function(val) { return setValueInspector(val); } );
case VALUE_DISPLAY._default :
editWidget = new textBox(_txt, function(val) /*=>*/ {return setValueInspector(val)});
if(struct_has(display_data, "unit")) editWidget.unit = display_data.unit;
if(struct_has(display_data, "front_button")) editWidget.front_button = display_data.front_button;
extract_node = "Node_Number";
break; #endregion
break;
case VALUE_DISPLAY.range : #region
editWidget = new rangeBox(_txt, function(val, index) { return setValueInspector(val, index); } );
case VALUE_DISPLAY.range :
editWidget = new rangeBox(_txt, function(val, index) /*=>*/ {return setValueInspector(val, index)});
if(!struct_has(display_data, "linked")) display_data.linked = false;
@ -586,47 +587,36 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i);
extract_node = "Node_Number";
break; #endregion
break;
case VALUE_DISPLAY.vector : #region
case VALUE_DISPLAY.vector :
var val = animator.getValue();
var len = array_length(val);
if(len <= 4) {
editWidget = new vectorBox(len, function(val, index) { return setValueInspector(val, index); }, unit );
editWidget = new vectorBox(len, function(val, index) /*=>*/ {return setValueInspector(val, index)}, unit );
if(struct_has(display_data, "label")) editWidget.axis = display_data.label;
if(struct_has(display_data, "linkable")) editWidget.linkable = display_data.linkable;
if(struct_has(display_data, "per_line")) editWidget.per_line = display_data.per_line;
if(struct_has(display_data, "linked")) editWidget.linked = display_data.linked;
if(len == 2) {
var _dim = struct_try_get(display_data, "useGlobal", true);
extract_node = [ "Node_Vector2", "Node_Path" ];
if(_dim && array_equals(def_val, DEF_SURF)) {
node.attributes.use_project_dimension = true;
editWidget.side_button = button(function() /*=>*/ {
node.attributes.use_project_dimension = !node.attributes.use_project_dimension;
node.triggerRender();
}).setIcon(THEME.node_use_project, 0, COLORS._main_icon).setTooltip("Use project dimension");
}
} else if(len == 3)
extract_node = "Node_Vector3";
else if(len == 4)
extract_node = "Node_Vector4";
switch(len) {
case 2 : extract_node = [ "Node_Vector2", "Node_Path" ]; break;
case 3 : extract_node = "Node_Vector3"; break;
case 4 : extract_node = "Node_Vector4"; break;
}
}
for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = " " + string(array_safe_get_fast(global.displaySuffix_Axis, i));
animators[i].suffix = $" {array_safe_get_fast(global.displaySuffix_Axis, i)}";
break; #endregion
break;
case VALUE_DISPLAY.vector_range : #region
case VALUE_DISPLAY.vector_range :
var val = animator.getValue();
editWidget = new vectorRangeBox(array_length(val), _txt, function(val, index) { return setValueInspector(val, index); }, unit );
editWidget = new vectorRangeBox(array_length(val), _txt, function(val, index) /*=>*/ {return setValueInspector(val, index)}, unit );
if(!struct_has(display_data, "linked")) display_data.linked = false;
if(!struct_has(display_data, "ranged")) display_data.ranged = false;
@ -636,100 +626,97 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
else if(array_length(val) == 4) extract_node = "Node_Vector4";
for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = " " + string(array_safe_get_fast(global.displaySuffix_VecRange, i));
animators[i].suffix = $" {array_safe_get_fast(global.displaySuffix_VecRange, i)}";
break; #endregion
break;
case VALUE_DISPLAY.rotation : #region
case VALUE_DISPLAY.rotation :
var _step = struct_try_get(display_data, "step", -1);
editWidget = new rotator(function(val) {
return setValueInspector(val);
}, _step );
editWidget = new rotator(function(val) /*=>*/ {return setValueInspector(val)}, _step);
extract_node = "Node_Number";
break; #endregion
break;
case VALUE_DISPLAY.rotation_range : #region
editWidget = new rotatorRange(function(val, index) { return setValueInspector(val, index); } );
case VALUE_DISPLAY.rotation_range :
editWidget = new rotatorRange(function(val, index) /*=>*/ {return setValueInspector(val, index)});
for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i);
animators[i].suffix = $" {array_safe_get_fast(global.displaySuffix_Range, i)}";
extract_node = "Node_Vector2";
break; #endregion
break;
case VALUE_DISPLAY.rotation_random : #region
editWidget = new rotatorRandom(function(val, index) { return setValueInspector(val, index); } );
case VALUE_DISPLAY.rotation_random :
editWidget = new rotatorRandom(function(val, index) /*=>*/ {return setValueInspector(val, index)});
extract_node = "Node_Vector2";
break; #endregion
break;
case VALUE_DISPLAY.slider : #region
case VALUE_DISPLAY.slider :
var _range = struct_try_get(display_data, "range", [ 0, 1 ]);
editWidget = new textBox(TEXTBOX_INPUT.number, function(val) { return setValueInspector(toNumber(val)); } )
editWidget = new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ {return setValueInspector(toNumber(val))})
.setSlideRange(_range[0], _range[1]);
if(struct_has(display_data, "update_stat"))
editWidget.update_stat = display_data.update_stat;
extract_node = "Node_Number";
break; #endregion
break;
case VALUE_DISPLAY.slider_range : #region
case VALUE_DISPLAY.slider_range :
var _range = struct_try_get(display_data, "range", [ 0, 1, 0.01 ]);
editWidget = new sliderRange(_range[2], type == VALUE_TYPE.integer, [ _range[0], _range[1] ],
function(val, index) { return setValueInspector(val, index); } );
editWidget = new sliderRange(_range[2], type == VALUE_TYPE.integer, [ _range[0], _range[1] ], function(val, index) /*=>*/ {return setValueInspector(val, index)});
for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i);
animators[i].suffix = $" {array_safe_get_fast(global.displaySuffix_Range, i)}";
extract_node = "Node_Vector2";
break; #endregion
break;
case VALUE_DISPLAY.area : #region
editWidget = new areaBox(function(val, index) { return setValueInspector(val, index); }, unit);
case VALUE_DISPLAY.area :
editWidget = new areaBox(function(val, index) /*=>*/ {return setValueInspector(val, index)}, unit);
editWidget.onSurfaceSize = struct_try_get(display_data, "onSurfaceSize", noone);
editWidget.showShape = struct_try_get(display_data, "useShape", true);
for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Area, i, "");
animators[i].suffix = $" {array_safe_get_fast(global.displaySuffix_Area, i, "")}";
extract_node = "Node_Area";
break; #endregion
break;
case VALUE_DISPLAY.padding : #region
editWidget = new paddingBox(function(val, index) { return setValueInspector(val, index); }, unit);
case VALUE_DISPLAY.padding :
editWidget = new paddingBox(function(val, index) /*=>*/ {return setValueInspector(val, index)}, unit);
for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Padding, i);
animators[i].suffix = $" {array_safe_get_fast(global.displaySuffix_Padding, i)}";
extract_node = "Node_Vector4";
break; #endregion
break;
case VALUE_DISPLAY.corner : #region
editWidget = new cornerBox(function(val, index) { return setValueInspector(val, index); }, unit);
case VALUE_DISPLAY.corner :
editWidget = new cornerBox(function(val, index) /*=>*/ {return setValueInspector(val, index)}, unit);
for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Padding, i);
animators[i].suffix = $" {array_safe_get_fast(global.displaySuffix_Padding, i)}";
extract_node = "Node_Vector4";
break; #endregion
break;
case VALUE_DISPLAY.puppet_control : #region
editWidget = new controlPointBox(function(val, index) { return setValueInspector(val, index); });
case VALUE_DISPLAY.puppet_control :
editWidget = new controlPointBox(function(val, index) /*=>*/ {return setValueInspector(val, index)});
extract_node = "";
break; #endregion
break;
case VALUE_DISPLAY.enum_scroll : #region
case VALUE_DISPLAY.enum_scroll :
if(!is_struct(display_data)) display_data = { data: display_data };
var choices = __txt_junction_data(instanceof(node), connect_type, index, display_data.data);
editWidget = new scrollBox(choices, function(val) /*=>*/ { if(val == -1) return; return setValueInspector(toNumber(val)); } );
editWidget = new scrollBox(choices, function(val) /*=>*/ { return val == -1? undefined : setValueInspector(toNumber(val)); } );
if(struct_has(display_data, "update_hover")) editWidget.update_hover = display_data.update_hover;
if(struct_has(display_data, "horizontal")) editWidget.horizontal = display_data.horizontal;
@ -739,76 +726,76 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
rejectConnect();
key_inter = CURVE_TYPE.cut;
extract_node = "";
break; #endregion
break;
case VALUE_DISPLAY.enum_button : #region
case VALUE_DISPLAY.enum_button :
if(!is_struct(display_data)) display_data = { data: display_data };
var choices = __txt_junction_data(instanceof(node), connect_type, index, display_data.data);
editWidget = new buttonGroup(choices, function(val) { return setValueInspector(val); } );
editWidget = new buttonGroup(choices, function(val) /*=>*/ {return setValueInspector(val)});
rejectConnect();
key_inter = CURVE_TYPE.cut;
extract_node = "";
break; #endregion
break;
case VALUE_DISPLAY.matrix : #region
editWidget = new matrixGrid(_txt, display_data.size, function(val, index) { return setValueInspector(val, index); }, unit );
case VALUE_DISPLAY.matrix :
editWidget = new matrixGrid(_txt, display_data.size, function(val, index) /*=>*/ {return setValueInspector(val, index)}, unit );
for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = $" {i}";
extract_node = "";
break; #endregion
break;
case VALUE_DISPLAY.boolean_grid : #region
editWidget = new matrixGrid(_txt, display_data.size, function(val, index) { return setValueInspector(val, index); }, unit );
case VALUE_DISPLAY.boolean_grid :
editWidget = new matrixGrid(_txt, display_data.size, function(val, index) /*=>*/ {return setValueInspector(val, index)}, unit );
for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = $" {i}";
extract_node = "";
break; #endregion
break;
case VALUE_DISPLAY.transform : #region
editWidget = new transformBox(function(val, index) { return setValueInspector(val, index); });
case VALUE_DISPLAY.transform :
editWidget = new transformBox(function(val, index) /*=>*/ {return setValueInspector(val, index)});
extract_node = "Node_Transform_Array";
break; #endregion
break;
case VALUE_DISPLAY.toggle : #region
editWidget = new toggleGroup(display_data.data, function(val) { return setValueInspector(val); } );
case VALUE_DISPLAY.toggle :
editWidget = new toggleGroup(display_data.data, function(val) /*=>*/ {return setValueInspector(val)});
rejectConnect();
key_inter = CURVE_TYPE.cut;
extract_node = "";
break; #endregion
break;
case VALUE_DISPLAY.d3quarternion : #region
editWidget = new quarternionBox(function(val, index) { return setValueInspector(val, index); });
case VALUE_DISPLAY.d3quarternion :
editWidget = new quarternionBox(function(val, index) /*=>*/ {return setValueInspector(val, index)});
extract_node = "Node_Vector4";
attributes.angle_display = QUARTERNION_DISPLAY.euler;
break; #endregion
break;
case VALUE_DISPLAY.path_anchor : #region
editWidget = new pathAnchorBox(function(val, index) { return setValueInspector(val, index); });
case VALUE_DISPLAY.path_anchor :
editWidget = new pathAnchorBox(function(val, index) /*=>*/ {return setValueInspector(val, index)});
extract_node = "Node_Path_Anchor";
break; #endregion
break;
}
if(editWidget && struct_has(editWidget, "setSlideType")) editWidget.setSlideType(type == VALUE_TYPE.integer);
break;
case VALUE_TYPE.boolean : #region
case VALUE_TYPE.boolean :
if(name == "Active") editWidget = new checkBoxActive(function() /*=>*/ {return setValueInspector(!animator.getValue())} );
else editWidget = new checkBox( function() /*=>*/ {return setValueInspector(!animator.getValue())} );
key_inter = CURVE_TYPE.cut;
extract_node = "Node_Boolean";
break; #endregion
break;
case VALUE_TYPE.color :
switch(display_type) {
@ -962,7 +949,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
case VALUE_TYPE.d3Material :
show_in_inspector = true;
editWidget = new materialBox(function(ind) {
editWidget = new materialBox(function(ind) /*=>*/ {
var res = setValueInspector(ind);
node.triggerRender();
return res;
@ -1556,7 +1543,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(!updated) return false; /////////////////////////////////////////////////////////////////////////////////
if(is_instanceof(self, __NodeValue_Dimension))
node.attributes.use_project_dimension = false;
attributes.use_project_dimension = false;
if(connect_type == CONNECT_TYPE.input && self.index >= 0) {
var _val = animator.getValue(time);
@ -2176,7 +2163,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
#region attributes
attri = variable_clone(attributes);
if(struct_try_get(attri, "mapped") == 0) struct_remove(attri, "mapped");
if(struct_try_get(attri, "mapped") == 0) struct_remove(attri, "mapped");
if(struct_try_get(attri, "use_project_dimension") == true) struct_remove(attri, "use_project_dimension");
if(struct_names_count(attri)) _map.attri = attri;
#endregion
@ -2210,8 +2198,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
draw_line_shift_y = struct_try_get(_map, "shift_y", 0);
is_modified = struct_try_get(_map, "is_modified", false);
if(struct_has(_map, "attri"))
if(struct_has(_map, "attri")) {
struct_append(attributes, _map.attri);
if(struct_has(attributes, "use_project_dimension") && struct_has(node.attributes, "use_project_dimension"))
attributes.use_project_dimension = node.attributes.use_project_dimension;
}
if(struct_has(_map, "linked"))
display_data.linked = _map.linked;

View file

@ -4,6 +4,12 @@ function __NodeValue_Dimension(_node, value) : NodeValue("Dimension", _node, CON
setDisplay(VALUE_DISPLAY.vector);
def_length = 2;
attributes.use_project_dimension = true;
editWidget.side_button = button(function() /*=>*/ {
attributes.use_project_dimension = !attributes.use_project_dimension;
node.triggerRender();
}).setIcon(THEME.node_use_project, 0, COLORS._main_icon).setTooltip("Use project dimension");
/////============== GET =============
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
@ -53,7 +59,7 @@ function __NodeValue_Dimension(_node, value) : NodeValue("Dimension", _node, CON
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
if(node.attributes.use_project_dimension)
if(attributes.use_project_dimension)
return PROJECT.attributes.surface_dimension;
if(!is_anim) {
@ -69,8 +75,8 @@ function __NodeValue_Dimension(_node, value) : NodeValue("Dimension", _node, CON
return animator.getValue(_time);
}
static showValue = function() { ////showValue
if(node.attributes.use_project_dimension)
static showValue = function() {
if(attributes.use_project_dimension)
return PROJECT.attributes.surface_dimension;
return __showValue();

View file

@ -143,23 +143,15 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
}
#region ++++ inspector ++++
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ {
var path = getInputData(0);
if(path == "") return;
updatePaths(path);
update();
});
insp2UpdateTooltip = __txtx("play_with_timeline", "Play with timeline");
insp2UpdateIcon = [ THEME.play_sound, 1, COLORS._main_icon_light ];
setTrigger(2, __txtx("play_with_timeline", "Play with timeline"), [ THEME.play_sound, 1, COLORS._main_icon_light ], function() /*=>*/ { attributes.play = !attributes.play; });
attributes.play = true;
static onInspector1Update = function() {
var path = getInputData(0);
if(path == "") return;
updatePaths(path);
update();
}
static onInspector2Update = function() {
attributes.play = !attributes.play;
}
#endregion
static step = function() {

View file

@ -25,12 +25,7 @@ function Node_WAV_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) cons
[ "Format", false], 2, 3,
]
insp1UpdateTooltip = "Export";
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
export();
}
setTrigger(1, "Export", [ THEME.sequence_control, 1, COLORS._main_value_positive ], function() /*=>*/ {return export()});
static step = function() {
var remap = getInputData(4);

View file

@ -57,7 +57,7 @@ function Node_Websocket_Receiver(_x, _y, _group = noone) : Node(_x, _y, _group)
}
}
setInspector(1, __txt("Refresh Server"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() { setPort(); });
setTrigger(1, __txt("Refresh Server"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() { setPort(); });
static asyncPackets = function(_async_load) {
if(!active) return;

View file

@ -60,7 +60,7 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co
logNode($"Connected to {newUrl}:{newPort}");
}
setInspector(1, __txt("Resend"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() { triggerRender(); });
setTrigger(1, __txt("Resend"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() { triggerRender(); });
static sendCall = function(ID, params) {
var network = ds_map_try_get(NETWORK_CLIENTS, ID, noone);

View file

@ -76,13 +76,7 @@ function Node_XML_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
return true;
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
updatePaths(getInputData(0));
triggerRender();
}
setTrigger(1, __txt("Refresh"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() /*=>*/ { updatePaths(getInputData(0)); triggerRender(); });
static step = function() {
if(attributes.file_checker && file_exists_empty(path_current)) {

View file

@ -25,8 +25,8 @@ function Node_XML_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) cons
file_text_write_all(path, str);
}
setTrigger(1,,, function() /*=>*/ {return writeFile()});
static update = function(frame = CURRENT_FRAME) { writeFile(); }
static onInspector1Update = function() { writeFile(); }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);

View file

@ -402,6 +402,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
add_node_draw_x = 0;
add_node_draw_y = 0;
draw_refresh = true;
node_surface = surface_create(1, 1);
node_surface_update = true;
@ -1205,6 +1206,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var _upd = false;
_upd |= pFOCUS && mouse_click(mb_any);
_upd |= draw_refresh; draw_refresh = false;
_upd |= connection_cache[$ "_x"] != _x; connection_cache[$ "_x"] = _x;
_upd |= connection_cache[$ "_y"] != _y; connection_cache[$ "_y"] = _y;
@ -1609,12 +1611,12 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var t = get_timer();
node_surface_update |= !surface_valid(node_surface, w, h);
// node_surface_update |= !surface_valid(node_surface, w, h);
node_surface_update |= true;
node_surface = surface_verify(node_surface, w, h);
// node_surface = surface_verify(node_surface, w, h);
surface_set_target(node_surface);
if(node_surface_update) draw_clear_alpha(bg_color, 0.);
// surface_set_target(node_surface);
// if(node_surface_update) draw_clear_alpha(bg_color, 0.);
if(node_surface_update) array_foreach(_node_draw, function(_n) /*=>*/ { _n.drawNodeBehind(__gr_x, __gr_y, __mx, __my, __gr_s); });
array_foreach(value_draggings, function(_v) /*=>*/ { _v.graph_selecting = true; });
@ -1631,16 +1633,16 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(node_surface_update) array_foreach(_node_draw, function(_n) /*=>*/ { _n.drawBadge(__gr_x, __gr_y, __gr_s); });
if(node_surface_update) array_foreach(_node_draw, function(_n) /*=>*/ { _n.drawNodeFG(__gr_x, __gr_y, __mx, __my, __gr_s, display_parameter, __self); });
surface_reset_target();
// surface_reset_target();
node_surface_update = false;
if(PANEL_INSPECTOR && PANEL_INSPECTOR.prop_hover != noone)
value_focus = PANEL_INSPECTOR.prop_hover;
BLEND_ALPHA_MULP
draw_surface_safe(node_surface);
BLEND_NORMAL
// BLEND_ALPHA_MULP
// draw_surface_safe(node_surface);
// BLEND_NORMAL
printIf(log, $"Draw node: {get_timer() - t}"); t = get_timer();
@ -2874,8 +2876,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(array_empty(nodes_selecting)) return;
clipboard_set_text("");
var _map = {};
_map.nodes = [];
var _map = {
version: SAVE_VERSION,
nodes: [],
};
for(var i = 0; i < array_length(nodes_selecting); i++)
SAVE_NODE(_map.nodes, nodes_selecting[i],,,, getCurrentContext());

View file

@ -834,6 +834,9 @@ function Panel_Inspector() : PanelContent() constructor {
_colsp = false;
yy += pad;
// draw_set_color(COLORS.panel_bg_clear_inner); // clear content below before drawing, animated section collapse, maybe?
// draw_rectangle(0, yy, w, h, false);
var txt = __txt(jun[0]);
var coll = jun[1] && filter_text == "";

View file

@ -162,8 +162,8 @@ function SAVE_NODE(_arr, _node, dx = 0, dy = 0, scale = false, context = PANEL_G
m.x -= dx;
m.y -= dy;
var c = context == noone? noone : context.node_id;
if(m.group == c) m.group = noone;
if(context != noone && struct_has(m, "group") && m.group == context.node_id)
m.group = noone;
array_push(_arr, m);
}