mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
color aerr
This commit is contained in:
parent
a88a6d8e1a
commit
19693492cf
10 changed files with 157 additions and 117 deletions
|
@ -45,19 +45,20 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
|
|||
|
||||
static trigger = function() {
|
||||
var dialog = dialogCall(o_dialog_color_selector, WIN_W / 2, WIN_H / 2);
|
||||
dialog.setDefault(current_color);
|
||||
dialog.selector.onApply = apply;
|
||||
dialog.onApply = apply;
|
||||
dialog.interactable = interactable;
|
||||
dialog.drop_target = self;
|
||||
|
||||
if(parentDialog) {
|
||||
if(is_instanceof(parentDialog, PanelContent)) {
|
||||
if(parentDialog.panel)
|
||||
parentDialog.panel.addChildren(dialog);
|
||||
} else
|
||||
parentDialog.addChildren(dialog);
|
||||
}
|
||||
dialog.setDefault(is_array(current_color)? array_safe_get(current_color, 0, 0) : current_color);
|
||||
dialog.selector.onApply = apply;
|
||||
dialog.onApply = apply;
|
||||
dialog.interactable = interactable;
|
||||
dialog.drop_target = self;
|
||||
|
||||
if(parentDialog == noone) return;
|
||||
|
||||
if(is_instanceof(parentDialog, PanelContent)) {
|
||||
if(parentDialog.panel)
|
||||
parentDialog.panel.addChildren(dialog);
|
||||
} else
|
||||
parentDialog.addChildren(dialog);
|
||||
}
|
||||
|
||||
static drawParam = function(params) {
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
function draw_tooltip_text(txt) { #region
|
||||
function draw_tooltip_text(txt) {
|
||||
txt = array_to_string(txt);
|
||||
|
||||
if(string_length(txt) > 1024)
|
||||
txt = string_copy(txt, 1, 1024) + "...";
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
|
||||
|
||||
var tw = min(max(320, WIN_W * 0.4), string_width(txt));
|
||||
var th = string_height_ext(txt, -1, tw);
|
||||
|
||||
var pd = ui(8);
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (tw + pd * 2));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (th + pd * 2));
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (tw + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (th + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + pd * 2, th + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + pd * 2, th + pd * 2);
|
||||
draw_text_line(mx + pd, my + pd, txt, -1, tw);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function draw_tooltip_color(clr) { #region
|
||||
function draw_tooltip_color(clr) {
|
||||
if(is_array(clr)) {
|
||||
draw_tooltip_palette(clr);
|
||||
return;
|
||||
|
@ -28,17 +28,17 @@ function draw_tooltip_color(clr) { #region
|
|||
var hh = ui(32);
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.s_box_r2, 0, mx + pd, my + pd, ww, hh, clr, 1);
|
||||
draw_sprite_stretched_add(THEME.s_box_r2, 1, mx + pd, my + pd, ww, hh, c_white, 0.3);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function draw_tooltip_palette(clr) { #region
|
||||
function draw_tooltip_palette(clr) {
|
||||
if(array_empty(clr)) return;
|
||||
|
||||
var ph = ui(32);
|
||||
|
@ -52,8 +52,8 @@ function draw_tooltip_palette(clr) { #region
|
|||
var hh = array_length(clr) * ph;
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -65,9 +65,9 @@ function draw_tooltip_palette(clr) { #region
|
|||
}
|
||||
|
||||
draw_sprite_stretched_add(THEME.s_box_r2, 1, mx + pd, my + pd, ww, hh, c_white, 0.3);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function draw_tooltip_gradient(clr) { #region
|
||||
function draw_tooltip_gradient(clr) {
|
||||
var gh = ui(32);
|
||||
if(!is_array(clr)) clr = [ clr ];
|
||||
|
||||
|
@ -75,8 +75,8 @@ function draw_tooltip_gradient(clr) { #region
|
|||
var hh = array_length(clr) * gh;
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -86,9 +86,9 @@ function draw_tooltip_gradient(clr) { #region
|
|||
clr[i].draw(mx + pd, _y, ui(ww), gh);
|
||||
_y += gh;
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function draw_tooltip_surface_array(surf) { #region
|
||||
function draw_tooltip_surface_array(surf) {
|
||||
if(!is_array(surf) || array_empty(surf)) return;
|
||||
|
||||
if(is_instanceof(surf[0], SurfaceAtlas)) {
|
||||
|
@ -108,8 +108,8 @@ function draw_tooltip_surface_array(surf) { #region
|
|||
var hh = sh * row;
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -130,9 +130,9 @@ function draw_tooltip_surface_array(surf) { #region
|
|||
draw_set_color(COLORS._main_icon);
|
||||
draw_rectangle(cx - sw * ss / 2, cy - sh * ss / 2, cx + sw * ss / 2 - 1, cy + sh * ss / 2 - 1, true);
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function draw_tooltip_surface(surf) { #region
|
||||
function draw_tooltip_surface(surf) {
|
||||
if(is_array(surf)) {
|
||||
draw_tooltip_surface_array(array_spread(surf))
|
||||
return;
|
||||
|
@ -154,16 +154,16 @@ function draw_tooltip_surface(surf) { #region
|
|||
var hh = sh * ss;
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
||||
draw_surface_ext_safe(surf, mx + pd, my + pd, ss, ss);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function draw_tooltip_sprite(spr) { #region
|
||||
function draw_tooltip_sprite(spr) {
|
||||
if(!sprite_exists(spr)) return;
|
||||
|
||||
var ox = sprite_get_xoffset(spr);
|
||||
|
@ -179,8 +179,8 @@ function draw_tooltip_sprite(spr) { #region
|
|||
var hh = sh * ss + ui(16);
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -193,9 +193,9 @@ function draw_tooltip_sprite(spr) { #region
|
|||
|
||||
draw_set_text(f_p3, fa_center, fa_bottom, COLORS._main_text_sub);
|
||||
draw_text(mx + (ww + pd * 2) / 2, my + hh + pd * 2 - ui(4), $"{sw} x {sh} px");
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function draw_tooltip_atlas(atlas) { #region
|
||||
function draw_tooltip_atlas(atlas) {
|
||||
if(!is_array(atlas)) atlas = [ atlas ];
|
||||
|
||||
var amo = array_length(atlas);
|
||||
|
@ -205,8 +205,8 @@ function draw_tooltip_atlas(atlas) { #region
|
|||
if(amo && is_array(atlas[0])) return;
|
||||
|
||||
var pd = ui(4);
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -242,9 +242,9 @@ function draw_tooltip_atlas(atlas) { #region
|
|||
draw_text_add(sx + ui(160), _y + ui(16), atl.rotation);
|
||||
draw_text_add(sx + ui(160), _y + ui(32), $"{atl.sx}, {atl.sy}");
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function draw_tooltip_buffer(buff) { #region
|
||||
function draw_tooltip_buffer(buff) {
|
||||
var txt = buffer_get_string(buff, false, 400);
|
||||
var len = string_length(txt);
|
||||
|
||||
|
@ -258,8 +258,8 @@ function draw_tooltip_buffer(buff) { #region
|
|||
th += string_height(" ");
|
||||
|
||||
var pd = ui(8);
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (tw + pd * 2));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (th + pd * 2));
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (tw + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (th + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + pd * 2, th + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + pd * 2, th + pd * 2);
|
||||
|
@ -269,16 +269,16 @@ function draw_tooltip_buffer(buff) { #region
|
|||
draw_set_text(f_code, fa_left, fa_bottom, COLORS._main_text_sub);
|
||||
draw_text(mx + pd, my + th + pd, $"...({buffer_get_size(buff)} bytes)");
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function draw_tooltip_curve(curve) { #region
|
||||
function draw_tooltip_curve(curve) {
|
||||
|
||||
var ww = ui(160);
|
||||
var hh = ui(160);
|
||||
|
||||
var pd = ui(8);
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (ww + pd * 2));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (hh + pd * 2));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
|
||||
|
@ -309,4 +309,4 @@ function draw_tooltip_curve(curve) { #region
|
|||
draw_set_color(COLORS.widget_curve_outline);
|
||||
draw_rectangle(x0, y0, x1, y1, true);
|
||||
|
||||
} #endregion
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
LATEST_VERSION = 1_16_00;
|
||||
VERSION = 1_17_11_0;
|
||||
SAVE_VERSION = 1_17_10_0;
|
||||
VERSION_STRING = "1.17.11.004";
|
||||
VERSION_STRING = "1.17.11.005";
|
||||
BUILD_NUMBER = 1_17_11_0;
|
||||
|
||||
HOTKEYS = ds_map_create();
|
||||
|
|
|
@ -227,12 +227,12 @@ function hotkey_draw(keyStr, _x, _y, _status = 0) {
|
|||
|
||||
}
|
||||
|
||||
draw_set_text(f_p1, fa_right, fa_center, tc);
|
||||
draw_set_text(f_p2, fa_right, fa_center, tc);
|
||||
var _tw = string_width( keyStr);
|
||||
var _th = string_height(keyStr);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, _x - _tw - ui(4), _y - _th / 2 - ui(3), _tw + ui(8), _th + ui(3), bc);
|
||||
draw_text(_x, _y, keyStr);
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, _x - _tw - ui(4), _y - _th / 2 - ui(5), _tw + ui(8), _th + ui(6), bc);
|
||||
draw_text(_x, _y - ui(2), keyStr);
|
||||
}
|
||||
|
||||
function hotkey_serialize() {
|
||||
|
|
|
@ -53,9 +53,9 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
_selecting_frame = noone;
|
||||
|
||||
frame_renderer_content = surface_create(1, 1);
|
||||
frame_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _full = true, _fx = frame_renderer_x) { #region frame_renderer
|
||||
var _h = _full? 64 : 48;
|
||||
var _anim = getInputData(12);
|
||||
frame_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone, _full = true, _fx = frame_renderer_x) {
|
||||
var _h = _full? 64 : 48;
|
||||
var _anim = getInputData(12);
|
||||
var _cnt_hover = false;
|
||||
|
||||
if(_full) {
|
||||
|
@ -170,7 +170,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
|
||||
return _h + 8 * _full;
|
||||
|
||||
}).setNode(self); #endregion
|
||||
}).setNode(self);
|
||||
|
||||
temp_surface = array_create(2);
|
||||
|
||||
|
@ -1228,7 +1228,7 @@ function timelineItemNode_Canvas(node) : timelineItemNode(node) constructor {
|
|||
var _surfs = node.output_surface;
|
||||
var _surf, _rx, _ry;
|
||||
var _rx0, _ry0;
|
||||
var _h = h - 2;
|
||||
var _h = h;
|
||||
|
||||
_ry = _h / 2 + _y;
|
||||
_ry0 = _y;
|
||||
|
|
|
@ -52,7 +52,7 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection(_x, _y, _group) con
|
|||
return _h;
|
||||
});
|
||||
|
||||
frame_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
|
||||
frame_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel) {
|
||||
var _h = 0;
|
||||
var _yy = _y;
|
||||
|
||||
|
@ -69,7 +69,7 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection(_x, _y, _group) con
|
|||
_frame_render.rx = frame_renderer.rx;
|
||||
_frame_render.ry = frame_renderer.ry;
|
||||
|
||||
var _wdh = _frame_render.draw(_x, _yy, _w, _m, _hover, _focus, false, frame_renderer_x);
|
||||
var _wdh = _frame_render.draw(_x, _yy, _w, _m, _hover, _focus, _panel, false, frame_renderer_x);
|
||||
if(is_undefined(_wdh)) continue;
|
||||
|
||||
frame_renderer_x_max = max(frame_renderer_x_max, _frame_render.node.frame_renderer_x_max);
|
||||
|
|
|
@ -16,7 +16,7 @@ function Node_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
|
||||
static getPreviewValues = function() { return getInputData(0); }
|
||||
|
||||
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) {
|
||||
PROCESSOR_OVERLAY_CHECK
|
||||
|
||||
inputs[1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
|
@ -46,9 +46,9 @@ function Node_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_rectangle(x0, y0, x1, y1, true);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) {
|
||||
var _surf = _data[0];
|
||||
var _pos = _data[1];
|
||||
var _sam = _data[2];
|
||||
|
@ -84,10 +84,10 @@ function Node_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
b /= amo;
|
||||
a /= amo;
|
||||
|
||||
return _alp? make_color_rgba(r, g, b, a) : make_color_rgb(r, g, b);
|
||||
} #endregion
|
||||
return make_color_rgba(r, g, b, _alp? a : 255);
|
||||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
var col = outputs[0].getValue();
|
||||
if(bbox.h <= 0) return;
|
||||
|
@ -98,5 +98,5 @@ function Node_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
}
|
||||
|
||||
drawColor(col, bbox.x0, bbox.y0, bbox.w, bbox.h);
|
||||
} #endregion
|
||||
}
|
||||
}
|
|
@ -556,13 +556,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
editWidget = noone;
|
||||
switch(display_type) {
|
||||
case VALUE_DISPLAY.button : #region
|
||||
var _onClick;
|
||||
|
||||
if(struct_has(display_data, "onClick"))
|
||||
_onClick = method(node, display_data.onClick);
|
||||
else
|
||||
_onClick = function() { setAnim(true); setValueDirect(true); };
|
||||
case VALUE_DISPLAY.button :
|
||||
var _onClick = struct_has(display_data, "onClick")? method(node, display_data.onClick) : function() /*=>*/ { setAnim(true); setValueDirect(true); };
|
||||
|
||||
editWidget = button(_onClick).setText(struct_try_get(display_data, "name", "Trigger"));
|
||||
runInUI = struct_try_get(display_data, "UI", false);
|
||||
|
@ -570,7 +565,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
visible = false;
|
||||
rejectArray();
|
||||
|
||||
return; #endregion
|
||||
return;
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
|
@ -814,8 +809,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
break;
|
||||
|
||||
case VALUE_TYPE.boolean : #region
|
||||
if(name == "Active") editWidget = new checkBoxActive(function() { return setValueInspector(!animator.getValue()); } );
|
||||
else editWidget = new checkBox( function() { return setValueInspector(!animator.getValue()); } );
|
||||
if(name == "Active") editWidget = new checkBoxActive(function() /*=>*/ {return setValueInspector(!animator.getValue())} );
|
||||
else editWidget = new checkBox( function() /*=>*/ {return setValueInspector(!animator.getValue())} );
|
||||
|
||||
key_inter = CURVE_TYPE.cut;
|
||||
extract_node = "Node_Boolean";
|
||||
|
@ -824,48 +819,45 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
case VALUE_TYPE.color :
|
||||
switch(display_type) {
|
||||
case VALUE_DISPLAY._default :
|
||||
editWidget = new buttonColor(function(color) { return setValueInspector(color); } );
|
||||
|
||||
editWidget = new buttonColor(function(color) /*=>*/ {return setValueInspector(color)});
|
||||
graph_h = ui(16);
|
||||
extract_node = "Node_Color";
|
||||
break;
|
||||
|
||||
case VALUE_DISPLAY.palette :
|
||||
editWidget = new buttonPalette(function(color) { return setValueInspector(color); } );
|
||||
|
||||
editWidget = new buttonPalette(function(color) /*=>*/ {return setValueInspector(color)});
|
||||
extract_node = "Node_Palette";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case VALUE_TYPE.gradient :
|
||||
editWidget = new buttonGradient(function(gradient) { return setValueInspector(gradient); } );
|
||||
|
||||
editWidget = new buttonGradient(function(gradient) /*=>*/ {return setValueInspector(gradient)});
|
||||
extract_node = "Node_Gradient_Out";
|
||||
break;
|
||||
|
||||
case VALUE_TYPE.path :
|
||||
switch(display_type) {
|
||||
case VALUE_DISPLAY.path_array :
|
||||
editWidget = new pathArrayBox(self, display_data.filter, function(path) { setValueInspector(path); } );
|
||||
editWidget = new pathArrayBox(self, display_data.filter, function(path) /*=>*/ {return setValueInspector(path)});
|
||||
break;
|
||||
|
||||
case VALUE_DISPLAY.path_load :
|
||||
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { setValueInspector(str); } );
|
||||
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ {return setValueInspector(str)});
|
||||
|
||||
editWidget.align = fa_left;
|
||||
editWidget.align = fa_left;
|
||||
editWidget.side_button = button(function() {
|
||||
var path = display_data.filter == "dir"? get_directory("") : get_open_filename_pxc(display_data.filter, "");
|
||||
key_release();
|
||||
if(path == "") return noone;
|
||||
return setValueInspector(path);
|
||||
}, THEME.button_path_icon);
|
||||
}, THEME.button_path_icon).setTooltip(__txt("Open Explorer..."));
|
||||
|
||||
extract_node = "Node_String";
|
||||
break;
|
||||
|
||||
case VALUE_DISPLAY.path_save :
|
||||
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { setValueInspector(str); } );
|
||||
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ {return setValueInspector(str)});
|
||||
|
||||
editWidget.align = fa_left;
|
||||
editWidget.side_button = button(function() {
|
||||
|
@ -873,45 +865,45 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
key_release();
|
||||
if(path == "") return noone;
|
||||
return setValueInspector(path);
|
||||
}, THEME.button_path_icon);
|
||||
}, THEME.button_path_icon).setTooltip(__txt("Open Explorer..."));
|
||||
|
||||
extract_node = "Node_String";
|
||||
break;
|
||||
|
||||
case VALUE_DISPLAY.path_font :
|
||||
editWidget = new fontScrollBox( function(val) { return setValueInspector(FONT_INTERNAL[val]); } );
|
||||
editWidget = new fontScrollBox(function(val) /*=>*/ {return setValueInspector(FONT_INTERNAL[val])});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case VALUE_TYPE.curve :
|
||||
display_type = VALUE_DISPLAY.curve;
|
||||
editWidget = new curveBox(function(_modified) { return setValueInspector(_modified); });
|
||||
editWidget = new curveBox(function(_modified) /*=>*/ {return setValueInspector(_modified)});
|
||||
break;
|
||||
|
||||
case VALUE_TYPE.text :
|
||||
switch(display_type) {
|
||||
case VALUE_DISPLAY._default :
|
||||
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
|
||||
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) /*=>*/ {return setValueInspector(str)});
|
||||
extract_node = "Node_String";
|
||||
break;
|
||||
|
||||
case VALUE_DISPLAY.text_box :
|
||||
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
|
||||
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ {return setValueInspector(str)});
|
||||
extract_node = "Node_String";
|
||||
break;
|
||||
|
||||
case VALUE_DISPLAY.codeLUA :
|
||||
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
|
||||
|
||||
editWidget.font = f_code;
|
||||
editWidget.format = TEXT_AREA_FORMAT.codeLUA;
|
||||
editWidget.min_lines = 4;
|
||||
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) /*=>*/ {return setValueInspector(str)});
|
||||
extract_node = "Node_String";
|
||||
|
||||
editWidget.font = f_code;
|
||||
editWidget.format = TEXT_AREA_FORMAT.codeLUA;
|
||||
editWidget.min_lines = 4;
|
||||
break;
|
||||
|
||||
case VALUE_DISPLAY.codeHLSL:
|
||||
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
|
||||
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) /*=>*/ {return setValueInspector(str)});
|
||||
|
||||
editWidget.autocomplete_server = hlsl_autocomplete_server;
|
||||
editWidget.function_guide_server = hlsl_function_guide_server;
|
||||
|
@ -925,20 +917,20 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
break;
|
||||
|
||||
case VALUE_DISPLAY.text_tunnel :
|
||||
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
|
||||
|
||||
editWidget.autocomplete_server = tunnel_autocomplete_server;
|
||||
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) /*=>*/ {return setValueInspector(str)});
|
||||
editWidget.autocomplete_server = tunnel_autocomplete_server;
|
||||
|
||||
extract_node = "Node_String";
|
||||
break;
|
||||
|
||||
case VALUE_DISPLAY.text_array :
|
||||
editWidget = new textArrayBox(function() { return animator.values[0].value; }, display_data.data, function() { node.doUpdate(); });
|
||||
editWidget = new textArrayBox(function() /*=>*/ {return animator.values[0].value}, display_data.data, function() /*=>*/ {return node.doUpdate()});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case VALUE_TYPE.d3Material :
|
||||
show_in_inspector = true;
|
||||
editWidget = new materialBox(function(ind) {
|
||||
var res = setValueInspector(ind);
|
||||
node.triggerRender();
|
||||
|
@ -946,15 +938,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
} );
|
||||
|
||||
if(!struct_has(display_data, "atlas")) display_data.atlas = true;
|
||||
show_in_inspector = true;
|
||||
extract_node = "Node_Canvas";
|
||||
break;
|
||||
|
||||
case VALUE_TYPE.surface :
|
||||
editWidget = new surfaceBox(function(ind) { return setValueInspector(ind); } );
|
||||
show_in_inspector = true;
|
||||
editWidget = new surfaceBox(function(ind) /*=>*/ {return setValueInspector(ind)});
|
||||
|
||||
if(!struct_has(display_data, "atlas")) display_data.atlas = true;
|
||||
show_in_inspector = true;
|
||||
extract_node = "Node_Canvas";
|
||||
break;
|
||||
|
||||
|
|
|
@ -338,6 +338,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
mouse_on_graph = false;
|
||||
node_bg_hovering = false;
|
||||
|
||||
file_drop_tooltip = new Panel_Graph_Drop_tooltip(self);
|
||||
#endregion
|
||||
|
||||
#region // ---- nodes ----
|
||||
|
@ -2496,12 +2498,17 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
_node_hover = _n;
|
||||
}
|
||||
|
||||
if(DRAGGING || FILE_IS_DROPPING)
|
||||
var _tip = "";
|
||||
|
||||
if(DRAGGING || FILE_IS_DROPPING) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_selection, 0, 8, 8, w - 16, h - 16, COLORS._main_value_positive, 1);
|
||||
_tip = file_drop_tooltip;
|
||||
}
|
||||
|
||||
if(DRAGGING) { // file dropping
|
||||
if(_node_hover && _node_hover.droppable(DRAGGING)) {
|
||||
_node_hover.draw_droppable = true;
|
||||
_tip = "Drop on node";
|
||||
if(mouse_release(mb_left)) _node_hover.onDrop(DRAGGING);
|
||||
|
||||
} else {
|
||||
|
@ -2509,8 +2516,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
}
|
||||
}
|
||||
|
||||
if(FILE_IS_DROPPING && _node_hover && _node_hover.dropPath != noone)
|
||||
if(FILE_IS_DROPPING && _node_hover && _node_hover.dropPath != noone) {
|
||||
_node_hover.draw_droppable = true;
|
||||
_tip = "Drop on node";
|
||||
}
|
||||
|
||||
if(FILE_DROPPED && !array_empty(FILE_DROPPING)) {
|
||||
if(_node_hover && _node_hover.dropPath != noone)
|
||||
|
@ -2518,6 +2527,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
else
|
||||
run_in(1, load_file_path, [ FILE_DROPPING, _gx, _gy ]);
|
||||
}
|
||||
|
||||
if(_tip != "") TOOLTIP = _tip;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3266,3 +3277,40 @@ function load_file_path(path, _x = undefined, _y = undefined) {
|
|||
// if(node && !IS_CMD) PANEL_GRAPH.toCenterNode();
|
||||
}
|
||||
}
|
||||
|
||||
function Panel_Graph_Drop_tooltip(panel) constructor {
|
||||
self.panel = panel;
|
||||
|
||||
static drawTooltip = function() {
|
||||
var _drop = __txt("Import File");
|
||||
var _shft = __txt("Options...");
|
||||
|
||||
draw_set_font(f_p1);
|
||||
var w1 = string_width(_drop);
|
||||
var h1 = string_height(_drop);
|
||||
|
||||
draw_set_font(f_p2);
|
||||
var w2 = string_width(_shft) + string_width("Shift") + ui(16);
|
||||
var h2 = string_height(_shft);
|
||||
|
||||
var tw = max(w1, w2);
|
||||
var th = h1 + ui(8) + h2;
|
||||
|
||||
var mx = min(mouse_mxs + ui(16), WIN_W - (tw + ui(16)));
|
||||
var my = min(mouse_mys + ui(16), WIN_H - (th + ui(16)));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + ui(16), th + ui(16));
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + ui(16), th + ui(16));
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(mx + ui(8), my + ui(8), _drop);
|
||||
|
||||
draw_set_font(f_p2);
|
||||
var _hx = mx + ui(12) + string_width("Shift");
|
||||
var _hy = my + ui(8) + h1 + ui(4) + h2 / 2 + ui(4);
|
||||
hotkey_draw("Shift", _hx, _hy);
|
||||
|
||||
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
|
||||
draw_text(_hx + ui(8), my + ui(8) + h1 + ui(6), _shft);
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ function tooltipHotkey(text, context = "", name = "") constructor {
|
|||
static drawTooltip = function() {
|
||||
if(keyStr == "") { draw_tooltip_text(text); return; }
|
||||
|
||||
draw_set_font(f_p0);
|
||||
draw_set_font(f_p1);
|
||||
var _w1 = string_width(text);
|
||||
|
||||
draw_set_font(f_p1);
|
||||
|
@ -24,7 +24,7 @@ function tooltipHotkey(text, context = "", name = "") constructor {
|
|||
draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + ui(16), th + ui(16));
|
||||
draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + ui(16), th + ui(16));
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
|
||||
draw_set_color(COLORS._main_text);
|
||||
draw_text_line(mx + ui(8), my + ui(8), text, -1, tw);
|
||||
|
||||
|
@ -45,7 +45,7 @@ function tooltipHotkey_assign(text, hotkey = "") constructor {
|
|||
draw_set_font(f_p1);
|
||||
var _w1 = string_width(hotkey);
|
||||
|
||||
draw_set_font(f_p0);
|
||||
draw_set_font(f_p1);
|
||||
var _w2 = 0;
|
||||
var th = 0;
|
||||
|
||||
|
@ -66,7 +66,7 @@ function tooltipHotkey_assign(text, hotkey = "") constructor {
|
|||
|
||||
var txy = my + ui(8);
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, _uns? COLORS._main_text_sub : COLORS._main_text);
|
||||
draw_set_text(f_p1, fa_left, fa_top, _uns? COLORS._main_text_sub : COLORS._main_text);
|
||||
for (var i = 0, n = array_length(_txt); i < n; i++) {
|
||||
var _t = _txt[i];
|
||||
var _ts = is_string(_t)? _t : _t.name;
|
||||
|
|
Loading…
Reference in a new issue