[Number] New increment display.

This commit is contained in:
Tanasart 2024-11-30 18:02:41 +07:00
parent 09e6a34ba7
commit 19545b24a0
12 changed files with 269 additions and 137 deletions

View file

@ -144,7 +144,9 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
}
}
function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_index = 0, _icon_blend = COLORS._main_icon, _icon_alpha = 1, _icon_scale = 1) {
function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_index = 0, _icon_blend = COLORS._main_icon, _icon_alpha = 1, _icon_scale = 1,
_button_blend = c_white) {
var res = 0;
var cc = is_array(_icon_blend)? _icon_blend[0] : _icon_blend;
@ -153,7 +155,7 @@ function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = n
cc = _icon_blend[1];
res = 1;
if(spr) draw_sprite_stretched(spr, 1, _x, _y, _w, _h);
if(spr) draw_sprite_stretched_ext(spr, 1, _x, _y, _w, _h, _button_blend);
if(_tip != "") TOOLTIP = _tip;
if(mouse_press(mb_left, _act)) res = 2;
@ -163,11 +165,11 @@ function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = n
if(mouse_release(mb_right, _act)) res = -3;
if(spr && mouse_click(mb_left, _act)) {
draw_sprite_stretched(spr, 2, _x, _y, _w, _h);
draw_sprite_stretched_ext(spr, 2, _x, _y, _w, _h, _button_blend);
draw_sprite_stretched_ext(spr, 3, _x, _y, _w, _h, COLORS._main_accent, 1);
}
} else if(spr)
draw_sprite_stretched(spr, 0, _x, _y, _w, _h);
draw_sprite_stretched_ext(spr, 0, _x, _y, _w, _h, _button_blend);
if(_icon) draw_sprite_ui_uniform(_icon, _icon_index, _x + _w / 2, _y + _h / 2, _icon_scale, cc, _icon_alpha == 1 || res == 0? _icon_alpha : _icon_alpha + 0.4);

View file

@ -251,12 +251,12 @@ function draw_arc_forward(_x, _y, _r, _th, _angSt, _angEd) {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function draw_circle_ui(_x, _y, _r, _o, _c = c_white, _a = 1) {
function draw_circle_ui(_x, _y, _r, _th, _c = c_white, _a = 1) {
shader_set(sh_node_circle);
shader_set_color("color", _c, _a);
shader_set_f("thickness", _o);
shader_set_f("thickness", _th);
shader_set_f("antialias", 1 / _r);
shader_set_i("fill", _o == 0);
shader_set_i("fill", _th == 0);
draw_sprite_stretched(s_fx_pixel, 0, _x - _r, _y - _r, _r * 2, _r * 2);
shader_reset();

View file

@ -1,7 +1,5 @@
function VFX_PREVIEW_NODE() {
if(!is_instanceof(group, Node_VFX_Group)) return self;
return group.getPreviewingNode();
}
function VFX_PREVIEW_NODE() { return is(group, Node_VFX_Group)? group.getPreviewingNode() : self; }
function VFX_PREVIEW_SURFACE() { return is(group, Node_VFX_Group)? group.getPreviewValues() : self; }
function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) constructor {
name = "VFX";
@ -20,26 +18,26 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group
custom_input_index = array_length(inputs);
if(NODE_NEW_MANUAL) { #region
if(NODE_NEW_MANUAL) {
var input = nodeBuild("Node_VFX_Spawner", -256, -32, self);
var output = nodeBuild("Node_VFX_Renderer_Output", 256 + 32 * 5, -32, self);
output.inputs[output.input_fix_len + 1].setFrom(input.outputs[0]);
preview_node = output;
} #endregion
}
static getNextNodes = function() { return allCached? getNextNodesExternal() : getNextNodesInternal(); }
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { #region
static onInspector2Update = function() {
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
var node = nodes[i];
node.clearCache();
}
} #endregion
}
static reset = function() { #region
static reset = function() {
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
var node = nodes[i];
if(!struct_has(node, "reset")) continue;
@ -69,9 +67,9 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group
if(!struct_has(node, "resetSeed")) continue;
node.resetSeed();
}
} #endregion
}
static update = function() { #region
static update = function() {
if(IS_FIRST_FRAME)
topoList = NodeListSort(nodes);
@ -89,22 +87,22 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group
nodes[i].setRenderStatus(true);
setRenderStatus(true);
}
} #endregion
}
static ononDoubleClick = function(panel) { #region
static ononDoubleClick = function(panel) {
preview_node = noone;
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
var node = nodes[i];
if(is_instanceof(node, Node_VFX_Renderer_Output) ||
is_instanceof(node, Node_VFX_Renderer)) {
preview_node = node;
break;
}
if(is(node, Node_VFX_Renderer_Output) || is(node, Node_VFX_Renderer)) {
preview_node = node;
break;
}
}
PANEL_PREVIEW.setNodePreview(self);
} #endregion
}
getPreviewingNode = function() { return preview_node; }
getPreviewValues = function() { return preview_node.getPreviewValues(); }
}

View file

@ -15,7 +15,7 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline(
prev_nodes = [];
if(NODE_NEW_MANUAL) { #region
if(NODE_NEW_MANUAL) {
var input = nodeBuild("Node_VFX_Spawner", x, y);
var output = nodeBuild("Node_VFX_Renderer", x + 256, y);
@ -23,21 +23,21 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline(
addNode(input);
addNode(output);
} #endregion
}
static clearTopoSorted = function() { INLINE topoSorted = false; prev_nodes = []; }
static getPreviousNodes = function() { #region
static getPreviousNodes = function() {
onGetPreviousNodes(prev_nodes);
return prev_nodes;
} #endregion
}
static onRemoveNode = function(node) { node.in_VFX = noone; }
static onAddNode = function(node) { node.in_VFX = self; }
static getNextNodes = function() { return __nodeLeafList(nodes); }
static reset = function() { #region
static reset = function() {
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
var node = nodes[i];
if(!struct_has(node, "reset")) continue;
@ -66,13 +66,25 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline(
if(!struct_has(node, "resetSeed")) continue;
node.resetSeed();
}
} #endregion
}
static update = function() { #region
if(IS_FIRST_FRAME) {
topoList = NodeListSort(nodes);
reset();
}
} #endregion
static update = function() {
if(!IS_FIRST_FRAME) return;
topoList = NodeListSort(nodes);
reset();
}
static getPreviewingNode = function() {
for( var i = 0, n = array_length(nodes); i < n; i++ )
if(is(nodes[i], Node_VFX_Renderer)) return nodes[i];
return self;
}
static getPreviewValues = function() {
for( var i = 0, n = array_length(nodes); i < n; i++ )
if(is(nodes[i], Node_VFX_Renderer)) return nodes[i].getPreviewValues();
return noone;
}
}

View file

@ -17,11 +17,15 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
newInput(3, nodeValue_Int("Line life", self, 4 ))
.rejectArray();
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
input_display_list = [
["Output", false], 0,
["Rendering", false], 1, 2, 3,
];
temp_surface = [ 0 ];
attribute_surface_depth();
attribute_interpolation();
@ -41,29 +45,29 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
setDynamicInput(2, true, VALUE_TYPE.particle);
dyna_input_check_shift = 1;
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
setTrigger(2, "Clear cache", [ THEME.cache, 0, COLORS._main_icon ]);
static onInspector2Update = function() { clearCache(); }
static step = function() { #region
static step = function() {
var _typ = getInputData(2);
inputs[3].setVisible(_typ == PARTICLE_RENDER_TYPE.line);
if(previewing && is_instanceof(group, Node_VFX_Group))
group.preview_node = self;
} #endregion
}
static update = function(_time = CURRENT_FRAME) { #region
static update = function(_time = CURRENT_FRAME) {
var _dim = inputs[0].getValue(_time);
temp_surface[0] = surface_verify(temp_surface[0], _dim[0], _dim[1]);
if(!IS_PLAYING) {
recoverCache();
return;
}
var _dim = inputs[0].getValue(_time);
var _exact = inputs[1].getValue(_time);
var _type = inputs[2].getValue(_time);
var _llife = inputs[3].getValue(_time);
@ -110,7 +114,5 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
surface_reset_shader();
cacheCurrentFrame(_outSurf);
} #endregion
getPreviewingNode = VFX_PREVIEW_NODE;
}
}

View file

@ -47,7 +47,7 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
setDynamicInput(2, true, VALUE_TYPE.particle);
dyna_input_check_shift = 1;
static createOutput = function() { #region
static createOutput = function() {
if(group == noone) return;
if(!is_struct(group)) return;
@ -62,9 +62,9 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
array_push(group.outputs, outParent);
group.refreshNodeDisplay();
group.sortIO();
} if(!LOADING && !APPENDING) createOutput(); #endregion
} if(!LOADING && !APPENDING) createOutput();
static step = function() { #region
static step = function() {
if(outParent == undefined) return;
var _dim = getInputData(0);
@ -78,9 +78,9 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
if(previewing && is_instanceof(group, Node_VFX_Group))
group.preview_node = self;
} #endregion
}
static update = function(_time = CURRENT_FRAME) { #region
static update = function(_time = CURRENT_FRAME) {
if(!is_instanceof(outParent, NodeValue)) return noone;
if(!IS_PLAYING) {
recoverCache();
@ -131,9 +131,9 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
surface_reset_shader();
cacheCurrentFrame(_outSurf);
} #endregion
}
static recoverCache = function(frame = CURRENT_FRAME) { #region
static recoverCache = function(frame = CURRENT_FRAME) {
if(!is_instanceof(outParent, NodeValue)) return false;
if(!cacheExist(frame)) return false;
@ -141,17 +141,17 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
outParent.setValue(_s);
return true;
} #endregion
}
static getGraphPreviewSurface = function() { #region
static getGraphPreviewSurface = function() {
if(!is_instanceof(outParent, NodeValue)) return noone;
return outParent.getValue();
} #endregion
}
static getPreviewValues = function() { #region
static getPreviewValues = function() {
if(!is_instanceof(outParent, NodeValue)) return noone;
return outParent.getValue();
} #endregion
}
getPreviewingNode = VFX_PREVIEW_NODE;
}

View file

@ -7,8 +7,8 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
manual_ungroupable = false;
attributes.Output_pool = false;
array_push(attributeEditors, ["Output all particles", function() { return attributes.Output_pool; },
new checkBox(function() { attributes.Output_pool = !attributes.Output_pool; }) ]);
array_push(attributeEditors, ["Output all particles", function() /*=>*/ {return attributes.Output_pool},
new checkBox(function() /*=>*/ { attributes.Output_pool = !attributes.Output_pool; }) ]);
inputs[21].setVisible(false, false);
@ -19,7 +19,7 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
newOutput(0, nodeValue_Output("Particles", self, VALUE_TYPE.particle, [] ));
newOutput(1, nodeValue_Output("On create", self, VALUE_TYPE.node, noone ));
newOutput(2, nodeValue_Output("On step", self, VALUE_TYPE.node, noone ));
newOutput(2, nodeValue_Output("On step", self, VALUE_TYPE.node, noone ));
newOutput(3, nodeValue_Output("On destroy", self, VALUE_TYPE.node, noone ));
array_insert(input_display_list, 0, ["Trigger", true], input_len + 0, input_len + 1);
@ -32,12 +32,14 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
if(attributes.Output_pool) {
outputs[0].setValue(parts);
return;
} else {
var _parts = [];
for( var i = 0, n = array_length(parts); i < n; i++ ) {
if(!parts[i].active) continue;
array_push(_parts, parts[i]);
}
outputs[0].setValue(_parts);
}
}
@ -86,6 +88,14 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
}
static getGraphPreviewSurface = function() { return getInputData(0); }
getPreviewingNode = VFX_PREVIEW_NODE;
static getPreviewingNode = function() {
if(!is(inline_context, Node_VFX_Group_Inline)) return self;
return inline_context.getPreviewingNode();
}
static getPreviewValues = function() {
if(!is(inline_context, Node_VFX_Group_Inline)) return self;
return inline_context.getPreviewValues();
}
}

View file

@ -19,7 +19,13 @@ function Node_VFX_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) construct
newOutput(0, nodeValue_Output("Path", self, VALUE_TYPE.pathnode, self));
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
input_display_list = [
0,
new Inspector_Label("To render trail properly, make sure to enable \"Output all particles\" in the spawner settings."),
1, 2,
];
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
draw_set_color(COLORS._main_accent);
for( var i = 0, n = array_length(lines); i < n; i++ ) {
@ -33,14 +39,14 @@ function Node_VFX_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) construct
_x + p1[0] * _s, _y + p1[1] * _s);
}
}
} #endregion
}
static getLineCount = function() { return array_length(lines); }
static getSegmentCount = function() { return array_length(lines); }
static getLength = function(index) { return array_safe_get_fast(length, index); }
static getLineCount = function() { return array_length(lines); }
static getSegmentCount = function() { return array_length(lines); }
static getLength = function(index) { return array_safe_get_fast(length, index); }
static getAccuLength = function(index) { return array_safe_get_fast(lengthAcc, index, []); }
static getPointRatio = function(_rat, _ind = 0, out = undefined) { #region
static getPointRatio = function(_rat, _ind = 0, out = undefined) {
if(out == undefined) out = new __vec2(); else { out.x = 0; out.y = 0; }
var _p0, _p1;
@ -61,13 +67,13 @@ function Node_VFX_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) construct
out.y = lerp(_p0[1], _p1[1], _fr);
return out;
} #endregion
}
static getPointDistance = function(_dist, ind = 0, out = undefined) { return getPointRatio(_dist / length[ind], ind, out); }
static getPathData = function() { return lineData; }
static getBoundary = function() { #region
static getBoundary = function() {
var boundary = new BoundingBox();
for( var i = 0, n = array_length(lines); i < n; i++ ) {
@ -77,21 +83,22 @@ function Node_VFX_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) construct
}
return boundary;
} #endregion
}
static update = function() { #region
static update = function() {
var _vfxs = getInputData(0);
if(array_empty(_vfxs) || !is_array(_vfxs)) return;
var _life = getInputData(1); _life = max(_life, 1);
var _colr = getInputData(2);
var _totlLen = array_length(_vfxs);
lines = array_verify(lines, _totlLen);
length = array_verify(length, _totlLen);
lengthAcc = array_verify(lengthAcc, _totlLen);
lineLength = array_verify(lineLength, _totlLen);
lineData = array_verify(lineData, _totlLen);
lines = array_verify(lines, _totlLen);
length = array_verify(length, _totlLen);
lengthAcc = array_verify(lengthAcc, _totlLen);
lineLength = array_verify(lineLength, _totlLen);
lineData = array_verify(lineData, _totlLen);
var _len = 0;
@ -147,10 +154,10 @@ function Node_VFX_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) construct
array_resize(lineData, _len);
outputs[0].setValue(self);
} #endregion
}
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);
draw_sprite_fit(s_node_vfx_trail, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
} #endregion
}
}

View file

@ -24,7 +24,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
newInput(1, nodeValue_Bool("Integer", self, false));
newInput(2, nodeValue_Enum_Scroll("Display", self, 0, { data: [ "Number", "Slider", "Rotator" ], update_hover: false }));
newInput(2, nodeValue_Enum_Scroll("Display", self, 0, { data: [ "Number", "Slider", "Rotator", "Increment" ], update_hover: false }));
newInput(3, nodeValue_Range("Range", self, [ 0, 1 ]));
@ -32,18 +32,30 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
newInput(5, nodeValue_Bool("Clamp to range", self, true));
newInput(6, nodeValue_Enum_Button("Style", self, 0, { data: [ "Blob", "Flat" ] }));
newOutput(0, nodeValue_Output("Number", self, VALUE_TYPE.float, 0));
input_display_list = [ 0, 1,
["Display", false], 2, 6, 3, 4, 5,
]
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var __ax = getInputData(0);
if(is_array(__ax)) return;
var _val = getInputData(0);
var _dsp = getInputData(2);
if(is_array(_val)) return;
if(_dsp == 0 || _dsp == 1) inputs[0].display_type = VALUE_DISPLAY._default;
else if(_dsp == 2) inputs[0].display_type = VALUE_DISPLAY.rotation;
inputs[0].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
inputs[0].display_type = VALUE_DISPLAY._default;
}
static setType = function() {
var int = getInputData(1);
var disp = getInputData(2);
var styl = getInputData(6);
var _ww = 96, _hh = 56;
@ -52,14 +64,18 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[3].setVisible(false);
inputs[4].setVisible(false);
inputs[5].setVisible(false);
inputs[6].setVisible(false);
break;
case 1 :
_ww = 160; _hh = 96;
_ww = 160;
if(styl == 0) _hh = 96;
else if(styl == 1) _hh = 64;
inputs[3].setVisible(true);
inputs[4].setVisible(true);
inputs[5].setVisible(true);
inputs[6].setVisible(true);
break;
case 2 :
@ -68,13 +84,23 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[3].setVisible(false);
inputs[4].setVisible(false);
inputs[5].setVisible(false);
inputs[6].setVisible(true);
break;
case 3 :
_ww = 160; _hh = 64;
inputs[3].setVisible(true);
inputs[4].setVisible(true);
inputs[5].setVisible(true);
inputs[6].setVisible(true);
break;
}
setDimension(_ww, _hh);
for( var i = 0; i < 1; i++ )
inputs[i].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float);
inputs[0].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float);
outputs[0].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float);
}
@ -94,65 +120,96 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
setType();
var _dat = getInputData(0);
outputs[0].setValue(_dat);
var _int = getInputData(1);
var _res = processNumber(_dat, _int);
outputs[0].setValue(_res);
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
var raw = getInputData(0);
var _int = getInputData(1);
var disp = getInputData(2);
var rang = getInputData(3);
var stp = getInputData(4);
var cmp = getInputData(5);
var sty = getInputData(6);
var _col = getColor();
var val = outputs[0].getValue();
if(disp == 0 || inputs[0].value_from != noone || bbox.h < line_get_height(f_p2)) {
var bbox = drawGetBbox(xx, yy, _s);
if(disp == 0 || inputs[0].value_from != noone) {
draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text);
draw_text_bbox(bbox, string_real(val));
return;
}
var _minn = rang[0];
var _maxx = rang[1];
switch(disp) {
case 1 :
draw_set_text(f_sdf, fa_center, fa_center, _col);
draw_text_transformed(bbox.xc, bbox.y0 + 16 * _s, string_real(val), _s * 0.5, _s * 0.5, 0);
var _hov = _hover;
var sl_w = bbox.w - 8 * _s;
var sl_h = _s * 40;
var sl_x0 = bbox.x0 + 4 * _s;
var sl_x1 = sl_x0 + sl_w;
var sl_y0 = (bbox.y0 + (24 * _s) + bbox.y1) / 2 - sl_h / 2;
var sl_y1 = sl_y0 + sl_h;
var c0 = (draggable && !slider_dragging)? colorMultiply(CDEF.main_grey, _col) : colorMultiply(CDEF.main_white, _col);
var c1 = colorMultiply(CDEF.main_dkgrey, _col);
var _minn = rang[0];
var _maxx = rang[1];
if(sty == 0) {
slider_value = slider_value == -1? raw : lerp_float(slider_value, raw, 2.5);
var _prog = clamp((slider_value - _minn) / (_maxx - _minn), 0., 1.);
slider_surface = surface_verify(slider_surface, sl_w, sl_h);
slider_value = slider_value == -1? raw : lerp_float(slider_value, raw, 2.5);
surface_set_shader(slider_surface, sh_ui_slider);
shader_set_color("c0", c0);
shader_set_color("c1", c1);
shader_set_dim("dimension", slider_surface);
shader_set_f("mouseProg", animation_curve_eval(ac_ripple, slider_m));
shader_set_f("prog", clamp((slider_value - _minn) / (_maxx - _minn), 0.1, 0.9));
bbox = drawGetBbox(xx, yy, _s, false);
bbox.fromPoints(bbox.x0, bbox.y0 + 16 * _s, bbox.x1, bbox.y1);
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, sl_w, sl_h);
surface_reset_shader();
draw_set_text(f_sdf, fa_center, fa_center, _col);
draw_text_transformed(bbox.xc, bbox.y0 + 16 * _s, string_real(val), _s * 0.5, _s * 0.5, 0);
draw_surface(slider_surface, sl_x0, sl_y0);
var sl_w = bbox.w - 8 * _s;
var sl_h = _s * 40;
var sl_x0 = bbox.x0 + 4 * _s;
var sl_x1 = sl_x0 + sl_w;
var sl_y0 = (bbox.y0 + (24 * _s) + bbox.y1) / 2 - sl_h / 2;
var sl_y1 = sl_y0 + sl_h;
var _hov = _hover && point_in_rectangle(_mx, _my, sl_x0, sl_y0, sl_x1, sl_y1);
var c0 = (_hov || slider_dragging)? colorMultiply(CDEF.main_white, _col) : colorMultiply(CDEF.main_grey, _col);
var c1 = colorMultiply(CDEF.main_dkgrey, _col);
slider_surface = surface_verify(slider_surface, sl_w, sl_h);
surface_set_shader(slider_surface, sh_ui_slider);
shader_set_color("c0", c0);
shader_set_color("c1", c1);
shader_set_dim("dimension", slider_surface);
shader_set_f("mouseProg", animation_curve_eval(ac_ripple, slider_m));
shader_set_f("prog", clamp(_prog, 0.1, 0.9));
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, sl_w, sl_h);
surface_reset_shader();
draw_surface(slider_surface, sl_x0, sl_y0);
} else if(sty == 1) {
slider_value = raw;
var _prog = clamp((slider_value - _minn) / (_maxx - _minn), 0., 1.);
var sl_w = bbox.w - 8 * _s;
var sl_h = bbox.h - 8 * _s;
var sl_x0 = bbox.x0 + 4 * _s;
var sl_x1 = bbox.x1 - 4 * _s;
var sl_y0 = bbox.y0 + 4 * _s;
var sl_y1 = bbox.y1 - 4 * _s;
var _hov = _hover && point_in_rectangle(_mx, _my, sl_x0, sl_y0, sl_x1, sl_y1);
draw_sprite_stretched_ext(THEME.textbox, 3, sl_x0, sl_y0, sl_w, sl_h + 1, _col, 1);
draw_sprite_stretched_ext(THEME.textbox, 4, sl_x0, sl_y0, sl_w * _prog, sl_h + 1, _col, 1);
draw_sprite_stretched_ext(THEME.textbox, _hov || slider_dragging, sl_x0, sl_y0, sl_w, sl_h + 1, _col, 1);
draw_set_text(f_sdf, fa_center, fa_center, _col);
draw_text_transformed(bbox.xc, bbox.yc + 2, string_real(val), _s * 0.5, _s * 0.5, 0);
}
if(slider_dragging) {
slider_m = lerp_float(slider_m, 1, 4);
@ -172,7 +229,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
} else
slider_m = lerp_float(slider_m, 0, 5);
if(_hover && point_in_rectangle(_mx, _my, sl_x0, sl_y0, sl_x1, sl_y1)) {
if(_hov) {
if(mouse_press(mb_left, _focus) && is_real(raw)) {
slider_dragging = true;
slider_mx = _mx;
@ -186,25 +243,40 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
case 2 :
var _ss = min(bbox.w, bbox.h);
var c0 = (draggable && !rotator_dragging)? colorMultiply(CDEF.main_grey, _col) : colorMultiply(CDEF.main_white, _col);
var c1 = colorMultiply(CDEF.main_dkgrey, _col);
var _dst = point_distance(_mx, _my, bbox.xc, bbox.yc);
var _x0 = bbox.xc - _ss / 2;
var _y0 = bbox.yc - _ss / 2;
rotator_surface = surface_verify(rotator_surface, _ss, _ss);
if(sty == 0) {
var c0 = (draggable && !rotator_dragging)? colorMultiply(CDEF.main_grey, _col) : colorMultiply(CDEF.main_white, _col);
var c1 = colorMultiply(CDEF.main_dkgrey, _col);
surface_set_shader(rotator_surface, sh_ui_rotator);
shader_set_color("c0", c0);
shader_set_color("c1", c1);
shader_set_f("angle", degtorad(raw));
shader_set_f("mouse", (_mx - _x0) / _ss, (_my - _y0) / _ss);
shader_set_f("mouseProg", animation_curve_eval(ac_ripple, rotator_m));
rotator_surface = surface_verify(rotator_surface, _ss, _ss);
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _ss, _ss);
surface_reset_shader();
surface_set_shader(rotator_surface, sh_ui_rotator);
shader_set_color("c0", c0);
shader_set_color("c1", c1);
shader_set_f("angle", degtorad(raw));
shader_set_f("mouse", (_mx - _x0) / _ss, (_my - _y0) / _ss);
shader_set_f("mouseProg", animation_curve_eval(ac_ripple, rotator_m));
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _ss, _ss);
surface_reset_shader();
draw_surface(rotator_surface, _x0, _y0);
} else if(sty == 1) {
var c0 = (draggable && !rotator_dragging)? colorMultiply(CDEF.main_grey, _col) : colorMultiply(CDEF.main_white, _col);
var c1 = colorMultiply(merge_color(CDEF.main_grey, CDEF.main_dkgrey, .5), _col);
draw_surface(rotator_surface, _x0, _y0);
var _r = _ss / 2 - 10 * _s;
draw_circle_ui(bbox.xc, bbox.yc, _r, .04, cola(c1));
var _knx = bbox.xc + lengthdir_x(_r - 2 * _s, raw);
var _kny = bbox.yc + lengthdir_y(_r - 2 * _s, raw);
draw_circle_ui(_knx, _kny, 8 * _s, 0, cola(c0));
}
if(rotator_dragging) {
rotator_m = lerp_float(rotator_m, 1, 4);
@ -235,6 +307,35 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
draw_set_text(f_sdf, fa_center, fa_center, _col);
draw_text_transformed(bbox.xc, bbox.yc, string_real(val, 999, 3), _s * .5, _s * .5, 0);
break;
case 3 :
var bw = 32 * _s;
var bh = bbox.h - 8 * _s;
var bx = bbox.x0 + 4 * _s;
var by = bbox.y0 + 4 * _s;
var cc = colorMultiply(CDEF.main_white, _col);
var b = buttonInstant(THEME.button_def, bx, by, bw, bh, [ _mx, _my ], _focus, _hover, "", THEME.minus, 0, COLORS._main_value_negative, 1, .75 * _s, cc);
if(b) draggable = false;
if(b == 2) {
val -= stp;
if(cmp) val = clamp(val, _minn, _maxx);
inputs[0].setValue(val);
}
var bx = bbox.x1 - 4 * _s - bw;
var b = buttonInstant(THEME.button_def, bx, by, bw, bh, [ _mx, _my ], _focus, _hover, "", THEME.add, 0, COLORS._main_value_positive, 1, .75 * _s, cc);
if(b) draggable = false;
if(b == 2) {
val += stp;
if(cmp) val = clamp(val, _minn, _maxx);
inputs[0].setValue(val);
}
draw_set_text(f_sdf, fa_center, fa_center, _col);
draw_text_transformed(bbox.xc, bbox.yc + 2, string_real(val), _s * 0.5, _s * 0.5, 0);
break;
}
}

View file

@ -985,7 +985,7 @@ function Panel_Inspector() : PanelContent() constructor {
color_picker_index++;
}
if(jun.editWidget.temp_hovering) {
if(jun.editWidget && jun.editWidget.temp_hovering) {
draw_sprite_stretched_ext(THEME.prop_selecting, 0, ui(4), _selY, contentPane.surface_w - ui(8), _selH, COLORS._main_accent, 1);
jun.editWidget.temp_hovering = false;
}

View file

@ -554,8 +554,8 @@ function Panel_Preview() : PanelContent() constructor {
return _node;
}
function getNodePreviewSurface() { return preview_surfaces[splitView? splitSelection : 0]; }
function getNodePreviewSequence() { return preview_sequence[splitView? splitSelection : 0]; }
function getNodePreviewSurface() { return preview_surfaces[splitView? splitSelection : 0]; }
function getNodePreviewSequence() { return preview_sequence[splitView? splitSelection : 0]; }
function getPreviewData() {
preview_surfaces = [ noone, noone ];

View file

@ -23,7 +23,7 @@ void main() {
a = smoothstep(aa, 0., dist);
}
vec4 c = mix(vec4(0.), color, a);
vec4 c = vec4(color.rgb, color.a * a);
gl_FragColor = c;
}