mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-02-07 10:45:22 +01:00
[Array] Creating array of mixed types will output array of any
type.
This commit is contained in:
parent
5e940692fa
commit
caa1e57cd6
7 changed files with 28 additions and 19 deletions
|
@ -257,8 +257,9 @@
|
|||
{"name":"palette mixer","order":2,"path":"folders/shader/UI/palette mixer.yy",},
|
||||
{"name":"sprites","order":336,"path":"folders/sprites.yy",},
|
||||
{"name":"bs","order":3,"path":"folders/sprites/bs.yy",},
|
||||
{"name":"font","order":1,"path":"folders/sprites/font.yy",},
|
||||
{"name":"gameframe","order":4,"path":"folders/sprites/gameframe.yy",},
|
||||
{"name":"meta","order":1,"path":"folders/sprites/meta.yy",},
|
||||
{"name":"meta","order":2,"path":"folders/sprites/meta.yy",},
|
||||
{"name":"misc","order":5,"path":"folders/sprites/misc.yy",},
|
||||
{"name":"nodes","order":6,"path":"folders/sprites/nodes.yy",},
|
||||
{"name":"profiler","order":8,"path":"folders/sprites/profiler.yy",},
|
||||
|
@ -1862,7 +1863,6 @@
|
|||
{"name":"s_biterator_tab_inactive","order":11,"path":"sprites/s_biterator_tab_inactive/s_biterator_tab_inactive.yy",},
|
||||
{"name":"s_biterator_toggler","order":13,"path":"sprites/s_biterator_toggler/s_biterator_toggler.yy",},
|
||||
{"name":"s_bone_constrain","order":33,"path":"sprites/s_bone_constrain/s_bone_constrain.yy",},
|
||||
{"name":"s_empty","order":9,"path":"sprites/s_empty/s_empty.yy",},
|
||||
{"name":"s_fade_up","order":2,"path":"sprites/s_fade_up/s_fade_up.yy",},
|
||||
{"name":"s_filter_log_level","order":5,"path":"sprites/s_filter_log_level/s_filter_log_level.yy",},
|
||||
{"name":"s_filter_node_inspector","order":4,"path":"sprites/s_filter_node_inspector/s_filter_node_inspector.yy",},
|
||||
|
|
Binary file not shown.
|
@ -100,7 +100,7 @@ event_inherited();
|
|||
meta_filter = [];
|
||||
|
||||
sp_sample = new scrollPane(x1 - x0 - ui(12), y1 - y0 - 1, function(_y, _m) {
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 1);
|
||||
|
||||
var txt = pages[project_page];
|
||||
var list, _group_label;
|
||||
|
@ -287,9 +287,7 @@ event_inherited();
|
|||
|
||||
draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text);
|
||||
name_height = max(name_height, string_height_ext(_name, -1, grid_width) + ui(8));
|
||||
BLEND_ALPHA
|
||||
draw_text_ext(tx, ty - ui(2), _name, -1, grid_width);
|
||||
BLEND_NORMAL
|
||||
draw_text_ext_add(tx, ty - ui(2), _name, -1, grid_width);
|
||||
|
||||
if(++_cur_col >= col) {
|
||||
if(name_height) {
|
||||
|
|
|
@ -15,13 +15,15 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
|
||||
var bw = _w / 2 - ui(4);
|
||||
var bh = ui(36);
|
||||
if(buttonTextIconInstant(true, THEME.button_hide_fill, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add"), COLORS._main_value_positive) == 2) {
|
||||
var by = _y + ui(8);
|
||||
if(buttonTextIconInstant(true, THEME.button_hide_fill, _x, by, bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add"), COLORS._main_value_positive) == 2) {
|
||||
attributes.size = max(attributes.size, (array_length(inputs) - input_fix_len) / data_length ) + 1;
|
||||
onInputResize();
|
||||
}
|
||||
|
||||
var bx = _x + _w - bw;
|
||||
var act = attributes.size > 0;
|
||||
if(buttonTextIconInstant(act, THEME.button_hide_fill, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove"), COLORS._main_value_negative) == 2) {
|
||||
if(buttonTextIconInstant(act, THEME.button_hide_fill, bx, by, bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove"), COLORS._main_value_negative) == 2) {
|
||||
attributes.size--;
|
||||
onInputResize();
|
||||
}
|
||||
|
@ -111,8 +113,6 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
}
|
||||
}
|
||||
|
||||
// w = _typ == VALUE_TYPE.surface? 128 : 96;
|
||||
|
||||
refreshDynamicInput();
|
||||
}
|
||||
|
||||
|
@ -144,16 +144,27 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
var res = [];
|
||||
var ind = 0;
|
||||
|
||||
var _set = _typ == VALUE_TYPE.any;
|
||||
var _setT = VALUE_TYPE.any;
|
||||
|
||||
for( var i = input_fix_len; i < array_length(inputs); i++ ) {
|
||||
var val = getInputData(i);
|
||||
|
||||
if(is_array(val) && spd) array_append(res, val);
|
||||
else array_push(res, val);
|
||||
|
||||
if(_typ == VALUE_TYPE.any && inputs[i].value_from)
|
||||
outputs[0].setType(inputs[i].value_from.type);
|
||||
if(inputs[i].value_from == noone) continue;
|
||||
|
||||
if(_set) {
|
||||
_setT = inputs[i].value_from.type;
|
||||
_set = false;
|
||||
|
||||
} else if(_setT != inputs[i].value_from.type)
|
||||
_setT = VALUE_TYPE.any;
|
||||
}
|
||||
|
||||
if(_typ == VALUE_TYPE.any) outputs[0].setType(_setT);
|
||||
|
||||
outputs[0].setValue(res);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,9 +66,6 @@ function NodeObject(_name, _node, _tooltip = "") constructor {
|
|||
author = "";
|
||||
license = "";
|
||||
|
||||
_fn = registerFunctionLite("New node", name, function(n) /*=>*/ { PANEL_GRAPH.createNodeHotkey(n); }, [ nodeName ]);
|
||||
_fn.spr = spr;
|
||||
|
||||
static init = function() {
|
||||
if(IS_CMD) return;
|
||||
|
||||
|
@ -79,12 +76,15 @@ function NodeObject(_name, _node, _tooltip = "") constructor {
|
|||
tooltip = _n.tooltip;
|
||||
}
|
||||
} init();
|
||||
|
||||
|
||||
static setTags = function(_tags) { tags = _tags; return self; }
|
||||
static setSpr = function(_spr) { spr = _spr; return self; }
|
||||
static setTooltip = function(_tool) { tooltip = _tool; return self; }
|
||||
static setParam = function(_par) { createParam = _par; return self; }
|
||||
static setBuild = function(_fn) { createFn = method(self, _fn); usecreateFn = true; return self; }
|
||||
|
||||
_fn = registerFunctionLite("New node", name, function(n) /*=>*/ { PANEL_GRAPH.createNodeHotkey(n); }, [ nodeName ]);
|
||||
_fn.spr = spr;
|
||||
static setBuild = function(_fn) { createFn = method(self, _fn); usecreateFn = true; return self; }
|
||||
|
||||
static setIO = function(t) {
|
||||
for(var i = 0; i < argument_count; i++) {
|
||||
|
|
|
@ -1159,7 +1159,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
if(type == VALUE_TYPE.text) return display_type == VALUE_DISPLAY.text_array? value : string_real(value);
|
||||
|
||||
if(typeNumeric(typeFrom) && type == VALUE_TYPE.color) return value >= 1? value : make_color_rgb(value * 255, value * 255, value * 255);
|
||||
if(typeNumeric(typeFrom) && type == VALUE_TYPE.color) return value;
|
||||
|
||||
if(typeFrom == VALUE_TYPE.boolean && type == VALUE_TYPE.text) return value? "true" : "false";
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
]);
|
||||
|
||||
MENU_ITEMS.inspector_group_set_color = menuItemGroup(__txt("Color"), _item, ["Inspector", "Set Color"]).setSpacing(ui(24));
|
||||
registerFunction("Inspector", "Set Color", "", MOD_KEY.none, function() /*=>*/ { menuCall("", [ MENU_ITEMS.inspector_group_set_color ]); });
|
||||
registerFunction("Inspector", "Set Color", "", MOD_KEY.none, function() /*=>*/ { menuCall("", [ MENU_ITEMS.inspector_group_set_color ]); });
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
Loading…
Reference in a new issue