[Preview, graph panels] Add button to set modified value as the default value.

This commit is contained in:
Tanasart 2025-01-31 14:22:39 +07:00
parent e334871059
commit afaac2014d
31 changed files with 623 additions and 451 deletions

Binary file not shown.

Binary file not shown.

View file

@ -353,9 +353,11 @@
function resetPosition() {
if(!active) return;
if(anchor == ANCHOR.none) {
dialog_x = xstart - dialog_w / 2;
dialog_y = ystart - dialog_h / 2;
} else {
if(anchor & ANCHOR.left) dialog_x = min(xstart, WIN_SW - dialog_w);
if(anchor & ANCHOR.right) dialog_x = max(xstart - dialog_w, 0);

View file

@ -1,4 +1,4 @@
function __Panel_Linear_Setting_Item(name, editWidget, data, onEdit = noone, getDefault = noone, action = noone) constructor {
function __Panel_Linear_Setting_Item(name, editWidget, data, onEdit = noone, getDefault = noone, action = noone, prefKey = noone) constructor {
self.name = name;
self.editWidget = editWidget;
self.data = data;
@ -6,8 +6,9 @@ function __Panel_Linear_Setting_Item(name, editWidget, data, onEdit = noone, get
self.onEdit = onEdit;
self.getDefault = getDefault;
self.action = action == noone? noone : struct_try_get(FUNCTIONS, string_to_var2(action[0], action[1]), noone);
key = "";
self.prefKey = prefKey;
self.key = "";
self.is_patreon = false;
static setKey = function(_key) { self.key = _key; return self; }
@ -17,9 +18,9 @@ function __Panel_Linear_Setting_Item(name, editWidget, data, onEdit = noone, get
function __Panel_Linear_Setting_Item_Preference(name, key, editWidget, _data = noone) : __Panel_Linear_Setting_Item(name, editWidget, _data) constructor {
self.key = key;
data = function() { return PREFERENCES[$ key]; }
onEdit = function(val) { PREFERENCES[$ key] = val; PREF_SAVE(); }
getDefault = function() { return PREFERENCES_DEF[$ key]; }
data = function( ) { return getPreference(key); }
onEdit = function(v) { setPreference(key, v); }
getDefault = function( ) { return getPreference(key, PREFERENCES_DEF); }
}
function __Panel_Linear_Setting_Label(name, sprite, _index = 0, _color = c_white) constructor {
@ -32,12 +33,14 @@ function __Panel_Linear_Setting_Label(name, sprite, _index = 0, _color = c_white
function Panel_Linear_Setting() : PanelContent() constructor {
title = __txt("Settings");
w = ui(400);
wdgw = ui(180);
wdgw = ui(200);
hpad = 0;
bg_y = -1;
bg_y_to = -1;
bg_a = 0;
resizable = false;
hk_editing = noone;
selecting_menu = noone;
properties = [];
@ -46,7 +49,7 @@ function Panel_Linear_Setting() : PanelContent() constructor {
curr_height = 0;
shift_height = true;
static setHeight = function() { h = prop_height * array_length(properties) + ui(16); }
static setHeight = function() { h = prop_height * array_length(properties) + ui(16) + hpad; }
static resetHeight = function(_h) {
if(h == _h) return;
@ -65,6 +68,9 @@ function Panel_Linear_Setting() : PanelContent() constructor {
var th = prop_height;
var ww = max(wdgw, w * 0.5);
var wh = TEXTBOX_HEIGHT;
var _bs = ui(32);
var _mm = [ mx, my ];
var _hov = false;
if(bg_y) draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, ui(4), bg_y, w - ui(8), th, COLORS.panel_prop_bg, 0.5 * bg_a);
@ -108,7 +114,7 @@ function Panel_Linear_Setting() : PanelContent() constructor {
continue;
}
if(is_instanceof(_prop, __Panel_Linear_Setting_Label)) {
if(is(_prop, __Panel_Linear_Setting_Label)) {
var _text = _prop.name;
var _spr = _prop.sprite;
var _ind = _prop.index;
@ -124,7 +130,7 @@ function Panel_Linear_Setting() : PanelContent() constructor {
continue;
}
if(is_instanceof(_prop, __Panel_Linear_Setting_Item)) {
if(is(_prop, __Panel_Linear_Setting_Item)) {
var _text = _prop.name;
var _data = _prop.data;
var _widg = _prop.editWidget;
@ -143,19 +149,15 @@ function Panel_Linear_Setting() : PanelContent() constructor {
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(16), yy + th / 2, _text);
var _x1 = w - ui(8);
var _wdw = ww;
if(_prop.getDefault != noone)
_wdw -= ui(32 + 8);
var _x1 = w - ui(4);
var _wdw = ww - ui(4);
if(_prop.prefKey != noone) _wdw -= ui(24) + ui(4);
if(_prop.getDefault != noone) _wdw -= ui(24) + ui(4);
var params = new widgetParam(_x1 - ww, yy + th / 2 - wh / 2, _wdw, wh, _data, {}, [ mx, my ], x, y)
.setFont(f_p2);
if(is_instanceof(_widg, checkBox)) {
params.halign = fa_center;
params.valign = fa_center;
}
.setFont(f_p2);
if(is(_widg, checkBox)) { params.halign = fa_center; params.valign = fa_center; }
_widg.drawParam(params);
@ -203,16 +205,37 @@ function Panel_Linear_Setting() : PanelContent() constructor {
}
var _bx = _x1;
var _by = yy + th / 2 - _bs / 2;
var _cc = [ COLORS._main_icon, COLORS._main_icon_light ];
if(_prop.prefKey != noone) {
_bx -= ui(24);
var _prefVal = getPreference(_prop.prefKey);
if(isEqual(_data, _prefVal))
draw_sprite_ext(THEME.icon_default, 0, _bx + ui(24) / 2, _by + _bs / 2, 1, 1, 0, COLORS._main_icon_dark);
else {
if(buttonInstant(noone, _bx, _by, ui(24), _bs, _mm, pHOVER, pFOCUS, __txt("Set default"), THEME.icon_default, 0, _cc, .75) == 2)
setPreference(_prop.prefKey, _data);
}
_bx -= ui(2);
}
if(_prop.getDefault != noone) {
var _defVal = is_method(_prop.getDefault)? _prop.getDefault() : _prop.getDefault;
var _bs = ui(32);
var _bx = _x1 - _bs;
var _by = yy + th / 2 - _bs / 2;
var _defVal = _prop.getDefault;
if(_prop.prefKey != noone) _defVal = getPreference(_prop.prefKey);
else if(is_method(_prop.getDefault)) _defVal = _prop.getDefault();
_bx -= ui(24);
if(isEqual(_data, _defVal))
draw_sprite_ext(THEME.refresh_16, 0, _bx + _bs / 2, _by + _bs / 2, 1, 1, 0, COLORS._main_icon_dark);
draw_sprite_ext(THEME.refresh_16, 0, _bx + ui(24) / 2, _by + _bs / 2, 1, 1, 0, COLORS._main_icon_dark);
else {
if(buttonInstant(THEME.button_hide_fill, _bx, _by, _bs, _bs, [ mx, my ], pHOVER, pFOCUS, __txt("Reset"), THEME.refresh_16) == 2)
if(buttonInstant(noone, _bx, _by, ui(24), _bs, _mm, pHOVER, pFOCUS, __txt("Reset"), THEME.refresh_16, 0, _cc, .75) == 2)
_prop.onEdit(_defVal);
}
}
@ -232,12 +255,9 @@ function Panel_Linear_Setting() : PanelContent() constructor {
if(keyboard_check_pressed(vk_escape)) hk_editing = noone;
}
curr_height = yy + ui(4);
curr_height = yy + ui(4) + hpad;
}
function drawContent() { drawSettings(); }
function preDraw() {
resetHeight(curr_height);
}
function preDraw() { resetHeight(curr_height); }
}

View file

@ -22,12 +22,12 @@
#region animation class
function AnimationManager() constructor {
frames_total = 30;
frames_total = PREFERENCES.project_animation_duration;
current_frame = 0;
real_frame = 0;
time_since_last_frame = 0;
framerate = 30;
framerate = PREFERENCES.project_animation_framerate;
is_playing = false;
is_rendering = false;
frame_progress = false;

View file

@ -178,7 +178,7 @@ function buttonInstant(spr, _x, _y, _w, _h, _m, _hvr, _act, _tip = "", _icon = n
} else if(spr)
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);
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 : 1);
return res;
}

View file

@ -73,7 +73,7 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
var _cw = _w;
var _bs = min(_h, ui(32));
if(_w - _bs > ui(64) && interactable) {
if(_w - _bs > ui(128) && interactable) {
var bx = _x + _cw - _bs;
_cw -= _bs;
@ -92,7 +92,7 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
b_picker.icon_blend = COLORS._main_icon;
}
if(_cw > ui(64)) {
if(_cw > ui(128)) {
bx -= _bs + ui(4)
_cw -= _bs + ui(4);

View file

@ -30,8 +30,7 @@ function dialogPanelCall(_panel, _x = noone, _y = noone, params = {}) {
dia.y = _y;
dia.xstart = _x;
dia.ystart = _y;
dia.anchor = _panel.anchor;
dia.anchor = params[$ "anchor"] ?? _panel.anchor;
dia.resetPosition();
if(struct_try_get(params, "focus", true))

View file

@ -32,7 +32,7 @@ function point_project_line(px, py, l0x, l0y, l1x, l1y) {
function point_project_curve(mx, my, x0, y0, x1, y1) {
var xc = (x0 + x1) / 2;
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 16 * PREFERENCES.connection_line_sample);
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 16 * PROJECT.graphConnection.line_sample);
sample = clamp(sample, 8, 128);
var dist = 999999;

View file

@ -2,7 +2,7 @@ function draw_line_curve_color(x0, y0, x1, y1, xc = noone, yc = noone, _s = 1, t
if(xc == noone) xc = (x0 + x1) / 2;
if(yc == noone) yc = (y0 + y1) / 2;
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample);
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PROJECT.graphConnection.line_sample);
sample = clamp(sample, 2, 128);
if(type == LINE_STYLE.dashed) sample *= 2;
@ -51,7 +51,7 @@ function draw_line_curve_color(x0, y0, x1, y1, xc = noone, yc = noone, _s = 1, t
}
function draw_line_curve_corner(x0, y0, x1, y1, _s = 1, thick = 1, col1 = c_white, col2 = c_white) {
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample);
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PROJECT.graphConnection.line_sample);
sample = clamp(sample, 2, 128);
var x2 = lerp(x0, x1, 0.9);
@ -87,7 +87,7 @@ function draw_line_curve_corner(x0, y0, x1, y1, _s = 1, thick = 1, col1 = c_whit
}
function distance_to_curve(mx, my, x0, y0, x1, y1, xc, yc, _s) {
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample);
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PROJECT.graphConnection.line_sample);
sample = clamp(sample, 2, 128);
var dist = 999999;
@ -125,7 +125,7 @@ function distance_to_curve(mx, my, x0, y0, x1, y1, xc, yc, _s) {
}
function distance_to_curve_corner(mx, my, x0, y0, x1, y1, _s) {
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample);
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PROJECT.graphConnection.line_sample);
sample = clamp(sample, 2, 128);
var dist = 999999;

View file

@ -5,7 +5,7 @@ function connection_get_curve(x0, y0, x1, y1, xc = noone, yc = noone) { #region
if(yc == noone) yc = (y0 + y1) / 2;
var pnt = array_create(sample + 1);
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample);
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PROJECT.graphConnection.line_sample);
sample = clamp(sample, 2, 128);
var x2 = lerp(x0, x1, 0. - sign(x1 - x0) * 0.2) - abs(y1 - y0) * 0.1;
@ -41,7 +41,7 @@ function connection_get_curve(x0, y0, x1, y1, xc = noone, yc = noone) { #region
return pnt;
} #endregion
function connection_get_curve_down(x0, y0, x1, y1) { #region
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample);
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PROJECT.graphConnection.line_sample);
sample = clamp(sample, 2, 128);
var pnt = array_create(sample + 1);

View file

@ -2196,7 +2196,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(branch_drawing) return;
branch_drawing = true;
if(!PREFERENCES.connection_line_highlight_all && _depth == 1) return;
if(!project.graphConnection.line_highlight_all && _depth == 1) return;
for( var i = 0, n = array_length(inputs); i < n; i++ ) {
if(inputs[i].value_from == noone) continue;

View file

@ -9,13 +9,25 @@ function variable_editor(nodeVal) constructor {
/*Boolean*/ [ "Default" ],
/*Color*/ [ "Default", "Palette" ],
/*Gradient*/[ "Default" ],
/*Path*/ [ "Import", "Export", "Font" ],
/*Path*/ [ "Read", "Write", "Font" ],
/*Curve*/ [ "Default", ],
/*Text*/ [ "Default", ],
]
tb_name = new textBox(TEXTBOX_INPUT.text, function(s) /*=>*/ {
if(string_pos(" ", s)) { noti_warning("Global variable name can't have space."); return; }
var _node = value.node;
for( var i = 0, n = array_length(_node.inputs); i < n; i++ ) {
var _in = _node.inputs[i];
if(_in == value) continue;
if(_in.name == s) {
noti_warning("Duplicate variable name.");
return;
}
}
value.name = s;
RENDER_ALL
});
@ -127,8 +139,8 @@ function variable_editor(nodeVal) constructor {
case "Area" : value.setDisplay(VALUE_DISPLAY.area); break;
case "Palette" : value.setDisplay(VALUE_DISPLAY.palette); break;
case "Import" : value.setDisplay(VALUE_DISPLAY.path_load, { filter: "" }); break;
case "Export" : value.setDisplay(VALUE_DISPLAY.path_save, { filter: "" }); break;
case "Read" : value.setDisplay(VALUE_DISPLAY.path_load, { filter: "" }); break;
case "Write" : value.setDisplay(VALUE_DISPLAY.path_save, { filter: "" }); break;
case "Font" : value.setDisplay(VALUE_DISPLAY.path_font); break;
}
}

View file

@ -856,7 +856,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
case VALUE_DISPLAY.path_load :
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { if(NOT_LOAD) check_directory_redirector(str); setValueInspector(str); });
editWidget.align = fa_left;
array_append(node.project.pathInputs, self);
if(!is(node, Node_Global)) array_append(node.project.pathInputs, self);
editWidget.side_button = button(function() /*=>*/ {
var path = display_data.filter == "dir"? get_directory("") : get_open_filename_pxc(display_data.filter, "");
@ -2039,8 +2039,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(target != noone)
drawCorner |= target.type == VALUE_TYPE.action;
var corner = PREFERENCES.connection_line_corner * ss;
var th = max(1, PREFERENCES.connection_line_width * ss);
var corner = PROJECT.graphConnection.line_corner * ss;
var th = max(1, PROJECT.graphConnection.line_width * ss);
var sx = x;
var sy = y;
@ -2053,7 +2053,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
_mx *= aa;
_my *= aa;
var _fade = PREFERENCES.connection_line_highlight_fade;
var _fade = PROJECT.graphConnection.line_highlight_fade;
var col = custom_color == noone? merge_color(_fade, color_display, .5) : custom_color;
draw_set_color(col);
@ -2061,13 +2061,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var _output = connect_type == CONNECT_TYPE.output;
var _drawParam = {
corner : corner,
extend : PREFERENCES.connection_line_extend,
extend : PROJECT.graphConnection.line_extend,
fromIndex : 1,
toIndex : 1,
type : LINE_STYLE.solid,
}
switch(PREFERENCES.curve_connection_line) {
switch(PROJECT.graphConnection.type) {
case 0 :
if(drawCorner) draw_line_width(sx, sy, _mx, _my, th);
else {
@ -2430,16 +2430,16 @@ function checkJuncConnection(from, to, params) {
var cx = round((frx + jx) / 2 + shx);
var cy = round((fry + jy) / 2 + shy);
var th = max(1, PREFERENCES.connection_line_width * _s);
var th = max(1, PROJECT.graphConnection.line_width * _s);
var hover, hovDist = max(th * 2, 6);
var _fin = from.draw_line_shift_e > -1? from.draw_line_shift_e : from.drawLineIndex;
var _tin = to.draw_line_shift_e > -1? to.draw_line_shift_e : to.drawLineIndex;
var _x0 = min(jx, cx, frx) - hovDist - max(_fin, _tin) * PREFERENCES.connection_line_extend;
var _x0 = min(jx, cx, frx) - hovDist - max(_fin, _tin) * PROJECT.graphConnection.line_extend;
var _y0 = min(jy, cy, fry) - hovDist;
var _x1 = max(jx, cx, frx) + hovDist + max(_fin, _tin) * PREFERENCES.connection_line_extend;
var _x1 = max(jx, cx, frx) + hovDist + max(_fin, _tin) * PROJECT.graphConnection.line_extend;
var _y1 = max(jy, cy, fry) + hovDist;
if(!point_in_rectangle(mx, my, _x0, _y0, _x1, _y1)) return noone;
@ -2452,10 +2452,10 @@ function checkJuncConnection(from, to, params) {
} else {
var _hdist;
switch(PREFERENCES.curve_connection_line) {
switch(PROJECT.graphConnection.type) {
case 0 :
if(downDirection) _hdist = distance_to_line(mx, my, jx, jy, frx, fry);
else _hdist = distance_to_linear_connection(mx, my, frx, fry, jx, jy, _s, PREFERENCES.connection_line_extend);
else _hdist = distance_to_linear_connection(mx, my, frx, fry, jx, jy, _s, PROJECT.graphConnection.line_extend);
break;
case 1 :
@ -2470,7 +2470,7 @@ function checkJuncConnection(from, to, params) {
case 3 :
if(downDirection) _hdist = distance_to_elbow_diag_corner(mx, my, frx, fry, jx, jy);
else _hdist = distance_to_elbow_diag(mx, my, frx, fry, jx, jy, cx, cy, _s, PREFERENCES.connection_line_extend, _fin, _tin);
else _hdist = distance_to_elbow_diag(mx, my, frx, fry, jx, jy, cx, cy, _s, PROJECT.graphConnection.line_extend, _fin, _tin);
break;
default : return noone;
@ -2512,10 +2512,10 @@ function drawJuncConnection(from, to, params, _thick = false) {
var shy = to.draw_line_shift_y * _s;
var cx = round((frx + jx) / 2 + shx);
var cy = round((fry + jy) / 2 + shy);
var th = max(1, PREFERENCES.connection_line_width * _s) * (1 + _thick);
var th = max(1, PROJECT.graphConnection.line_width * _s) * (1 + _thick);
#region draw parameters
var corner = PREFERENCES.connection_line_corner * _s;
var corner = PROJECT.graphConnection.line_corner * _s;
var ty = LINE_STYLE.solid;
if(to.type == VALUE_TYPE.node || struct_try_get(params, "dashed"))
@ -2525,7 +2525,7 @@ function drawJuncConnection(from, to, params, _thick = false) {
var _selc = to.node.branch_drawing && from.node.branch_drawing;
if(high) {
var _fade = PREFERENCES.connection_line_highlight_fade;
var _fade = PROJECT.graphConnection.line_highlight_fade;
var _colr = _selc? 1 : _fade;
c0 = merge_color(bg, from.custom_color == noone? from.color_display : from.custom_color, _colr);
@ -2557,13 +2557,13 @@ function drawJuncConnection(from, to, params, _thick = false) {
if(_loop) { draw_line_feedback(jx, jy, frx, fry, th, c1, c0, ss); return; }
var down = to.type == VALUE_TYPE.action || from.type == VALUE_TYPE.action;
drawParam.extend = PREFERENCES.connection_line_extend;
drawParam.extend = PROJECT.graphConnection.line_extend;
drawParam.fromIndex = from.draw_line_shift_e > -1? from.draw_line_shift_e : from.drawLineIndex;
drawParam.toIndex = to.draw_line_shift_e > -1? to.draw_line_shift_e : to.drawLineIndex;
drawParam.corner = corner;
drawParam.type = ty;
switch(PREFERENCES.curve_connection_line) {
switch(PROJECT.graphConnection.type) {
case 0 :
if(down) draw_line_width_color(jx, jy, frx, fry, th, c0, c1);
else draw_line_connect(frx, fry, jx, jy, ss, th, c0, c1, drawParam);

View file

@ -4,35 +4,32 @@ function Panel_Animation_Scaler() : Panel_Linear_Setting() constructor {
w = ui(380);
scale_to = TOTAL_FRAMES;
#region data
properties = [
new __Panel_Linear_Setting_Item(
__txtx("anim_scale_target_frame_length", "Target frame length"),
new textBox(TEXTBOX_INPUT.number, function(to) { scale_to = toNumber(to); }),
function() { return scale_to; },
)
];
setHeight();
h += ui(36);
b_apply = button(function() { scale(); })
.setIcon(THEME.accept_16, 0, COLORS._main_icon_dark);
#endregion
properties = [
new __Panel_Linear_Setting_Item(
__txtx("anim_scale_target_frame_length", "Target frame length"),
new textBox(TEXTBOX_INPUT.number, function(to) /*=>*/ { scale_to = toNumber(to); }),
function() /*=>*/ {return scale_to},
)
];
hpad = ui(36);
setHeight();
b_apply = button(function() /*=>*/ {return scale()}).setIcon(THEME.accept_16, 0, COLORS._main_icon_dark);
static scale = function() {
var fac = scale_to / TOTAL_FRAMES;
for (var k = 0, n = array_length(PROJECT.allNodes); k < n; k++) {
var _node = PROJECT.allNodes[k];
for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) {
var _node = PROJECT.allNodes[i];
if(!_node || !_node.active) continue;
for(var i = 0; i < array_length(_node.inputs); i++) {
var in = _node.inputs[i];
for(var j = 0, m = array_length(_node.inputs); j < m; j++) {
var in = _node.inputs[j];
if(!in.is_anim) continue;
for(var j = 0; j < array_length(in.animator.values); j++) {
var t = in.animator.values[j];
for(var k = 0, p = array_length(in.animator.values); k < p; k++) {
var t = in.animator.values[k];
t.time = t.ratio * scale_to;
}
}

View file

@ -1,27 +1,35 @@
function Panel_Animation_Setting() : Panel_Linear_Setting() constructor {
title = __txtx("animation_settings", "Animation Settings");
w = ui(380);
#region data
properties = [
new __Panel_Linear_Setting_Item(
__txtx("anim_length", "Animation length"),
new textBox(TEXTBOX_INPUT.number, function(str) { TOTAL_FRAMES = real(str); }),
function() { return TOTAL_FRAMES; }
),
new __Panel_Linear_Setting_Item(
__txtx("anim_frame_rate", "Preview frame rate"),
new textBox(TEXTBOX_INPUT.number, function(str) { PROJECT.animator.framerate = real(str); }),
function() { return PROJECT.animator.framerate; }
),
new __Panel_Linear_Setting_Item(
__txtx("anim_on_end", "On end"),
new buttonGroup([ __txt("Loop"), __txt("Stop"), __txt("Ping Pong")], function(b) { PROJECT.animator.playback = b; }),
function() { return PROJECT.animator.playback; }
),
];
properties = [
new __Panel_Linear_Setting_Item(
__txtx("anim_length", "Animation length"),
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PROJECT.animator.frames_total = round(real(str)); }),
function( ) /*=>*/ {return PROJECT.animator.frames_total},
function(v) /*=>*/ { PROJECT.animator.frames_total = v; },
PREFERENCES.project_animation_duration,
noone,
"project_animation_duration",
),
setHeight();
#endregion
new __Panel_Linear_Setting_Item(
__txtx("anim_frame_rate", "Preview frame rate"),
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PROJECT.animator.framerate = real(str); }),
function( ) /*=>*/ {return PROJECT.animator.framerate},
function(v) /*=>*/ { PROJECT.animator.framerate = v; },
PREFERENCES.project_animation_framerate,
noone,
"project_animation_framerate",
),
new __Panel_Linear_Setting_Item(
__txtx("anim_on_end", "On end"),
new buttonGroup([ __txt("Loop"), __txt("Stop"), __txt("Ping Pong")], function(b) /*=>*/ { PROJECT.animator.playback = b; }),
function( ) /*=>*/ {return PROJECT.animator.playback},
function(v) /*=>*/ { PROJECT.animator.playback = v; },
),
];
setHeight();
}

View file

@ -1,6 +1,6 @@
function Panel_Collections_Setting() : Panel_Linear_Setting() constructor {
title = __txtx("collection_settings", "Collection Settings");
w = ui(380);
w = ui(380);
properties = [
new __Panel_Linear_Setting_Item(
@ -8,21 +8,25 @@ function Panel_Collections_Setting() : Panel_Linear_Setting() constructor {
new buttonGroup([ "Grid", "List" ], function(i) /*=>*/ { PANEL_COLLECTION.contentView = i; }),
function() /*=>*/ {return PANEL_COLLECTION.contentView},
),
new __Panel_Linear_Setting_Item_Preference(
__txt("Show label"),
"collection_label",
new checkBox(function() /*=>*/ { PREFERENCES.collection_label = !PREFERENCES.collection_label; PREF_SAVE(); }),
),
new __Panel_Linear_Setting_Item_Preference(
__txtx("coll_animated", "Animated thumbnail"),
"collection_animated",
new checkBox(function() /*=>*/ { PREFERENCES.collection_animated = !PREFERENCES.collection_animated; PREF_SAVE(); }),
),
new __Panel_Linear_Setting_Item_Preference(
__txtx("coll_animated_speed", "Animation speed"),
"collection_preview_speed",
new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { PREFERENCES.collection_preview_speed = val; PREF_SAVE(); }),
),
new __Panel_Linear_Setting_Item_Preference(
__txtx("coll_thumbnail_scale", "Thumbnail scale"),
"collection_scale",

View file

@ -271,6 +271,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
show_grid : true,
show_dimension : true,
show_compute : true,
show_view_control : 1,
avoid_label : false,
preview_scale : 100,
@ -281,7 +282,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
}
connection_param = new connectionParameter();
show_view_control = 1;
bg_color = c_black;
@ -518,74 +518,77 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
toolbars_general = [
[
THEME.icon_preview_export,
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txtx("panel_graph_export_image", "Export graph as image"), "Graph", "Export As Image")},
function(param) /*=>*/ { dialogPanelCall(new Panel_Graph_Export_Image(self)); }
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txtx("panel_graph_export_image", "Export graph as image"), "Graph", "Export As Image")},
function(p) /*=>*/ { dialogPanelCall(new Panel_Graph_Export_Image(self)); }
],
[
THEME.search_24,
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txt("Search"), "Graph", "Search")},
function(param) /*=>*/ { toggleSearch(); }
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txt("Search"), "Graph", "Search")},
function(p) /*=>*/ { toggleSearch(); }
],
[
THEME.icon_center_canvas,
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txtx("panel_graph_center_to_nodes", "Center to nodes"), "Graph", "Focus content")},
function(param) /*=>*/ { toCenterNode(); }
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txtx("panel_graph_center_to_nodes", "Center to nodes"), "Graph", "Focus content")},
function(p) /*=>*/ { toCenterNode(); }
],
[
THEME.icon_minimap,
function() /*=>*/ {return minimap_show},
function() /*=>*/ {return new tooltipHotkey(__txtx("panel_graph_toggle_minimap", "Toggle minimap"), "Graph", "Toggle Minimap")},
function(param) /*=>*/ { minimap_show = !minimap_show; }
function() /*=>*/ {return minimap_show},
function() /*=>*/ {return new tooltipHotkey(__txtx("panel_graph_toggle_minimap", "Toggle minimap"), "Graph", "Toggle Minimap")},
function(p) /*=>*/ { minimap_show = !minimap_show; }
],
[
THEME.icon_curve_connection,
function() /*=>*/ {return PREFERENCES.curve_connection_line},
function() /*=>*/ {return new tooltipHotkey(__txtx("panel_graph_connection_line", "Connection render settings") + "...", "Graph", "Connection Settings")},
function(param) /*=>*/ { dialogPanelCall(new Panel_Graph_Connection_Setting(), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left }); }
function() /*=>*/ {return project.graphConnection.type},
function() /*=>*/ {return new tooltipHotkey(__txtx("panel_graph_connection_line", "Connection render settings") + "...", "Graph", "Connection Settings")},
function(p) /*=>*/ { dialogPanelCall(new Panel_Graph_Connection_Setting(),
x + w - ui(8), y + h - toolbar_height - ui(8), { anchor: ANCHOR.bottom | ANCHOR.right }); }
],
[
THEME.icon_grid_setting,
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txtx("grid_title", "Grid settings") + "...", "Graph", "Grid Settings")},
function(param) /*=>*/ { dialogPanelCall(new Panel_Graph_Grid_Setting(), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left }); }
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txtx("grid_title", "Grid settings") + "...", "Graph", "Grid Settings")},
function(p) /*=>*/ { dialogPanelCall(new Panel_Graph_Grid_Setting(),
x + w - ui(8), y + h - toolbar_height - ui(8), { anchor: ANCHOR.bottom | ANCHOR.right }); }
],
[
THEME.icon_visibility,
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txtx("graph_visibility_title", "Visibility settings") + "...", "Graph", "View Settiings")},
function(param) /*=>*/ { dialogPanelCall(new Panel_Graph_View_Setting(self, display_parameter), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left }); }
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txtx("graph_visibility_title", "Visibility settings") + "...", "Graph", "View Settiings")},
function(p) /*=>*/ { dialogPanelCall(new Panel_Graph_View_Setting(self, display_parameter),
x + w - ui(8), y + h - toolbar_height - ui(8), { anchor: ANCHOR.bottom | ANCHOR.right }); }
],
];
toolbars_halign = [
[ THEME.object_halign, function() /*=>*/ {return 2}, function() /*=>*/ {return ""}, function(param) /*=>*/ { node_halign(nodes_selecting, fa_right); } ],
[ THEME.object_halign, function() /*=>*/ {return 1}, function() /*=>*/ {return ""}, function(param) /*=>*/ { node_halign(nodes_selecting, fa_center); } ],
[ THEME.object_halign, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(param) /*=>*/ { node_halign(nodes_selecting, fa_left); } ],
[ THEME.object_halign, function() /*=>*/ {return 2}, function() /*=>*/ {return ""}, function(p) /*=>*/ { node_halign(nodes_selecting, fa_right); } ],
[ THEME.object_halign, function() /*=>*/ {return 1}, function() /*=>*/ {return ""}, function(p) /*=>*/ { node_halign(nodes_selecting, fa_center); } ],
[ THEME.object_halign, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(p) /*=>*/ { node_halign(nodes_selecting, fa_left); } ],
];
toolbars_valign = [
[ THEME.object_valign, function() /*=>*/ {return 2}, function() /*=>*/ {return ""}, function(param) /*=>*/ { node_valign(nodes_selecting, fa_bottom); } ],
[ THEME.object_valign, function() /*=>*/ {return 1}, function() /*=>*/ {return ""}, function(param) /*=>*/ { node_valign(nodes_selecting, fa_middle); } ],
[ THEME.object_valign, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(param) /*=>*/ { node_valign(nodes_selecting, fa_top); } ],
[ THEME.object_valign, function() /*=>*/ {return 2}, function() /*=>*/ {return ""}, function(p) /*=>*/ { node_valign(nodes_selecting, fa_bottom); } ],
[ THEME.object_valign, function() /*=>*/ {return 1}, function() /*=>*/ {return ""}, function(p) /*=>*/ { node_valign(nodes_selecting, fa_middle); } ],
[ THEME.object_valign, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(p) /*=>*/ { node_valign(nodes_selecting, fa_top); } ],
];
toolbars_distrib = [
[ THEME.obj_distribute_h, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(param) /*=>*/ { node_hdistribute(nodes_selecting); } ],
[ THEME.obj_distribute_v, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(param) /*=>*/ { node_vdistribute(nodes_selecting); } ],
[ THEME.obj_distribute_h, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(p) /*=>*/ { node_hdistribute(nodes_selecting); } ],
[ THEME.obj_distribute_v, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(p) /*=>*/ { node_vdistribute(nodes_selecting); } ],
];
toolbars_auto_arrange = [
[ THEME.obj_auto_align, function() /*=>*/ {return 0}, function() /*=>*/ {return "Auto align"}, function(param) /*=>*/ { node_auto_align(nodes_selecting); } ],
[ THEME.obj_auto_organize, function() /*=>*/ {return 0}, function() /*=>*/ {return "Auto organize"}, function(param) /*=>*/ { dialogPanelCall(new Panel_Graph_Auto_Organize(PANEL_GRAPH.nodes_selecting), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left }) } ],
[ THEME.obj_auto_align, function() /*=>*/ {return 0}, function() /*=>*/ {return "Auto align"}, function(p) /*=>*/ { node_auto_align(nodes_selecting); } ],
[ THEME.obj_auto_organize, function() /*=>*/ {return 0}, function() /*=>*/ {return "Auto organize"}, function(p) /*=>*/ { dialogPanelCall(new Panel_Graph_Auto_Organize(PANEL_GRAPH.nodes_selecting), p.x, p.y, { anchor: ANCHOR.bottom | ANCHOR.left }) } ],
];
distribution_spacing = 0;
toolbars_distrib_space = [
[ THEME.obj_distribute_h, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(param) /*=>*/ { node_hdistribute_dist(nodes_selecting, nodes_select_anchor, distribution_spacing); } ],
[ THEME.obj_distribute_v, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(param) /*=>*/ { node_vdistribute_dist(nodes_selecting, nodes_select_anchor, distribution_spacing); } ],
[ THEME.obj_distribute_h, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(p) /*=>*/ { node_hdistribute_dist(nodes_selecting, nodes_select_anchor, distribution_spacing); } ],
[ THEME.obj_distribute_v, function() /*=>*/ {return 0}, function() /*=>*/ {return ""}, function(p) /*=>*/ { node_vdistribute_dist(nodes_selecting, nodes_select_anchor, distribution_spacing); } ],
[ new textBox(TEXTBOX_INPUT.number, function(val) { distribution_spacing = value_snap(val, 4); } ).setPadding(4), function() /*=>*/ {return distribution_spacing} ],
];
@ -812,7 +815,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
setTitle();
run_in(2, function() /*=>*/ {
setSlideShow(0);
struct_override(display_parameter, project.graph_display_parameter);
struct_override(display_parameter, project.graphDisplay);
});
}
@ -1135,14 +1138,14 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(h < ui(96)) return;
view_hovering = false;
if(!show_view_control) return;
if(!display_parameter.show_view_control) return;
var _side = show_view_control == 1? 1 : -1;
var _side = display_parameter.show_view_control == 1? 1 : -1;
var _hab = pHOVER && !view_pan_tool && !view_zoom_tool;
var d3_view_wz = ui(16);
var _d3x = show_view_control == 1?
var _d3x = display_parameter.show_view_control == 1?
ui(8) + d3_view_wz :
w - ui(8) - d3_view_wz;
@ -1198,7 +1201,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(view_hovering && mouse_press(mb_right, pFOCUS)) {
mouse_on_graph = false;
menuCall("preview_view_controller", [ menuItem("Hide view controllers", function() /*=>*/ { show_view_control = 0; }) ]);
menuCall("preview_view_controller", [ menuItem("Hide view controllers", function() /*=>*/ { display_parameter.show_view_control = 0; }) ]);
}
}
@ -1227,11 +1230,21 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
_upd |= connection_cache[$ "_w"] != _w; connection_cache[$ "_w"] = _w;
_upd |= connection_cache[$ "_h"] != _h; connection_cache[$ "_h"] = _h;
_upd |= connection_cache[$ "curve_connection_line"] != PREFERENCES.curve_connection_line; connection_cache[$ "curve_connection_line"] = PREFERENCES.curve_connection_line;
_upd |= connection_cache[$ "connection_line_width"] != PREFERENCES.connection_line_width; connection_cache[$ "connection_line_width"] = PREFERENCES.connection_line_width;
_upd |= connection_cache[$ "connection_line_corner"] != PREFERENCES.connection_line_corner; connection_cache[$ "connection_line_corner"] = PREFERENCES.connection_line_corner;
_upd |= connection_cache[$ "connection_line_extend"] != PREFERENCES.connection_line_extend; connection_cache[$ "connection_line_extend"] = PREFERENCES.connection_line_extend;
_upd |= connection_cache[$ "connection_line_aa"] != PREFERENCES.connection_line_aa; connection_cache[$ "connection_line_aa"] = PREFERENCES.connection_line_aa;
_upd |= connection_cache[$ "type"] != project.graphConnection.type;
connection_cache[$ "type"] = project.graphConnection.type;
_upd |= connection_cache[$ "line_width"] != project.graphConnection.line_width;
connection_cache[$ "line_width"] = project.graphConnection.line_width;
_upd |= connection_cache[$ "line_corner"] != project.graphConnection.line_corner;
connection_cache[$ "line_corner"] = project.graphConnection.line_corner;
_upd |= connection_cache[$ "line_extend"] != project.graphConnection.line_extend;
connection_cache[$ "line_extend"] = project.graphConnection.line_extend;
_upd |= connection_cache[$ "line_aa"] != project.graphConnection.line_aa;
connection_cache[$ "line_aa"] = project.graphConnection.line_aa;
connection_draw_update |= _upd;
@ -1241,7 +1254,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
function drawNodes() { //
if(selection_block-- > 0) return;
display_parameter.highlight = !array_empty(nodes_selecting) && ((PREFERENCES.connection_line_highlight == 1 && key_mod_press(ALT)) || PREFERENCES.connection_line_highlight == 2);
display_parameter.highlight = !array_empty(nodes_selecting) &&
((PROJECT.graphConnection.line_highlight == 1 && key_mod_press(ALT)) || PROJECT.graphConnection.line_highlight == 2);
var _focus = pFOCUS && !view_hovering;
var gr_x = graph_x * graph_s;
@ -1531,7 +1545,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
printIf(log, $"Draw active: {get_timer() - t}"); t = get_timer();
// draw connections
var aa = floor(min(8192 / w, 8192 / h, PREFERENCES.connection_line_aa));
var aa = floor(min(8192 / w, 8192 / h, project.graphConnection.line_aa));
connection_draw_update |= !surface_valid(connection_surface_cc, w * aa, h * aa);
@ -2373,7 +2387,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
}
if(pHOVER && point_in_rectangle(mx, my, mx0, my0, mx0 + ui(16), my0 + ui(16))) {
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(10), my0 + ui(10), 0.5, 0.5, 180, c_white, 0.75);
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(4), my0 + ui(4), 0.5, 0.5, 180, c_white, 0.75);
if(mouse_press(mb_left, pFOCUS)) {
minimap_dragging = true;
minimap_drag_sx = minimap_w;
@ -2382,7 +2396,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
minimap_drag_my = my;
}
} else
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(10), my0 + ui(10), 0.5, 0.5, 180, c_white, 0.3);
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(4), my0 + ui(4), 0.5, 0.5, 180, c_white, 0.3);
}
function drawSearch() {
@ -2592,7 +2606,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
drawGrid();
var ovy = ui(8);
if(show_view_control == 2) ovy += ui(36);
if(display_parameter.show_view_control == 2) ovy += ui(36);
// if(is_searching) ovy += line_get_height(f_p2, 20);
drawNodes();

View file

@ -1,46 +1,87 @@
function Panel_Graph_Connection_Setting() : Panel_Linear_Setting() constructor {
title = __txtx("graph_connection_settings", "Connection Settings");
project = PANEL_GRAPH.project;
graphConnection = project.graphConnection;
properties = [
new __Panel_Linear_Setting_Item_Preference(
new __Panel_Linear_Setting_Item(
__txt("Type"),
"curve_connection_line",
new buttonGroup(array_create(4, THEME.icon_curve_connection), function(val) /*=>*/ { PREFERENCES.curve_connection_line = val; }),
new buttonGroup(array_create(4, THEME.icon_curve_connection), function(val) /*=>*/ { graphConnection.type = val; }),
function( ) /*=>*/ {return graphConnection.type},
function(v) /*=>*/ { graphConnection.type = v; },
PREFERENCES.project_graphConnection.type,
noone,
"project_graphConnection.type",
),
new __Panel_Linear_Setting_Item_Preference(
new __Panel_Linear_Setting_Item(
__txtx("dialog_connection_thickness", "Line thickness"),
"connection_line_width",
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PREFERENCES.connection_line_width = max(0.5, real(str)); }),
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { graphConnection.line_width = max(0.5, real(str)); }),
function( ) /*=>*/ {return graphConnection.line_width},
function(v) /*=>*/ { graphConnection.line_width = v; },
PREFERENCES.project_graphConnection.line_width,
noone,
"project_graphConnection.line_width",
),
new __Panel_Linear_Setting_Item_Preference(
new __Panel_Linear_Setting_Item(
__txtx("dialog_connection_radius", "Corner radius"),
"connection_line_corner",
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PREFERENCES.connection_line_corner = max(0, real(str)); }),
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { graphConnection.line_corner = max(0, real(str)); }),
function( ) /*=>*/ {return graphConnection.line_corner},
function(v) /*=>*/ { graphConnection.line_corner = v; },
PREFERENCES.project_graphConnection.line_corner,
noone,
"project_graphConnection.line_corner",
),
new __Panel_Linear_Setting_Item_Preference(
new __Panel_Linear_Setting_Item(
__txtx("dialog_connection_extends", "Extends"),
"connection_line_extend",
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PREFERENCES.connection_line_extend = max(0, real(str)); }),
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { graphConnection.line_extend = max(0, real(str)); }),
function( ) /*=>*/ {return graphConnection.line_extend},
function(v) /*=>*/ { graphConnection.line_extend = v; },
PREFERENCES.project_graphConnection.line_extend,
noone,
"project_graphConnection.line_extend",
),
new __Panel_Linear_Setting_Item_Preference(
new __Panel_Linear_Setting_Item(
__txtx("pref_connection_quality", "Render quality"),
"connection_line_aa",
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PREFERENCES.connection_line_aa = clamp(real(str), 1, 4); }),
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { graphConnection.line_aa = clamp(real(str), 1, 4); }),
function( ) /*=>*/ {return graphConnection.line_aa},
function(v) /*=>*/ { graphConnection.line_aa = v; },
PREFERENCES.project_graphConnection.line_aa,
noone,
"project_graphConnection.line_aa",
),
new __Panel_Linear_Setting_Item_Preference(
new __Panel_Linear_Setting_Item(
__txtx("pref_connection_highlight", "Highlight connection"),
"connection_line_highlight",
new buttonGroup([ "None", "ALT", "Always" ], function(val) /*=>*/ { PREFERENCES.connection_line_highlight = val; }),
new buttonGroup([ "None", "ALT", "Always" ], function(val) /*=>*/ { graphConnection.line_highlight = val; }),
function( ) /*=>*/ {return graphConnection.line_highlight},
function(v) /*=>*/ { graphConnection.line_highlight = v; },
PREFERENCES.project_graphConnection.line_highlight,
noone,
"project_graphConnection.line_highlight",
),
new __Panel_Linear_Setting_Item_Preference(
new __Panel_Linear_Setting_Item(
__txtx("pref_connection_highlight_fade", "Fade connection"),
"connection_line_highlight_fade",
slider(0, 1, 0.05, function(val) /*=>*/ { PREFERENCES.connection_line_highlight_fade = val; }),
slider(0, 1, 0.05, function(val) /*=>*/ { graphConnection.line_highlight_fade = val; }),
function( ) /*=>*/ {return graphConnection.line_highlight_fade},
function(v) /*=>*/ { graphConnection.line_highlight_fade = v; },
PREFERENCES.project_graphConnection.line_highlight_fade,
noone,
"project_graphConnection.line_highlight_fade",
),
new __Panel_Linear_Setting_Item_Preference(
new __Panel_Linear_Setting_Item(
__txtx("pref_connection_highlight_all", "Highlight all"),
"connection_line_highlight_all",
new checkBox(function() /*=>*/ { PREFERENCES.connection_line_highlight_all = !PREFERENCES.connection_line_highlight_all; }),
new checkBox(function() /*=>*/ { graphConnection.line_highlight_all = !graphConnection.line_highlight_all; }),
function( ) /*=>*/ {return graphConnection.line_highlight_fade},
function(v) /*=>*/ { graphConnection.line_highlight_fade = v; },
PREFERENCES.project_graphConnection.line_highlight_fade,
noone,
"project_graphConnection.line_highlight_fade",
),
];

View file

@ -8,13 +8,12 @@ function Panel_Graph_Export_Image(_panel) : PanelContent() constructor {
min_w = ui(640);
min_h = ui(320);
set_wm = ui(320);
surf_s = min(w - set_wm - padding * 3, h - padding * 2);
c_space = ui(24);
set_w = w - surf_s - padding * 2 - c_space;
set_w = min(w / 2, ui(320));
set_h = h - padding * 2 - ui(32) - padding;
surf_w = w - set_w - padding * 2 - ui(16);
surf_h = h - padding * 2;
targetPanel = _panel;
nodeList = targetPanel.nodes_list;
surface = noone;
@ -74,10 +73,10 @@ function Panel_Graph_Export_Image(_panel) : PanelContent() constructor {
b_export.text = __txt("Export") + "...";
sc_settings = new scrollPane(set_w, set_h, function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 1);
draw_clear_alpha(COLORS.panel_bg_clear_inner, 1);
var _ww = max(set_w * 0.5, ui(160));
var _hh = ui(26);
var _hh = ui(24);
var _ss = ui(28);
var _ty = _y + _hh / 2;
var _tx = sc_settings.surface_w - ui(8);
@ -86,13 +85,13 @@ function Panel_Graph_Export_Image(_panel) : PanelContent() constructor {
for( var i = 0, n = array_length(widgets); i < n; i++ ) {
var _tyy = _ty + wh * i;
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
draw_set_text(f_p3, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(8), _tyy, __txt(widgets[i][0], "graph_export_"));
var _wid = widgets[i][1];
var _dat = widgets[i][2]();
var _param = new widgetParam(_tx - _ww, _tyy - _hh / 2, _ww, _hh, _dat, {}, _m, sc_settings.x + x, sc_settings.y + y).setFont(f_p2);
var _param = new widgetParam(_tx - _ww, _tyy - _hh / 2, _ww, _hh, _dat, {}, _m, sc_settings.x + x, sc_settings.y + y).setFont(f_p3);
if(is(_wid, checkBox)) _param.x += _ww / 2 - _param.s / 2;
_wid.setFocusHover(pFOCUS, pHOVER);
@ -107,12 +106,11 @@ function Panel_Graph_Export_Image(_panel) : PanelContent() constructor {
});
function onResize() {
surf_s = min(w - set_wm - padding * 3, h - padding * 2);
set_w = w - surf_s - padding * 2 - c_space;
set_w = min(w / 2, ui(320));
set_h = h - padding * 2 - ui(32) - padding;
sc_settings.resize(set_w, set_h);
surf_w = w - set_w - padding * 2 - ui(16);
surf_h = h - padding * 2;
}
function refresh() {
@ -130,36 +128,38 @@ function Panel_Graph_Export_Image(_panel) : PanelContent() constructor {
var ty = padding;
var sh = 160;
var _sx0 = tx, _sx1 = _sx0 + surf_s;
var _sy0 = h / 2 - surf_s / 2;
var _sy1 = h / 2 + surf_s / 2;
var _sx0 = tx, _sx1 = _sx0 + surf_w;
var _sy0 = h / 2 - surf_h / 2;
var _sy1 = h / 2 + surf_h / 2;
var _m = [ mx, my ];
if(is_surface(surface)) {
var _sw = surface_get_width_safe(surface);
var _sh = surface_get_height_safe(surface);
var ss = min(surf_s / _sw, surf_s / _sh);
var ss = min(surf_w / _sw, surf_h / _sh);
bg_surface = surface_verify(bg_surface, _sw * ss, _sh * ss);
surface_set_target(bg_surface);
draw_sprite_tiled_ext(s_transparent, 0, 0, 0, 1, 1, COLORS.panel_preview_transparent, 1);
surface_reset_target();
var _sx = _sx0 + surf_s / 2 - _sw * ss / 2;
var _sy = _sy0 + surf_s / 2 - _sh * ss / 2;
var _sx = _sx0 + surf_w / 2 - _sw * ss / 2;
var _sy = _sy0 + surf_h / 2 - _sh * ss / 2;
draw_surface(bg_surface, _sx, _sy);
draw_surface_ext_safe(surface, _sx, _sy, ss, ss, 0, c_white, 1);
draw_set_text(f_p2, fa_center, fa_bottom, COLORS._main_text_sub);
draw_text_add(_sx0 + surf_s / 2, _sy + _sh * ss - ui(2), $"{_sw} x {_sh} px");
draw_text_add(_sx0 + surf_w / 2, _sy + _sh * ss - ui(2), $"{_sw} x {_sh} px");
draw_set_color(COLORS._main_icon);
draw_set_alpha(.5);
draw_rectangle(_sx, _sy, _sx + _sw * ss, _sy + _sh * ss, 1);
draw_set_alpha(1);
var bx = _sx1 - ui(24) - ui(4);
var by = _sy + ui(1) + ui(4);
var bx = _sx + _sw * ss - ui(24) - ui(4);
var by = _sy + ui(1) + ui(4);
if(buttonInstant(THEME.button_hide_fill, bx, by, ui(24), ui(24), _m, pHOVER, pFOCUS) == 2)
refresh();
@ -167,21 +167,27 @@ function Panel_Graph_Export_Image(_panel) : PanelContent() constructor {
} else {
draw_set_color(COLORS._main_icon);
draw_set_alpha(.5);
draw_rectangle(_sx0, _sy0, _sx1, _sy1, 1);
draw_set_alpha(1);
}
var sx = w - padding - set_w;
var sy = ty;
draw_sprite_stretched(THEME.ui_panel_bg, 1, sx - ui(8), sy, set_w + ui(8), h - padding * 2);
sc_settings.verify(set_w - ui(8), set_h - ui(16));
sc_settings.setFocusHover(pFOCUS, pHOVER);
sc_settings.draw(sx, sy, mx - sx, my - sy);
sc_settings.drawOffset(sx, sy + ui(8), mx, my);
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
var _bw = ui(96);
var _bh = ui(32);
bx = w - padding - _bw;
by = h - padding - _bh;
bx = w - padding - ui(8) - _bw;
by = h - padding - ui(8) - _bh;
b_export.setInteract(is_surface(surface));
b_export.setFocusHover(pFOCUS, pHOVER);
b_export.draw(bx, by, _bw, _bh, _m);

View file

@ -1,50 +1,67 @@
function Panel_Graph_Grid_Setting() : Panel_Linear_Setting() constructor {
title = __txtx("graph_grid_settings", "Grid Settings");
title = __txtx("graph_grid_settings", "Grid Settings");
project = PANEL_GRAPH.project;
graphGrid = project.graphGrid;
properties = [
new __Panel_Linear_Setting_Item(
__txtx("grid_snap", "Snap to grid"),
new checkBox(function() /*=>*/ { PANEL_GRAPH_PROJECT_CHECK PANEL_GRAPH.project.graphGrid.snap = !PANEL_GRAPH.project.graphGrid.snap; }),
function() /*=>*/ {return PANEL_GRAPH.project.graphGrid.snap},
function(val) /*=>*/ { PANEL_GRAPH.project.graphGrid.snap = val; },
true,
["Graph", "Toggle Grid Snap"]
new checkBox(function() /*=>*/ { graphGrid.snap = !graphGrid.snap; }),
function( ) /*=>*/ {return graphGrid.snap},
function(v) /*=>*/ { graphGrid.snap = v; },
PREFERENCES.project_graphGrid.snap,
["Graph", "Toggle Grid Snap"],
"project_graphGrid.snap",
),
new __Panel_Linear_Setting_Item(
__txtx("grid_size", "Grid size"),
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PANEL_GRAPH_PROJECT_CHECK PANEL_GRAPH.project.graphGrid.size = max(1, real(str)); }),
function() /*=>*/ {return PANEL_GRAPH.project.graphGrid.size},
function(val) /*=>*/ { PANEL_GRAPH.project.graphGrid.size = val; },
16,
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { graphGrid.size = max(1, real(str)); }),
function( ) /*=>*/ {return graphGrid.size},
function(v) /*=>*/ { graphGrid.size = v; },
PREFERENCES.project_graphGrid.size,
noone,
"project_graphGrid.size",
),
new __Panel_Linear_Setting_Item(
__txtx("project_graphGrid_opacity", "Grid opacity"),
slider(0, 1, .05, function(str) /*=>*/ { PANEL_GRAPH_PROJECT_CHECK PANEL_GRAPH.project.graphGrid.opacity = clamp(real(str), 0, 1); }),
function() /*=>*/ {return PANEL_GRAPH.project.graphGrid.opacity},
function(val) /*=>*/ { PANEL_GRAPH.project.graphGrid.opacity = val; },
0.05,
slider(0, 1, .05, function(str) /*=>*/ { graphGrid.opacity = clamp(real(str), 0, 1); }),
function( ) /*=>*/ {return graphGrid.opacity},
function(v) /*=>*/ { graphGrid.opacity = v; },
PREFERENCES.project_graphGrid.opacity,
noone,
"project_graphGrid.opacity",
),
new __Panel_Linear_Setting_Item(
__txtx("project_graphGrid_color", "Grid color"),
new buttonColor(function(color) /*=>*/ { PANEL_GRAPH_PROJECT_CHECK PANEL_GRAPH.project.graphGrid.color = color; }, self),
function() /*=>*/ {return PANEL_GRAPH.project.graphGrid.color},
function(val) /*=>*/ { PANEL_GRAPH.project.graphGrid.color = val; },
c_white,
new buttonColor(function(color) /*=>*/ { graphGrid.color = color; }, self),
function( ) /*=>*/ {return graphGrid.color},
function(v) /*=>*/ { graphGrid.color = v; },
PREFERENCES.project_graphGrid.color,
noone,
"project_graphGrid.color",
),
new __Panel_Linear_Setting_Item(
__txtx("grid_show_origin", "Show origin"),
new checkBox(function() /*=>*/ { PANEL_GRAPH_PROJECT_CHECK PANEL_GRAPH.project.graphGrid.show_origin = !PANEL_GRAPH.project.graphGrid.show_origin; }),
function() /*=>*/ {return PANEL_GRAPH.project.graphGrid.show_origin},
function(val) /*=>*/ { PANEL_GRAPH.project.graphGrid.show_origin = val; },
false,
["Graph", "Toggle Show Origin"]
new checkBox(function() /*=>*/ { graphGrid.show_origin = !graphGrid.show_origin; }),
function( ) /*=>*/ {return graphGrid.show_origin},
function(v) /*=>*/ { graphGrid.show_origin = v; },
PREFERENCES.project_graphGrid.show_origin,
["Graph", "Toggle Show Origin"],
"project_graphGrid.show_origin",
),
new __Panel_Linear_Setting_Item(
__txtx("grid_highlight_every", "Highlight period"),
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PANEL_GRAPH_PROJECT_CHECK PANEL_GRAPH.project.graphGrid.highlight = max(1, round(real(str))); }),
function() /*=>*/ {return PANEL_GRAPH.project.graphGrid.highlight},
function(val) /*=>*/ { PANEL_GRAPH.project.graphGrid.highlight = val; },
12,
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { graphGrid.highlight = max(1, round(real(str))); }),
function( ) /*=>*/ {return graphGrid.highlight},
function(v) /*=>*/ { graphGrid.highlight = v; },
PREFERENCES.project_graphGrid.highlight,
noone,
"project_graphGrid.highlight",
),
];

View file

@ -10,40 +10,49 @@ function Panel_Graph_View_Setting(graphPanel, display) : Panel_Linear_Setting()
new checkBox(function() /*=>*/ { display_parameter.show_grid = !display_parameter.show_grid; }),
function() /*=>*/ {return display_parameter.show_grid},
function(val) /*=>*/ { display_parameter.show_grid = val; },
true,
PREFERENCES.project_graphDisplay.show_grid,
[ "Graph", "Toggle Grid" ],
"project_graphDisplay.show_grid",
),
new __Panel_Linear_Setting_Item(
__txtx("graph_visibility_dim", "Dimension"),
new checkBox(function() /*=>*/ { display_parameter.show_dimension = !display_parameter.show_dimension; }),
function() /*=>*/ {return display_parameter.show_dimension},
function(val) /*=>*/ { display_parameter.show_dimension = val; },
true,
PREFERENCES.project_graphDisplay.show_dimension,
[ "Graph", "Toggle Dimension" ],
"project_graphDisplay.show_dimension",
),
new __Panel_Linear_Setting_Item(
__txtx("graph_visibility_compute", "Compute Time"),
new checkBox(function() /*=>*/ { display_parameter.show_compute = !display_parameter.show_compute; }),
function() /*=>*/ {return display_parameter.show_compute},
function(val) /*=>*/ { display_parameter.show_compute = val; },
true,
PREFERENCES.project_graphDisplay.show_compute,
[ "Graph", "Toggle Compute" ],
"project_graphDisplay.show_compute",
),
new __Panel_Linear_Setting_Item(
__txtx("graph_visibility_avoid_label", "Avoid Label"),
new checkBox(function() /*=>*/ { display_parameter.avoid_label = !display_parameter.avoid_label; }),
function() /*=>*/ {return display_parameter.avoid_label},
function(val) /*=>*/ { display_parameter.avoid_label = val; },
true,
PREFERENCES.project_graphDisplay.avoid_label,
[ "Graph", "Toggle Avoid Label" ],
"project_graphDisplay.avoid_label",
),
new __Panel_Linear_Setting_Item(
__txtx("graph_visibility_slideshow", "Show Controller"),
new checkBox(function() /*=>*/ { display_parameter.show_control = !display_parameter.show_control; }),
function() /*=>*/ {return display_parameter.show_control},
function(val) /*=>*/ { display_parameter.show_control = val; },
false,
PREFERENCES.project_graphDisplay.show_control,
[ "Graph", "Toggle Control" ],
"project_graphDisplay.show_control",
),
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -53,22 +62,29 @@ function Panel_Graph_View_Setting(graphPanel, display) : Panel_Linear_Setting()
slider(50, 100, 1, function(val) /*=>*/ { display_parameter.preview_scale = val; }),
function() /*=>*/ {return display_parameter.preview_scale},
function(val) /*=>*/ { display_parameter.preview_scale = val; },
100,
PREFERENCES.project_graphDisplay.preview_scale,
noone,
"project_graphDisplay.preview_scale",
),
new __Panel_Linear_Setting_Item(
__txt("View Control"),
new buttonGroup([ "None", "Left", "Right" ], function(val) /*=>*/ { graphPanel.show_view_control = val; }),
function() /*=>*/ {return graphPanel.show_view_control},
function(val) /*=>*/ { graphPanel.show_view_control = val; },
1,
new buttonGroup([ "None", "Left", "Right" ], function(val) /*=>*/ { display_parameter.show_view_control = val; }),
function() /*=>*/ {return display_parameter.show_view_control},
function(val) /*=>*/ { display_parameter.show_view_control = val; },
PREFERENCES.project_graphDisplay.show_view_control,
noone,
"project_graphDisplay.show_view_control",
),
new __Panel_Linear_Setting_Item(
__txtx("graph_visibility_tooltip", "Show Tooltip"),
new checkBox(function() /*=>*/ { display_parameter.show_tooltip = !display_parameter.show_tooltip; }),
function() /*=>*/ {return display_parameter.show_tooltip},
function(val) /*=>*/ { display_parameter.show_tooltip = val; },
true,
PREFERENCES.project_graphDisplay.show_tooltip,
[ "Graph", "Toggle Tooltip" ],
"project_graphDisplay.show_tooltip",
),
];

View file

@ -399,37 +399,6 @@ function Panel_Preference() : PanelContent() constructor {
new checkBox(function() /*=>*/ { PREFERENCES.add_node_remember = !PREFERENCES.add_node_remember; })
));
// ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
// __txtx("pref_connection_type", "Connection type"),
// "curve_connection_line",
// new buttonGroup([ THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection ],
// (val) => { PREFERENCES.curve_connection_line = val; PREF_SAVE(); })
// ));
// ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
// __txtx("pref_connection_thickness", "Connection thickness"),
// "connection_line_width",
// new textBox(TEXTBOX_INPUT.number, (str) => { PREFERENCES.connection_line_width = real(str); PREF_SAVE(); })
// ));
// ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
// __txtx("pref_connection_curve_smoothness", "Connection curve smoothness"),
// "connection_line_sample",
// new textBox(TEXTBOX_INPUT.number, (str) => { PREFERENCES.connection_line_sample = real(str); PREF_SAVE(); })
// ));
// ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
// __txtx("pref_connection_aa", "Connection anti aliasing"),
// "connection_line_aa",
// new textBox(TEXTBOX_INPUT.number, (str) => { PREFERENCES.connection_line_aa = max(1, real(str)); PREF_SAVE(); })
// ));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_connection_anim", "Connection line animation"),
"connection_line_transition",
new checkBox(function() /*=>*/ { PREFERENCES.connection_line_transition = !PREFERENCES.connection_line_transition; PREF_SAVE(); })
));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_graph_group_in_tab", "Open group in new tab"),
"graph_open_group_in_tab",

View file

@ -48,7 +48,6 @@
function panel_preview_set_reset_view_on() { CALL("preview_set_reset_view_on"); PANEL_PREVIEW.set_reset_view_on(); }
function panel_preview_toggle_reset_view() { CALL("preview_toggle_reset_view"); PANEL_PREVIEW.toggle_reset_view(); }
function panel_preview_show_info() { CALL("preview_show_info"); PANEL_PREVIEW.show_info = !PANEL_PREVIEW.show_info; }
function panel_preview_toggle_lock() { CALL("preview_toggle_lock"); PANEL_PREVIEW.toggle_lock(); }
function __fnInit_Preview() {
@ -113,8 +112,6 @@
registerFunction("Preview", "Toggle Onion Skin", "", MOD_KEY.none, panel_preview_onion_enabled ).setMenu("preview_onion_enabled")
registerFunction("Preview", "Toggle Onion Skin view", "", MOD_KEY.none, panel_preview_onion_on_top ).setMenu("preview_onion_on_top")
registerFunction("Preview", "Toggle Show Info", "", MOD_KEY.none, panel_preview_show_info ).setMenu("preview_show_info")
registerFunction("Preview", "Toggle Lock", "", MOD_KEY.none, panel_preview_toggle_lock ).setMenu("preview_toggle_lock")
registerFunction("Preview", "Popup", "", MOD_KEY.none, function() /*=>*/ { create_preview_window(PANEL_PREVIEW.getNodePreview()); }).setMenu("preview_popup")
@ -221,9 +218,6 @@ function Panel_Preview() : PanelContent() constructor {
mouse_pos_string = "";
show_info = true;
show_view_control = 1;
resetViewOnDoubleClick = true;
tb_zoom_level = new textBox(TEXTBOX_INPUT.number, function(z) /*=>*/ {
@ -340,11 +334,6 @@ function Panel_Preview() : PanelContent() constructor {
d3_scene_light1.transform.position.set(1, 2, -3);
#endregion
#region tool
d3_tool_snap = false;
d3_tool_snap_position = 1;
d3_tool_snap_rotation = 15;
#endregion
#endregion
#region // ---- minimap ----
@ -435,13 +424,15 @@ function Panel_Preview() : PanelContent() constructor {
THEME.icon_grid_setting,
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txtx("grid_title", "Grid settings") + "...", "Preview", "Grid Settings")},
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_Grid_Setting(), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left }); },
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_Grid_Setting(),
x + ui(8), y + h - toolbar_height - ui(8), { anchor: ANCHOR.bottom | ANCHOR.left }); },
),
new panel_toolbar_icon("Onion Skin",
THEME.onion_skin,
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txt("Onion Skin") + "...", "Preview", "Onion Skin Settings")},
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_Onion_Setting(), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left }); },
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_Onion_Setting(),
x + ui(8), y + h - toolbar_height - ui(8), { anchor: ANCHOR.bottom | ANCHOR.left }); },
),
];
@ -450,13 +441,15 @@ function Panel_Preview() : PanelContent() constructor {
THEME.d3d_preview_settings,
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txt("3D Preview Settings") + "...", "Preview", "3D View Settings")},
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_3D_Setting(self), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left }); },
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_3D_Setting(),
x + w - ui(8), y + h - toolbar_height - ui(8), { anchor: ANCHOR.bottom | ANCHOR.right }); },
),
new panel_toolbar_icon("3D Snap Settings",
THEME.d3d_snap_settings,
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txt("3D Snap Settings") + "...", "Preview", "3D Snap Settings")},
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_Snap_Setting(self), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left }); },
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_Snap_Setting(),
x + w - ui(8), y + h - toolbar_height - ui(8), { anchor: ANCHOR.bottom | ANCHOR.right }); },
),
];
@ -465,13 +458,15 @@ function Panel_Preview() : PanelContent() constructor {
THEME.d3d_preview_settings,
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txt("3D SDF Preview Settings") + "...", "Preview", "3D SDF View Settings")},
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_3D_SDF_Setting(self), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left }); },
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_3D_SDF_Setting(),
x + w - ui(8), y + h - toolbar_height - ui(8), { anchor: ANCHOR.bottom | ANCHOR.right }); },
),
new panel_toolbar_icon("3D Snap Settings",
THEME.d3d_snap_settings,
function() /*=>*/ {return 0},
function() /*=>*/ {return new tooltipHotkey(__txt("3D Snap Settings") + "...", "Preview", "3D Snap Settings")},
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_Snap_Setting(self), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left }); },
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_Snap_Setting(),
x + w - ui(8), y + h - toolbar_height - ui(8), { anchor: ANCHOR.bottom | ANCHOR.right }); },
),
];
@ -503,7 +498,8 @@ function Panel_Preview() : PanelContent() constructor {
[
THEME.icon_visibility,
new tooltipHotkey(__txtx("graph_visibility_title", "Visibility settings") + "...", "Preview", "View Settings"),
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_View_Setting(self), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left }); },
function(param) /*=>*/ { dialogPanelCall(new Panel_Preview_View_Setting(self),
x + w - ui(8), y + h - toolbar_height - ui(8), { anchor: ANCHOR.bottom | ANCHOR.right }); },
function() /*=>*/ {return 0},
],
[
@ -1445,7 +1441,7 @@ function Panel_Preview() : PanelContent() constructor {
function drawPreviewOverlay() {
right_menu_y = toolbar_height - ui(4);
if(show_view_control == 2) {
if(PROJECT.previewSetting.show_view_control == 2) {
if(d3_active) right_menu_y += ui(72);
else right_menu_y += ui(40);
}
@ -1460,7 +1456,7 @@ function Panel_Preview() : PanelContent() constructor {
if(right_menu_x == 0) right_menu_x = w - ui(8);
if(show_info) {
if(PROJECT.previewSetting.show_info) {
if(PANEL_PREVIEW == self) {
draw_set_color(COLORS._main_text_accent);
draw_text(right_menu_x, right_menu_y, __txt("Active"));
@ -1607,10 +1603,10 @@ function Panel_Preview() : PanelContent() constructor {
}
function drawViewController() {
if(!show_view_control) return;
if(!PROJECT.previewSetting.show_view_control) return;
var _side = show_view_control == 1? 1 : -1;
var _view_x = show_view_control == 1?
var _side = PROJECT.previewSetting.show_view_control == 1? 1 : -1;
var _view_x = PROJECT.previewSetting.show_view_control == 1?
tool_side_draw_l * toolbar_width + ui(8) :
w - tool_side_draw_r * toolbar_width - ui(8);
@ -1739,7 +1735,7 @@ function Panel_Preview() : PanelContent() constructor {
if(view_hovering && mouse_press(mb_right, pFOCUS)) {
mouse_on_preview = false;
menuCall("preview_view_controller", [ menuItem("Hide view controllers", function() /*=>*/ { show_view_control = 0; }) ]);
menuCall("preview_view_controller", [ menuItem("Hide view controllers", function() /*=>*/ { PROJECT.previewSetting.show_view_control = 0; }) ]);
}
}
@ -1828,9 +1824,9 @@ function Panel_Preview() : PanelContent() constructor {
} else {
if(key_mod_press(CTRL) || d3_tool_snap) {
_snx = d3_tool_snap_position;
_sny = d3_tool_snap_rotation;
if(key_mod_press(CTRL) || PROJECT.previewSetting.d3_tool_snap) {
_snx = PROJECT.previewSetting.d3_tool_snap_position;
_sny = PROJECT.previewSetting.d3_tool_snap_rotation;
}
_node.drawOverlay3D(overActive, d3_scene, _mx, _my, _snx, _sny, params);
@ -2475,8 +2471,8 @@ function Panel_Preview() : PanelContent() constructor {
draw_sprite_stretched_ext(THEME.ui_panel, 0, 0, 0, minimap_w, minimap_h, COLORS.panel_bg_clear_inner, .75 + .25 * hover);
var _surf = getNodePreviewSurface();
var _dim = [ 1, 1 ];
var minx, maxx, miny, maxy;
var _dim;
if(is_surface(_surf)) {
_dim = surface_get_dimension(_surf);
@ -2516,14 +2512,9 @@ function Panel_Preview() : PanelContent() constructor {
var gw = gx1 - gx0;
var gh = gy1 - gy0;
if(is_surface(_surf)) {
if(is_surface(_surf))
draw_surface_ext(_surf, nx0, ny0, ss, ss, 0, c_white, 1);
// draw_set_color(COLORS.panel_graph_minimap_focus);
// draw_rectangle(nx0, ny0, nx1, ny1, 1);
}
draw_sprite_stretched_ext(THEME.ui_panel, 1, gx0, gy0, gw, gh, COLORS._main_icon_light, 1);
var _mini_mx = minx + (mx - mx0) / minimap_w * spw;
@ -2562,7 +2553,7 @@ function Panel_Preview() : PanelContent() constructor {
}
if(pHOVER && point_in_rectangle(mx, my, mx0, my0, mx0 + ui(16), my0 + ui(16))) {
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(10), my0 + ui(10), 0.5, 0.5, 180, c_white, 0.75);
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(4), my0 + ui(4), 0.5, 0.5, 180, c_white, 0.75);
if(mouse_press(mb_left, pFOCUS)) {
minimap_dragging = true;
minimap_drag_sx = minimap_w;
@ -2571,7 +2562,7 @@ function Panel_Preview() : PanelContent() constructor {
minimap_drag_my = my;
}
} else
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(10), my0 + ui(10), 0.5, 0.5, 180, c_white, 0.3);
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(4), my0 + ui(4), 0.5, 0.5, 180, c_white, 0.3);
}
////- ACTION

View file

@ -1,57 +1,69 @@
function Panel_Preview_Grid_Setting() : Panel_Linear_Setting() constructor {
title = __txtx("preview_grid_settings", "Grid Settings");
previewGrid = PROJECT.previewGrid;
properties = [
new __Panel_Linear_Setting_Item(
__txt("Enabled"),
new checkBox(function() /*=>*/ { PROJECT.previewGrid.show = !PROJECT.previewGrid.show; }),
function() /*=>*/ {return PROJECT.previewGrid.show},
function(val) /*=>*/ { PROJECT.previewGrid.show = val; },
false,
["Preview", "Toggle Grid"]
new checkBox(function() /*=>*/ { previewGrid.show = !previewGrid.show; }),
function( ) /*=>*/ {return previewGrid.show},
function(v) /*=>*/ { previewGrid.show = v; },
PREFERENCES.project_previewGrid.show,
["Preview", "Toggle Grid"],
"project_previewGrid.show",
),
new __Panel_Linear_Setting_Item(
__txt("Pixel Grid"),
new checkBox(function() /*=>*/ { PROJECT.previewGrid.pixel = !PROJECT.previewGrid.pixel; }),
function() /*=>*/ {return PROJECT.previewGrid.pixel},
function(val) /*=>*/ { PROJECT.previewGrid.pixel = val; },
false,
["Preview", "Toggle Pixel Grid"]
new checkBox(function() /*=>*/ { previewGrid.pixel = !previewGrid.pixel; }),
function( ) /*=>*/ {return previewGrid.pixel},
function(v) /*=>*/ { previewGrid.pixel = v; },
PREFERENCES.project_previewGrid.pixel,
["Preview", "Toggle Pixel Grid"],
"project_previewGrid.pixel",
),
new __Panel_Linear_Setting_Item(
__txtx("grid_snap", "Snap to grid"),
new checkBox(function() /*=>*/ { PROJECT.previewGrid.snap = !PROJECT.previewGrid.snap; }),
function() /*=>*/ {return PROJECT.previewGrid.snap},
function(val) /*=>*/ { PROJECT.previewGrid.snap = val; },
false,
["Preview", "Toggle Snap to Grid"]
new checkBox(function() /*=>*/ { previewGrid.snap = !previewGrid.snap; }),
function( ) /*=>*/ {return previewGrid.snap},
function(v) /*=>*/ { previewGrid.snap = v; },
PREFERENCES.project_previewGrid.snap,
["Preview", "Toggle Snap to Grid"],
"project_previewGrid.snap",
),
new __Panel_Linear_Setting_Item(
__txt("Grid size"),
new vectorBox(2, function(value, index) /*=>*/ {
var _v = PROJECT.previewGrid.size[index];
PROJECT.previewGrid.size[index] = max(1, value);
return _v != max(1, value);
}).setLinkInactiveColor(COLORS._main_icon_light),
function() /*=>*/ {return PROJECT.previewGrid.size},
function(val) /*=>*/ { PROJECT.previewGrid.size = val; },
[ 16, 16 ],
new vectorBox(2, function(value, index) /*=>*/ { var _v = previewGrid.size[index]; previewGrid.size[index] = max(1, value); return _v != max(1, value); })
.setLinkInactiveColor(COLORS._main_icon_light),
function( ) /*=>*/ {return previewGrid.size},
function(v) /*=>*/ { previewGrid.size = v; },
PREFERENCES.project_previewGrid.size,
noone,
"project_previewGrid.size",
),
new __Panel_Linear_Setting_Item(
__txt("Grid opacity"),
slider(0, 1, .05, function(str) /*=>*/ { PROJECT.previewGrid.opacity = clamp(real(str), 0, 1); }),
function() /*=>*/ {return PROJECT.previewGrid.opacity},
function(val) /*=>*/ { PROJECT.previewGrid.opacity = val; },
0.5,
slider(0, 1, .05, function(str) /*=>*/ { previewGrid.opacity = clamp(real(str), 0, 1); }),
function( ) /*=>*/ {return previewGrid.opacity},
function(v) /*=>*/ { previewGrid.opacity = v; },
PREFERENCES.project_previewGrid.opacity,
noone,
"project_previewGrid.opacity",
),
new __Panel_Linear_Setting_Item(
__txt("Grid color"),
new buttonColor(function(color) /*=>*/ { PROJECT.previewGrid.color = color; }, self),
function() /*=>*/ {return PROJECT.previewGrid.color},
function(val) /*=>*/ { PROJECT.previewGrid.color = val; },
COLORS.panel_preview_grid,
new buttonColor(function(color) /*=>*/ { previewGrid.color = color; }, self),
function( ) /*=>*/ {return previewGrid.color},
function(v) /*=>*/ { previewGrid.color = v; },
PREFERENCES.project_previewGrid.color,
noone,
"project_previewGrid.color",
),
];
setHeight();

View file

@ -1,49 +1,50 @@
function Panel_Preview_Onion_Setting() : Panel_Linear_Setting() constructor {
title = __txtx("preview_onion_skin_settings", "Onion skin Settings");
onion = PROJECT.onion_skin;
properties = [
new __Panel_Linear_Setting_Item(
__txt("Enabled"),
new checkBox(function() /*=>*/ { PROJECT.onion_skin.enabled = !PROJECT.onion_skin.enabled; }),
function() /*=>*/ {return PROJECT.onion_skin.enabled},
function(val) /*=>*/ { PROJECT.onion_skin.enabled = val; },
new checkBox(function() /*=>*/ { onion.enabled = !onion.enabled; }),
function( ) /*=>*/ {return onion.enabled},
function(v) /*=>*/ { onion.enabled = v; },
false,
["Preview", "Toggle Onion Skin"]
),
new __Panel_Linear_Setting_Item(
__txtx("onion_skin_top", "Draw on top"),
new checkBox(function() /*=>*/ { PROJECT.onion_skin.on_top = !PROJECT.onion_skin.on_top; }),
function() /*=>*/ {return PROJECT.onion_skin.on_top},
function(val) /*=>*/ { PROJECT.onion_skin.on_top = val; },
new checkBox(function() /*=>*/ { onion.on_top = !onion.on_top; }),
function( ) /*=>*/ {return onion.on_top},
function(v) /*=>*/ { onion.on_top = v; },
true,
["Preview", "Toggle Onion Skin view"]
),
new __Panel_Linear_Setting_Item(
__txtx("onion_skin_frame_step", "Frame step"),
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { PROJECT.onion_skin.step = max(1, round(real(str))); }),
function() /*=>*/ {return PROJECT.onion_skin.step},
function(val) /*=>*/ { PROJECT.onion_skin.step = val; },
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ { onion.step = max(1, round(real(str))); }),
function( ) /*=>*/ {return onion.step},
function(v) /*=>*/ { onion.step = v; },
1,
),
new __Panel_Linear_Setting_Item(
__txtx("onion_skin_pre_color", "Pre Color"),
new buttonColor(function(color) /*=>*/ { PROJECT.onion_skin.color[0] = color; }, self),
function() /*=>*/ {return PROJECT.onion_skin.color[0]},
function(val) /*=>*/ { PROJECT.onion_skin.color[0] = val; },
new buttonColor(function(color) /*=>*/ { onion.color[0] = color; }, self),
function( ) /*=>*/ {return onion.color[0]},
function(v) /*=>*/ { onion.color[0] = v; },
c_red,
),
new __Panel_Linear_Setting_Item(
__txtx("onion_skin_post_color", "Post Color"),
new buttonColor(function(color) /*=>*/ { PROJECT.onion_skin.color[1] = color; }, self),
function() /*=>*/ {return PROJECT.onion_skin.color[1]},
function(val) /*=>*/ { PROJECT.onion_skin.color[1] = val; },
new buttonColor(function(color) /*=>*/ { onion.color[1] = color; }, self),
function( ) /*=>*/ {return onion.color[1]},
function(v) /*=>*/ { onion.color[1] = v; },
c_blue,
),
new __Panel_Linear_Setting_Item(
__txt("Opacity"),
slider(0, 1, .05, function(str) /*=>*/ { PROJECT.onion_skin.alpha = clamp(real(str), 0, 1); }),
function() /*=>*/ {return PROJECT.onion_skin.alpha},
function(val) /*=>*/ { PROJECT.onion_skin.alpha = val; },
slider(0, 1, .05, function(str) /*=>*/ { onion.alpha = clamp(real(str), 0, 1); }),
function( ) /*=>*/ {return onion.alpha},
function(v) /*=>*/ { onion.alpha = v; },
0.5,
),
];

View file

@ -1,28 +1,36 @@
function Panel_Preview_Snap_Setting(panel) : Panel_Linear_Setting() constructor {
function Panel_Preview_Snap_Setting() : Panel_Linear_Setting() constructor {
title = __txtx("preview_snap_settings", "3D Snap Settings");
preview_panel = panel;
previewPanel = PROJECT.previewSetting;
properties = [
new __Panel_Linear_Setting_Item(
__txt("Snap"),
new checkBox(function() { preview_panel.d3_tool_snap = !preview_panel.d3_tool_snap; }),
function() { return preview_panel.d3_tool_snap },
function(val) { preview_panel.d3_tool_snap = val; },
false,
new checkBox(function() /*=>*/ { previewPanel.d3_tool_snap = !previewPanel.d3_tool_snap; }),
function( ) /*=>*/ {return previewPanel.d3_tool_snap},
function(v) /*=>*/ { previewPanel.d3_tool_snap = v; },
PREFERENCES.project_previewSetting.d3_tool_snap,
noone,
"project_previewSetting.d3_tool_snap",
),
new __Panel_Linear_Setting_Item(
__txt("Linear"),
new textBox(TEXTBOX_INPUT.number, function(val) { preview_panel.d3_tool_snap_position = val; }),
function() { return preview_panel.d3_tool_snap_position },
function(val) { preview_panel.d3_tool_snap_position = val; },
1,
new textBox(TEXTBOX_INPUT.number, function(v) /*=>*/ { previewPanel.d3_tool_snap_position = v; }),
function( ) /*=>*/ {return previewPanel.d3_tool_snap_position},
function(v) /*=>*/ { previewPanel.d3_tool_snap_position = v; },
PREFERENCES.project_previewSetting.d3_tool_snap_position,
noone,
"project_previewSetting.d3_tool_snap_position",
),
new __Panel_Linear_Setting_Item(
__txt("Rotation"),
new textBox(TEXTBOX_INPUT.number, function(val) { preview_panel.d3_tool_snap_rotation = val; }),
function() { return preview_panel.d3_tool_snap_rotation },
function(val) { preview_panel.d3_tool_snap_rotation = val; },
15,
new textBox(TEXTBOX_INPUT.number, function(v) /*=>*/ { previewPanel.d3_tool_snap_rotation = v; }),
function( ) /*=>*/ {return previewPanel.d3_tool_snap_rotation},
function(v) /*=>*/ { previewPanel.d3_tool_snap_rotation = v; },
PREFERENCES.project_previewSetting.d3_tool_snap_rotation,
noone,
"project_previewSetting.d3_tool_snap_rotation",
),
]

View file

@ -1,6 +1,6 @@
function Panel_Preview_View_Setting(previewPanel) : Panel_Linear_Setting() constructor {
function Panel_Preview_View_Setting() : Panel_Linear_Setting() constructor {
title = __txtx("preview_view_settings", "View Settings");
self.previewPanel = previewPanel;
previewPanel = PROJECT.previewSetting;
properties = [
new __Panel_Linear_Setting_Item(
@ -8,15 +8,18 @@ function Panel_Preview_View_Setting(previewPanel) : Panel_Linear_Setting() const
new checkBox(function() /*=>*/ { previewPanel.show_info = !previewPanel.show_info; }),
function() /*=>*/ {return previewPanel.show_info},
function(val) /*=>*/ { previewPanel.show_info = val; },
true,
["Preview", "Toggle Show Info"]
PREFERENCES.project_previewSetting.show_info,
["Preview", "Toggle Show Info"],
"project_previewSetting.show_info",
),
new __Panel_Linear_Setting_Item(
__txt("View Control"),
new buttonGroup([ "None", "Left", "Right" ], function(val) /*=>*/ { previewPanel.show_view_control = val; }),
function() /*=>*/ {return previewPanel.show_view_control},
function(val) /*=>*/ { previewPanel.show_view_control = val; },
1,
PREFERENCES.project_previewSetting.show_view_control,
noone,
"project_previewSetting.show_view_control",
),
];

View file

@ -101,17 +101,6 @@
PREFERENCES.graph_zoom_smoooth = 4;
PREFERENCES.graph_open_group_in_tab = false;
PREFERENCES.connection_line_width = 2;
PREFERENCES.connection_line_sample = 1;
PREFERENCES.connection_line_corner = 8;
PREFERENCES.connection_line_aa = 2;
PREFERENCES.connection_line_transition = true;
PREFERENCES.connection_line_highlight = 0;
PREFERENCES.connection_line_highlight_fade = 0.75;
PREFERENCES.connection_line_highlight_all = false;
PREFERENCES.connection_line_extend = 16;
PREFERENCES.curve_connection_line = 1;
PREFERENCES.collection_animated = true;
PREFERENCES.collection_label = true;
@ -186,6 +175,67 @@
PREFERENCES.multi_window = false;
#endregion
#region //////////////////////////////////////////////////////////////////////// PROJECT ////////////////////////////////////////////////////////////////////////
PREFERENCES.project_animation_duration = 30;
PREFERENCES.project_animation_framerate = 30;
PREFERENCES.project_previewGrid = {
show : false,
snap : false,
size : [ 16, 16 ],
opacity : 0.5,
color : cola(#6d6d81),
pixel : false,
}
PREFERENCES.project_previewSetting = {
show_info : true,
show_view_control : 1,
d3_tool_snap : false,
d3_tool_snap_position : 1,
d3_tool_snap_rotation : 15,
}
PREFERENCES.project_graphGrid = {
show : true,
show_origin : false,
snap : true,
size : 16,
color : cola(c_white),
opacity : 0.05,
highlight : 12,
}
PREFERENCES.project_graphDisplay = {
show_grid : true,
show_dimension : true,
show_compute : true,
show_view_control : 1,
avoid_label : false,
preview_scale : 100,
highlight : false,
show_control : false,
show_tooltip : true,
}
PREFERENCES.project_graphConnection = {
type : 1,
line_width : 2,
line_sample : 1,
line_corner : 8,
line_aa : 2,
line_highlight : 0,
line_highlight_fade : 0.75,
line_highlight_all : false,
line_extend : 16,
}
#endregion
PREFERENCES_DEF = variable_clone(PREFERENCES);
#endregion
@ -413,6 +463,36 @@
}
#endregion
#region get set
function getPreference(_k, _pref = PREFERENCES) {
var _sep = string_splice(_k, ".");
var _pnt = PREFERENCES;
for( var i = 0, n = array_length(_sep); i < n; i++ ) {
var _s = _sep[i];
if(!struct_has(_pnt, _s)) return noone;
_pnt = _pnt[$ _s];
}
return _pnt;
}
function setPreference(_k, _v) {
var _sep = string_splice(_k, ".");
var _pnt = PREFERENCES;
for( var i = 0, n = array_length(_sep); i < n; i++ ) {
var _s = _sep[i];
if(!struct_has(_pnt, _s)) return noone;
if(i == n - 1) _pnt[$ _s] = _v;
else _pnt = _pnt[$ _s];
}
PREF_SAVE();
}
#endregion
#region command palette
//!#mfunc __regFnPref {"args":["name"," key"],"order":[0,1]}
#macro __regFnPref_mf0 { registerFunctionLite("Preference",
@ -450,11 +530,6 @@
__regFnPref_mf0 __txtx("pref_supporter_icon", "Show supporter icon") __regFnPref_mf1 "show_supporter_icon" __regFnPref_mf2
__regFnPref_mf0 __txtx("pref_add_node_remember", "Remember add node position") __regFnPref_mf1 "add_node_remember" __regFnPref_mf2
__regFnPref_mf0 __txtx("pref_connection_type", "Connection type") __regFnPref_mf1 "curve_connection_line" __regFnPref_mf2
__regFnPref_mf0 __txtx("pref_connection_thickness", "Connection thickness") __regFnPref_mf1 "connection_line_width" __regFnPref_mf2
__regFnPref_mf0 __txtx("pref_connection_curve_smoothness", "Connection curve smoothness") __regFnPref_mf1 "connection_line_sample" __regFnPref_mf2
__regFnPref_mf0 __txtx("pref_connection_aa", "Connection anti aliasing") __regFnPref_mf1 "connection_line_aa" __regFnPref_mf2
__regFnPref_mf0 __txtx("pref_connection_anim", "Connection line animation") __regFnPref_mf1 "connection_line_transition" __regFnPref_mf2
__regFnPref_mf0 __txtx("pref_graph_group_in_tab", "Open group in new tab") __regFnPref_mf1 "graph_open_group_in_tab" __regFnPref_mf2
__regFnPref_mf0 __txtx("pref_graph_zoom_smoothing", "Graph zoom smoothing") __regFnPref_mf1 "graph_zoom_smoooth" __regFnPref_mf2
@ -473,4 +548,5 @@
__regFnPref_mf0 __txtx("pref_node_3d_preview", "Preview surface size") __regFnPref_mf1 "node_3d_preview_size" __regFnPref_mf2
__regFnPref_mf0 __txtx("pref_file_watcher_delay", "File watcher delay (s)") __regFnPref_mf1 "file_watcher_delay" __regFnPref_mf2
}
#endregion
#endregion

View file

@ -40,40 +40,12 @@ function Project() constructor {
previewNode = "";
inspectingNode = "";
previewGrid = {
show : false,
snap : false,
size : [ 16, 16 ],
opacity : 0.5,
color : cola(COLORS.panel_preview_grid),
pixel : false,
}
previewGrid = variable_clone(PREFERENCES.project_previewGrid);
previewSetting = variable_clone(PREFERENCES.project_previewSetting);
graphGrid = {
show : true,
show_origin : false,
snap : true,
size : 16,
color : cola(c_white),
opacity : 0.05,
highlight : 12,
}
graph_display_parameter = {
show_grid : true,
show_dimension : true,
show_compute : true,
avoid_label : false,
preview_scale : 100,
highlight : false,
show_control : false,
show_tooltip : true,
}
addons = {};
graphGrid = variable_clone(PREFERENCES.project_graphGrid);
graphDisplay = variable_clone(PREFERENCES.project_graphDisplay);
graphConnection = variable_clone(PREFERENCES.project_graphConnection);
onion_skin = {
enabled : false,
@ -84,6 +56,8 @@ function Project() constructor {
on_top : true,
};
addons = {};
tunnels_in = ds_map_create();
tunnels_in_map = ds_map_create();
tunnels_out = ds_map_create();
@ -176,9 +150,7 @@ function Project() constructor {
globalNode.step();
}
static postStep = function() {
slideShowPostStep();
}
static postStep = function() { slideShowPostStep(); }
useSlideShow = false;
slideShow = {};
@ -205,11 +177,10 @@ function Project() constructor {
}
static cleanup = function() {
array_foreach(allNodes, function(_node) {
_node.active = false;
_node.cleanUp();
delete _node;
array_foreach(allNodes, function(_n) /*=>*/ {
_n.active = false;
_n.cleanUp();
delete _n;
});
ds_map_destroy(nodeMap);
@ -245,9 +216,10 @@ function Project() constructor {
var _insp_node = PANEL_INSPECTOR? PANEL_INSPECTOR.getInspecting() : noone;
_map.inspectingNode = _insp_node? _insp_node.node_id : noone;
_map.previewGrid = previewGrid;
_map.graphGrid = graphGrid;
_map.attributes = attributes;
_map.previewGrid = variable_clone(previewGrid);
_map.graphGrid = variable_clone(graphGrid);
_map.graphConnection = variable_clone(graphConnection);
_map.attributes = variable_clone(attributes);
_map.timelines = timelines.serialize();
_map.notes = array_map(notes, function(note) { return note.serialize(); } );
@ -256,7 +228,7 @@ function Project() constructor {
_map.load_layout = load_layout;
if(load_layout) _map.layout = panelSerialize(true);
_map.graph_display_parameter = graph_display_parameter;
_map.graph_display_parameter = graphDisplay;
__node_list = [];
array_foreach(allNodes, function(node) { if(node.active) array_push(__node_list, node.serialize()); })
@ -285,15 +257,16 @@ function Project() constructor {
animator.playback = struct_try_get(_anim_map, "playback", ANIMATOR_END.loop);
}
if(struct_has(_map, "onion_skin")) struct_override(onion_skin, _map.onion_skin);
if(struct_has(_map, "previewGrid")) struct_override(previewGrid, _map.previewGrid);
if(struct_has(_map, "graphGrid")) struct_override(graphGrid, _map.graphGrid);
if(struct_has(_map, "attributes")) struct_override(attributes, _map.attributes);
if(struct_has(_map, "onion_skin")) struct_override(onion_skin, _map.onion_skin);
if(struct_has(_map, "previewGrid")) struct_override(previewGrid, _map.previewGrid);
if(struct_has(_map, "graphGrid")) struct_override(graphGrid, _map.graphGrid);
if(struct_has(_map, "graphConnection")) struct_override(graphConnection, _map.graphConnection);
if(struct_has(_map, "attributes")) struct_override(attributes, _map.attributes);
if(struct_has(_map, "metadata")) meta.deserialize(_map.metadata);
if(struct_has(_map, "composer")) composer = _map.composer;
if(struct_has(_map, "freeze")) freeze = _map.freeze;
if(struct_has(_map, "graph_display_parameter")) struct_override(graph_display_parameter, _map.graph_display_parameter);
if(struct_has(_map, "graph_display_parameter")) struct_override(graphDisplay, _map.graph_display_parameter);
is_nightly = struct_try_get(_map, "is_nightly", is_nightly);
load_layout = struct_try_get(_map, "load_layout", load_layout);

View file

@ -8,7 +8,10 @@ function struct_override(original, override) {
var _key = array_safe_get(args, i);
if(!struct_has(original, _key)) continue;
original[$ _key] = override[$ _key];
if(is_struct(original[$ _key]))
original[$ _key] = struct_override(original[$ _key], override[$ _key]);
else
original[$ _key] = override[$ _key];
}
return original;