mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +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":"number_function","order":14,"path":"scripts/number_function/number_function.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_corner","order":3,"path":"scripts/pack_corner/pack_corner.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":"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":"outputBox","path":"scripts/outputBox/outputBox.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_corner","path":"scripts/pack_corner/pack_corner.yy",},},
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
function Node_3D_Mesh(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group) constructor {
|
||||
name = "3D Mesh";
|
||||
#macro __d3d_input_list_mesh ["Mesh", false]
|
||||
|
||||
function Node_3D_Mesh(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group) constructor {
|
||||
name = "3D Mesh";
|
||||
in_mesh = array_length(inputs);
|
||||
|
||||
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) {}
|
||||
}
|
|
@ -53,7 +53,6 @@ function Node_MK_Delay_Machine(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
var _blnd = getInputData(8);
|
||||
|
||||
cacheCurrentFrame(_surf);
|
||||
|
||||
random_set_seed(_seed);
|
||||
|
||||
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,
|
||||
]
|
||||
|
||||
static onDrawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {
|
||||
|
||||
}
|
||||
static onDrawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {}
|
||||
|
||||
static step = function() {
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -400,6 +400,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
}
|
||||
|
||||
static refreshDynamicInput = function() {
|
||||
if(LOADING || APPENDING) return;
|
||||
|
||||
var _in = [];
|
||||
|
||||
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() {
|
||||
if(!isRenderActive()) return;
|
||||
|
||||
clearCache();
|
||||
var arr = getNextNodesRaw();
|
||||
for( var i = 0, n = array_length(arr); i < n; i++ )
|
||||
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();
|
||||
}
|
||||
|
||||
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"))
|
||||
return;
|
||||
|
||||
|
@ -2286,6 +2287,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
|
||||
for( var i = _dynamic_inputs; i >= 1; i-- ) {
|
||||
var _ind = _input_fix_len + i * _data_length;
|
||||
|
||||
if(_pad_dyna > 0)
|
||||
repeat(_pad_dyna) array_insert(load_map.inputs, _ind, noone);
|
||||
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;
|
||||
repeat(_pad_fix)
|
||||
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)
|
||||
return;
|
||||
|
||||
|
|
|
@ -243,6 +243,7 @@
|
|||
case "input" :
|
||||
map = node.inputMap;
|
||||
break;
|
||||
|
||||
case "outputs" :
|
||||
case "output" :
|
||||
map = node.outputMap;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Interlace";
|
||||
|
||||
update_on_frame = true;
|
||||
use_cache = CACHE_USE.manual;
|
||||
clearCacheOnChange = false;
|
||||
|
||||
newInput(0, nodeValue_Surface("Surface in", self));
|
||||
|
||||
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);
|
||||
|
||||
temp_surface = [ ];
|
||||
|
||||
input_display_list = [ 1,
|
||||
["Surface", false], 0, 2, 3, 4,
|
||||
["Effects", false], 7, 8, 9,
|
||||
|
@ -32,22 +34,28 @@ function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _surf = _data[0];
|
||||
var _axis = _data[7];
|
||||
var _size = _data[8];
|
||||
var _invt = _data[9];
|
||||
|
||||
var _dim = surface_get_dimension(_surf);
|
||||
var _prev = array_safe_get_fast(cached_output, CURRENT_FRAME - 1, noone);
|
||||
|
||||
surface_set_shader(_outSurf, sh_interlaced);
|
||||
shader_set_i("useSurf", CURRENT_FRAME >= 1);
|
||||
shader_set_surface("prevFrame", array_safe_get(temp_surface, _array_index));
|
||||
shader_set_i("useSurf", is_surface(_prev));
|
||||
shader_set_surface("prevFrame", _prev);
|
||||
|
||||
shader_set_2("dimension", _dim);
|
||||
shader_set_i("axis", _axis);
|
||||
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);
|
||||
surface_reset_shader();
|
||||
|
||||
temp_surface[_array_index] = surface_verify(array_safe_get(temp_surface, _array_index), _dim[0], _dim[1]);
|
||||
surface_set_shader(temp_surface[_array_index], noone);
|
||||
draw_surface_safe(_surf);
|
||||
surface_reset_shader();
|
||||
cacheCurrentFrame(_surf);
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]);
|
||||
_outSurf = channel_apply(_data[0], _outSurf, _data[4]);
|
||||
|
||||
return _outSurf;
|
||||
} #endregion
|
||||
}
|
||||
}
|
|
@ -245,7 +245,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
/////============= 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;
|
||||
dummy_get = get_node;
|
||||
|
||||
|
@ -253,47 +253,47 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
dummy_redo = _dummy_redo;
|
||||
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setActive = function(_active, _tooltip) { #region
|
||||
static setActive = function(_active, _tooltip) {
|
||||
INLINE
|
||||
active = _active;
|
||||
active_tooltip = _tooltip;
|
||||
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setWindows = function() { #region
|
||||
static setWindows = function() {
|
||||
INLINE
|
||||
setActive(OS == os_windows, "Not available on MacOS");
|
||||
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setTooltip = function(_tip) { tooltip = _tip; return self; }
|
||||
|
||||
static nonValidate = function() { #region
|
||||
static nonValidate = function() {
|
||||
validateValue = false;
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static nonForward = function() { #region
|
||||
static nonForward = function() {
|
||||
forward = false;
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
/////============= NAME =============
|
||||
|
||||
static getName = function() { #region
|
||||
static getName = function() {
|
||||
if(name_custom) return name;
|
||||
return __txt_junction_name(instanceof(node), connect_type, index, name);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setName = function(_name) { #region
|
||||
static setName = function(_name) {
|
||||
INLINE
|
||||
name = _name;
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
/////============= VALUE ============
|
||||
|
||||
|
@ -307,7 +307,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return true;
|
||||
}
|
||||
|
||||
static setDefault = function(vals) { #region
|
||||
static setDefault = function(vals) {
|
||||
if(LOADING || APPENDING) return self;
|
||||
|
||||
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));
|
||||
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static resetValue = function() { #region
|
||||
static resetValue = function() {
|
||||
unit.mode = def_unit;
|
||||
setValue(unit.apply(variable_clone(def_val)));
|
||||
attributes.mapped = 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;
|
||||
display_data.onSurfaceSize = ref;
|
||||
|
||||
|
@ -343,7 +343,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
cache_value[0] = false;
|
||||
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setValidator = function(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 setArrayDynamic = function() { dynamic_array = true; return self; }
|
||||
|
||||
static rejectArrayProcess = function() { #region
|
||||
static rejectArrayProcess = function() {
|
||||
process_array = false;
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setDropKey = function() { #region
|
||||
static setDropKey = function() {
|
||||
switch(type) {
|
||||
case VALUE_TYPE.integer : 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:
|
||||
drop_key = "None";
|
||||
}
|
||||
} setDropKey(); #endregion
|
||||
} setDropKey();
|
||||
|
||||
mappedJunc = noone;
|
||||
mapped_vec4 = false;
|
||||
|
@ -425,13 +425,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return self;
|
||||
}
|
||||
|
||||
static setMapped = function(junc) { #region
|
||||
static setMapped = function(junc) {
|
||||
mappedJunc = junc;
|
||||
isTimelineVisible = function() { INLINE return is_anim && value_from == noone && mappedJunc.attributes.mapped; }
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static mappableStep = function() { #region
|
||||
static mappableStep = function() {
|
||||
editWidget = mapWidget && attributes.mapped? mapWidget : editWidgetRaw;
|
||||
setArrayDepth(attributes.mapped);
|
||||
|
||||
|
@ -443,22 +443,22 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
node.refreshNodeDisplay();
|
||||
}
|
||||
|
||||
} #endregion
|
||||
}
|
||||
|
||||
/////========== ANIMATION ==========
|
||||
|
||||
static setAnimable = function(_anim) { #region
|
||||
static setAnimable = function(_anim) {
|
||||
animable = _anim;
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static isAnimable = function() { #region
|
||||
static isAnimable = function() {
|
||||
if(type == VALUE_TYPE.PCXnode) return false;
|
||||
if(display_type == VALUE_DISPLAY.text_array) return false;
|
||||
return animable;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setAnim = function(anim, record = false) { #region
|
||||
static setAnim = function(anim, record = false) {
|
||||
if(is_anim == anim) return;
|
||||
if(record) {
|
||||
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.refreshTimeline();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
/////============ DISPLAY ===========
|
||||
|
||||
|
@ -985,6 +985,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
case VALUE_TYPE.pathnode :
|
||||
extract_node = "Node_Path";
|
||||
break;
|
||||
|
||||
case VALUE_TYPE.any :
|
||||
editWidget = new outputBox();
|
||||
break;
|
||||
}
|
||||
|
||||
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 ============
|
||||
|
||||
static uncache = function() { #region
|
||||
static uncache = function() {
|
||||
use_cache = false;
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static resetCache = function() { cache_value[0] = false; }
|
||||
|
||||
|
@ -1624,10 +1628,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
/////=========== CONNECT ===========
|
||||
|
||||
static rejectConnect = function() { #region
|
||||
static rejectConnect = function() {
|
||||
auto_connect = false;
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static isConnectable = function(_valueFrom, checkRecur = true, _log = false) {
|
||||
|
||||
|
@ -1759,21 +1763,21 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return false;
|
||||
}
|
||||
|
||||
static removeFromLoop = function(_remove_list = true) { #region
|
||||
static removeFromLoop = function(_remove_list = true) {
|
||||
if(value_from_loop != noone)
|
||||
value_from_loop.destroy();
|
||||
|
||||
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.node.active) return;
|
||||
|
||||
removeFrom(_remove_list);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static searchNodeBackward = function(_node) { #region
|
||||
static searchNodeBackward = function(_node) {
|
||||
if(node == _node) return true;
|
||||
for(var i = 0; i < array_length(node.inputs); i++) {
|
||||
var _in = node.inputs[i].value_from;
|
||||
|
@ -1781,11 +1785,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static hasJunctionFrom = function() { INLINE return value_from != noone || value_from_loop != noone; }
|
||||
|
||||
static getJunctionTo = function() { #region
|
||||
static getJunctionTo = function() {
|
||||
var _junc_to = [];
|
||||
|
||||
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;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
/////============= DRAW =============
|
||||
|
||||
|
@ -1815,7 +1819,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
color_display = type == VALUE_TYPE.action? #8fde5d : draw_fg;
|
||||
} 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(value_from != noone) return -1;
|
||||
if(expUse) return -1;
|
||||
|
@ -1855,7 +1859,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
}
|
||||
|
||||
return -1;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static drawJunction_fast = function(_s, _mx, _my) {
|
||||
INLINE
|
||||
|
@ -1995,7 +1999,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
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 aa = params.aa; // 1
|
||||
|
||||
|
@ -2053,32 +2057,32 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
}
|
||||
break;
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
/////========== EXPRESSION ==========
|
||||
|
||||
static setUseExpression = function(useExp) { #region
|
||||
static setUseExpression = function(useExp) {
|
||||
INLINE
|
||||
if(expUse == useExp) return;
|
||||
expUse = useExp;
|
||||
node.triggerRender();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setExpression = function(_expression) { #region
|
||||
static setExpression = function(_expression) {
|
||||
expUse = true;
|
||||
expression = _expression;
|
||||
expressionUpdate();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static expressionUpdate = function() { #region
|
||||
static expressionUpdate = function() {
|
||||
expTree = evaluateFunctionList(expression);
|
||||
resetCache();
|
||||
node.triggerRender();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
/////=========== SERIALIZE ===========
|
||||
|
||||
static serialize = function(scale = false, preset = false) { #region
|
||||
static serialize = function(scale = false, preset = false) {
|
||||
var _map = {};
|
||||
|
||||
_map.visible = visible;
|
||||
|
@ -2123,9 +2127,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
_map.bypass = bypass_junc? bypass_junc.visible : false;
|
||||
|
||||
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 == noone) return;
|
||||
if(!is_struct(_map)) return;
|
||||
|
@ -2184,14 +2188,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
attributeApply();
|
||||
onValidate();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static attributeApply = function() { #region
|
||||
static attributeApply = function() {
|
||||
if(struct_has(attributes, "mapped") && attributes.mapped)
|
||||
mappableStep();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static connect = function(log = false) { #region
|
||||
static connect = function(log = false) {
|
||||
//print($"{node} | {con_node} : {con_index}");
|
||||
|
||||
if(con_node == -1 || con_index == -1)
|
||||
|
@ -2215,38 +2219,40 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
if(log) log_warning("LOAD", $"[Connect] Reconnecting {node.name} to {_nd.name}", node);
|
||||
|
||||
if(con_index == VALUE_TAG.updateInTrigger) return setFrom(_nd.updatedInTrigger);
|
||||
else if(con_index == VALUE_TAG.updateOutTrigger) return setFrom(_nd.updatedOutTrigger);
|
||||
else if(con_index < _ol) {
|
||||
if(con_index == VALUE_TAG.updateInTrigger) return setFrom(_nd.updatedInTrigger);
|
||||
if(con_index == VALUE_TAG.updateOutTrigger) return setFrom(_nd.updatedOutTrigger);
|
||||
|
||||
if(con_index < _ol) {
|
||||
var _set = setFrom(_nd.outputs[con_index], 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;
|
||||
|
||||
} 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);
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Output not exist.", node);
|
||||
|
||||
return false;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
/////============= MISC =============
|
||||
|
||||
static extractNode = function(_type = extract_node) { #region
|
||||
static extractNode = function(_type = extract_node) {
|
||||
if(_type == "") return noone;
|
||||
|
||||
var ext = nodeBuild(_type, node.x, node.y);
|
||||
|
@ -2297,9 +2303,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
}
|
||||
|
||||
ext.doUpdate();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static dragValue = function() { #region
|
||||
static dragValue = function() {
|
||||
if(drop_key == "None") return;
|
||||
|
||||
DRAGGING = {
|
||||
|
@ -2314,14 +2320,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
if(connect_type == CONNECT_TYPE.input)
|
||||
DRAGGING.from = self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static destroy = function() { #region
|
||||
static destroy = function() {
|
||||
if(error_notification != noone) {
|
||||
noti_remove(error_notification);
|
||||
error_notification = noone;
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static cleanUp = function() {}
|
||||
|
||||
|
@ -2331,7 +2337,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
/////========== FUNCTIONS ==========
|
||||
|
||||
function drawJuncConnection(from, to, params) { #region
|
||||
function drawJuncConnection(from, to, params) {
|
||||
#region parameters
|
||||
var log = params.log;
|
||||
var high = params.highlight;
|
||||
|
@ -2502,4 +2508,4 @@ function drawJuncConnection(from, to, params) { #region
|
|||
#endregion
|
||||
|
||||
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) {
|
||||
setParam(params);
|
||||
|
||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.halign, params.valign);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue