mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
[Interlace] Fix unnecessary cache clear.
This commit is contained in:
parent
bb1dcd7b2d
commit
69628d31dc
13 changed files with 159 additions and 108 deletions
|
@ -1245,6 +1245,7 @@
|
||||||
{"name":"notification_system","order":7,"path":"scripts/notification_system/notification_system.yy",},
|
{"name":"notification_system","order":7,"path":"scripts/notification_system/notification_system.yy",},
|
||||||
{"name":"number_function","order":14,"path":"scripts/number_function/number_function.yy",},
|
{"name":"number_function","order":14,"path":"scripts/number_function/number_function.yy",},
|
||||||
{"name":"obj_reader","order":2,"path":"scripts/obj_reader/obj_reader.yy",},
|
{"name":"obj_reader","order":2,"path":"scripts/obj_reader/obj_reader.yy",},
|
||||||
|
{"name":"outputBox","order":15,"path":"scripts/outputBox/outputBox.yy",},
|
||||||
{"name":"pack_bottom_left","order":2,"path":"scripts/pack_bottom_left/pack_bottom_left.yy",},
|
{"name":"pack_bottom_left","order":2,"path":"scripts/pack_bottom_left/pack_bottom_left.yy",},
|
||||||
{"name":"pack_corner","order":3,"path":"scripts/pack_corner/pack_corner.yy",},
|
{"name":"pack_corner","order":3,"path":"scripts/pack_corner/pack_corner.yy",},
|
||||||
{"name":"pack_shelf","order":1,"path":"scripts/pack_shelf/pack_shelf.yy",},
|
{"name":"pack_shelf","order":1,"path":"scripts/pack_shelf/pack_shelf.yy",},
|
||||||
|
|
|
@ -1856,6 +1856,7 @@
|
||||||
{"id":{"name":"number_function","path":"scripts/number_function/number_function.yy",},},
|
{"id":{"name":"number_function","path":"scripts/number_function/number_function.yy",},},
|
||||||
{"id":{"name":"obj_reader","path":"scripts/obj_reader/obj_reader.yy",},},
|
{"id":{"name":"obj_reader","path":"scripts/obj_reader/obj_reader.yy",},},
|
||||||
{"id":{"name":"object_get_depth","path":"scripts/object_get_depth/object_get_depth.yy",},},
|
{"id":{"name":"object_get_depth","path":"scripts/object_get_depth/object_get_depth.yy",},},
|
||||||
|
{"id":{"name":"outputBox","path":"scripts/outputBox/outputBox.yy",},},
|
||||||
{"id":{"name":"pack_best_fit","path":"scripts/pack_best_fit/pack_best_fit.yy",},},
|
{"id":{"name":"pack_best_fit","path":"scripts/pack_best_fit/pack_best_fit.yy",},},
|
||||||
{"id":{"name":"pack_bottom_left","path":"scripts/pack_bottom_left/pack_bottom_left.yy",},},
|
{"id":{"name":"pack_bottom_left","path":"scripts/pack_bottom_left/pack_bottom_left.yy",},},
|
||||||
{"id":{"name":"pack_corner","path":"scripts/pack_corner/pack_corner.yy",},},
|
{"id":{"name":"pack_corner","path":"scripts/pack_corner/pack_corner.yy",},},
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
|
#macro __d3d_input_list_mesh ["Mesh", false]
|
||||||
|
|
||||||
function Node_3D_Mesh(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group) constructor {
|
function Node_3D_Mesh(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group) constructor {
|
||||||
name = "3D Mesh";
|
name = "3D Mesh";
|
||||||
|
|
||||||
in_mesh = array_length(inputs);
|
in_mesh = array_length(inputs);
|
||||||
|
|
||||||
outputs[0] = nodeValue_Output("Mesh", self, VALUE_TYPE.d3Mesh, noone);
|
outputs[0] = nodeValue_Output("Mesh", self, VALUE_TYPE.d3Mesh, noone);
|
||||||
|
|
||||||
#macro __d3d_input_list_mesh ["Mesh", false]
|
|
||||||
|
|
||||||
static processData = function(_output, _data, _output_index, _array_index = 0) {}
|
static processData = function(_output, _data, _output_index, _array_index = 0) {}
|
||||||
}
|
}
|
|
@ -53,7 +53,6 @@ function Node_MK_Delay_Machine(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||||
var _blnd = getInputData(8);
|
var _blnd = getInputData(8);
|
||||||
|
|
||||||
cacheCurrentFrame(_surf);
|
cacheCurrentFrame(_surf);
|
||||||
|
|
||||||
random_set_seed(_seed);
|
random_set_seed(_seed);
|
||||||
|
|
||||||
var _sw = surface_get_width_safe(_surf);
|
var _sw = surface_get_width_safe(_surf);
|
||||||
|
|
|
@ -28,9 +28,7 @@ function Node_3D_Mesh_Cube(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group
|
||||||
["Material", false], in_mesh + 0, in_mesh + 1, in_mesh + 2, in_mesh + 3, in_mesh + 4, in_mesh + 5, in_mesh + 6,
|
["Material", false], in_mesh + 0, in_mesh + 1, in_mesh + 2, in_mesh + 3, in_mesh + 4, in_mesh + 5, in_mesh + 6,
|
||||||
]
|
]
|
||||||
|
|
||||||
static onDrawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {
|
static onDrawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static step = function() {
|
static step = function() {
|
||||||
var _mat_side = getInputData(in_mesh + 0);
|
var _mat_side = getInputData(in_mesh + 0);
|
||||||
|
|
|
@ -111,6 +111,8 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// w = _typ == VALUE_TYPE.surface? 128 : 96;
|
||||||
|
|
||||||
refreshDynamicInput();
|
refreshDynamicInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -400,6 +400,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
static refreshDynamicInput = function() {
|
static refreshDynamicInput = function() {
|
||||||
|
if(LOADING || APPENDING) return;
|
||||||
|
|
||||||
var _in = [];
|
var _in = [];
|
||||||
|
|
||||||
for( var i = 0; i < input_fix_len; i++ )
|
for( var i = 0; i < input_fix_len; i++ )
|
||||||
|
@ -2068,7 +2070,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
static _clearCacheForward = function() {
|
static _clearCacheForward = function() {
|
||||||
if(!isRenderActive()) return;
|
if(!isRenderActive()) return;
|
||||||
|
|
||||||
clearCache();
|
|
||||||
var arr = getNextNodesRaw();
|
var arr = getNextNodesRaw();
|
||||||
for( var i = 0, n = array_length(arr); i < n; i++ )
|
for( var i = 0, n = array_length(arr); i < n; i++ )
|
||||||
arr[i]._clearCacheForward();
|
arr[i]._clearCacheForward();
|
||||||
|
@ -2265,7 +2266,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
if(anim_timeline && attributes.show_timeline) refreshTimeline();
|
if(anim_timeline && attributes.show_timeline) refreshTimeline();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inputBalance = function() { //Cross version compatibility for dynamic input nodes
|
static inputBalance = function() { // Cross-version compatibility for dynamic input nodes
|
||||||
if(!struct_has(load_map, "data_length"))
|
if(!struct_has(load_map, "data_length"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2286,6 +2287,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
|
|
||||||
for( var i = _dynamic_inputs; i >= 1; i-- ) {
|
for( var i = _dynamic_inputs; i >= 1; i-- ) {
|
||||||
var _ind = _input_fix_len + i * _data_length;
|
var _ind = _input_fix_len + i * _data_length;
|
||||||
|
|
||||||
if(_pad_dyna > 0)
|
if(_pad_dyna > 0)
|
||||||
repeat(_pad_dyna) array_insert(load_map.inputs, _ind, noone);
|
repeat(_pad_dyna) array_insert(load_map.inputs, _ind, noone);
|
||||||
else
|
else
|
||||||
|
@ -2295,10 +2297,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
var _pad_fix = input_fix_len - _input_fix_len;
|
var _pad_fix = input_fix_len - _input_fix_len;
|
||||||
repeat(_pad_fix)
|
repeat(_pad_fix)
|
||||||
array_insert(load_map.inputs, _input_fix_len, noone);
|
array_insert(load_map.inputs, _input_fix_len, noone);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inputGenerate = function() { //Generate input for dynamic input nodes
|
static inputGenerate = function() { // Generate inputs for dynamic input nodes
|
||||||
if(createNewInput == noone)
|
if(createNewInput == noone)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -243,6 +243,7 @@
|
||||||
case "input" :
|
case "input" :
|
||||||
map = node.inputMap;
|
map = node.inputMap;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "outputs" :
|
case "outputs" :
|
||||||
case "output" :
|
case "output" :
|
||||||
map = node.outputMap;
|
map = node.outputMap;
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||||
name = "Interlace";
|
name = "Interlace";
|
||||||
|
|
||||||
|
update_on_frame = true;
|
||||||
|
use_cache = CACHE_USE.manual;
|
||||||
|
clearCacheOnChange = false;
|
||||||
|
|
||||||
newInput(0, nodeValue_Surface("Surface in", self));
|
newInput(0, nodeValue_Surface("Surface in", self));
|
||||||
|
|
||||||
newInput(1, nodeValue_Bool("Active", self, true));
|
newInput(1, nodeValue_Bool("Active", self, true));
|
||||||
|
@ -23,8 +27,6 @@ function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
|
||||||
|
|
||||||
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
|
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
|
||||||
|
|
||||||
temp_surface = [ ];
|
|
||||||
|
|
||||||
input_display_list = [ 1,
|
input_display_list = [ 1,
|
||||||
["Surface", false], 0, 2, 3, 4,
|
["Surface", false], 0, 2, 3, 4,
|
||||||
["Effects", false], 7, 8, 9,
|
["Effects", false], 7, 8, 9,
|
||||||
|
@ -32,22 +34,28 @@ function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
|
||||||
|
|
||||||
attribute_surface_depth();
|
attribute_surface_depth();
|
||||||
|
|
||||||
static step = function() { #region
|
insp2UpdateTooltip = "Clear cache";
|
||||||
|
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
|
||||||
|
|
||||||
|
static onInspector2Update = function() { clearCache(); }
|
||||||
|
|
||||||
|
static step = function() {
|
||||||
__step_mask_modifier();
|
__step_mask_modifier();
|
||||||
|
}
|
||||||
|
|
||||||
} #endregion
|
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||||
|
|
||||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
|
||||||
var _surf = _data[0];
|
var _surf = _data[0];
|
||||||
var _axis = _data[7];
|
var _axis = _data[7];
|
||||||
var _size = _data[8];
|
var _size = _data[8];
|
||||||
var _invt = _data[9];
|
var _invt = _data[9];
|
||||||
|
|
||||||
var _dim = surface_get_dimension(_surf);
|
var _dim = surface_get_dimension(_surf);
|
||||||
|
var _prev = array_safe_get_fast(cached_output, CURRENT_FRAME - 1, noone);
|
||||||
|
|
||||||
surface_set_shader(_outSurf, sh_interlaced);
|
surface_set_shader(_outSurf, sh_interlaced);
|
||||||
shader_set_i("useSurf", CURRENT_FRAME >= 1);
|
shader_set_i("useSurf", is_surface(_prev));
|
||||||
shader_set_surface("prevFrame", array_safe_get(temp_surface, _array_index));
|
shader_set_surface("prevFrame", _prev);
|
||||||
|
|
||||||
shader_set_2("dimension", _dim);
|
shader_set_2("dimension", _dim);
|
||||||
shader_set_i("axis", _axis);
|
shader_set_i("axis", _axis);
|
||||||
shader_set_i("invert", _invt);
|
shader_set_i("invert", _invt);
|
||||||
|
@ -56,15 +64,12 @@ function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
|
||||||
draw_surface_safe(_surf);
|
draw_surface_safe(_surf);
|
||||||
surface_reset_shader();
|
surface_reset_shader();
|
||||||
|
|
||||||
temp_surface[_array_index] = surface_verify(array_safe_get(temp_surface, _array_index), _dim[0], _dim[1]);
|
cacheCurrentFrame(_surf);
|
||||||
surface_set_shader(temp_surface[_array_index], noone);
|
|
||||||
draw_surface_safe(_surf);
|
|
||||||
surface_reset_shader();
|
|
||||||
|
|
||||||
__process_mask_modifier(_data);
|
__process_mask_modifier(_data);
|
||||||
_outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]);
|
_outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]);
|
||||||
_outSurf = channel_apply(_data[0], _outSurf, _data[4]);
|
_outSurf = channel_apply(_data[0], _outSurf, _data[4]);
|
||||||
|
|
||||||
return _outSurf;
|
return _outSurf;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -245,7 +245,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
/////============= META =============
|
/////============= META =============
|
||||||
|
|
||||||
static setDummy = function(get_node, _dummy_undo = -1, _dummy_redo = -1) { #region
|
static setDummy = function(get_node, _dummy_undo = -1, _dummy_redo = -1) {
|
||||||
is_dummy = true;
|
is_dummy = true;
|
||||||
dummy_get = get_node;
|
dummy_get = get_node;
|
||||||
|
|
||||||
|
@ -253,47 +253,47 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
dummy_redo = _dummy_redo;
|
dummy_redo = _dummy_redo;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setActive = function(_active, _tooltip) { #region
|
static setActive = function(_active, _tooltip) {
|
||||||
INLINE
|
INLINE
|
||||||
active = _active;
|
active = _active;
|
||||||
active_tooltip = _tooltip;
|
active_tooltip = _tooltip;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setWindows = function() { #region
|
static setWindows = function() {
|
||||||
INLINE
|
INLINE
|
||||||
setActive(OS == os_windows, "Not available on MacOS");
|
setActive(OS == os_windows, "Not available on MacOS");
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setTooltip = function(_tip) { tooltip = _tip; return self; }
|
static setTooltip = function(_tip) { tooltip = _tip; return self; }
|
||||||
|
|
||||||
static nonValidate = function() { #region
|
static nonValidate = function() {
|
||||||
validateValue = false;
|
validateValue = false;
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static nonForward = function() { #region
|
static nonForward = function() {
|
||||||
forward = false;
|
forward = false;
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
/////============= NAME =============
|
/////============= NAME =============
|
||||||
|
|
||||||
static getName = function() { #region
|
static getName = function() {
|
||||||
if(name_custom) return name;
|
if(name_custom) return name;
|
||||||
return __txt_junction_name(instanceof(node), connect_type, index, name);
|
return __txt_junction_name(instanceof(node), connect_type, index, name);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setName = function(_name) { #region
|
static setName = function(_name) {
|
||||||
INLINE
|
INLINE
|
||||||
name = _name;
|
name = _name;
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
/////============= VALUE ============
|
/////============= VALUE ============
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static setDefault = function(vals) { #region
|
static setDefault = function(vals) {
|
||||||
if(LOADING || APPENDING) return self;
|
if(LOADING || APPENDING) return self;
|
||||||
|
|
||||||
animator.values = [];
|
animator.values = [];
|
||||||
|
@ -315,17 +315,17 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
array_push(animator.values, new valueKey(vals[i][0], vals[i][1], animator));
|
array_push(animator.values, new valueKey(vals[i][0], vals[i][1], animator));
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static resetValue = function() { #region
|
static resetValue = function() {
|
||||||
unit.mode = def_unit;
|
unit.mode = def_unit;
|
||||||
setValue(unit.apply(variable_clone(def_val)));
|
setValue(unit.apply(variable_clone(def_val)));
|
||||||
attributes.mapped = false;
|
attributes.mapped = false;
|
||||||
|
|
||||||
is_modified = false;
|
is_modified = false;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setUnitRef = function(ref, mode = VALUE_UNIT.constant) { #region
|
static setUnitRef = function(ref, mode = VALUE_UNIT.constant) {
|
||||||
express_edit.side_button = unit.triggerButton;
|
express_edit.side_button = unit.triggerButton;
|
||||||
display_data.onSurfaceSize = ref;
|
display_data.onSurfaceSize = ref;
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
cache_value[0] = false;
|
cache_value[0] = false;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setValidator = function(val) {
|
static setValidator = function(val) {
|
||||||
validator = val;
|
validator = val;
|
||||||
|
@ -355,12 +355,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
static setArrayDepth = function(aDepth) { array_depth = aDepth; return self; }
|
static setArrayDepth = function(aDepth) { array_depth = aDepth; return self; }
|
||||||
static setArrayDynamic = function() { dynamic_array = true; return self; }
|
static setArrayDynamic = function() { dynamic_array = true; return self; }
|
||||||
|
|
||||||
static rejectArrayProcess = function() { #region
|
static rejectArrayProcess = function() {
|
||||||
process_array = false;
|
process_array = false;
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setDropKey = function() { #region
|
static setDropKey = function() {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case VALUE_TYPE.integer : drop_key = "Number"; break;
|
case VALUE_TYPE.integer : drop_key = "Number"; break;
|
||||||
case VALUE_TYPE.float : drop_key = "Number"; break;
|
case VALUE_TYPE.float : drop_key = "Number"; break;
|
||||||
|
@ -380,7 +380,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
default:
|
default:
|
||||||
drop_key = "None";
|
drop_key = "None";
|
||||||
}
|
}
|
||||||
} setDropKey(); #endregion
|
} setDropKey();
|
||||||
|
|
||||||
mappedJunc = noone;
|
mappedJunc = noone;
|
||||||
mapped_vec4 = false;
|
mapped_vec4 = false;
|
||||||
|
@ -425,13 +425,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
static setMapped = function(junc) { #region
|
static setMapped = function(junc) {
|
||||||
mappedJunc = junc;
|
mappedJunc = junc;
|
||||||
isTimelineVisible = function() { INLINE return is_anim && value_from == noone && mappedJunc.attributes.mapped; }
|
isTimelineVisible = function() { INLINE return is_anim && value_from == noone && mappedJunc.attributes.mapped; }
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static mappableStep = function() { #region
|
static mappableStep = function() {
|
||||||
editWidget = mapWidget && attributes.mapped? mapWidget : editWidgetRaw;
|
editWidget = mapWidget && attributes.mapped? mapWidget : editWidgetRaw;
|
||||||
setArrayDepth(attributes.mapped);
|
setArrayDepth(attributes.mapped);
|
||||||
|
|
||||||
|
@ -443,22 +443,22 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
node.refreshNodeDisplay();
|
node.refreshNodeDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
/////========== ANIMATION ==========
|
/////========== ANIMATION ==========
|
||||||
|
|
||||||
static setAnimable = function(_anim) { #region
|
static setAnimable = function(_anim) {
|
||||||
animable = _anim;
|
animable = _anim;
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isAnimable = function() { #region
|
static isAnimable = function() {
|
||||||
if(type == VALUE_TYPE.PCXnode) return false;
|
if(type == VALUE_TYPE.PCXnode) return false;
|
||||||
if(display_type == VALUE_DISPLAY.text_array) return false;
|
if(display_type == VALUE_DISPLAY.text_array) return false;
|
||||||
return animable;
|
return animable;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setAnim = function(anim, record = false) { #region
|
static setAnim = function(anim, record = false) {
|
||||||
if(is_anim == anim) return;
|
if(is_anim == anim) return;
|
||||||
if(record) {
|
if(record) {
|
||||||
recordAction(ACTION_TYPE.custom, function(data) {
|
recordAction(ACTION_TYPE.custom, function(data) {
|
||||||
|
@ -498,7 +498,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
node.inputs[attributes.map_index + 1].setAnim(anim);
|
node.inputs[attributes.map_index + 1].setAnim(anim);
|
||||||
|
|
||||||
node.refreshTimeline();
|
node.refreshTimeline();
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
/////============ DISPLAY ===========
|
/////============ DISPLAY ===========
|
||||||
|
|
||||||
|
@ -985,6 +985,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
case VALUE_TYPE.pathnode :
|
case VALUE_TYPE.pathnode :
|
||||||
extract_node = "Node_Path";
|
extract_node = "Node_Path";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VALUE_TYPE.any :
|
||||||
|
editWidget = new outputBox();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_struct(display_data) && struct_has(display_data, "side_button") && editWidget.side_button == noone)
|
if(is_struct(display_data) && struct_has(display_data, "side_button") && editWidget.side_button == noone)
|
||||||
|
@ -1062,10 +1066,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
/////============= CACHE ============
|
/////============= CACHE ============
|
||||||
|
|
||||||
static uncache = function() { #region
|
static uncache = function() {
|
||||||
use_cache = false;
|
use_cache = false;
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static resetCache = function() { cache_value[0] = false; }
|
static resetCache = function() { cache_value[0] = false; }
|
||||||
|
|
||||||
|
@ -1624,10 +1628,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
/////=========== CONNECT ===========
|
/////=========== CONNECT ===========
|
||||||
|
|
||||||
static rejectConnect = function() { #region
|
static rejectConnect = function() {
|
||||||
auto_connect = false;
|
auto_connect = false;
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isConnectable = function(_valueFrom, checkRecur = true, _log = false) {
|
static isConnectable = function(_valueFrom, checkRecur = true, _log = false) {
|
||||||
|
|
||||||
|
@ -1759,21 +1763,21 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static removeFromLoop = function(_remove_list = true) { #region
|
static removeFromLoop = function(_remove_list = true) {
|
||||||
if(value_from_loop != noone)
|
if(value_from_loop != noone)
|
||||||
value_from_loop.destroy();
|
value_from_loop.destroy();
|
||||||
|
|
||||||
PROJECT.modified = true;
|
PROJECT.modified = true;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static checkConnection = function(_remove_list = true) { #region
|
static checkConnection = function(_remove_list = true) {
|
||||||
if(value_from == noone) return;
|
if(value_from == noone) return;
|
||||||
if(value_from.node.active) return;
|
if(value_from.node.active) return;
|
||||||
|
|
||||||
removeFrom(_remove_list);
|
removeFrom(_remove_list);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static searchNodeBackward = function(_node) { #region
|
static searchNodeBackward = function(_node) {
|
||||||
if(node == _node) return true;
|
if(node == _node) return true;
|
||||||
for(var i = 0; i < array_length(node.inputs); i++) {
|
for(var i = 0; i < array_length(node.inputs); i++) {
|
||||||
var _in = node.inputs[i].value_from;
|
var _in = node.inputs[i].value_from;
|
||||||
|
@ -1781,11 +1785,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static hasJunctionFrom = function() { INLINE return value_from != noone || value_from_loop != noone; }
|
static hasJunctionFrom = function() { INLINE return value_from != noone || value_from_loop != noone; }
|
||||||
|
|
||||||
static getJunctionTo = function() { #region
|
static getJunctionTo = function() {
|
||||||
var _junc_to = [];
|
var _junc_to = [];
|
||||||
|
|
||||||
for(var i = 0; i < array_length(value_to); i++) {
|
for(var i = 0; i < array_length(value_to); i++) {
|
||||||
|
@ -1797,7 +1801,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
}
|
}
|
||||||
|
|
||||||
return _junc_to;
|
return _junc_to;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
/////============= DRAW =============
|
/////============= DRAW =============
|
||||||
|
|
||||||
|
@ -1815,7 +1819,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
color_display = type == VALUE_TYPE.action? #8fde5d : draw_fg;
|
color_display = type == VALUE_TYPE.action? #8fde5d : draw_fg;
|
||||||
} updateColor();
|
} updateColor();
|
||||||
|
|
||||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||||
if(type != VALUE_TYPE.integer && type != VALUE_TYPE.float) return -1;
|
if(type != VALUE_TYPE.integer && type != VALUE_TYPE.float) return -1;
|
||||||
if(value_from != noone) return -1;
|
if(value_from != noone) return -1;
|
||||||
if(expUse) return -1;
|
if(expUse) return -1;
|
||||||
|
@ -1855,7 +1859,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static drawJunction_fast = function(_s, _mx, _my) {
|
static drawJunction_fast = function(_s, _mx, _my) {
|
||||||
INLINE
|
INLINE
|
||||||
|
@ -1995,7 +1999,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
return drawJuncConnection(value_from, self, params);
|
return drawJuncConnection(value_from, self, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
static drawConnectionMouse = function(params, _mx, _my, target) { #region
|
static drawConnectionMouse = function(params, _mx, _my, target) {
|
||||||
var ss = params.s;
|
var ss = params.s;
|
||||||
var aa = params.aa; // 1
|
var aa = params.aa; // 1
|
||||||
|
|
||||||
|
@ -2053,32 +2057,32 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
/////========== EXPRESSION ==========
|
/////========== EXPRESSION ==========
|
||||||
|
|
||||||
static setUseExpression = function(useExp) { #region
|
static setUseExpression = function(useExp) {
|
||||||
INLINE
|
INLINE
|
||||||
if(expUse == useExp) return;
|
if(expUse == useExp) return;
|
||||||
expUse = useExp;
|
expUse = useExp;
|
||||||
node.triggerRender();
|
node.triggerRender();
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setExpression = function(_expression) { #region
|
static setExpression = function(_expression) {
|
||||||
expUse = true;
|
expUse = true;
|
||||||
expression = _expression;
|
expression = _expression;
|
||||||
expressionUpdate();
|
expressionUpdate();
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static expressionUpdate = function() { #region
|
static expressionUpdate = function() {
|
||||||
expTree = evaluateFunctionList(expression);
|
expTree = evaluateFunctionList(expression);
|
||||||
resetCache();
|
resetCache();
|
||||||
node.triggerRender();
|
node.triggerRender();
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
/////=========== SERIALIZE ===========
|
/////=========== SERIALIZE ===========
|
||||||
|
|
||||||
static serialize = function(scale = false, preset = false) { #region
|
static serialize = function(scale = false, preset = false) {
|
||||||
var _map = {};
|
var _map = {};
|
||||||
|
|
||||||
_map.visible = visible;
|
_map.visible = visible;
|
||||||
|
@ -2123,9 +2127,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
_map.bypass = bypass_junc? bypass_junc.visible : false;
|
_map.bypass = bypass_junc? bypass_junc.visible : false;
|
||||||
|
|
||||||
return _map;
|
return _map;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static applyDeserialize = function(_map, scale = false, preset = false) { #region
|
static applyDeserialize = function(_map, scale = false, preset = false) {
|
||||||
if(_map == undefined) return;
|
if(_map == undefined) return;
|
||||||
if(_map == noone) return;
|
if(_map == noone) return;
|
||||||
if(!is_struct(_map)) return;
|
if(!is_struct(_map)) return;
|
||||||
|
@ -2184,14 +2188,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
attributeApply();
|
attributeApply();
|
||||||
onValidate();
|
onValidate();
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static attributeApply = function() { #region
|
static attributeApply = function() {
|
||||||
if(struct_has(attributes, "mapped") && attributes.mapped)
|
if(struct_has(attributes, "mapped") && attributes.mapped)
|
||||||
mappableStep();
|
mappableStep();
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static connect = function(log = false) { #region
|
static connect = function(log = false) {
|
||||||
//print($"{node} | {con_node} : {con_index}");
|
//print($"{node} | {con_node} : {con_index}");
|
||||||
|
|
||||||
if(con_node == -1 || con_index == -1)
|
if(con_node == -1 || con_index == -1)
|
||||||
|
@ -2216,37 +2220,39 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
if(log) log_warning("LOAD", $"[Connect] Reconnecting {node.name} to {_nd.name}", node);
|
if(log) log_warning("LOAD", $"[Connect] Reconnecting {node.name} to {_nd.name}", node);
|
||||||
|
|
||||||
if(con_index == VALUE_TAG.updateInTrigger) return setFrom(_nd.updatedInTrigger);
|
if(con_index == VALUE_TAG.updateInTrigger) return setFrom(_nd.updatedInTrigger);
|
||||||
else if(con_index == VALUE_TAG.updateOutTrigger) return setFrom(_nd.updatedOutTrigger);
|
if(con_index == VALUE_TAG.updateOutTrigger) return setFrom(_nd.updatedOutTrigger);
|
||||||
else if(con_index < _ol) {
|
|
||||||
|
if(con_index < _ol) {
|
||||||
var _set = setFrom(_nd.outputs[con_index], false, true);
|
var _set = setFrom(_nd.outputs[con_index], false, true);
|
||||||
if(_set) return true;
|
if(_set) return true;
|
||||||
|
|
||||||
if(_set == -1) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Not connectable.", node);
|
if(_set == -1) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Not connectable.", node);
|
||||||
else if(_set == -2) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Condition not met.", node);
|
else if(_set == -2) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Condition not met.", node);
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} else if(con_index >= 1000) {
|
|
||||||
var _inp = array_safe_get_fast(_nd.inputs, con_index - 1000, noone);
|
|
||||||
if(_inp == noone) return false;
|
|
||||||
|
|
||||||
var _set = setFrom(_inp.bypass_junc, false, true);
|
|
||||||
|
|
||||||
if(_set) return true;
|
|
||||||
|
|
||||||
if(_set == -1) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Not connectable.", node);
|
|
||||||
else if(_set == -2) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Condition not met.", node);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Output not exist.", node);
|
if(con_index >= 1000) { //connect bypass
|
||||||
|
var _inp = array_safe_get_fast(_nd.inputs, con_index - 1000, noone);
|
||||||
|
if(_inp == noone) return false;
|
||||||
|
|
||||||
|
var _set = setFrom(_inp.bypass_junc, false, true);
|
||||||
|
if(_set) return true;
|
||||||
|
|
||||||
|
if(_set == -1) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} (bypass) : Not connectable.", node);
|
||||||
|
else if(_set == -2) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} (bypass) : Condition not met.", node);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
|
log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Output not exist.", node);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/////============= MISC =============
|
/////============= MISC =============
|
||||||
|
|
||||||
static extractNode = function(_type = extract_node) { #region
|
static extractNode = function(_type = extract_node) {
|
||||||
if(_type == "") return noone;
|
if(_type == "") return noone;
|
||||||
|
|
||||||
var ext = nodeBuild(_type, node.x, node.y);
|
var ext = nodeBuild(_type, node.x, node.y);
|
||||||
|
@ -2297,9 +2303,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.doUpdate();
|
ext.doUpdate();
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static dragValue = function() { #region
|
static dragValue = function() {
|
||||||
if(drop_key == "None") return;
|
if(drop_key == "None") return;
|
||||||
|
|
||||||
DRAGGING = {
|
DRAGGING = {
|
||||||
|
@ -2314,14 +2320,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
if(connect_type == CONNECT_TYPE.input)
|
if(connect_type == CONNECT_TYPE.input)
|
||||||
DRAGGING.from = self;
|
DRAGGING.from = self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static destroy = function() { #region
|
static destroy = function() {
|
||||||
if(error_notification != noone) {
|
if(error_notification != noone) {
|
||||||
noti_remove(error_notification);
|
noti_remove(error_notification);
|
||||||
error_notification = noone;
|
error_notification = noone;
|
||||||
}
|
}
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static cleanUp = function() {}
|
static cleanUp = function() {}
|
||||||
|
|
||||||
|
@ -2331,7 +2337,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
/////========== FUNCTIONS ==========
|
/////========== FUNCTIONS ==========
|
||||||
|
|
||||||
function drawJuncConnection(from, to, params) { #region
|
function drawJuncConnection(from, to, params) {
|
||||||
#region parameters
|
#region parameters
|
||||||
var log = params.log;
|
var log = params.log;
|
||||||
var high = params.highlight;
|
var high = params.highlight;
|
||||||
|
@ -2502,4 +2508,4 @@ function drawJuncConnection(from, to, params) { #region
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
return hovering;
|
return hovering;
|
||||||
} #endregion
|
}
|
26
scripts/outputBox/outputBox.gml
Normal file
26
scripts/outputBox/outputBox.gml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
function outputBox() : widget() constructor {
|
||||||
|
|
||||||
|
static trigger = function() { }
|
||||||
|
|
||||||
|
static drawParam = function(params) {
|
||||||
|
setParam(params);
|
||||||
|
return draw(params.x, params.y, params.w, params.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static draw = function(_x, _y, _w, _value) {
|
||||||
|
x = _x;
|
||||||
|
y = _y;
|
||||||
|
w = _w;
|
||||||
|
|
||||||
|
draw_set_text(font, fa_left, fa_top, COLORS._main_text_sub);
|
||||||
|
|
||||||
|
var _txt = string(_value);
|
||||||
|
var _sh = string_height_ext(_txt, -1, w - ui(16)) + ui(16);
|
||||||
|
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, _sh, COLORS._main_icon_light);
|
||||||
|
draw_text_ext_add(_x + ui(8), _y + ui(8), _txt, -1, _w - ui(16));
|
||||||
|
|
||||||
|
return _sh;
|
||||||
|
}
|
||||||
|
|
||||||
|
static clone = function() { return new outputBox(); }
|
||||||
|
}
|
13
scripts/outputBox/outputBox.yy
Normal file
13
scripts/outputBox/outputBox.yy
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"$GMScript":"v1",
|
||||||
|
"%Name":"outputBox",
|
||||||
|
"isCompatibility":false,
|
||||||
|
"isDnD":false,
|
||||||
|
"name":"outputBox",
|
||||||
|
"parent":{
|
||||||
|
"name":"widgets",
|
||||||
|
"path":"folders/widgets.yy",
|
||||||
|
},
|
||||||
|
"resourceType":"GMScript",
|
||||||
|
"resourceVersion":"2.0",
|
||||||
|
}
|
|
@ -425,7 +425,6 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
static drawParam = function(params) {
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
|
|
||||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.halign, params.valign);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.halign, params.valign);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue