mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
- Fix some junctions still show up after hiding.
This commit is contained in:
parent
9e2b0fdcea
commit
f951f279c9
9 changed files with 73 additions and 47 deletions
|
@ -53,7 +53,7 @@
|
|||
CURRENT_COLOR = c_white;
|
||||
#endregion
|
||||
|
||||
#region inputsdis
|
||||
#region input
|
||||
globalvar FOCUS, FOCUS_STR, HOVER, HOVERING_ELEMENT, _HOVERING_ELEMENT;
|
||||
globalvar DOUBLE_CLICK, DOUBLE_CLICK_POS;
|
||||
globalvar DIALOG_CLICK;
|
||||
|
|
|
@ -69,22 +69,24 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
|
|||
|
||||
butx += ui(20);
|
||||
if(!global_var) { // visibility
|
||||
index = jun.visible;
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, index, butx, lb_y, 1,, 0.8);
|
||||
var _visi = jun.isVisible();
|
||||
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, _visi, butx, lb_y, 1,, 0.8);
|
||||
if(_hover && point_in_circle(_m[0], _m[1], butx, lb_y, ui(10))) {
|
||||
cHov = true;
|
||||
|
||||
if(visi_hold != noone && jun.visible != visi_hold) {
|
||||
jun.visible = visi_hold;
|
||||
if(visi_hold != noone && jun.visible_manual != visi_hold) {
|
||||
jun.visible_manual = visi_hold;
|
||||
jun.node.refreshNodeDisplay();
|
||||
}
|
||||
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, index, butx, lb_y, 1,, 1);
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, _visi, butx, lb_y, 1,, 1);
|
||||
TOOLTIP = __txt("Visibility");
|
||||
|
||||
if(mouse_press(mb_left, _focus)) {
|
||||
jun.visible = !jun.visible;
|
||||
visi_hold = jun.visible;
|
||||
jun.visible_manual = _visi? -1 : 1;
|
||||
|
||||
visi_hold = jun.visible_manual;
|
||||
jun.node.refreshNodeDisplay();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,9 +162,9 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
|||
#endregion
|
||||
}
|
||||
|
||||
static onValueUpdate = function(index) { #region
|
||||
static onValueUpdate = function(index) {
|
||||
if(index == in_d3d + 9) PANEL_PREVIEW.tool_current = noone;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
var _proj = getInputData(in_d3d + 3);
|
||||
|
|
|
@ -454,7 +454,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
var _dy = 9999;
|
||||
|
||||
for( var i = 0; i < ds_list_size(outputs); i++ ) {
|
||||
if(!outputs[| i].visible) continue;
|
||||
if(!outputs[| i].isVisible()) continue;
|
||||
if(junc != noone && !junc.isConnectable(outputs[| i], true)) continue;
|
||||
|
||||
var _ddy = abs(outputs[| i].y - _y);
|
||||
|
@ -473,7 +473,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
for( var i = shift; i < ds_list_size(inputs); i++ ) {
|
||||
var _inp = inputs[| i];
|
||||
|
||||
if(!_inp.visible) continue;
|
||||
if(!_inp.isVisible()) continue;
|
||||
if(_inp.value_from != noone) continue;
|
||||
if(junc != noone && (value_bit(junc.type) & value_bit(_inp.type)) == 0) continue;
|
||||
|
||||
|
@ -802,8 +802,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
if(!_inp.isDynamic()) continue;
|
||||
|
||||
var val = _inp.getValue(frame);
|
||||
// setInputData(i, val);
|
||||
inputs_data[i] = val;
|
||||
|
||||
inputs_data[i] = val; // setInputData(i, val);
|
||||
input_value_map[$ _inp.internalName] = val;
|
||||
}
|
||||
}
|
||||
|
@ -878,7 +878,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
}
|
||||
|
||||
static valueUpdate = function(index) {
|
||||
|
||||
onValueUpdate(index);
|
||||
|
||||
if(is_dynamic_input) will_setHeight = true;
|
||||
|
@ -887,6 +886,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
|
||||
static valueFromUpdate = function(index) {
|
||||
onValueFromUpdate(index);
|
||||
onValueUpdate(index);
|
||||
|
||||
if(auto_input && !LOADING && !APPENDING)
|
||||
refreshDynamicInput();
|
||||
|
@ -1494,10 +1494,10 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
|
||||
if(show_output_name) {
|
||||
for(var i = 0; i < ds_list_size(outputs); i++)
|
||||
if(outputs[| i].visible) outputs[| i].drawNameBG(_s);
|
||||
if(outputs[| i].isVisible()) outputs[| i].drawNameBG(_s);
|
||||
|
||||
for(var i = 0; i < ds_list_size(outputs); i++)
|
||||
if(outputs[| i].visible) outputs[| i].drawName(_s, _mx, _my);
|
||||
if(outputs[| i].isVisible()) outputs[| i].drawName(_s, _mx, _my);
|
||||
}
|
||||
|
||||
if(hasInspector1Update() && PANEL_GRAPH.pHOVER && point_in_circle(_mx, _my, inspectInput1.x, inspectInput1.y, 10)) {
|
||||
|
|
|
@ -87,12 +87,12 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
return _hov;
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
static step = function() {
|
||||
inputs[| 2].mappableStep();
|
||||
inputs[| 3].mappableStep();
|
||||
inputs[| 4].mappableStep();
|
||||
inputs[| 5].mappableStep();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _dim = _data[0];
|
||||
|
|
|
@ -237,7 +237,7 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
return _hov;
|
||||
}
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _dim = _data[0];
|
||||
var _bg = _data[1];
|
||||
var _shape = _data[2];
|
||||
|
@ -364,7 +364,7 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
var _shp = array_safe_get(shape_types, _shape, "");
|
||||
if(is_struct(_shp)) _shp = _shp.data;
|
||||
|
||||
switch(_shp) { #region
|
||||
switch(_shp) {
|
||||
case "Rectangle" :
|
||||
inputs[| 9].setVisible( true);
|
||||
inputs[| 18].setVisible(false);
|
||||
|
@ -547,7 +547,7 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
shader_set_f("teethAngle", _data[27]);
|
||||
break;
|
||||
|
||||
} #endregion
|
||||
}
|
||||
|
||||
shader_set_f("dimension", _dim);
|
||||
shader_set_f("bgColor", _bgcol);
|
||||
|
@ -565,5 +565,5 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
surface_reset_shader();
|
||||
|
||||
return _outSurf;
|
||||
} #endregion
|
||||
}
|
||||
}
|
|
@ -178,6 +178,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
#region ---- inspector ----
|
||||
visible = _connect == JUNCTION_CONNECT.output || _type == VALUE_TYPE.surface || _type == VALUE_TYPE.path || _type == VALUE_TYPE.PCXnode;
|
||||
visible_manual = 0;
|
||||
show_in_inspector = true;
|
||||
visible_in_list = true;
|
||||
|
||||
|
@ -492,6 +493,34 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return self;
|
||||
}
|
||||
|
||||
static forceVisible = function(_vis) {
|
||||
visible = _vis;
|
||||
show_in_inspector = _vis;
|
||||
visible_manual = 0;
|
||||
|
||||
node.will_setHeight = true;
|
||||
return self;
|
||||
}
|
||||
|
||||
static isVisible = function() {
|
||||
if(!node.active) return false;
|
||||
|
||||
if(connect_type == JUNCTION_CONNECT.output) {
|
||||
if(!array_empty(value_to)) return true;
|
||||
if(visible_manual != 0) return visible_manual == 1;
|
||||
|
||||
return visible;
|
||||
}
|
||||
|
||||
if(value_from) return true;
|
||||
if(visible_manual != 0) return visible_manual == 1;
|
||||
if(!visible) return false;
|
||||
|
||||
if(index == -1) return true;
|
||||
|
||||
return visible_in_list;
|
||||
}
|
||||
|
||||
static setDisplay = function(_type = VALUE_DISPLAY._default, _data = {}) { #region
|
||||
display_type = _type;
|
||||
display_data = _data;
|
||||
|
@ -1985,20 +2014,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
}
|
||||
} #endregion
|
||||
|
||||
static isVisible = function() { #region
|
||||
if(!node.active) return false;
|
||||
|
||||
if(connect_type == JUNCTION_CONNECT.output)
|
||||
return visible || !array_empty(value_to);
|
||||
|
||||
if(value_from) return true;
|
||||
if(!visible) return false;
|
||||
|
||||
if(index == -1) return true;
|
||||
|
||||
return visible_in_list;
|
||||
} #endregion
|
||||
|
||||
/////========== EXPRESSION ==========
|
||||
|
||||
static setUseExpression = function(useExp) { #region
|
||||
|
@ -2025,8 +2040,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
static serialize = function(scale = false, preset = false) { #region
|
||||
var _map = {};
|
||||
|
||||
_map.visible = visible;
|
||||
_map.color = color;
|
||||
_map.visible = visible;
|
||||
_map.visible_manual = visible_manual;
|
||||
_map.color = color;
|
||||
|
||||
if(connect_type == JUNCTION_CONNECT.output)
|
||||
return _map;
|
||||
|
@ -2072,8 +2088,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(_map == noone) return;
|
||||
if(!is_struct(_map)) return;
|
||||
|
||||
visible = struct_try_get(_map, "visible", visible);
|
||||
color = struct_try_get(_map, "color", -1);
|
||||
visible = struct_try_get(_map, "visible", visible);
|
||||
visible_manual = struct_try_get(_map, "visible_manual", visible_manual);
|
||||
color = struct_try_get(_map, "color", -1);
|
||||
|
||||
if(connect_type == JUNCTION_CONNECT.output)
|
||||
return;
|
||||
|
|
|
@ -3071,18 +3071,18 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
for(var j = 0; j < ds_list_size(_node.inputs); j++) {
|
||||
var _jun = _node.inputs[| j];
|
||||
if(!_jun.visible) continue;
|
||||
if(!_jun.isVisible()) continue;
|
||||
|
||||
if(_jun.value_from == noone)
|
||||
_jun.visible = false;
|
||||
_jun.visible_manual = -1;
|
||||
}
|
||||
|
||||
for(var j = 0; j < ds_list_size(_node.outputs); j++) {
|
||||
var _jun = _node.outputs[| j];
|
||||
if(!_jun.visible) continue;
|
||||
if(!_jun.isVisible()) continue;
|
||||
|
||||
if(array_empty(_jun.getJunctionTo()))
|
||||
_jun.visible = false;
|
||||
_jun.visible_manual = -1;
|
||||
}
|
||||
|
||||
_node.will_setHeight = true;
|
||||
|
|
|
@ -13,6 +13,8 @@ enum RENDER_TYPE {
|
|||
#macro RENDER_ALL_REORDER UPDATE_RENDER_ORDER = true; UPDATE |= RENDER_TYPE.full;
|
||||
#macro RENDER_ALL UPDATE |= RENDER_TYPE.full;
|
||||
#macro RENDER_PARTIAL UPDATE |= RENDER_TYPE.partial;
|
||||
|
||||
global.getvalue_hit = 0;
|
||||
#endregion
|
||||
|
||||
function ResetAllNodesRender() { #region
|
||||
|
@ -172,6 +174,8 @@ function Render(partial = false, runAction = false) { #region
|
|||
LOG_BLOCK_START();
|
||||
LOG_IF(global.FLAG.render, $"============================== RENDER START [{partial? "PARTIAL" : "FULL"}] [frame {CURRENT_FRAME}] ==============================");
|
||||
|
||||
// global.getvalue_hit = 0;
|
||||
|
||||
try {
|
||||
var t = get_timer();
|
||||
var t1 = get_timer();
|
||||
|
@ -259,6 +263,9 @@ function Render(partial = false, runAction = false) { #region
|
|||
noti_warning(exception_print(e));
|
||||
}
|
||||
|
||||
// print("\n============== render stat ==============");
|
||||
// print($"Get value hit: {global.getvalue_hit}");
|
||||
|
||||
LOG_END();
|
||||
|
||||
} #endregion
|
||||
|
|
Loading…
Reference in a new issue