mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 22:46:19 +01:00
- [Array loop] Fix output junction detached from the node once group IO is rearranged.
This commit is contained in:
parent
c21b14e44c
commit
b6fe38a0ba
5 changed files with 33 additions and 20 deletions
|
@ -9,12 +9,16 @@ if(!MOUSE_WRAPPING) {
|
||||||
else if(slide_da == 0 && abs(_ady) > abs(_adx) + 8 && abs(mouse_my - slide_dy) > 64) slide_da = 1;
|
else if(slide_da == 0 && abs(_ady) > abs(_adx) + 8 && abs(mouse_my - slide_dy) > 64) slide_da = 1;
|
||||||
else if(slide_da == 1 && abs(_adx) > abs(_ady) + 8 && abs(mouse_mx - slide_dx) > 64) slide_da = 0;
|
else if(slide_da == 1 && abs(_adx) > abs(_ady) + 8 && abs(mouse_mx - slide_dx) > 64) slide_da = 0;
|
||||||
|
|
||||||
var spd = (slide_da? _ady : _adx) * tb.slide_speed;
|
var _s = tb.slide_speed;
|
||||||
var _val = value_snap(tb.slide_sv + spd, tb.slide_speed);
|
if(key_mod_press(CTRL)) _s *= 10;
|
||||||
|
if(key_mod_press(ALT)) _s /= 10;
|
||||||
|
|
||||||
|
var spd = (slide_da? _ady : _adx) * _s;
|
||||||
|
var _val = value_snap(tb.slide_sv + spd, _s);
|
||||||
|
|
||||||
draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text);
|
draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text);
|
||||||
|
|
||||||
var _stp_sz = 50 * tb.slide_speed;
|
var _stp_sz = 50 * _s;
|
||||||
var _stp_fl = round(_val / _stp_sz) * _stp_sz;
|
var _stp_fl = round(_val / _stp_sz) * _stp_sz;
|
||||||
var _stp_md = _val - _stp_fl;
|
var _stp_md = _val - _stp_fl;
|
||||||
|
|
||||||
|
@ -24,9 +28,9 @@ if(!MOUSE_WRAPPING) {
|
||||||
_tw = max(_tw, string_width(_v) + 16);
|
_tw = max(_tw, string_width(_v) + 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
var _snp_s = 50 * tb.slide_speed;
|
var _snp_s = 50 * _s;
|
||||||
var _snp_v = round(_val / _snp_s) * _snp_s;
|
var _snp_v = round(_val / _snp_s) * _snp_s;
|
||||||
if(abs(_val - _snp_v) < 5 * tb.slide_speed)
|
if(abs(_val - _snp_v) < 5 * _s)
|
||||||
_val = _snp_v;
|
_val = _snp_v;
|
||||||
|
|
||||||
if(slide_da) {
|
if(slide_da) {
|
||||||
|
@ -41,11 +45,11 @@ if(!MOUSE_WRAPPING) {
|
||||||
var _v = _stp_fl + i * _stp_sz;
|
var _v = _stp_fl + i * _stp_sz;
|
||||||
|
|
||||||
draw_set_alpha(0.4 - abs(i) * 0.1);
|
draw_set_alpha(0.4 - abs(i) * 0.1);
|
||||||
draw_text(slide_dx, slide_dy - (_v - tb.slide_sv) / tb.slide_speed, _v);
|
draw_text(slide_dx, slide_dy - (_v - tb.slide_sv) / _s, _v);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_set_alpha(1);
|
draw_set_alpha(1);
|
||||||
draw_text(slide_dx, slide_dy - (_val - tb.slide_sv) / tb.slide_speed, _val);
|
draw_text(slide_dx, slide_dy - (_val - tb.slide_sv) / _s, _val);
|
||||||
} else {
|
} else {
|
||||||
var _sdw = 240;
|
var _sdw = 240;
|
||||||
var _sdh = 48;
|
var _sdh = 48;
|
||||||
|
@ -58,11 +62,11 @@ if(!MOUSE_WRAPPING) {
|
||||||
var _v = _stp_fl + i * _stp_sz;
|
var _v = _stp_fl + i * _stp_sz;
|
||||||
|
|
||||||
draw_set_alpha(0.4 - abs(i) * 0.1);
|
draw_set_alpha(0.4 - abs(i) * 0.1);
|
||||||
draw_text(slide_dx + (_v - tb.slide_sv) / tb.slide_speed, slide_dy, _v);
|
draw_text(slide_dx + (_v - tb.slide_sv) / _s, slide_dy, _v);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_set_alpha(1);
|
draw_set_alpha(1);
|
||||||
draw_text(slide_dx + (_val - tb.slide_sv) / tb.slide_speed, slide_dy, _val);
|
draw_text(slide_dx + (_val - tb.slide_sv) / _s, slide_dy, _val);
|
||||||
}
|
}
|
||||||
|
|
||||||
tb._input_text = string_real(_val);
|
tb._input_text = string_real(_val);
|
||||||
|
|
|
@ -468,11 +468,13 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
||||||
for( var i = siz - 1; i >= custom_output_index; i-- )
|
for( var i = siz - 1; i >= custom_output_index; i-- )
|
||||||
ds_list_delete(outputs, i);
|
ds_list_delete(outputs, i);
|
||||||
|
|
||||||
|
for( var i = 0; i < siz; i++ )
|
||||||
|
array_push(output_display_list, i);
|
||||||
|
|
||||||
for( var i = custom_output_index; i < siz; i++ ) {
|
for( var i = custom_output_index; i < siz; i++ ) {
|
||||||
var _jout = ds_priority_delete_min(ar);
|
var _jout = ds_priority_delete_min(ar);
|
||||||
_jout.index = i;
|
_jout.index = i;
|
||||||
ds_list_add(outputs, _jout);
|
ds_list_add(outputs, _jout);
|
||||||
array_push(output_display_list, i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ds_priority_destroy(ar);
|
ds_priority_destroy(ar);
|
||||||
|
|
|
@ -8,23 +8,23 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
|
||||||
.setVisible(true, true);
|
.setVisible(true, true);
|
||||||
|
|
||||||
outputs[| 0] = nodeValue("Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0 )
|
outputs[| 0] = nodeValue("Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0 )
|
||||||
.setVisible(false);
|
.setVisible(false, false);
|
||||||
|
|
||||||
static getNextNodes = function() {
|
static getNextNodes = function() { #region
|
||||||
if(!struct_has(group, "outputNextNode")) return [];
|
if(!struct_has(group, "outputNextNode")) return [];
|
||||||
return group.outputNextNode();
|
return group.outputNextNode();
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static step = function() {
|
static step = function() { #region
|
||||||
if(!variable_struct_exists(group, "iterated")) return;
|
if(!variable_struct_exists(group, "iterated")) return;
|
||||||
|
|
||||||
var type = inputs[| 0].isLeaf()? VALUE_TYPE.any : inputs[| 0].value_from.type;
|
var type = inputs[| 0].isLeaf()? VALUE_TYPE.any : inputs[| 0].value_from.type;
|
||||||
inputs[| 0].setType(type);
|
inputs[| 0].setType(type);
|
||||||
group.outputs[| 0].setType(type);
|
group.outputs[| 0].setType(type);
|
||||||
outputs[| 0].setType(type);
|
outputs[| 0].setType(type);
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static cloneValue = function(_prev_val, _val) {
|
static cloneValue = function(_prev_val, _val) { #region
|
||||||
if(inputs[| 0].isLeaf()) return _prev_val;
|
if(inputs[| 0].isLeaf()) return _prev_val;
|
||||||
|
|
||||||
var is_surf = inputs[| 0].value_from.type == VALUE_TYPE.surface;
|
var is_surf = inputs[| 0].value_from.type == VALUE_TYPE.surface;
|
||||||
|
@ -35,9 +35,9 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
|
||||||
else _new_val = array_clone(_val);
|
else _new_val = array_clone(_val);
|
||||||
|
|
||||||
return _new_val;
|
return _new_val;
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static update = function(frame = CURRENT_FRAME) {
|
static update = function(frame = CURRENT_FRAME) { #region
|
||||||
if(inputs[| 0].isLeaf()) {
|
if(inputs[| 0].isLeaf()) {
|
||||||
group.iterationUpdate();
|
group.iterationUpdate();
|
||||||
return;
|
return;
|
||||||
|
@ -55,7 +55,7 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
|
||||||
outputs[| 0].setValue(_val);
|
outputs[| 0].setValue(_val);
|
||||||
group.outputs[| 0].setValue(_val);
|
group.outputs[| 0].setValue(_val);
|
||||||
group.iterationUpdate();
|
group.iterationUpdate();
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static onLoadGroup = function() { #region
|
static onLoadGroup = function() { #region
|
||||||
if(group == noone) nodeDelete(self);
|
if(group == noone) nodeDelete(self);
|
||||||
|
|
|
@ -37,6 +37,8 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
||||||
|
|
||||||
inputs[| 4] = nodeValue("Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.01)
|
inputs[| 4] = nodeValue("Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.01)
|
||||||
|
|
||||||
|
inputs[| 5] = nodeValue("Clamp to range", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)
|
||||||
|
|
||||||
outputs[| 0] = nodeValue("Number", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
|
outputs[| 0] = nodeValue("Number", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
|
||||||
|
|
||||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||||
|
@ -57,6 +59,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
||||||
case 0 :
|
case 0 :
|
||||||
inputs[| 3].setVisible(false);
|
inputs[| 3].setVisible(false);
|
||||||
inputs[| 4].setVisible(false);
|
inputs[| 4].setVisible(false);
|
||||||
|
inputs[| 5].setVisible(false);
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case 1 :
|
||||||
if(inputs[| 0].isLeaf()) {
|
if(inputs[| 0].isLeaf()) {
|
||||||
|
@ -65,6 +68,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
||||||
}
|
}
|
||||||
inputs[| 3].setVisible(true);
|
inputs[| 3].setVisible(true);
|
||||||
inputs[| 4].setVisible(true);
|
inputs[| 4].setVisible(true);
|
||||||
|
inputs[| 5].setVisible(true);
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2 :
|
||||||
if(inputs[| 0].isLeaf()) {
|
if(inputs[| 0].isLeaf()) {
|
||||||
|
@ -73,6 +77,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
||||||
}
|
}
|
||||||
inputs[| 3].setVisible(false);
|
inputs[| 3].setVisible(false);
|
||||||
inputs[| 4].setVisible(false);
|
inputs[| 4].setVisible(false);
|
||||||
|
inputs[| 5].setVisible(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +102,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
||||||
var disp = getInputData(2);
|
var disp = getInputData(2);
|
||||||
var rang = getInputData(3);
|
var rang = getInputData(3);
|
||||||
var stp = getInputData(4);
|
var stp = getInputData(4);
|
||||||
|
var cmp = getInputData(5);
|
||||||
var _col = getColor();
|
var _col = getColor();
|
||||||
|
|
||||||
if(inputs[| 0].value_from != noone || disp == 0) { #region
|
if(inputs[| 0].value_from != noone || disp == 0) { #region
|
||||||
|
@ -147,6 +153,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
||||||
var _valM = (_mx - sl_x0) / (sl_x1 - sl_x0);
|
var _valM = (_mx - sl_x0) / (sl_x1 - sl_x0);
|
||||||
var _valL = lerp(_minn, _maxx, _valM);
|
var _valL = lerp(_minn, _maxx, _valM);
|
||||||
_valL = value_snap(_valL, stp);
|
_valL = value_snap(_valL, stp);
|
||||||
|
if(cmp) _valL = clamp(_valL, _minn, _maxx);
|
||||||
inputs[| 0].setValue(_valL);
|
inputs[| 0].setValue(_valL);
|
||||||
|
|
||||||
if(mouse_release(mb_left))
|
if(mouse_release(mb_left))
|
||||||
|
|
Loading…
Reference in a new issue