- [Animation Panel] Add Ctrl+Click to edit keyframe value directly.

This commit is contained in:
Tanasart 2024-06-19 14:04:03 +07:00
parent 3ae01f7d86
commit 0009a20ba3
35 changed files with 505 additions and 323 deletions

View file

@ -260,6 +260,7 @@
{"name":"o_dialog_splash","order":9,"path":"objects/o_dialog_splash/o_dialog_splash.yy",}, {"name":"o_dialog_splash","order":9,"path":"objects/o_dialog_splash/o_dialog_splash.yy",},
{"name":"o_dialog_textbox_autocomplete","order":7,"path":"objects/o_dialog_textbox_autocomplete/o_dialog_textbox_autocomplete.yy",}, {"name":"o_dialog_textbox_autocomplete","order":7,"path":"objects/o_dialog_textbox_autocomplete/o_dialog_textbox_autocomplete.yy",},
{"name":"o_dialog_textbox_function_guide","order":8,"path":"objects/o_dialog_textbox_function_guide/o_dialog_textbox_function_guide.yy",}, {"name":"o_dialog_textbox_function_guide","order":8,"path":"objects/o_dialog_textbox_function_guide/o_dialog_textbox_function_guide.yy",},
{"name":"o_dialog_value_editor","order":9,"path":"objects/o_dialog_value_editor/o_dialog_value_editor.yy",},
{"name":"o_dialog_warning","order":10,"path":"objects/o_dialog_warning/o_dialog_warning.yy",}, {"name":"o_dialog_warning","order":10,"path":"objects/o_dialog_warning/o_dialog_warning.yy",},
{"name":"o_main","order":1,"path":"objects/o_main/o_main.yy",}, {"name":"o_main","order":1,"path":"objects/o_main/o_main.yy",},
{"name":"o_pie_menu","order":14,"path":"objects/o_pie_menu/o_pie_menu.yy",}, {"name":"o_pie_menu","order":14,"path":"objects/o_pie_menu/o_pie_menu.yy",},

View file

@ -568,6 +568,7 @@
{"id":{"name":"o_dialog_splash","path":"objects/o_dialog_splash/o_dialog_splash.yy",},}, {"id":{"name":"o_dialog_splash","path":"objects/o_dialog_splash/o_dialog_splash.yy",},},
{"id":{"name":"o_dialog_textbox_autocomplete","path":"objects/o_dialog_textbox_autocomplete/o_dialog_textbox_autocomplete.yy",},}, {"id":{"name":"o_dialog_textbox_autocomplete","path":"objects/o_dialog_textbox_autocomplete/o_dialog_textbox_autocomplete.yy",},},
{"id":{"name":"o_dialog_textbox_function_guide","path":"objects/o_dialog_textbox_function_guide/o_dialog_textbox_function_guide.yy",},}, {"id":{"name":"o_dialog_textbox_function_guide","path":"objects/o_dialog_textbox_function_guide/o_dialog_textbox_function_guide.yy",},},
{"id":{"name":"o_dialog_value_editor","path":"objects/o_dialog_value_editor/o_dialog_value_editor.yy",},},
{"id":{"name":"o_dialog_warning","path":"objects/o_dialog_warning/o_dialog_warning.yy",},}, {"id":{"name":"o_dialog_warning","path":"objects/o_dialog_warning/o_dialog_warning.yy",},},
{"id":{"name":"o_main","path":"objects/o_main/o_main.yy",},}, {"id":{"name":"o_main","path":"objects/o_main/o_main.yy",},},
{"id":{"name":"o_pie_menu","path":"objects/o_pie_menu/o_pie_menu.yy",},}, {"id":{"name":"o_pie_menu","path":"objects/o_pie_menu/o_pie_menu.yy",},},

View file

@ -0,0 +1,47 @@
/// @description init
event_inherited();
#region data
dialog_w = ui(240);
dialog_h = TEXTBOX_HEIGHT + ui(8);
draggable = false;
destroy_on_click_out = true;
junction = noone;
keyframe = noone;
editWidget = noone;
wid_h = 0;
function setKey(_key) {
self.keyframe = _key;
junction = _key.anim.prop;
if(!junction.editWidget) {
instance_destroy();
return self;
}
editWidget = junction.editWidget.clone();
if(editWidget == noone) {
instance_destroy();
return self;
}
editWidget.onModify = function(val, index = noone) {
var v = keyframe.value;
if(is_array(v)) {
if(index >= 0)
v[index] = val;
else if(is_array(val))
v = val;
} else
v = val;
keyframe.value = v;
junction.node.triggerRender();
};
return self;
}
#endregion

View file

@ -0,0 +1,24 @@
/// @description init
if(editWidget == noone) exit;
#region Draw
draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h);
draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h);
editWidget.setFocusHover(sFOCUS, sHOVER);
var eX = dialog_x + ui(4);
var eY = dialog_y + ui(4);
var eW = dialog_w - ui(8);
var param = new widgetParam(eX, eY, eW, TEXTBOX_HEIGHT, keyframe.value, junction.display_data);
var _h = editWidget.drawParam(param);
dialog_h = _h + ui(8);
if(wid_h != dialog_h) {
dialog_y = min(dialog_y, WIN_H - dialog_h - ui(8));
wid_h = dialog_h;
}
#endregion

View file

@ -0,0 +1,39 @@
{
"$GMObject":"",
"%Name":"o_dialog_value_editor",
"eventList":[
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
],
"managed":true,
"name":"o_dialog_value_editor",
"overriddenProperties":[],
"parent":{
"name":"widget",
"path":"folders/dialog/widget.yy",
},
"parentObjectId":{
"name":"_p_dialog",
"path":"objects/_p_dialog/_p_dialog.yy",
},
"persistent":false,
"physicsAngularDamping":0.1,
"physicsDensity":0.5,
"physicsFriction":0.2,
"physicsGroup":1,
"physicsKinematic":false,
"physicsLinearDamping":0.1,
"physicsObject":false,
"physicsRestitution":0.1,
"physicsSensor":false,
"physicsShape":1,
"physicsShapePoints":[],
"physicsStartAwake":true,
"properties":[],
"resourceType":"GMObject",
"resourceVersion":"2.0",
"solid":false,
"spriteId":null,
"spriteMaskId":null,
"visible":true,
}

View file

@ -9,8 +9,8 @@ function __sliderRange(_min, _max, _step, _onModify) : widget() constructor {
dragging = noone; dragging = noone;
drag_sv = 0; drag_sv = 0;
tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, clamp(val, minn, maxx)); }); tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(clamp(val, minn, maxx), 0); });
tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, clamp(val, minn, maxx)); }); tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(clamp(val, minn, maxx), 1); });
tb_value_min.slidable = true; tb_value_min.slidable = true;
tb_value_max.slidable = true; tb_value_max.slidable = true;
@ -83,13 +83,13 @@ function __sliderRange(_min, _max, _step, _onModify) : widget() constructor {
if(key_mod_press(CTRL)) if(key_mod_press(CTRL))
val = round(val); val = round(val);
if(onModify(dragging_index, val)) if(onModify(val, dragging_index))
UNDO_HOLDING = true; UNDO_HOLDING = true;
MOUSE_BLOCK = true; MOUSE_BLOCK = true;
if(mouse_check_button_pressed(mb_right)) { if(mouse_check_button_pressed(mb_right)) {
onModify(dragging_index, drag_sv); onModify(drag_sv, dragging_index);
instance_destroy(dragging); instance_destroy(dragging);
dragging = noone; dragging = noone;
UNDO_HOLDING = false; UNDO_HOLDING = false;

View file

@ -60,7 +60,7 @@ end",
if(_addon == noone) return noone; if(_addon == noone) return noone;
var wd = new vectorBox(size, noone); var wd = new vectorBox(size, noone);
wd.setLua(_addon.thread, onModify, function(i, v) { wd.setLua(_addon.thread, onModify, function(v, i) {
return lua_call(lua_thread, lua_thread_key, i + 1, v); return lua_call(lua_thread, lua_thread_key, i + 1, v);
}); });

View file

@ -37,56 +37,56 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
onModifySingle[0] = function(val) { #region onModifySingle[0] = function(val) { #region
var v = toNumber(val); var v = toNumber(val);
var m = onModify(0, v); var m = onModify(v, 0);
if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value) if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value)
return m; return m;
m |= onModify(1, v); m |= onModify(v, 1);
m |= onModify(2, v); m |= onModify(v, 2);
m |= onModify(3, v); m |= onModify(v, 3);
return m; return m;
} #endregion } #endregion
onModifySingle[1] = function(val) { #region onModifySingle[1] = function(val) { #region
var v = toNumber(val); var v = toNumber(val);
var m = onModify(1, v); var m = onModify(v, 1);
if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value) if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value)
return m; return m;
m |= onModify(0, v); m |= onModify(v, 0);
m |= onModify(2, v); m |= onModify(v, 2);
m |= onModify(3, v); m |= onModify(v, 3);
return m; return m;
} #endregion } #endregion
onModifySingle[2] = function(val) { #region onModifySingle[2] = function(val) { #region
var v = toNumber(val); var v = toNumber(val);
var m = onModify(2, v); var m = onModify(v, 2);
if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value) if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value)
return m; return m;
m |= onModify(0, v); m |= onModify(v, 0);
m |= onModify(1, v); m |= onModify(v, 1);
m |= onModify(3, v); m |= onModify(v, 3);
return m; return m;
} #endregion } #endregion
onModifySingle[3] = function(val) { #region onModifySingle[3] = function(val) { #region
var v = toNumber(val); var v = toNumber(val);
var m = onModify(3, v); var m = onModify(v, 3);
if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value) if(mode == AREA_MODE.area || mode == AREA_MODE.two_point || !link_value)
return m; return m;
m |= onModify(0, v); m |= onModify(v, 0);
m |= onModify(1, v); m |= onModify(v, 1);
m |= onModify(2, v); m |= onModify(v, 2);
return m; return m;
} #endregion } #endregion
@ -181,10 +181,10 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
var sh = array_safe_get_fast(_data, 3); var sh = array_safe_get_fast(_data, 3);
var ss = unit.mode == VALUE_UNIT.reference? [ 1, 1 ] : onSurfaceSize(); var ss = unit.mode == VALUE_UNIT.reference? [ 1, 1 ] : onSurfaceSize();
onModify(0, ss[0] - (cx + sw)); onModify(ss[0] - (cx + sw), 0);
onModify(1, cy - sh); onModify(cy - sh, 1);
onModify(2, cx - sw); onModify(cx - sw, 2);
onModify(3, ss[1] - (cy + sh)); onModify(ss[1] - (cy + sh), 3);
break; break;
case AREA_MODE.padding : //padding to two points case AREA_MODE.padding : //padding to two points
@ -194,10 +194,10 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
var b = array_safe_get_fast(_data, 3); var b = array_safe_get_fast(_data, 3);
var ss = unit.mode == VALUE_UNIT.reference? [ 1, 1 ] : onSurfaceSize(); var ss = unit.mode == VALUE_UNIT.reference? [ 1, 1 ] : onSurfaceSize();
onModify(0, l); onModify(l, 0);
onModify(1, t); onModify(t, 1);
onModify(2, ss[0] - r); onModify(ss[0] - r, 2);
onModify(3, ss[1] - b); onModify(ss[1] - b, 3);
break; break;
case AREA_MODE.two_point : //twp points to area case AREA_MODE.two_point : //twp points to area
@ -206,14 +206,14 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
var x1 = array_safe_get_fast(_data, 2); var x1 = array_safe_get_fast(_data, 2);
var y1 = array_safe_get_fast(_data, 3); var y1 = array_safe_get_fast(_data, 3);
onModify(0, (x0 + x1) / 2); onModify( (x0 + x1) / 2, 0);
onModify(1, (y0 + y1) / 2); onModify( (y0 + y1) / 2, 1);
onModify(2, abs(x0 - x1) / 2); onModify(abs(x0 - x1) / 2, 2);
onModify(3, abs(y0 - y1) / 2); onModify(abs(y0 - y1) / 2, 3);
break; break;
} }
onModify(5, (mode + 1) % 3); onModify((mode + 1) % 3, 5);
} #endregion } #endregion
var _bx = _x + _w - _bs; var _bx = _x + _w - _bs;
@ -226,24 +226,24 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
switch(mode) { switch(mode) {
case AREA_MODE.area : case AREA_MODE.area :
var ss = onSurfaceSize(); var ss = onSurfaceSize();
onModify(0, cnvt? 0.5 : ss[0] / 2); onModify(cnvt? 0.5 : ss[0] / 2, 0);
onModify(1, cnvt? 0.5 : ss[1] / 2); onModify(cnvt? 0.5 : ss[1] / 2, 1);
onModify(2, cnvt? 0.5 : ss[0] / 2); onModify(cnvt? 0.5 : ss[0] / 2, 2);
onModify(3, cnvt? 0.5 : ss[1] / 2); onModify(cnvt? 0.5 : ss[1] / 2, 3);
break; break;
case AREA_MODE.padding : case AREA_MODE.padding :
var ss = onSurfaceSize(); var ss = onSurfaceSize();
onModify(0, 0); onModify(0, 0);
onModify(1, 0); onModify(0, 1);
onModify(2, 0); onModify(0, 2);
onModify(3, 0); onModify(0, 3);
break; break;
case AREA_MODE.two_point : case AREA_MODE.two_point :
var ss = onSurfaceSize(); var ss = onSurfaceSize();
onModify(0, 0); onModify(0, 0);
onModify(1, 0); onModify(0, 1);
onModify(2, cnvt? 1 : ss[0]); onModify(cnvt? 1 : ss[0], 2);
onModify(3, cnvt? 1 : ss[1]); onModify(cnvt? 1 : ss[1], 3);
break; break;
} }
} #endregion } #endregion
@ -257,7 +257,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
if(useShape && !is_array(_bind) && buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, _bact, _bhov,, THEME.inspector_area, _bind) == 2) { if(useShape && !is_array(_bind) && buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, _bact, _bhov,, THEME.inspector_area, _bind) == 2) {
var val = (array_safe_get_fast(_data, 4) + 1) % 2; var val = (array_safe_get_fast(_data, 4) + 1) % 2;
onModify(4, val); onModify(val, 4);
} }
if(mode == AREA_MODE.padding) { if(mode == AREA_MODE.padding) {

View file

@ -6,7 +6,7 @@ function checkBoxGroup(sprs, _onClick) : widget() constructor {
holding = noone; holding = noone;
tooltips = []; tooltips = [];
static trigger = function(ind, val) { onClick(ind, val); } static trigger = function(value, index) { onClick(value, index); }
static setTooltips = function(tt) { tooltips = tt; return self; } static setTooltips = function(tt) { tooltips = tt; return self; }
static drawParam = function(params) { static drawParam = function(params) {
@ -47,10 +47,10 @@ function checkBoxGroup(sprs, _onClick) : widget() constructor {
TOOLTIP = array_safe_get(tooltips, i, ""); TOOLTIP = array_safe_get(tooltips, i, "");
if(holding != noone) if(holding != noone)
trigger(i, holding); trigger(holding, i);
if(mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
trigger(i, !_value[i]); trigger(!_value[i], i);
holding = _value[i]; holding = _value[i];
} }
} else } else

View file

@ -18,15 +18,15 @@ function controlPointBox(_onModify) : widget() constructor {
onModify = _onModify; onModify = _onModify;
onSurfaceSize = -1; onSurfaceSize = -1;
tbCx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cx, toNumber(val)); }); tbCx.hide = true; tbCx.slidable = true; tbCx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(toNumber(val), PUPPET_CONTROL.cx ); }); tbCx.hide = true; tbCx.slidable = true;
tbCy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.cy, toNumber(val)); }); tbCy.hide = true; tbCy.slidable = true; tbCy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(toNumber(val), PUPPET_CONTROL.cy ); }); tbCy.hide = true; tbCy.slidable = true;
tbFx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fx, toNumber(val)); }); tbFx.hide = true; tbFx.slidable = true; tbFx = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(toNumber(val), PUPPET_CONTROL.fx ); }); tbFx.hide = true; tbFx.slidable = true;
tbFy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); }); tbFy.hide = true; tbFy.slidable = true; tbFy = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(toNumber(val), PUPPET_CONTROL.fy ); }); tbFy.hide = true; tbFy.slidable = true;
tbW = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.width, max(0, toNumber(val))); }); tbW.hide = true; tbW.slidable = true; tbW = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(max(0, toNumber(val)), PUPPET_CONTROL.width ); }); tbW.hide = true; tbW.slidable = true;
tbH = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(PUPPET_CONTROL.height, max(0, toNumber(val))); }); tbH.hide = true; tbH.slidable = true; tbH = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(max(0, toNumber(val)), PUPPET_CONTROL.height); }); tbH.hide = true; tbH.slidable = true;
rot = new rotator(function(val) { return onModify(PUPPET_CONTROL.fy, toNumber(val)); }); rot = new rotator(function(val) { return onModify(toNumber(val), PUPPET_CONTROL.fy); });
sW = new textBox(TEXTBOX_INPUT.number, function(val) { onModify(PUPPET_CONTROL.width, toNumber(val)); }) sW = new textBox(TEXTBOX_INPUT.number, function(val) { onModify(toNumber(val), PUPPET_CONTROL.width); })
.setSlidable(0.01, false, [ 1, 32 ]); .setSlidable(0.01, false, [ 1, 32 ]);
tbCx.label = "cx"; tbCx.label = "cx";
@ -39,7 +39,7 @@ function controlPointBox(_onModify) : widget() constructor {
scMode = new scrollBox( scMode = new scrollBox(
sMode, sMode,
function(val) { onModify(PUPPET_CONTROL.mode, toNumber(val)); } function(val) { onModify(toNumber(val), PUPPET_CONTROL.mode); }
); );
widgets = [ scMode, tbCx, tbCy, tbFx, tbFy, tbW, tbH, rot, sW ]; widgets = [ scMode, tbCx, tbCy, tbFx, tbFy, tbW, tbH, rot, sW ];

View file

@ -6,20 +6,20 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor {
b_link = button(function() { linked = !linked; }); b_link = button(function() { linked = !linked; });
b_link.icon = THEME.value_link; b_link.icon = THEME.value_link;
onModifyIndex = function(index, val) { onModifyIndex = function(val, index) {
if(linked) { if(linked) {
for( var i = 0; i < 4; i++ ) for( var i = 0; i < 4; i++ )
onModify(i, toNumber(val)); onModify(toNumber(val), i);
return; return;
} }
onModify(index, toNumber(val)); onModify(toNumber(val), index);
} }
onModifySingle[0] = function(val) { onModifyIndex(0, val); } onModifySingle[0] = function(val) { onModifyIndex(val, 0); }
onModifySingle[1] = function(val) { onModifyIndex(1, val); } onModifySingle[1] = function(val) { onModifyIndex(val, 1); }
onModifySingle[2] = function(val) { onModifyIndex(2, val); } onModifySingle[2] = function(val) { onModifyIndex(val, 2); }
onModifySingle[3] = function(val) { onModifyIndex(3, val); } onModifySingle[3] = function(val) { onModifyIndex(val, 3); }
labels = [ "r", "t", "l", "b" ]; labels = [ "r", "t", "l", "b" ];

View file

@ -9,12 +9,13 @@ function draw_tooltip_text(txt) { #region
var tw = min(max(320, WIN_W * 0.4), string_width(txt)); var tw = min(max(320, WIN_W * 0.4), string_width(txt));
var th = string_height_ext(txt, -1, tw); var th = string_height_ext(txt, -1, tw);
var mx = min(mouse_mx + ui(16), WIN_W - (tw + ui(16))); var pd = ui(8);
var my = min(mouse_my + ui(16), WIN_H - (th + ui(16))); var mx = min(mouse_mx + ui(16), WIN_W - (tw + pd * 2));
var my = min(mouse_my + ui(16), WIN_H - (th + pd * 2));
draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + ui(16), th + ui(16)); draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + pd * 2, th + pd * 2);
draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + ui(16), th + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + pd * 2, th + pd * 2);
draw_text_line(mx + ui(8), my + ui(8), txt, -1, tw); draw_text_line(mx + pd, my + pd, txt, -1, tw);
} #endregion } #endregion
function draw_tooltip_color(clr) { #region function draw_tooltip_color(clr) { #region
@ -26,14 +27,15 @@ function draw_tooltip_color(clr) { #region
var ww = ui(32); var ww = ui(32);
var hh = ui(32); var hh = ui(32);
var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); var pd = ui(4);
var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
draw_set_color(clr); draw_sprite_stretched_ext(THEME.menu_button_mask, 0, mx + pd, my + pd, ww, hh, clr, 1);
draw_rectangle(mx + ui(8), my + ui(8), mx + ui(ww + 8), my + ui(hh + 8), false); draw_sprite_stretched_add(THEME.menu_button_mask, 1, mx + pd, my + pd, ww, hh, c_white, 0.3);
} #endregion } #endregion
function draw_tooltip_palette(clr) { #region function draw_tooltip_palette(clr) { #region
@ -49,17 +51,20 @@ function draw_tooltip_palette(clr) { #region
var ww = min(ui(160), ui(32) * pal_len); var ww = min(ui(160), ui(32) * pal_len);
var hh = array_length(clr) * ph; var hh = array_length(clr) * ph;
var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); var pd = ui(4);
var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
var _y = my + ui(8); var _y = my + pd;
for( var i = 0, n = array_length(clr); i < n; i++ ) { for( var i = 0, n = array_length(clr); i < n; i++ ) {
drawPalette(clr[i], mx + ui(8), _y, ui(ww), ph); drawPalette(clr[i], mx + pd, _y, ui(ww), ph);
_y += ph; _y += ph;
} }
draw_sprite_stretched_add(THEME.menu_button_mask, 1, mx + pd, my + pd, ww, hh, c_white, 0.3);
} #endregion } #endregion
function draw_tooltip_gradient(clr) { #region function draw_tooltip_gradient(clr) { #region
@ -69,15 +74,16 @@ function draw_tooltip_gradient(clr) { #region
var ww = ui(160); var ww = ui(160);
var hh = array_length(clr) * gh; var hh = array_length(clr) * gh;
var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); var pd = ui(4);
var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
var _y = my + ui(8); var _y = my + pd;
for( var i = 0, n = array_length(clr); i < n; i++ ) { for( var i = 0, n = array_length(clr); i < n; i++ ) {
clr[i].draw(mx + ui(8), _y, ui(ww), gh); clr[i].draw(mx + pd, _y, ui(ww), gh);
_y += gh; _y += gh;
} }
} #endregion } #endregion
@ -101,11 +107,12 @@ function draw_tooltip_surface_array(surf) { #region
var ww = sw * col; var ww = sw * col;
var hh = sh * row; var hh = sh * row;
var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); var pd = ui(4);
var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
for( var ind = 0; ind < amo; ind++ ) { for( var ind = 0; ind < amo; ind++ ) {
if(!is_surface(surf[ind])) continue; if(!is_surface(surf[ind])) continue;
@ -116,8 +123,8 @@ function draw_tooltip_surface_array(surf) { #region
var sw = surface_get_width_safe(surf[ind]); var sw = surface_get_width_safe(surf[ind]);
var sh = surface_get_height_safe(surf[ind]); var sh = surface_get_height_safe(surf[ind]);
var ss = nn / max(sw, sh); var ss = nn / max(sw, sh);
var cx = mx + ui(8) + j * nn + nn / 2; var cx = mx + pd + j * nn + nn / 2;
var cy = my + ui(8) + i * nn + nn / 2; var cy = my + pd + i * nn + nn / 2;
draw_surface_ext_safe(surf[ind], cx - sw * ss / 2, cy - sh * ss / 2, ss, ss, 0, c_white, 1); draw_surface_ext_safe(surf[ind], cx - sw * ss / 2, cy - sh * ss / 2, ss, ss, 0, c_white, 1);
draw_set_color(COLORS._main_icon); draw_set_color(COLORS._main_icon);
@ -146,13 +153,14 @@ function draw_tooltip_surface(surf) { #region
var ww = sw * ss; var ww = sw * ss;
var hh = sh * ss; var hh = sh * ss;
var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); var pd = ui(4);
var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
draw_surface_ext_safe(surf, mx + ui(8), my + ui(8), ss, ss); draw_surface_ext_safe(surf, mx + pd, my + pd, ss, ss);
} #endregion } #endregion
function draw_tooltip_sprite(spr) { #region function draw_tooltip_sprite(spr) { #region
@ -170,20 +178,21 @@ function draw_tooltip_sprite(spr) { #region
var ww = sw * ss * sn + 2 * (sn - 1); var ww = sw * ss * sn + 2 * (sn - 1);
var hh = sh * ss + ui(16); var hh = sh * ss + ui(16);
var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); var pd = ui(4);
var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
var sx = mx + ui(8) + ox * ss; var sx = mx + pd + ox * ss;
var sy = my + ui(8) + oy * ss; var sy = my + pd + oy * ss;
for( var i = 0; i < sn; i++ ) for( var i = 0; i < sn; i++ )
draw_sprite_ext(spr, i, sx + i * (sw * ss + 2), sy, ss, ss, 0, c_white, 1); draw_sprite_ext(spr, i, sx + i * (sw * ss + 2), sy, ss, ss, 0, c_white, 1);
draw_set_text(f_p3, fa_center, fa_bottom, COLORS._main_text_sub); draw_set_text(f_p3, fa_center, fa_bottom, COLORS._main_text_sub);
draw_text(mx + (ww + ui(16)) / 2, my + hh + ui(16 - 4), $"{sw} x {sh} px"); draw_text(mx + (ww + pd * 2) / 2, my + hh + pd * 2 - ui(4), $"{sw} x {sh} px");
} #endregion } #endregion
function draw_tooltip_atlas(atlas) { #region function draw_tooltip_atlas(atlas) { #region
@ -195,14 +204,15 @@ function draw_tooltip_atlas(atlas) { #region
if(amo && is_array(atlas[0])) return; if(amo && is_array(atlas[0])) return;
var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); var pd = ui(4);
var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); var mx = min(mouse_mx + ui(16), WIN_W - (ww + pd * 2));
var my = min(mouse_my + ui(16), WIN_H - (hh + pd * 2));
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + pd * 2, hh + pd * 2);
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + pd * 2, hh + pd * 2);
var sx = mx + ui(8); var sx = mx + pd;
var sy = my + ui(8); var sy = my + pd;
for( var i = 0; i < amo; i++ ) { for( var i = 0; i < amo; i++ ) {
var _y = sy + i * ui(48 + 8); var _y = sy + i * ui(48 + 8);
@ -247,15 +257,16 @@ function draw_tooltip_buffer(buff) { #region
if(len > 400) if(len > 400)
th += string_height(" "); th += string_height(" ");
var mx = min(mouse_mx + ui(16), WIN_W - (tw + ui(16))); var pd = ui(8);
var my = min(mouse_my + ui(16), WIN_H - (th + ui(16))); var mx = min(mouse_mx + ui(16), WIN_W - (tw + pd * 2));
var my = min(mouse_my + ui(16), WIN_H - (th + pd * 2));
draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + ui(16), th + ui(16)); draw_sprite_stretched(THEME.textbox, 3, mx, my, tw + pd * 2, th + pd * 2);
draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + ui(16), th + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, tw + pd * 2, th + pd * 2);
draw_text_line(mx + ui(8), my + ui(8), txt, -1, tw); draw_text_line(mx + pd, my + pd, txt, -1, tw);
if(len > 400) { if(len > 400) {
draw_set_text(f_code, fa_left, fa_bottom, COLORS._main_text_sub); draw_set_text(f_code, fa_left, fa_bottom, COLORS._main_text_sub);
draw_text(mx + ui(8), my + th + ui(8), $"...({buffer_get_size(buff)} bytes)"); draw_text(mx + pd, my + th + pd, $"...({buffer_get_size(buff)} bytes)");
} }
} #endregion } #endregion

View file

@ -9,37 +9,37 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct
b_link = button(function() { linked = !linked; }); b_link = button(function() { linked = !linked; });
b_link.icon = THEME.value_link; b_link.icon = THEME.value_link;
onModifyIndex = function(index, val) { onModifyIndex = function(val, index) {
var modi = false; var modi = false;
if(linked) { if(linked) {
for( var i = 0; i < inputs; i++ ) for( var i = 0; i < inputs; i++ )
modi |= onModify(i, toNumber(val)); modi |= onModify(toNumber(val), i);
return modi; return modi;
} }
return onModify(index, toNumber(val)); return onModify(toNumber(val), index);
} }
onModifySingle[0] = function(val) { return onModifyIndex(0, val); } onModifySingle[0] = function(val) { return onModifyIndex(val, 0); }
onModifySingle[1] = function(val) { return onModifyIndex(1, val); } onModifySingle[1] = function(val) { return onModifyIndex(val, 1); }
onModifySingle[2] = function(val) { return onModifyIndex(2, val); } onModifySingle[2] = function(val) { return onModifyIndex(val, 2); }
onModifySingle[3] = function(val) { return onModifyIndex(3, val); } onModifySingle[3] = function(val) { return onModifyIndex(val, 3); }
onModifySingle[4] = function(val) { return onModifyIndex(4, val); } onModifySingle[4] = function(val) { return onModifyIndex(val, 4); }
onModifySingle[5] = function(val) { return onModifyIndex(5, val); } onModifySingle[5] = function(val) { return onModifyIndex(val, 5); }
onModifySingle[6] = function(val) { return onModifyIndex(6, val); } onModifySingle[6] = function(val) { return onModifyIndex(val, 6); }
onModifySingle[7] = function(val) { return onModifyIndex(7, val); } onModifySingle[7] = function(val) { return onModifyIndex(val, 7); }
onModifySingle[ 8] = function(val) { return onModifyIndex( 8, val); } onModifySingle[ 8] = function(val) { return onModifyIndex(val, 8); }
onModifySingle[ 9] = function(val) { return onModifyIndex( 9, val); } onModifySingle[ 9] = function(val) { return onModifyIndex(val, 9); }
onModifySingle[10] = function(val) { return onModifyIndex(10, val); } onModifySingle[10] = function(val) { return onModifyIndex(val, 10); }
onModifySingle[11] = function(val) { return onModifyIndex(11, val); } onModifySingle[11] = function(val) { return onModifyIndex(val, 11); }
onModifySingle[12] = function(val) { return onModifyIndex(12, val); } onModifySingle[12] = function(val) { return onModifyIndex(val, 12); }
onModifySingle[13] = function(val) { return onModifyIndex(13, val); } onModifySingle[13] = function(val) { return onModifyIndex(val, 13); }
onModifySingle[14] = function(val) { return onModifyIndex(14, val); } onModifySingle[14] = function(val) { return onModifyIndex(val, 14); }
onModifySingle[15] = function(val) { return onModifyIndex(15, val); } onModifySingle[15] = function(val) { return onModifyIndex(val, 15); }
extras = -1; extras = -1;

View file

@ -23,19 +23,19 @@ function variable_editor(nodeVal) constructor {
RENDER_ALL RENDER_ALL
}); });
vb_range = new vectorBox(2, function(index, val) { vb_range = new vectorBox(2, function(value, index) {
slider_range[index] = val; slider_range[index] = value;
refreshInput(); refreshInput();
}); });
tb_step = new textBox(TEXTBOX_INPUT.number, function(val) { tb_step = new textBox(TEXTBOX_INPUT.number, function(value) {
slider_step = val; slider_step = value;
refreshInput(); refreshInput();
}); });
sc_type = new scrollBox(val_type_name, function(val) { sc_type = new scrollBox(val_type_name, function(value) {
type_index = val; type_index = value;
sc_disp.data_list = display_list[val]; sc_disp.data_list = display_list[value];
disp_index = 0; disp_index = 0;
refreshInput(); refreshInput();
@ -43,8 +43,8 @@ function variable_editor(nodeVal) constructor {
} ); } );
sc_type.update_hover = false; sc_type.update_hover = false;
sc_disp = new scrollBox(display_list[0], function(val) { sc_disp = new scrollBox(display_list[0], function(value) {
disp_index = val; disp_index = value;
refreshInput(); refreshInput();
RENDER_ALL RENDER_ALL

View file

@ -391,8 +391,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
default : default :
mapWidget = vec4? mapWidget = vec4?
new vectorRangeBox(4, TEXTBOX_INPUT.number, function(index, val) { return setValueDirect(val, index); }) : new vectorRangeBox(4, TEXTBOX_INPUT.number, function(val, index) { return setValueDirect(val, index); }) :
new rangeBox(TEXTBOX_INPUT.number, function(index, val) { return setValueDirect(val, index); }); new rangeBox( TEXTBOX_INPUT.number, function(val, index) { return setValueDirect(val, index); });
mapWidget.side_button = mapButton; mapWidget.side_button = mapButton;
break; break;
} }
@ -536,7 +536,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion break; #endregion
case VALUE_DISPLAY.range : #region case VALUE_DISPLAY.range : #region
editWidget = new rangeBox(_txt, function(index, val) { return setValueInspector(val, index); } ); editWidget = new rangeBox(_txt, function(val, index) { return setValueInspector(val, index); } );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
@ -553,7 +553,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var len = array_length(val); var len = array_length(val);
if(len <= 4) { if(len <= 4) {
editWidget = new vectorBox(len, function(index, val) { return setValueInspector(val, index); }, unit ); editWidget = new vectorBox(len, function(val, index) { return setValueInspector(val, index); }, unit );
if(struct_has(display_data, "label")) editWidget.axis = display_data.label; if(struct_has(display_data, "label")) editWidget.axis = display_data.label;
if(struct_has(display_data, "linkable")) editWidget.linkable = display_data.linkable; if(struct_has(display_data, "linkable")) editWidget.linkable = display_data.linkable;
@ -588,7 +588,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
case VALUE_DISPLAY.vector_range : #region case VALUE_DISPLAY.vector_range : #region
var val = animator.getValue(); var val = animator.getValue();
editWidget = new vectorRangeBox(array_length(val), _txt, function(index, val) { return setValueInspector(val, index); }, unit ); editWidget = new vectorRangeBox(array_length(val), _txt, function(val, index) { return setValueInspector(val, index); }, unit );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
@ -614,7 +614,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion break; #endregion
case VALUE_DISPLAY.rotation_range : #region case VALUE_DISPLAY.rotation_range : #region
editWidget = new rotatorRange(function(index, val) { return setValueInspector(val, index); } ); editWidget = new rotatorRange(function(val, index) { return setValueInspector(val, index); } );
for( var i = 0, n = array_length(animators); i < n; i++ ) for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i); animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i);
@ -623,7 +623,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion break; #endregion
case VALUE_DISPLAY.rotation_random : #region case VALUE_DISPLAY.rotation_random : #region
editWidget = new rotatorRandom(function(index, val) { return setValueInspector(val, index); } ); editWidget = new rotatorRandom(function(val, index) { return setValueInspector(val, index); } );
extract_node = "Node_Vector2"; extract_node = "Node_Vector2";
break; #endregion break; #endregion
@ -644,7 +644,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var _range = struct_try_get(display_data, "range", [ 0, 1, 0.01 ]); var _range = struct_try_get(display_data, "range", [ 0, 1, 0.01 ]);
editWidget = new sliderRange(_range[2], type == VALUE_TYPE.integer, [ _range[0], _range[1] ], editWidget = new sliderRange(_range[2], type == VALUE_TYPE.integer, [ _range[0], _range[1] ],
function(index, val) { return setValueInspector(val, index); } ); function(val, index) { return setValueInspector(val, index); } );
for( var i = 0, n = array_length(animators); i < n; i++ ) for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i); animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i);
@ -653,7 +653,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion break; #endregion
case VALUE_DISPLAY.area : #region case VALUE_DISPLAY.area : #region
editWidget = new areaBox(function(index, val) { return setValueInspector(val, index); }, unit); editWidget = new areaBox(function(val, index) { return setValueInspector(val, index); }, unit);
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
@ -667,7 +667,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion break; #endregion
case VALUE_DISPLAY.padding : #region case VALUE_DISPLAY.padding : #region
editWidget = new paddingBox(function(index, val) { return setValueInspector(val, index); }, unit); editWidget = new paddingBox(function(val, index) { return setValueInspector(val, index); }, unit);
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
for( var i = 0, n = array_length(animators); i < n; i++ ) for( var i = 0, n = array_length(animators); i < n; i++ )
@ -677,7 +677,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion break; #endregion
case VALUE_DISPLAY.corner : #region case VALUE_DISPLAY.corner : #region
editWidget = new cornerBox(function(index, val) { return setValueInspector(val, index); }, unit); editWidget = new cornerBox(function(val, index) { return setValueInspector(val, index); }, unit);
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
for( var i = 0, n = array_length(animators); i < n; i++ ) for( var i = 0, n = array_length(animators); i < n; i++ )
@ -687,7 +687,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion break; #endregion
case VALUE_DISPLAY.puppet_control : #region case VALUE_DISPLAY.puppet_control : #region
editWidget = new controlPointBox(function(index, val) { return setValueInspector(val, index); }); editWidget = new controlPointBox(function(val, index) { return setValueInspector(val, index); });
extract_node = ""; extract_node = "";
break; #endregion break; #endregion
@ -720,7 +720,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion break; #endregion
case VALUE_DISPLAY.matrix : #region case VALUE_DISPLAY.matrix : #region
editWidget = new matrixGrid(_txt, display_data.size, function(index, val) { return setValueInspector(val, index); }, unit ); editWidget = new matrixGrid(_txt, display_data.size, function(val, index) { return setValueInspector(val, index); }, unit );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
for( var i = 0, n = array_length(animators); i < n; i++ ) for( var i = 0, n = array_length(animators); i < n; i++ )
@ -730,7 +730,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion break; #endregion
case VALUE_DISPLAY.boolean_grid : #region case VALUE_DISPLAY.boolean_grid : #region
editWidget = new matrixGrid(_txt, display_data.size, function(index, val) { return setValueInspector(val, index); }, unit ); editWidget = new matrixGrid(_txt, display_data.size, function(val, index) { return setValueInspector(val, index); }, unit );
for( var i = 0, n = array_length(animators); i < n; i++ ) for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = $" {i}"; animators[i].suffix = $" {i}";
@ -739,7 +739,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion break; #endregion
case VALUE_DISPLAY.transform : #region case VALUE_DISPLAY.transform : #region
editWidget = new transformBox(function(index, val) { return setValueInspector(val, index); }); editWidget = new transformBox(function(val, index) { return setValueInspector(val, index); });
extract_node = "Node_Transform_Array"; extract_node = "Node_Transform_Array";
break; #endregion break; #endregion
@ -753,14 +753,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion break; #endregion
case VALUE_DISPLAY.d3quarternion : #region case VALUE_DISPLAY.d3quarternion : #region
editWidget = new quarternionBox(function(index, val) { return setValueInspector(val, index); }); editWidget = new quarternionBox(function(val, index) { return setValueInspector(val, index); });
extract_node = "Node_Vector4"; extract_node = "Node_Vector4";
display_data.angle_display = QUARTERNION_DISPLAY.euler; display_data.angle_display = QUARTERNION_DISPLAY.euler;
break; #endregion break; #endregion
case VALUE_DISPLAY.path_anchor : #region case VALUE_DISPLAY.path_anchor : #region
editWidget = new pathAnchorBox(function(index, val) { return setValueInspector(val, index); }); editWidget = new pathAnchorBox(function(val, index) { return setValueInspector(val, index); });
extract_node = "Node_Path_Anchor"; extract_node = "Node_Path_Anchor";
break; #endregion break; #endregion
@ -1455,7 +1455,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} }
} #endregion } #endregion
static setValueInspector = function(_val = 0, index = noone) { #region static setValueInspector = function(_val = 0, index = noone, time = CURRENT_FRAME) { #region
INLINE INLINE
var res = false; var res = false;
@ -1472,7 +1472,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(_node == node) res = r; if(_node == node) res = r;
} }
} else { } else {
res = setValueDirect(val, index); res = setValueDirect(val, index, time);
} }
return res; return res;
@ -1520,6 +1520,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var _sval = val; var _sval = val;
if(is_array(_sval) && !array_empty(_sval)) if(is_array(_sval) && !array_empty(_sval))
_sval = _sval[0]; _sval = _sval[0];
if(is_instanceof(_sval, SurfaceAtlas)) if(is_instanceof(_sval, SurfaceAtlas))
draw_junction_index = VALUE_TYPE.atlas; draw_junction_index = VALUE_TYPE.atlas;
} }

View file

@ -13,20 +13,20 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor {
b_link = button(function() { linked = !linked; }); b_link = button(function() { linked = !linked; });
b_link.icon = THEME.value_link; b_link.icon = THEME.value_link;
onModifyIndex = function(index, val) { onModifyIndex = function(val, index) {
if(linked) { if(linked) {
for( var i = 0; i < 4; i++ ) for( var i = 0; i < 4; i++ )
onModify(i, toNumber(val)); onModify(toNumber(val), i);
return; return;
} }
onModify(index, toNumber(val)); onModify(toNumber(val), index);
} }
onModifySingle[0] = function(val) { onModifyIndex(0, val); } onModifySingle[0] = function(val) { onModifyIndex(val, 0); }
onModifySingle[1] = function(val) { onModifyIndex(1, val); } onModifySingle[1] = function(val) { onModifyIndex(val, 1); }
onModifySingle[2] = function(val) { onModifyIndex(2, val); } onModifySingle[2] = function(val) { onModifyIndex(val, 2); }
onModifySingle[3] = function(val) { onModifyIndex(3, val); } onModifySingle[3] = function(val) { onModifyIndex(val, 3); }
for(var i = 0; i < 4; i++) { for(var i = 0; i < 4; i++) {
tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]);

View file

@ -1156,6 +1156,8 @@ function Panel_Animation() : PanelContent() constructor {
} #endregion } #endregion
//// DRAW KEYFRAMES //// DRAW KEYFRAMES
__keyframe_editing = noone;
function _drawDopesheetAnimatorKeys(_cont, animator, msx, msy) { #region function _drawDopesheetAnimatorKeys(_cont, animator, msx, msy) { #region
var _node = _cont.node; var _node = _cont.node;
var prop_y = animator.y; var prop_y = animator.y;
@ -1199,12 +1201,49 @@ function Panel_Animation() : PanelContent() constructor {
keyframe_dragout = false; keyframe_dragout = false;
keyframe_drag_mx = mx; keyframe_drag_mx = mx;
keyframe_drag_my = my; keyframe_drag_my = my;
} else if(mouse_press(mb_left)) { } else if(mouse_press(mb_left)) {
keyframe_dragging = keyframe; if(key_mod_press(CTRL)) {
keyframe_drag_type = KEYFRAME_DRAG_TYPE.move;
keyframe_drag_mx = mx; var _wid = animator.prop.editWidget;
keyframe_drag_my = my; __keyframe_editing = keyframe;
keyframe_drag_my = my;
switch(animator.prop.type) {
case VALUE_TYPE.color :
switch(animator.prop.display_type) {
case VALUE_DISPLAY.palette :
var dialog = dialogCall(o_dialog_palette, WIN_W / 2, WIN_H / 2);
dialog.setDefault(keyframe.value);
dialog.onApply = function(val) { __keyframe_editing.value = val; };
dialog.drop_target = _wid;
break;
default :
var dialog = dialogCall(o_dialog_color_selector, WIN_W / 2, WIN_H / 2);
dialog.setDefault(keyframe.value);
dialog.selector.onApply = function(val) { __keyframe_editing.value = val; };
dialog.onApply = function(val) { __keyframe_editing.value = val; };
dialog.drop_target = _wid;
}
break;
case VALUE_TYPE.gradient :
var dialog = dialogCall(o_dialog_gradient, WIN_W / 2, WIN_H / 2);
dialog.setDefault(keyframe.value.clone());
dialog.onApply = function(val) { __keyframe_editing.value = val; };
dialog.drop_target = _wid;
break;
default :
dialogCall(o_dialog_value_editor, mouse_mx + ui(8), mouse_my + ui(8)).setKey(keyframe);
}
} else {
keyframe_dragging = keyframe;
keyframe_drag_type = KEYFRAME_DRAG_TYPE.move;
keyframe_drag_mx = mx;
keyframe_drag_my = my;
}
} }
} }
} }
@ -1336,12 +1375,12 @@ function Panel_Animation() : PanelContent() constructor {
_add = true; _add = true;
break; break;
} else if(_key.time > CURRENT_FRAME) { } else if(_key.time > CURRENT_FRAME) {
ds_list_insert(animator.values, k, new valueKey(CURRENT_FRAME, animator.getValue(), animator)); ds_list_insert(animator.values, k, new valueKey(CURRENT_FRAME, variable_clone(animator.getValue()), animator));
_add = true; _add = true;
break; break;
} }
} }
if(!_add) ds_list_add(animator.values, new valueKey(CURRENT_FRAME, animator.getValue(, false), animator)); if(!_add) ds_list_add(animator.values, new valueKey(CURRENT_FRAME, variable_clone(animator.getValue(, false)), animator));
} }
#endregion #endregion
@ -1858,9 +1897,7 @@ function Panel_Animation() : PanelContent() constructor {
if(!array_exists(keyframe_selecting, key_hover)) if(!array_exists(keyframe_selecting, key_hover))
keyframe_selecting = [ key_hover ]; keyframe_selecting = [ key_hover ];
} }
}
if(mouse_press(mb_left, pFOCUS)) {
if(stagger_mode == 1) { if(stagger_mode == 1) {
if(key_hover == noone || !array_exists(keyframe_selecting, key_hover)) if(key_hover == noone || !array_exists(keyframe_selecting, key_hover))
stagger_mode = 0; stagger_mode = 0;

View file

@ -1,5 +1,5 @@
function graph_export_image(allList, nodeList, settings = {}) { function graph_export_image(allList, nodeList, settings = {}) {
var amo = ds_list_size(nodeList); var amo = array_length(nodeList);
if(amo < 1) return; if(amo < 1) return;
var scale = struct_try_get(settings, "scale", 1); var scale = struct_try_get(settings, "scale", 1);
@ -16,13 +16,13 @@ function graph_export_image(allList, nodeList, settings = {}) {
var borderColor = struct_try_get(settings, "borderColor", c_white); var borderColor = struct_try_get(settings, "borderColor", c_white);
var borderAlpha = struct_try_get(settings, "borderAlpha", 0.5); var borderAlpha = struct_try_get(settings, "borderAlpha", 0.5);
var bbox_x0 = nodeList[| 0].x * scale; var bbox_x0 = nodeList[0].x * scale;
var bbox_y0 = nodeList[| 0].y * scale; var bbox_y0 = nodeList[0].y * scale;
var bbox_x1 = bbox_x0 + nodeList[| 0].w * scale; var bbox_x1 = bbox_x0 + nodeList[0].w * scale;
var bbox_y1 = bbox_y0 + nodeList[| 0].h * scale; var bbox_y1 = bbox_y0 + nodeList[0].h * scale;
for( var i = 0; i < ds_list_size(nodeList); i++ ) { for( var i = 0; i < array_length(nodeList); i++ ) {
var _node = nodeList[| i]; var _node = nodeList[i];
_node.draw_graph_culled = false; _node.draw_graph_culled = false;
var _x = _node.x * scale; var _x = _node.x * scale;
@ -76,13 +76,13 @@ function graph_export_image(allList, nodeList, settings = {}) {
draw_set_alpha(1); draw_set_alpha(1);
} }
for(var i = 0; i < ds_list_size(allList); i++) for(var i = 0; i < array_length(allList); i++)
allList[| i].preDraw(gr_x, gr_y, scale); allList[i].preDraw(gr_x, gr_y, scale);
#region draw frame #region draw frame
for(var i = 0; i < ds_list_size(nodeList); i++) { for(var i = 0; i < array_length(nodeList); i++) {
if(instanceof(nodeList[| i]) != "Node_Frame") continue; if(instanceof(nodeList[i]) != "Node_Frame") continue;
nodeList[| i].drawNode(gr_x, gr_y, mx, my, scale); nodeList[i].drawNode(gr_x, gr_y, mx, my, scale);
} }
#endregion #endregion
@ -100,8 +100,8 @@ function graph_export_image(allList, nodeList, settings = {}) {
param.avoid_label = true; param.avoid_label = true;
param.preview_scale = 100; param.preview_scale = 100;
for(var i = 0; i < ds_list_size(nodeList); i++) for(var i = 0; i < array_length(nodeList); i++)
nodeList[| i].drawConnections(param, true); nodeList[i].drawConnections(param, true);
surface_reset_target(); surface_reset_target();
shader_set(sh_downsample); shader_set(sh_downsample);
@ -113,11 +113,11 @@ function graph_export_image(allList, nodeList, settings = {}) {
#endregion #endregion
#region draw node #region draw node
for(var i = 0; i < ds_list_size(nodeList); i++) for(var i = 0; i < array_length(nodeList); i++)
nodeList[| i].onDrawNodeBehind(gr_x, gr_y, mx, my, scale); nodeList[i].onDrawNodeBehind(gr_x, gr_y, mx, my, scale);
for(var i = 0; i < ds_list_size(nodeList); i++) { for(var i = 0; i < array_length(nodeList); i++) {
var _node = nodeList[| i]; var _node = nodeList[i];
if(instanceof(_node) == "Node_Frame") continue; if(instanceof(_node) == "Node_Frame") continue;
var val = _node.drawNode(gr_x, gr_y, mx, my, scale, param); var val = _node.drawNode(gr_x, gr_y, mx, my, scale, param);
} }

View file

@ -1,8 +1,10 @@
function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor {
title = __txtx("panel_export_graph", "Export Graph"); title = __txtx("panel_export_graph", "Export Graph");
w = ui(360); padding = ui(8);
h = ui(524); w = ui(640);
min_h = h; h = ui(400);
set_w = ui(240);
surf_s = w - set_w - padding * 2;
self.targetPanel = targetPanel; self.targetPanel = targetPanel;
@ -24,33 +26,45 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor {
borderAlpha : 0.05, borderAlpha : 0.05,
}; };
sel = 0; sel = 0;
nodes_select = [ "All nodes", "Selected" ]; nodes_select = [ "All nodes", "Selected" ];
widgets = []; widgets = [];
widgets[0] = [ "Nodes", new scrollBox(nodes_select, function(val) { sel = val; nodeList = val? ds_list_create_from_array(targetPanel.nodes_selecting) : targetPanel.nodes_list; refresh(); }, false), widgets[0] = [ "Nodes", new scrollBox(nodes_select, function(val) { sel = val; nodeList = val? ds_list_create_from_array(targetPanel.nodes_selecting) : targetPanel.nodes_list; refresh(); }, false),
function() { return nodes_select[sel] } ]; function() { return nodes_select[sel] } ];
widgets[1] = [ "Scale", new textBox(TEXTBOX_INPUT.number, function(val) { settings.scale = val; refresh(); }), widgets[1] = [ "Scale", new textBox(TEXTBOX_INPUT.number, function(val) { settings.scale = val; refresh(); }),
function() { return settings.scale } ]; function() { return settings.scale } ];
widgets[2] = [ "Padding", new textBox(TEXTBOX_INPUT.number, function(val) { settings.padding = val; refresh(); }), widgets[2] = [ "Padding", new textBox(TEXTBOX_INPUT.number, function(val) { settings.padding = val; refresh(); }),
function() { return settings.padding } ]; function() { return settings.padding } ];
widgets[3] = [ "Solid Background", new checkBox(function() { settings.bgEnable = !settings.bgEnable; refresh(); }), widgets[3] = [ "Solid Background", new checkBox(function() { settings.bgEnable = !settings.bgEnable; refresh(); }),
function() { return settings.bgEnable } ]; function() { return settings.bgEnable } ];
widgets[4] = [ "Background Color", new buttonColor(function(val) { settings.bgColor = val; refresh(); }), widgets[4] = [ "Background Color", new buttonColor(function(val) { settings.bgColor = val; refresh(); }),
function() { return settings.bgColor } ]; function() { return settings.bgColor } ];
widgets[5] = [ "Render Grid", new checkBox(function() { settings.gridEnable = !settings.gridEnable; refresh(); }), widgets[5] = [ "Render Grid", new checkBox(function() { settings.gridEnable = !settings.gridEnable; refresh(); }),
function() { return settings.gridEnable } ]; function() { return settings.gridEnable } ];
widgets[6] = [ "Grid Color", new buttonColor(function(val) { settings.gridColor = val; refresh(); }), widgets[6] = [ "Grid Color", new buttonColor(function(val) { settings.gridColor = val; refresh(); }),
function() { return settings.gridColor } ]; function() { return settings.gridColor } ];
widgets[7] = [ "Grid Opacity", new textBox(TEXTBOX_INPUT.number, function(val) { settings.gridAlpha = val; refresh(); }), widgets[7] = [ "Grid Opacity", new textBox(TEXTBOX_INPUT.number, function(val) { settings.gridAlpha = val; refresh(); }),
function() { return settings.gridAlpha } ]; function() { return settings.gridAlpha } ];
widgets[8] = [ "Border", new textBox(TEXTBOX_INPUT.number, function(val) { settings.borderPad = val; refresh(); }), widgets[8] = [ "Border", new textBox(TEXTBOX_INPUT.number, function(val) { settings.borderPad = val; refresh(); }),
function() { return settings.borderPad } ]; function() { return settings.borderPad } ];
widgets[9] = [ "Border Color", new buttonColor(function(val) { settings.borderColor = val; refresh(); }), widgets[9] = [ "Border Color", new buttonColor(function(val) { settings.borderColor = val; refresh(); }),
function() { return settings.borderColor } ]; function() { return settings.borderColor } ];
widgets[10] = [ "Border Opacity", new textBox(TEXTBOX_INPUT.number, function(val) { settings.borderAlpha = val; refresh(); }), widgets[10] = [ "Border Opacity", new textBox(TEXTBOX_INPUT.number, function(val) { settings.borderAlpha = val; refresh(); }),
function() { return settings.borderAlpha } ]; function() { return settings.borderAlpha } ];
b_export = button(function() { #region
b_export = button(function() {
if(!is_surface(surface)) return; if(!is_surface(surface)) return;
var path = get_save_filename_pxc("image|*.png;*.jpg", "Screenshot"); var path = get_save_filename_pxc("image|*.png;*.jpg", "Screenshot");
@ -59,9 +73,11 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor {
if(filename_ext(path) != ".png") path += ".png"; if(filename_ext(path) != ".png") path += ".png";
surface_save(surface, path); surface_save(surface, path);
noti_status($"Graph image exported at {path}"); noti_status($"Graph image exported at {path}");
}); #endregion });
sc_settings = new scrollPane(w - ui(padding + padding), h - ui(title_height + padding + 204), function(_y, _m) { #region b_export.text = __txt("Export") + "...";
sc_settings = new scrollPane(set_w, h - padding * 2, function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 0); draw_clear_alpha(COLORS.panel_bg_clear, 0);
var _ww = ui(160); var _ww = ui(160);
@ -89,13 +105,15 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor {
var _h = wh * array_length(widgets) + _hh; var _h = wh * array_length(widgets) + _hh;
return _h; return _h;
}); #endregion });
function onResize() { #region function onResize() {
sc_settings.resize(w - ui(padding + padding), h - ui(title_height + padding + 204)); surf_s = w - set_w - padding * 2;
} #endregion
function refresh() { #region sc_settings.resize(set_w, h - padding * 2);
}
function refresh() {
if(is_surface(surface)) if(is_surface(surface))
surface_free(surface); surface_free(surface);
surface = noone; surface = noone;
@ -104,54 +122,53 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor {
return; return;
surface = graph_export_image(targetPanel.nodes_list, nodeList, settings); surface = graph_export_image(targetPanel.nodes_list, nodeList, settings);
} refresh(); #endregion } refresh();
function drawContent(panel) { #region function drawContent(panel) {
var tx = padding; var tx = padding;
var ty = padding; var ty = padding;
var sh = 160; var sh = 160;
var _sx0 = tx, _sx1 = _sx0 + surf_s;
var _sy0 = ty, _sy1 = _sy0 + surf_s;
if(is_surface(surface)) { if(is_surface(surface)) {
var _sw = surface_get_width_safe(surface); var _sw = surface_get_width_safe(surface);
var _sh = surface_get_height_safe(surface); var _sh = surface_get_height_safe(surface);
var ss = min(surf_s / _sw, surf_s / _sh);
var ss = min((w - padding * 2) / _sw, sh / _sh); draw_surface_ext_safe(surface, _sx0 + surf_s / 2 - _sw * ss / 2,
draw_surface_ext_safe(surface, w / 2 - _sw * ss / 2, ty + sh / 2 - _sh * ss / 2, ss, ss, 0, c_white, 1); _sy0 + surf_s / 2 - _sh * ss / 2, ss, ss, 0, c_white, 1);
draw_set_text(f_p2, fa_center, fa_bottom, COLORS._main_text_sub); draw_set_text(f_p2, fa_center, fa_bottom, COLORS._main_text_sub);
draw_text_add(w / 2, ty + sh - ui(2), $"{surface_get_width_safe(surface)} x {surface_get_height_safe(surface)} px"); draw_text_add(w / 2, ty + sh - ui(2), $"{_sw} x {_sh} px");
} }
draw_set_color(COLORS._main_icon); draw_set_color(COLORS._main_icon);
draw_rectangle(tx, ty, tx + w - padding * 2, ty + sh, 1); draw_rectangle(_sx0, _sy0, _sx1, _sy1, 1);
var bx = w - padding - ui(4) - ui(24); var bx = _sx1 - ui(24);
var by = padding + ui(4); var by = _sy0;
var _m = [ mx, my ]; var _m = [ mx, my ];
if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, pFOCUS, pHOVER) == 2) if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, pFOCUS, pHOVER) == 2)
refresh(); refresh();
draw_sprite_ui(THEME.refresh_16, 0, bx + ui(12), by + ui(12),,,, COLORS._main_icon, 1); draw_sprite_ui(THEME.refresh_16, 0, bx + ui(12), by + ui(12),,,, COLORS._main_icon, 1);
var sx = tx; var sx = _sx1;
var sy = ty + sh + ui(16); var sy = _sy0;
sc_settings.setFocusHover(pFOCUS, pHOVER); sc_settings.setFocusHover(pFOCUS, pHOVER);
sc_settings.draw(sx, sy, mx - sx, my - sy); sc_settings.draw(sx, sy, mx - sx, my - sy);
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text); draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
var txt = __txt("Export") + "..."; var _bw = ui(64);
var _bw = string_width(txt) + ui(32); var _bh = ui(24);
var _bh = string_height(txt) + ui(12);
bx = w - padding - _bw; bx = w - padding - _bw;
by = h - padding - _bh; by = h - padding - _bh;
b_export.setInteract(is_surface(surface)); b_export.setInteract(is_surface(surface));
b_export.setFocusHover(pFOCUS, pHOVER); b_export.setFocusHover(pFOCUS, pHOVER);
b_export.draw(bx, by, _bw, _bh, _m); b_export.draw(bx, by, _bw, _bh, _m);
}
draw_set_alpha(is_surface(surface) * 0.5 + 0.5);
draw_text(bx + ui(16), by + ui(6), txt);
draw_set_alpha(1);
} #endregion
} }

View file

@ -15,7 +15,7 @@ function Panel_Node_Canvas_Pressure(canvas) : Panel_Linear_Setting() constructor
), ),
new __Panel_Linear_Setting_Item( new __Panel_Linear_Setting_Item(
__txt("Size"), __txt("Size"),
new vectorBox(2, function(in, val) { canvas.tool_attribute.pressure_size[in] = val; }), new vectorBox(2, function(value, index) { canvas.tool_attribute.pressure_size[index] = value; }),
function() { return canvas.tool_attribute.pressure_size; }, function() { return canvas.tool_attribute.pressure_size; },
function(val) { canvas.tool_attribute.pressure_size = val; }, function(val) { canvas.tool_attribute.pressure_size = val; },
[ 1, 1 ], [ 1, 1 ],

View file

@ -39,7 +39,7 @@ function Panel_Preview_3D_Setting(panel) : Panel_Linear_Setting() constructor {
), ),
new __Panel_Linear_Setting_Item( new __Panel_Linear_Setting_Item(
__txt("View Plane"), __txt("View Plane"),
new vectorBox(2, function(index, value) { new vectorBox(2, function(value, index) {
if(index == 0) preview_panel.d3_view_camera.view_near = value; if(index == 0) preview_panel.d3_view_camera.view_near = value;
else if(index == 1) preview_panel.d3_view_camera.view_far = value; else if(index == 1) preview_panel.d3_view_camera.view_far = value;
}), }),

View file

@ -28,7 +28,7 @@ function Panel_Preview_Grid_Setting() : Panel_Linear_Setting() constructor {
), ),
new __Panel_Linear_Setting_Item( new __Panel_Linear_Setting_Item(
__txt("Grid size"), __txt("Grid size"),
new vectorBox(2, function(index, value) { new vectorBox(2, function(value, index) {
var _v = PROJECT.previewGrid.size[index]; var _v = PROJECT.previewGrid.size[index];
PROJECT.previewGrid.size[index] = max(1, value); PROJECT.previewGrid.size[index] = max(1, value);

View file

@ -1,13 +1,13 @@
function pathAnchorBox(_onModify) : widget() constructor { function pathAnchorBox(_onModify) : widget() constructor {
onModify = _onModify; onModify = _onModify;
onModifySingle[0] = function(val) { return onModify(0, toNumber(val)); } onModifySingle[0] = function(val) { return onModify(toNumber(val), 0); }
onModifySingle[1] = function(val) { return onModify(1, toNumber(val)); } onModifySingle[1] = function(val) { return onModify(toNumber(val), 1); }
onModifySingle[2] = function(val) { return onModify(2, toNumber(val)); } onModifySingle[2] = function(val) { return onModify(toNumber(val), 2); }
onModifySingle[3] = function(val) { return onModify(3, toNumber(val)); } onModifySingle[3] = function(val) { return onModify(toNumber(val), 3); }
onModifySingle[4] = function(val) { return onModify(4, toNumber(val)); } onModifySingle[4] = function(val) { return onModify(toNumber(val), 4); }
onModifySingle[5] = function(val) { return onModify(5, toNumber(val)); } onModifySingle[5] = function(val) { return onModify(toNumber(val), 5); }
for(var i = 0; i < 6; i++) { for(var i = 0; i < 6; i++) {
tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]);
@ -82,7 +82,7 @@ function pathAnchorBox(_onModify) : widget() constructor {
var by = _ty + _th / 2 - _bw / 2; var by = _ty + _th / 2 - _bw / 2;
if(buttonInstant(THEME.button_hide, bx, by, _bw, _bw, _m, active, hover, "Linked", THEME.value_link, !_linked, _blend) == 2) if(buttonInstant(THEME.button_hide, bx, by, _bw, _bw, _m, active, hover, "Linked", THEME.value_link, !_linked, _blend) == 2)
onModify(6, !_linked); onModify(!_linked, 6);
resetFocus(); resetFocus();
return h; return h;

View file

@ -72,8 +72,8 @@
attributeEditor = [ attributeEditor = [
[ "Default Surface", "surface_dimension", new vectorBox(2, [ "Default Surface", "surface_dimension", new vectorBox(2,
function(ind, val) { function(val, index) {
attributes.surface_dimension[ind] = val; attributes.surface_dimension[index] = val;
PROJECT_ATTRIBUTES.surface_dimension = array_clone(attributes.surface_dimension); PROJECT_ATTRIBUTES.surface_dimension = array_clone(attributes.surface_dimension);
RENDER_ALL RENDER_ALL
return true; return true;

View file

@ -8,11 +8,11 @@ function quarternionBox(_onModify) : widget() constructor {
current_value = [ 0, 0, 0, 0 ]; current_value = [ 0, 0, 0, 0 ];
current_unit = QUARTERNION_DISPLAY.quarterion; current_unit = QUARTERNION_DISPLAY.quarterion;
onModifyIndex = function(index, val) { onModifyIndex = function(val, index) {
var v = toNumber(val); var v = toNumber(val);
if(current_unit == QUARTERNION_DISPLAY.quarterion) { if(current_unit == QUARTERNION_DISPLAY.quarterion) {
return onModify(index, v); return onModify(v, index);
} else { } else {
var v = toNumber(val); var v = toNumber(val);
@ -23,7 +23,7 @@ function quarternionBox(_onModify) : widget() constructor {
]; ];
qv[index] = v; qv[index] = v;
return onModify(noone, qv); return onModify(qv);
} }
} }
@ -34,10 +34,10 @@ function quarternionBox(_onModify) : widget() constructor {
disp_w = noone; disp_w = noone;
clickable = true; clickable = true;
onModifySingle[0] = function(val) { return onModifyIndex(0, val); } onModifySingle[0] = function(val) { return onModifyIndex(val, 0); }
onModifySingle[1] = function(val) { return onModifyIndex(1, val); } onModifySingle[1] = function(val) { return onModifyIndex(val, 1); }
onModifySingle[2] = function(val) { return onModifyIndex(2, val); } onModifySingle[2] = function(val) { return onModifyIndex(val, 2); }
onModifySingle[3] = function(val) { return onModifyIndex(3, val); } onModifySingle[3] = function(val) { return onModifyIndex(val, 3); }
for(var i = 0; i < 4; i++) { for(var i = 0; i < 4; i++) {
tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]);

View file

@ -10,21 +10,21 @@ function rangeBox(_type, _onModify) : widget() constructor {
__txtx("widget_range_constant", "Constant"), __txtx("widget_range_constant", "Constant"),
]); ]);
onModifyIndex = function(index, val) { onModifyIndex = function(val, index) {
var modi = false; var modi = false;
if(linked) { if(linked) {
for( var i = 0; i < 2; i++ ) for( var i = 0; i < 2; i++ )
modi |= onModify(i, toNumber(val)); modi |= onModify(toNumber(val), i);
return modi; return modi;
} }
return onModify(index, toNumber(val)); return onModify(toNumber(val), index);
} }
labels = [ "min", "max" ]; labels = [ "min", "max" ];
onModifySingle[0] = function(val) { return onModifyIndex(0, toNumber(val)); } onModifySingle[0] = function(val) { return onModifyIndex(toNumber(val), 0); }
onModifySingle[1] = function(val) { return onModifyIndex(1, toNumber(val)); } onModifySingle[1] = function(val) { return onModifyIndex(toNumber(val), 1); }
extras = -1; extras = -1;
@ -92,8 +92,8 @@ function rangeBox(_type, _onModify) : widget() constructor {
_display_data.linked = linked; _display_data.linked = linked;
if(linked) { if(linked) {
onModify(0, _data[0]); onModify(_data[0], 0);
onModify(1, _data[0]); onModify(_data[0], 1);
} }
} }

View file

@ -9,10 +9,10 @@ function rotatorRandom(_onModify) : widget() constructor {
knob_hovering = noone; knob_hovering = noone;
mode = 0; mode = 0;
tb_min_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, val); } ).setSlidable([ 0.1, 15 ], true); tb_min_0.hide = true; tb_min_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 1); } ).setSlidable([ 0.1, 15 ], true); tb_min_0.hide = true;
tb_max_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(2, val); } ).setSlidable([ 0.1, 15 ], true); tb_max_0.hide = true; tb_max_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 2); } ).setSlidable([ 0.1, 15 ], true); tb_max_0.hide = true;
tb_min_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(3, val); } ).setSlidable([ 0.1, 15 ], true); tb_min_1.hide = true; tb_min_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 3); } ).setSlidable([ 0.1, 15 ], true); tb_min_1.hide = true;
tb_max_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(4, val); } ).setSlidable([ 0.1, 15 ], true); tb_max_1.hide = true; tb_max_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 4); } ).setSlidable([ 0.1, 15 ], true); tb_max_1.hide = true;
tooltip = new tooltipSelector("Mode", [ tooltip = new tooltipSelector("Mode", [
__txtx("widget_rotator_random_range", "Range"), __txtx("widget_rotator_random_range", "Range"),
@ -87,23 +87,26 @@ function rotatorRandom(_onModify) : widget() constructor {
tooltip.index = mode; tooltip.index = mode;
if(buttonInstant(noone, _x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, active, hover, tooltip, THEME.rotator_random_mode, mode, [ COLORS._main_icon, c_white ]) == 2) { #region if(buttonInstant(noone, _x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, active, hover, tooltip, THEME.rotator_random_mode, mode, [ COLORS._main_icon, c_white ]) == 2) { #region
mode = (mode + 1) % 4; mode = (mode + 1) % 4;
onModify(0, mode); onModify(mode, 0);
if(mode == 0) { if(mode == 0) {
onModify(1, 0); onModify( 0, 1);
onModify(2, 180); onModify(180, 2);
} else if(mode == 1) { } else if(mode == 1) {
onModify(1, (_data[1] + _data[2]) / 2); onModify((_data[1] + _data[2]) / 2, 1);
onModify(2, abs(_data[1] - _data[2]) / 2); onModify(abs(_data[1] - _data[2]) / 2, 2);
} else if(mode == 2) { } else if(mode == 2) {
onModify(1, 0); onModify(0, 1);
onModify(2, 90); onModify(90, 2);
onModify(3, 180); onModify(180, 3);
onModify(4, 270); onModify(270, 4);
} else if(mode == 3) { } else if(mode == 3) {
onModify(1, 45); onModify(45, 1);
onModify(2, 225); onModify(225, 2);
onModify(3, 45); onModify(45, 3);
} }
} #endregion } #endregion
@ -139,17 +142,17 @@ function rotatorRandom(_onModify) : widget() constructor {
curr_val[2] = round(dragging.delta_acc + drag_sv[2]); curr_val[2] = round(dragging.delta_acc + drag_sv[2]);
val = key_mod_press(CTRL)? round(curr_val[1] / 15) * 15 : curr_val[1]; val = key_mod_press(CTRL)? round(curr_val[1] / 15) * 15 : curr_val[1];
modi |= onModify(1, val); modi |= onModify(val, 1);
val = key_mod_press(CTRL)? round(curr_val[2] / 15) * 15 : curr_val[2]; val = key_mod_press(CTRL)? round(curr_val[2] / 15) * 15 : curr_val[2];
modi |= onModify(2, val); modi |= onModify(val, 2);
if(modi) UNDO_HOLDING = true; if(modi) UNDO_HOLDING = true;
MOUSE_BLOCK = true; MOUSE_BLOCK = true;
if(mouse_check_button_pressed(mb_right)) { if(mouse_check_button_pressed(mb_right)) {
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); for( var i = 0; i < 5; i++ ) onModify(drag_dat[i], i);
instance_destroy(rotator_Rotator); instance_destroy(rotator_Rotator);
dragging = noone; dragging = noone;
@ -214,12 +217,12 @@ function rotatorRandom(_onModify) : widget() constructor {
real_val[1] = round(dragging.delta_acc + drag_sv[1]); real_val[1] = round(dragging.delta_acc + drag_sv[1]);
val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1]; val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1];
if(onModify(1, val)) UNDO_HOLDING = true; if(onModify(val, 1)) UNDO_HOLDING = true;
MOUSE_BLOCK = true; MOUSE_BLOCK = true;
if(mouse_check_button_pressed(mb_right)) { if(mouse_check_button_pressed(mb_right)) {
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); for( var i = 0; i < 5; i++ ) onModify(drag_dat[i], i);
instance_destroy(rotator_Rotator); instance_destroy(rotator_Rotator);
dragging = noone; dragging = noone;
@ -294,7 +297,7 @@ function rotatorRandom(_onModify) : widget() constructor {
real_val[ind] = round(drag_sv[ind] + dragging.delta_acc); real_val[ind] = round(drag_sv[ind] + dragging.delta_acc);
val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind]; val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind];
if(onModify(ind, val)) modi = true; if(onModify(val, ind)) modi = true;
} }
if(modi) { if(modi) {
@ -303,7 +306,7 @@ function rotatorRandom(_onModify) : widget() constructor {
} }
if(mouse_check_button_pressed(mb_right)) { if(mouse_check_button_pressed(mb_right)) {
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); for( var i = 0; i < 5; i++ ) onModify(drag_dat[i], i);
instance_destroy(rotator_Rotator); instance_destroy(rotator_Rotator);
dragging = noone; dragging = noone;
@ -390,12 +393,12 @@ function rotatorRandom(_onModify) : widget() constructor {
real_val[ind] = round(drag_sv[ind] + dragging.delta_acc); real_val[ind] = round(drag_sv[ind] + dragging.delta_acc);
val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind]; val = key_mod_press(CTRL)? round(real_val[ind] / 15) * 15 : real_val[ind];
if(onModify(ind, val)) UNDO_HOLDING = true; if(onModify(val, ind)) UNDO_HOLDING = true;
MOUSE_BLOCK = true; MOUSE_BLOCK = true;
if(mouse_check_button_pressed(mb_right)) { if(mouse_check_button_pressed(mb_right)) {
for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); for( var i = 0; i < 5; i++ ) onModify(drag_dat[i], i);
instance_destroy(rotator_Rotator); instance_destroy(rotator_Rotator);
dragging = noone; dragging = noone;

View file

@ -8,8 +8,8 @@ function rotatorRange(_onModify) : widget() constructor {
knob_hovering = noone; knob_hovering = noone;
tb_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, val); } ).setSlidable([ 0.1, 15 ], true); tb_min.hide = true; tb_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 0); } ).setSlidable([ 0.1, 15 ], true); tb_min.hide = true;
tb_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, val); } ).setSlidable([ 0.1, 15 ], true); tb_max.hide = true; tb_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 1); } ).setSlidable([ 0.1, 15 ], true); tb_max.hide = true;
static setInteract = function(interactable = noone) { #region static setInteract = function(interactable = noone) { #region
self.interactable = interactable; self.interactable = interactable;
@ -76,16 +76,16 @@ function rotatorRange(_onModify) : widget() constructor {
real_val[1] = round(dragging.delta_acc + drag_sv[1]); real_val[1] = round(dragging.delta_acc + drag_sv[1]);
val = key_mod_press(CTRL)? round(real_val[0] / 15) * 15 : real_val[0]; val = key_mod_press(CTRL)? round(real_val[0] / 15) * 15 : real_val[0];
modi |= onModify(0, val); modi |= onModify(val, 0);
val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1]; val = key_mod_press(CTRL)? round(real_val[1] / 15) * 15 : real_val[1];
modi |= onModify(1, val); modi |= onModify(val, 1);
if(modi) UNDO_HOLDING = true; if(modi) UNDO_HOLDING = true;
MOUSE_BLOCK = true; MOUSE_BLOCK = true;
if(mouse_check_button_pressed(mb_right)) { if(mouse_check_button_pressed(mb_right)) {
for( var i = 0; i < 2; i++ ) onModify(i, drag_dat[i]); for( var i = 0; i < 2; i++ ) onModify(drag_dat[i], i);
instance_destroy(rotator_Rotator); instance_destroy(rotator_Rotator);
dragging = noone; dragging = noone;

View file

@ -6,8 +6,8 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor {
onModify = _onModify; onModify = _onModify;
tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, clamp(val, curr_range[0], curr_range[1])); }).setSlidable(_step, _int, _range); tb_value_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(clamp(val, curr_range[0], curr_range[1]), 0); }).setSlidable(_step, _int, _range);
tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, clamp(val, curr_range[0], curr_range[1])); }).setSlidable(_step, _int, _range); tb_value_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(clamp(val, curr_range[0], curr_range[1]), 1); }).setSlidable(_step, _int, _range);
tb_value_min.hide = true; tb_value_min.hide = true;
tb_value_max.hide = true; tb_value_max.hide = true;

View file

@ -921,8 +921,8 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
ch_y += line_get_height(); ch_y += line_get_height();
} }
cursor_pos_x = cursor_pos_x == 0? cursor_pos_x_to : lerp_float(cursor_pos_x, cursor_pos_x_to, 2); cursor_pos_x = cursor_pos_x == 0? cursor_pos_x_to : lerp_float(cursor_pos_x, cursor_pos_x_to, 1);
cursor_pos_y = cursor_pos_y == 0? cursor_pos_y_to : lerp_float(cursor_pos_y, cursor_pos_y_to, 2); cursor_pos_y = cursor_pos_y == 0? cursor_pos_y_to : lerp_float(cursor_pos_y, cursor_pos_y_to, 1);
#endregion #endregion
display_text(tx, text_y + ui(7), _input_text, msx, msy, hover && hoverRect); display_text(tx, text_y + ui(7), _input_text, msx, msy, hover && hoverRect);

View file

@ -649,7 +649,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
disp_x_to -= _w - ui(16); disp_x_to -= _w - ui(16);
cursor_pos_y = c_y0; cursor_pos_y = c_y0;
cursor_pos = cursor_pos == 0? cursor_pos_to : lerp_float(cursor_pos, cursor_pos_to, 2); cursor_pos = cursor_pos == 0? cursor_pos_to : lerp_float(cursor_pos, cursor_pos_to, 1);
if(cursor_select > -1) { //draw highlight if(cursor_select > -1) { //draw highlight
draw_set_color(COLORS.widget_text_highlight); draw_set_color(COLORS.widget_text_highlight);

View file

@ -9,13 +9,13 @@ enum TRANSFORM {
function transformBox(_onModify) : widget() constructor { function transformBox(_onModify) : widget() constructor {
onModify = _onModify; onModify = _onModify;
onModifySingle[TRANSFORM.pos_x] = function(val) { onModify(TRANSFORM.pos_x, val); } onModifySingle[TRANSFORM.pos_x] = function(val) { onModify(val, TRANSFORM.pos_x); }
onModifySingle[TRANSFORM.pos_y] = function(val) { onModify(TRANSFORM.pos_y, val); } onModifySingle[TRANSFORM.pos_y] = function(val) { onModify(val, TRANSFORM.pos_y); }
onModifySingle[TRANSFORM.rot ] = function(val) { onModify(TRANSFORM.rot , val); } //unused onModifySingle[TRANSFORM.rot ] = function(val) { onModify(val, TRANSFORM.rot ); } //unused
onModifySingle[TRANSFORM.sca_x] = function(val) { onModify(TRANSFORM.sca_x, val); } onModifySingle[TRANSFORM.sca_x] = function(val) { onModify(val, TRANSFORM.sca_x); }
onModifySingle[TRANSFORM.sca_y] = function(val) { onModify(TRANSFORM.sca_y, val); } onModifySingle[TRANSFORM.sca_y] = function(val) { onModify(val, TRANSFORM.sca_y); }
rot = new rotator(function(val) { onModify(TRANSFORM.rot, val); }); rot = new rotator(function(val) { onModify(val, TRANSFORM.rot); });
labels = [ "x", "y", "rot", "sx", "sy" ]; labels = [ "x", "y", "rot", "sx", "sy" ];

View file

@ -18,7 +18,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
tooltip = new tooltipSelector("Axis", [ __txt("Independent"), __txt("Linked") ]); tooltip = new tooltipSelector("Axis", [ __txt("Independent"), __txt("Linked") ]);
onModifyIndex = function(index, val) { onModifyIndex = function(val, index) {
var v = toNumber(val); var v = toNumber(val);
if(linked) { if(linked) {
@ -27,21 +27,21 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
tb[i]._input_text = v; tb[i]._input_text = v;
if(is_callable(onModify)) if(is_callable(onModify))
modi |= onModify(i, v); modi |= onModify(v, i);
} }
return modi; return modi;
} }
if(is_callable(onModify)) if(is_callable(onModify))
return onModify(index, v); return onModify(v, index);
return noone; return noone;
} }
axis = [ "x", "y", "z", "w" ]; axis = [ "x", "y", "z", "w" ];
onModifySingle[0] = function(val) { return onModifyIndex(0, val); } onModifySingle[0] = function(val) { return onModifyIndex(val, 0); }
onModifySingle[1] = function(val) { return onModifyIndex(1, val); } onModifySingle[1] = function(val) { return onModifyIndex(val, 1); }
onModifySingle[2] = function(val) { return onModifyIndex(2, val); } onModifySingle[2] = function(val) { return onModifyIndex(val, 2); }
onModifySingle[3] = function(val) { return onModifyIndex(3, val); } onModifySingle[3] = function(val) { return onModifyIndex(val, 3); }
for(var i = 0; i < 4; i++) { for(var i = 0; i < 4; i++) {
tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]);

View file

@ -12,22 +12,22 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
__txtx("widget_range_constant", "Constant"), __txtx("widget_range_constant", "Constant"),
]); ]);
onModifyIndex = function(index, val) { onModifyIndex = function(val, index) {
if(linked) { if(linked) {
var modi = false; var modi = false;
modi |= onModify(floor(index / 2) * 2 + 0, toNumber(val)); modi |= onModify(toNumber(val), floor(index / 2) * 2 + 0);
modi |= onModify(floor(index / 2) * 2 + 1, toNumber(val)); modi |= onModify(toNumber(val), floor(index / 2) * 2 + 1);
return modi; return modi;
} }
return onModify(index, toNumber(val)); return onModify(toNumber(val), index);
} }
axis = [ "x", "y", "z", "w"]; axis = [ "x", "y", "z", "w"];
onModifySingle[0] = function(val) { return onModifyIndex(0, toNumber(val)); } onModifySingle[0] = function(val) { return onModifyIndex(toNumber(val), 0); }
onModifySingle[1] = function(val) { return onModifyIndex(1, toNumber(val)); } onModifySingle[1] = function(val) { return onModifyIndex(toNumber(val), 1); }
onModifySingle[2] = function(val) { return onModifyIndex(2, toNumber(val)); } onModifySingle[2] = function(val) { return onModifyIndex(toNumber(val), 2); }
onModifySingle[3] = function(val) { return onModifyIndex(3, toNumber(val)); } onModifySingle[3] = function(val) { return onModifyIndex(toNumber(val), 3); }
extras = -1; extras = -1;
@ -99,8 +99,8 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
if(linked) { if(linked) {
for(var i = 0; i < size; i += 2) { for(var i = 0; i < size; i += 2) {
onModify(i + 0, _data[i]); onModify(_data[i], i + 0);
onModify(i + 1, _data[i]); onModify(_data[i], i + 1);
} }
} }
} }

View file

@ -1,10 +1,11 @@
function widget() constructor { function widget() constructor {
active = false; active = false;
hover = false; hover = false;
hovering= false; hovering = false;
iactive = false; iactive = false;
ihover = false; ihover = false;
parent = noone; parent = noone;
keyframe = noone;
interactable = true; interactable = true;
right_click_block = true; right_click_block = true;