mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
small things
This commit is contained in:
parent
ac10ce12d0
commit
9bba747d34
9 changed files with 72 additions and 32 deletions
|
@ -140,14 +140,9 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
|
|||
var _htg = ui(12);
|
||||
var _bcc = COLORS._main_icon;
|
||||
|
||||
if(ihover && hover_hex > 0) {
|
||||
var _dis = false;
|
||||
if(ihover && point_in_rectangle(_m[0], _m[1], _bx + _bww, _y, _bx + _bw, _y + _h)) {
|
||||
if(hover_hex > 0) {
|
||||
if(ihover && point_in_rectangle(_m[0], _m[1], _bx + _bw - ui(24), _y, _bx + _bw, _y + _h)) {
|
||||
_htg = _bw - _bh;
|
||||
_dis = true;
|
||||
}
|
||||
|
||||
if(_dis && point_in_rectangle(_m[0], _m[1], _bx + _bw - ui(24), _y, _bx + _bw, _y + _h)) {
|
||||
_baa = 1.;
|
||||
|
||||
if(mouse_press(mb_left, iactive)) {
|
||||
|
@ -162,16 +157,15 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
|
|||
if(mouse_click(mb_left, iactive))
|
||||
_bcc = COLORS._main_icon_light;
|
||||
}
|
||||
}
|
||||
|
||||
hover_wid = lerp_float(hover_wid, _htg, 5);
|
||||
if(hover_hex > 0) {
|
||||
draw_set_text(f_p1, fa_right, fa_center, COLORS._main_text_sub);
|
||||
draw_text_add(_bx + _bw - ui(28), _y + _h / 2 + ui(1), color_get_hex(current_color));
|
||||
|
||||
draw_sprite_ext(interactable && key_mod_press(SHIFT)? THEME.paste_20 : THEME.copy_20, 0, _bcx, _bcy, 1, 1, 0, _bcc, _baa);
|
||||
}
|
||||
|
||||
hover_wid = lerp_float(hover_wid, _htg, 5);
|
||||
|
||||
var _a = _color_get_alpha(current_color);
|
||||
if(_a == 1) {
|
||||
draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by, _bww, _bh, current_color, 1);
|
||||
|
|
|
@ -88,6 +88,7 @@ function Node_2D_light(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
var hv = inputs[2].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); _hov |= bool(hv);
|
||||
var hv = inputs[3].drawOverlay(hover, active, px, py, _s, _mx, _my, _snx, _sny); _hov |= bool(hv);
|
||||
break;
|
||||
|
||||
case LIGHT_SHAPE_2D.line :
|
||||
case LIGHT_SHAPE_2D.line_asym :
|
||||
case LIGHT_SHAPE_2D.spot :
|
||||
|
|
|
@ -60,7 +60,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
|
||||
newInput(26, nodeValue_Bool("Clamp range", self, false ));
|
||||
|
||||
newInput(27, nodeValue_Enum_Scroll("Data Type", self, 1, [ "None", "Path", "Segments" ]));
|
||||
newInput(27, nodeValue_Enum_Scroll("Data Type", self, 1, [ "None", "Path", "Segments", "Two points" ]));
|
||||
|
||||
newInput(28, nodeValue_Vector("Segments", self, [[]]))
|
||||
.setArrayDepth(2);
|
||||
|
@ -71,9 +71,15 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
|
||||
newInput(31, nodeValue_Padding("Padding", self, [ 0, 0, 0, 0 ]))
|
||||
|
||||
newInput(32, nodeValue_Vec2("Start Point", self, [ 0, 0.5 ]))
|
||||
.setUnitRef(function(index) /*=>*/ {return getDimension(index)}, VALUE_UNIT.reference);
|
||||
|
||||
newInput(33, nodeValue_Vec2("End Point", self, [ 1, 0.5 ]))
|
||||
.setUnitRef(function(index) /*=>*/ {return getDimension(index)}, VALUE_UNIT.reference);
|
||||
|
||||
input_display_list = [
|
||||
["Output", true], 0, 1, 30, 31,
|
||||
["Line data", false], 27, 6, 7, 28, 19, 2, 20,
|
||||
["Line data", false], 27, 6, 7, 28, 32, 33, 19, 2, 20,
|
||||
["Line settings", false], 17, 3, 11, 12, 8, 25, 9, 26, 13, 14,
|
||||
["Wiggle", false], 4, 5,
|
||||
["Render", false], 10, 24, 15, 16,
|
||||
|
@ -110,10 +116,18 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
y1 = _y + y1 * _s;
|
||||
|
||||
draw_line(x0, y0, x1, y1);
|
||||
}
|
||||
}
|
||||
|
||||
// draw_circle(x0, y0, 4, false);
|
||||
}
|
||||
var _dtype = getInputData(27);
|
||||
var _hov = false;
|
||||
|
||||
if(_dtype == 3) {
|
||||
var hv = inputs[32].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); _hov |= bool(hv);
|
||||
var hv = inputs[33].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); _hov |= bool(hv);
|
||||
}
|
||||
|
||||
return _hov;
|
||||
}
|
||||
|
||||
static step = function() {
|
||||
|
@ -134,15 +148,26 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
inputs[ 2].setVisible(!_flen);
|
||||
inputs[20].setVisible( _flen);
|
||||
|
||||
var _pat = getInputData( 7);
|
||||
var _dtype = getInputData(27);
|
||||
var _segs = getInputData(28);
|
||||
var _pbbox = getInputData(30);
|
||||
|
||||
if(_dtype == 1 && _pat == noone)
|
||||
_dtype = 0;
|
||||
|
||||
if(_dtype == 2 && (array_invalid(_segs) || array_invalid(_segs[0])))
|
||||
_dtype = 0;
|
||||
|
||||
inputs[ 6].setVisible(_dtype == 0);
|
||||
inputs[ 7].setVisible(_dtype == 1, _dtype == 1);
|
||||
inputs[28].setVisible(_dtype == 2, _dtype == 2);
|
||||
|
||||
inputs[30].setVisible(_dtype);
|
||||
inputs[31].setVisible(_dtype && _pbbox);
|
||||
inputs[30].setVisible( _dtype == 1 || _dtype == 2);
|
||||
inputs[31].setVisible((_dtype == 1 || _dtype == 2) && _pbbox);
|
||||
|
||||
inputs[32].setVisible(_dtype == 3);
|
||||
inputs[33].setVisible(_dtype == 3);
|
||||
}
|
||||
|
||||
static onValueUpdate = function(index = 0) {
|
||||
|
@ -191,12 +216,18 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
|
||||
var _pbbox = _data[30];
|
||||
var _ppadd = _data[31];
|
||||
|
||||
var _pnt0 = _data[32];
|
||||
var _pnt1 = _data[33];
|
||||
#endregion
|
||||
|
||||
/////// Guard clauses
|
||||
/////// Check data
|
||||
|
||||
if(_dtype == 1 && _pat == noone) return _outData;
|
||||
if(_dtype == 2 && (array_invalid(_segs) || array_invalid(_segs[0]))) return _outData;
|
||||
if(_dtype == 1 && _pat == noone)
|
||||
_dtype = 0;
|
||||
|
||||
if(_dtype == 2 && (array_invalid(_segs) || array_invalid(_segs[0])))
|
||||
_dtype = 0;
|
||||
|
||||
/////// Data
|
||||
|
||||
|
@ -228,13 +259,25 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
|
||||
switch(_dtype) {
|
||||
case 0 :
|
||||
case 3 :
|
||||
var x0, y0, x1, y1;
|
||||
|
||||
if(_dtype == 0) {
|
||||
_ang = (_ang % 360 + 360) % 360;
|
||||
|
||||
var x0, y0, x1, y1;
|
||||
var _0 = point_rectangle_overlap(_dim[0], _dim[1], (_ang + 180) % 360);
|
||||
var _1 = point_rectangle_overlap(_dim[0], _dim[1], _ang);
|
||||
x0 = _0[0]; y0 = _0[1];
|
||||
x1 = _1[0]; y1 = _1[1];
|
||||
x0 = _0[0];
|
||||
y0 = _0[1];
|
||||
x1 = _1[0];
|
||||
y1 = _1[1];
|
||||
|
||||
} else if(_dtype == 3) {
|
||||
x0 = _pnt0[0];
|
||||
y0 = _pnt0[1];
|
||||
x1 = _pnt1[0];
|
||||
y1 = _pnt1[1];
|
||||
}
|
||||
|
||||
var _l = point_distance(x0, y0, x1, y1);
|
||||
var _d = point_direction(x0, y0, x1, y1);
|
||||
|
@ -480,6 +523,8 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
|
||||
if(_pbbox) _surfDim = [ max(1, maxx - minx + _ppadd[0] + _ppadd[2]), max(1, maxy - miny + _ppadd[1] + _ppadd[3]) ];
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/////// Draw
|
||||
|
|
|
@ -1285,7 +1285,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
arr[@ 1] = self;
|
||||
}
|
||||
|
||||
if(!expUse || !expTree.validate()) return;
|
||||
if(!expUse || expTree == noone || !expTree.validate()) return;
|
||||
|
||||
if(global.EVALUATE_HEAD == self) {
|
||||
noti_warning($"Expression evaluation error : recursive call detected.");
|
||||
|
|
|
@ -2284,7 +2284,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
var y1 = y0 + hh;
|
||||
|
||||
draw_sprite_stretched( THEME.ui_panel_bg, 3, x0, y0, ww, hh);
|
||||
draw_sprite_stretched_add(THEME.ui_panel, 1, x0, y0, ww, hh, c_white, 0.25);
|
||||
// draw_sprite_stretched_add(THEME.ui_panel, 1, x0, y0, ww, hh, c_white, 0.1);
|
||||
draw_sprite_stretched( THEME.button_hide_fill, 1, x0 + pd, y0 + pd, tw, th);
|
||||
|
||||
tb_search.font = f_p2;
|
||||
|
|
|
@ -45,7 +45,7 @@ function Panel_Notification() : PanelContent() constructor {
|
|||
sp_noti = new scrollPane(w - ui(padding + padding), h - ui(padding + padding), function(_y, _m) {
|
||||
draw_clear_alpha(COLORS.panel_bg_clear_inner, 1);
|
||||
|
||||
var hh = 32;
|
||||
var hh = ui(8);
|
||||
var yy = _y;
|
||||
var txw = sp_noti.surface_w - ui(48);
|
||||
if(show_time) txw -= ui(68);
|
||||
|
|
|
@ -76,7 +76,7 @@ function Panel_Presets(_node) : PanelContent() constructor {
|
|||
function onResize() { sc_presets.resize(w - ui(padding + padding), h - ui(padding + padding) - ui(28)); }
|
||||
|
||||
sc_presets = new scrollPane(w - ui(padding + padding), h - ui(padding + padding) - ui(28), function(_y, _m) {
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||
draw_clear_alpha(COLORS.panel_bg_clear_inner, 1);
|
||||
|
||||
var _ww = sc_presets.surface_w;
|
||||
var _h = 0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#ifdef _YY_HLSL11_
|
||||
#define CURVE_MAX 1024
|
||||
#define CURVE_MAX 256
|
||||
#else
|
||||
#define CURVE_MAX 256
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#ifdef _YY_HLSL11_
|
||||
#define CURVE_MAX 1024
|
||||
#define CURVE_MAX 256
|
||||
#else
|
||||
#define CURVE_MAX 256
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue