materialbox

This commit is contained in:
Tanasart 2024-04-08 12:13:46 +07:00
parent 31d3fc31c8
commit f74971f7fb
80 changed files with 707 additions and 422 deletions

View file

@ -542,7 +542,7 @@
{"name":"json_functions","order":8,"path":"scripts/json_functions/json_functions.yy",},
{"name":"json_minify","order":6,"path":"scripts/json_minify/json_minify.yy",},
{"name":"json_prettify","order":7,"path":"scripts/json_prettify/json_prettify.yy",},
{"name":"lcd_function","order":13,"path":"scripts/lcd_function/lcd_function.yy",},
{"name":"lcd_function","order":2,"path":"scripts/lcd_function/lcd_function.yy",},
{"name":"lerp_float","order":1,"path":"scripts/lerp_float/lerp_float.yy",},
{"name":"line_intersect","order":11,"path":"scripts/line_intersect/line_intersect.yy",},
{"name":"locale_data","order":1,"path":"scripts/locale_data/locale_data.yy",},
@ -550,7 +550,7 @@
{"name":"luaHighlight","order":1,"path":"scripts/luaHighlight/luaHighlight.yy",},
{"name":"mac_window_step","order":1,"path":"scripts/mac_window_step/mac_window_step.yy",},
{"name":"mask_function","order":1,"path":"scripts/mask_function/mask_function.yy",},
{"name":"math_function","order":7,"path":"scripts/math_function/math_function.yy",},
{"name":"math_function","order":3,"path":"scripts/math_function/math_function.yy",},
{"name":"matrixGrid","order":6,"path":"scripts/matrixGrid/matrixGrid.yy",},
{"name":"meta_data","order":12,"path":"scripts/meta_data/meta_data.yy",},
{"name":"mouse_input","order":1,"path":"scripts/mouse_input/mouse_input.yy",},
@ -1102,7 +1102,6 @@
{"name":"safe_operation","order":6,"path":"scripts/safe_operation/safe_operation.yy",},
{"name":"sample_projects","order":6,"path":"scripts/sample_projects/sample_projects.yy",},
{"name":"save_function","order":1,"path":"scripts/save_function/save_function.yy",},
{"name":"tooltip_hotkey","order":2,"path":"scripts/tooltip_hotkey/tooltip_hotkey.yy",},
{"name":"scrollBox","order":2,"path":"scripts/scrollBox/scrollBox.yy",},
{"name":"scrollPane","order":3,"path":"scripts/scrollPane/scrollPane.yy",},
{"name":"shell_functions","order":20,"path":"scripts/shell_functions/shell_functions.yy",},
@ -1122,6 +1121,7 @@
{"name":"surface_get_palette","order":2,"path":"scripts/surface_get_palette/surface_get_palette.yy",},
{"name":"surface_valid","order":5,"path":"scripts/surface_valid/surface_valid.yy",},
{"name":"surfaceBox","order":4,"path":"scripts/surfaceBox/surfaceBox.yy",},
{"name":"materialBox","order":14,"path":"scripts/materialBox/materialBox.yy",},
{"name":"text_file","order":5,"path":"scripts/text_file/text_file.yy",},
{"name":"textArrayBox","order":1,"path":"scripts/textArrayBox/textArrayBox.yy",},
{"name":"textBox","order":2,"path":"scripts/textBox/textBox.yy",},
@ -1131,6 +1131,7 @@
{"name":"time_source","order":25,"path":"scripts/time_source/time_source.yy",},
{"name":"timeline_data","order":18,"path":"scripts/timeline_data/timeline_data.yy",},
{"name":"toggleGroup","order":7,"path":"scripts/toggleGroup/toggleGroup.yy",},
{"name":"tooltip_hotkey","order":2,"path":"scripts/tooltip_hotkey/tooltip_hotkey.yy",},
{"name":"tooltip_selector_object","order":1,"path":"scripts/tooltip_selector_object/tooltip_selector_object.yy",},
{"name":"transformBox","order":15,"path":"scripts/transformBox/transformBox.yy",},
{"name":"tuple_functions","order":5,"path":"scripts/tuple_functions/tuple_functions.yy",},

View file

@ -1579,7 +1579,6 @@
{"id":{"name":"safe_operation","path":"scripts/safe_operation/safe_operation.yy",},},
{"id":{"name":"sample_projects","path":"scripts/sample_projects/sample_projects.yy",},},
{"id":{"name":"save_function","path":"scripts/save_function/save_function.yy",},},
{"id":{"name":"tooltip_hotkey","path":"scripts/tooltip_hotkey/tooltip_hotkey.yy",},},
{"id":{"name":"scrollBox","path":"scripts/scrollBox/scrollBox.yy",},},
{"id":{"name":"scrollPane","path":"scripts/scrollPane/scrollPane.yy",},},
{"id":{"name":"shader_functions","path":"scripts/shader_functions/shader_functions.yy",},},
@ -1605,6 +1604,7 @@
{"id":{"name":"surface_get_palette","path":"scripts/surface_get_palette/surface_get_palette.yy",},},
{"id":{"name":"surface_valid","path":"scripts/surface_valid/surface_valid.yy",},},
{"id":{"name":"surfaceBox","path":"scripts/surfaceBox/surfaceBox.yy",},},
{"id":{"name":"materialBox","path":"scripts/materialBox/materialBox.yy",},},
{"id":{"name":"testing_script","path":"scripts/testing_script/testing_script.yy",},},
{"id":{"name":"text_file","path":"scripts/text_file/text_file.yy",},},
{"id":{"name":"textArea","path":"scripts/textArea/textArea.yy",},},
@ -1618,6 +1618,7 @@
{"id":{"name":"timeline_data","path":"scripts/timeline_data/timeline_data.yy",},},
{"id":{"name":"timer_function","path":"scripts/timer_function/timer_function.yy",},},
{"id":{"name":"toggleGroup","path":"scripts/toggleGroup/toggleGroup.yy",},},
{"id":{"name":"tooltip_hotkey","path":"scripts/tooltip_hotkey/tooltip_hotkey.yy",},},
{"id":{"name":"tooltip_selector_object","path":"scripts/tooltip_selector_object/tooltip_selector_object.yy",},},
{"id":{"name":"transformBox","path":"scripts/transformBox/transformBox.yy",},},
{"id":{"name":"tuple_functions","path":"scripts/tuple_functions/tuple_functions.yy",},},

View file

@ -12,13 +12,15 @@ event_inherited();
alarm[0] = -1;
menu = 1;
hght = ui(36);
children = ds_list_create();
ds_list_add(children, self);
tooltips = [];
show_icon = false;
context = noone;
_hovering_ch = true;
setFocus(self.id);
function setMenu(_menu, align = fa_left) {
menu = _menu;
dialog_x = x;
@ -28,11 +30,9 @@ event_inherited();
dialog_w = 0;
dialog_h = 0;
while(ds_list_size(children) > 1) {
var ch = children[| 1];
instance_destroy(children[| 1]);
ds_list_delete(children, 1);
}
for( var i = 0, n = array_length(children); i < n; i++ )
instance_destroy(children[i]);
children = [];
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text);
for(var i = 0; i < array_length(menu); i++) {

View file

@ -1,4 +0,0 @@
/// @description
event_inherited();
ds_list_destroy(children);

View file

@ -5,8 +5,6 @@ if(!ready) exit;
var yy = dialog_y;
draw_sprite_stretched(THEME.menu_bg, 0, dialog_x, dialog_y, dialog_w, dialog_h);
//if(show_icon)
// draw_sprite_stretched(THEME.textbox_code, 0, dialog_x, dialog_y, ui(36), dialog_h);
for(var i = 0; i < array_length(menu); i++) {
var _menuItem = menu[i];
@ -14,54 +12,50 @@ if(!ready) exit;
if(is_instanceof(_menuItem, MenuItem) && _menuItem.shiftMenu != noone && key_mod_press(SHIFT))
_menuItem = _menuItem.shiftMenu;
if(_menuItem == -1) {
if(_menuItem == -1) { #region
var bx = dialog_x + ui(8);
var bw = dialog_w - ui(16);
draw_sprite_stretched(THEME.menu_separator, 0, bx, yy, bw, ui(6));
yy += ui(8);
continue;
}
} #endregion
var _h = hght;
var label = _menuItem.name;
if(is_instanceof(_menuItem, MenuItemGroup))
_h += hght;
var _h = is_instanceof(_menuItem, MenuItemGroup)? hght * 2 : hght;
var cc = struct_try_get(_menuItem, "color", c_white);
if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, dialog_x, yy + 1, dialog_x + dialog_w, yy + _h - 1)) {
selecting = i;
var tips = array_safe_get_fast(tooltips, i, noone);
var tips = array_safe_get_fast(tooltips, i, noone);
if(tips != noone) TOOLTIP = tips;
}
var cc = c_white;
if(struct_has(_menuItem, "color"))
cc = _menuItem.color;
if(selecting == i) {
if(cc == c_white)
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, COLORS.dialog_menubox_highlight, 0.75);
else
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, cc, 0.8);
var _hc = cc == c_white? COLORS.dialog_menubox_highlight : cc;
var _ha = cc == c_white? 0.75 : 0.8;
if(instanceof(_menuItem) == "MenuItem" && _menuItem.active && sFOCUS &&
((!mouse_inside && mouse_release(mb_left)) || keyboard_check_released(vk_enter))) {
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, _hc, _ha);
var _click = (!mouse_inside && mouse_release(mb_left)) || keyboard_check_released(vk_enter);
if(_hovering_ch && is_instanceof(_menuItem, MenuItem) && _menuItem.active && _click) {
var _dat = {
_x: dialog_x,
x: dialog_x + dialog_w,
y: yy,
depth: depth,
name: _menuItem.name,
index: i,
_x: dialog_x,
x: dialog_x + dialog_w,
y: yy,
depth: depth,
name: _menuItem.name,
index: i,
context: context,
params: _menuItem.params,
params: _menuItem.params,
};
var _res = _menuItem.func(_dat);
if(_menuItem.isShelf) ds_list_add(children, _res);
else instance_destroy(o_dialog_menubox);
if(_menuItem.isShelf) array_push(children, _res.id);
else instance_destroy(o_dialog_menubox);
}
} else if(cc != c_white)
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, cc, 0.5);
@ -108,7 +102,7 @@ if(!ready) exit;
_sh = sprite_get_height(_spr) + ui(8);
}
if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, _bx - _sw / 2, _by - _sh / 2, _bx + _sw / 2, _by + _sh / 2)) {
if(_hovering_ch && point_in_rectangle(mouse_mx, mouse_my, _bx - _sw / 2, _by - _sh / 2, _bx + _sw / 2, _by + _sh / 2)) {
if(_tlp != "") TOOLTIP = _tlp;
draw_sprite_stretched_ext(THEME.textbox, 3, _bx - _sw / 2, _by - _sh / 2, _sw, _sh, COLORS.dialog_menubox_highlight, 1);
draw_sprite_stretched_ext(THEME.textbox, 1, _bx - _sw / 2, _by - _sh / 2, _sw, _sh, COLORS.dialog_menubox_highlight, 1);
@ -174,6 +168,20 @@ if(!ready) exit;
draw_sprite_stretched(THEME.menu_bg, 1, dialog_x, dialog_y, dialog_w, dialog_h);
//draw_set_color(c_red);
//draw_set_alpha(_hovering_ch * 0.5 + 0.5);
//draw_circle(dialog_x, dialog_y, 6, false);
//draw_set_color(c_lime);
//draw_set_alpha(sHOVER * 0.5 + 0.5);
//draw_circle(dialog_x + 16, dialog_y, 6, false);
//draw_set_color(c_yellow);
//draw_set_alpha(sFOCUS * 0.5 + 0.5);
//draw_circle(dialog_x + 32, dialog_y, 6, false);
//draw_set_alpha(1);
if(mouse_inside && mouse_release(mb_left)) mouse_inside = false;
#endregion

View file

@ -1,19 +1,13 @@
/// @description
if !ready exit;
/// @description Insert description here
event_inherited();
#region destroy
var hovering = false;
var hov = point_in(mouse_mx, mouse_my);
for( var i = 0; i < ds_list_size(children); i++ ) {
var ch = children[| i];
if(!instance_exists(ch)) continue;
var x0 = ch.dialog_x;
var x1 = ch.dialog_x + ch.dialog_w;
var y0 = ch.dialog_y;
var y1 = ch.dialog_y + ch.dialog_h;
hovering |= sHOVER && point_in_rectangle(mouse_mx, mouse_my, x0, y0, x1, y1);
}
for( var i = 0, n = array_length(children); i < n; i++ ) {
if(!instance_exists(children[i])) continue;
hov |= children[i].point_in(mouse_mx, mouse_my);
}
if(mouse_press(mb_any, !hovering))
instance_destroy(self);
#endregion
_hovering_ch = hov;
if((mouse_check_button_pressed(mb_left)) && !hov)
instance_destroy();

View file

@ -5,7 +5,6 @@
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
],
"managed":true,
"name":"o_dialog_menubox",

View file

@ -2,10 +2,10 @@
event_inherited();
#region data
dialog_w = ui( 900);
dialog_h = ui( 640);
dialog_w = ui(900);
dialog_h = ui(640);
page_width = ui(160);
page_width = 160;
destroy_on_click_out = true;
destroy_on_escape = false;
@ -20,9 +20,9 @@ event_inherited();
onResize = function() {
sp_page.resize(page_width - ui(4), dialog_h - ui(title_height + padding));
sp_pref.resize(dialog_w - ui(padding + padding + page_width), dialog_h - ui(title_height + padding));
sp_hotkey.resize(dialog_w - ui(padding + padding + page_width), dialog_h - ui(title_height + padding));
sp_colors.resize(dialog_w - ui(padding + padding + page_width), dialog_h - (title_height + ui(padding + 40)));
sp_pref.resize( dialog_w - ui(padding + padding) - page_width, dialog_h - ui(title_height + padding));
sp_hotkey.resize(dialog_w - ui(padding + padding) - page_width, dialog_h - ui(title_height + padding));
sp_colors.resize(dialog_w - ui(padding + padding) - page_width, dialog_h - (title_height + ui(padding + 40)));
}
#endregion
@ -226,6 +226,7 @@ event_inherited();
"test_mode",
new checkBox(function() {
PREFERENCES.test_mode = !PREFERENCES.test_mode;
should_restart = true;
PREF_SAVE();
})
));
@ -281,14 +282,16 @@ event_inherited();
slider(0.5, 2, 0.01, function(val) {
PREFERENCES._display_scaling = val;
should_restart = true;
}, function() {
PREFERENCES._display_scaling = clamp(PREFERENCES._display_scaling, 0.5, 2);
PREFERENCES._display_scaling = max(PREFERENCES._display_scaling, 0.5);
resetScale(PREFERENCES._display_scaling, true);
should_restart = true;
}),
function() { return PREFERENCES._display_scaling; },
function(val) {
PREFERENCES._display_scaling = val;
resetScale(PREFERENCES._display_scaling, true);
should_restart = true;
@ -335,6 +338,15 @@ event_inherited();
.setEmpty()
));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_windows_control", "Use Windows style window control."),
"panel_menu_right_control",
new checkBox(function() {
PREFERENCES.panel_menu_right_control = !PREFERENCES.panel_menu_right_control;
PREF_SAVE();
})
));
ds_list_add(pref_appr, __txt("Splash"));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
@ -410,15 +422,6 @@ event_inherited();
})
));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_windows_control", "Use Windows style window control."),
"panel_menu_right_control",
new checkBox(function() {
PREFERENCES.panel_menu_right_control = !PREFERENCES.panel_menu_right_control;
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",
@ -589,7 +592,7 @@ event_inherited();
}, false);
sb_theme.align = fa_left;
sp_colors = new scrollPane(dialog_w - ui(padding + padding + page_width), dialog_h - (title_height + ui(padding) + ui(40)), function(_y, _m, _r) {
sp_colors = new scrollPane(dialog_w - ui(padding + padding) - page_width, dialog_h - (title_height + ui(padding) + ui(40)), function(_y, _m, _r) {
draw_clear_alpha(COLORS.panel_bg_clear, 0);
var hh = 0;
var th = ui(28);
@ -703,7 +706,7 @@ event_inherited();
];
hk_editing = noone;
sp_hotkey = new scrollPane(dialog_w - ui(padding + padding + page_width), dialog_h - ui(title_height + padding), function(_y, _m) {
sp_hotkey = new scrollPane(dialog_w - ui(padding + padding) - page_width, dialog_h - ui(title_height + padding), function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 0);
var padd = ui(8);
var hh = ui(8);
@ -974,7 +977,7 @@ event_inherited();
#region scrollpane
current_list = pref_global;
sp_pref = new scrollPane(dialog_w - ui(padding + padding + page_width), dialog_h - ui(title_height + padding), function(_y, _m, _r) {
sp_pref = new scrollPane(dialog_w - ui(padding + padding) - page_width, dialog_h - ui(title_height + padding), function(_y, _m, _r) {
draw_clear_alpha(COLORS.panel_bg_clear, 0);
var hh = 0;
var th = TEXTBOX_HEIGHT;

View file

@ -37,9 +37,9 @@ if !ready exit;
#region draw
section_current = "";
var px = dialog_x + ui(padding + page_width);
var px = dialog_x + ui(padding) + page_width;
var py = dialog_y + ui(title_height);
var pw = dialog_w - ui(padding + page_width + padding);
var pw = dialog_w - ui(padding + padding) - page_width;
var ph = dialog_h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
@ -81,7 +81,7 @@ if !ready exit;
loadColor(PREFERENCES.theme);
}
var x1 = dialog_x + ui(padding + page_width);
var x1 = dialog_x + ui(padding) + page_width;
var x2 = _x - ui(32);
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);

View file

@ -96,7 +96,7 @@ event_inherited();
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_inner);
draw_text(fx + ui(12), ly, filename_name_only(_rec));
ly += line_get_height(, ui(4));
ly += line_get_height() + ui(4);
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);
draw_text_cut(fx + ui(12), ly, _rec, ww - ui(24));
}
@ -191,7 +191,7 @@ event_inherited();
surface_set_target(clip_surf);
DRAW_CLEAR
draw_sprite_ui_uniform(spr, 0, 0, 0, s);
draw_sprite_uniform(spr, 0, 0, 0, s);
gpu_set_blendmode_ext(bm_dest_colour, bm_zero);
draw_sprite_stretched(THEME.ui_panel_bg, 4, 0, 0, _spw, _sph);
BLEND_NORMAL
@ -199,7 +199,7 @@ event_inherited();
draw_surface(clip_surf, _sx, _sy);
} else {
draw_sprite_ui_uniform(spr, 0, _sx, _sy, s);
draw_sprite_uniform(spr, 0, _sx, _sy, s);
}
} #endregion
}

View file

@ -115,30 +115,31 @@ if(winMan_isMinimized()) exit;
case "Color" :
draw_sprite_stretched_ext(THEME.color_picker_box, 1, mouse_mx + ui(-16), mouse_my + ui(-16), ui(32), ui(32), DRAGGING.data, 0.5);
break;
case "Palette" :
drawPalette(DRAGGING.data, mouse_mx - ui(64), mouse_my - ui(12), ui(128), ui(24), 0.5);
break;
case "Gradient" :
DRAGGING.data.draw(mouse_mx - ui(64), mouse_my - ui(12), ui(128), ui(24), 0.5);
break;
case "Asset" :
if(DRAGGING.data.spr) {
var ss = 32 / max(sprite_get_width(DRAGGING.data.spr), sprite_get_height(DRAGGING.data.spr))
draw_sprite_ext(DRAGGING.data.spr, 0, mouse_mx, mouse_my, ss, ss, 0, c_white, 0.5);
}
break;
case "Collection" :
if(DRAGGING.data.spr) {
var ss = 32 / max(sprite_get_width(DRAGGING.data.spr), sprite_get_height(DRAGGING.data.spr))
draw_sprite_ext(DRAGGING.data.spr, 0, mouse_mx, mouse_my, ss, ss, 0, c_white, 0.5);
}
break;
case "Bool" :
draw_set_alpha(0.5);
draw_set_text(f_h3, fa_center, fa_center, COLORS._main_text);
draw_text_bbox({ xc: mouse_mx, yc: mouse_my, w: ui(128), h: ui(24) }, __txt(DRAGGING.data? "True" : "False"));
draw_set_alpha(1);
break;
case "Asset" :
case "Project" :
case "Collection" :
if(DRAGGING.data.spr) {
var ss = ui(48) / max(sprite_get_width(DRAGGING.data.spr), sprite_get_height(DRAGGING.data.spr))
draw_sprite_ext(DRAGGING.data.spr, 0, mouse_mx + ui(8), mouse_my + ui(8), ss, ss, 0, c_white, 0.5);
}
break;
default:
draw_set_alpha(0.5);
draw_set_text(f_h3, fa_center, fa_center, COLORS._main_text);

View file

@ -278,3 +278,4 @@ _HOVERING_ELEMENT = noone;
#endregion
//if(global.cache_call) print($"CACHE called: {global.cache_call} | hit: {global.cache_hit} ({global.cache_hit / global.cache_call * 100}%)");
//if(!is_struct(FOCUS)) print(FOCUS);

View file

@ -1,6 +1,8 @@
globalvar PEN_USE, PEN_CONTACT, PEN_RELEASED, PEN_PRESSURE, PEN_X, PEN_Y;
globalvar PEN_RIGHT_CLICK, PEN_RIGHT_PRESS, PEN_RIGHT_RELEASE;
PEN_USE = false;
PEN_X = 0;
PEN_Y = 0;

View file

@ -25,8 +25,8 @@ function __Node_3D_Extrude(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
inputs[| 7] = nodeValue("Render scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 8] = nodeValue("Manual generate", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0)
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", onClick: function() { generateMesh(); doUpdate(); } });
inputs[| 8] = nodeValue("Manual generate", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", UI : true, onClick: function() { generateMesh(); doUpdate(); } });
inputs[| 9] = nodeValue("Light direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.rotation);

View file

@ -5,8 +5,8 @@ function __Node_3D_Obj(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
.setDisplay(VALUE_DISPLAY.path_load, { filter: "3d object|*.obj" })
.rejectArray();
inputs[| 1] = nodeValue("Generate", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0)
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", onClick: function() {
inputs[| 1] = nodeValue("Generate", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", UI : true, onClick: function() {
updateObj();
doUpdate();
} });

View file

@ -145,9 +145,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
.setDisplay(VALUE_DISPLAY.vector, { label: [ "Amplitude", "Period" ], linkable: false, per_line: true })
.rejectArray();
triggerSpawn = function() { inputs[| 44].setAnim(true); inputs[| 44].setValue(true); };
inputs[| 44] = nodeValue("Spawn", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
.setDisplay(VALUE_DISPLAY.button, { name: "Trigger", onClick: triggerSpawn, output: true })
.setDisplay(VALUE_DISPLAY.button, { name: "Trigger" })
.rejectArray();
inputs[| 45] = nodeValue("Follow Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false )

View file

@ -79,10 +79,10 @@ function buttonGroup(_data, _onClick) : widget() constructor {
var spr = i == 0 ? buttonSpr[0] : (i == amo - 1? buttonSpr[2] : buttonSpr[1]);
if(_selecting == i) {
draw_sprite_stretched(spr, 2, bx, _y, ww, _h);
draw_sprite_stretched(spr, 2, floor(bx), _y, ceil(ww), _h);
draw_sel = [spr, bx];
} else {
buttons[i].draw(bx, _y, ww, _h, _m, spr);
buttons[i].draw(floor(bx), _y, ceil(ww), _h, _m, spr);
if(buttons[i].clicked) onClick(i);
}

View file

@ -57,7 +57,9 @@
self.toggle = toggle;
self.params = params;
color = c_white;
isShelf = false;
isShelf = false;
shelfObject = noone;
shiftMenu = noone;

View file

@ -33,10 +33,8 @@ function __d3dMaterial(surface = noone) constructor {
gpu_set_tex_filter(texFilter);
}
static clone = function() {
var _mat = new __d3dMaterial();
_mat.surface = surface;
static clone = function(replaceSurface = surface) {
var _mat = new __d3dMaterial(replaceSurface);
_mat.diffuse = diffuse;
_mat.specular = specular;
@ -47,7 +45,39 @@ function __d3dMaterial(surface = noone) constructor {
_mat.normalStr = normalStr;
_mat.reflective = reflective;
_mat.texFilter = texFilter;
return _mat;
}
static serialize = function() {
var s = {
diffuse,
specular,
metalic,
shine,
normalStr,
reflective,
texFilter,
};
return json_stringify(s, false);
}
static deserialize = function(str) {
var s = json_try_parse(str, noone);
if(s == noone) return;
diffuse = s.diffuse;
specular = s.specular;
metalic = s.metalic;
shine = s.shine;
normalStr = s.normalStr;
reflective = s.reflective;
texFilter = s.texFilter;
}
}

View file

@ -25,7 +25,7 @@ function line_get_width(txt, font = noone, offset = 0) {
}
function resetScale(scale, willResize = false) {
if(scale == PREFERENCES.display_scaling) return;
if(PREFERENCES.display_scaling == scale) return;
PREFERENCES.display_scaling = scale;
resetPanel();

View file

@ -11,6 +11,7 @@ function dynaSurf() constructor {
static getWidth = function() { return is_surface(array_safe_get_fast(surfaces, 0))? surface_get_width(surfaces[0]) : 1; }
static getHeight = function() { return is_surface(array_safe_get_fast(surfaces, 0))? surface_get_height(surfaces[0]) : 1; }
static getFormat = function() { return is_surface(array_safe_get_fast(surfaces, 0))? surface_get_format(surfaces[0]) : surface_rgba8unorm; }
static draw = function(_x = 0, _y = 0, _sx = 1, _sy = 1, _ang = 0, _col = c_white, _alp = 1) {}
static drawStretch = function(_x = 0, _y = 0, _w = 1, _h = 1, _ang = 0, _col = c_white, _alp = 1) {

View file

@ -77,7 +77,7 @@ function Action(_type, _object, _data, _trigger = 0) constructor {
break;
case ACTION_TYPE.node_added :
nodeDelete(obj);
obj.destroy();
break;
case ACTION_TYPE.node_delete :
@ -113,7 +113,7 @@ function Action(_type, _object, _data, _trigger = 0) constructor {
case ACTION_TYPE.collection_loaded :
for( var i = 0, n = array_length(obj); i < n; i++ )
nodeDelete(obj[i]);
obj[i].destroy();
break;
case ACTION_TYPE.struct_modify :
@ -166,7 +166,7 @@ function Action(_type, _object, _data, _trigger = 0) constructor {
break;
case ACTION_TYPE.node_delete :
nodeDelete(obj);
obj.destroy();
break;
case ACTION_TYPE.junction_connect :

View file

@ -31,10 +31,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
LATEST_VERSION = 11600;
VERSION = 11690;
VERSION = 11692;
SAVE_VERSION = 11690;
VERSION_STRING = "1.16.9";
BUILD_NUMBER = 11690;
VERSION_STRING = "1.16.9.2";
BUILD_NUMBER = 11692;
globalvar APPEND_MAP;
APPEND_MAP = ds_map_create();
@ -89,7 +89,7 @@
#macro mouse_raw_y (device_mouse_raw_y(0) + window_get_y())
#macro mouse_ui [device_mouse_x_to_gui(0), device_mouse_y_to_gui(0)]
#macro sFOCUS FOCUS == self.id
#macro sFOCUS (FOCUS == self.id)
#macro sHOVER (!CURSOR_IS_LOCK && HOVER == self.id)
#macro DELTA_TIME delta_time / 1_000_000

View file

@ -5,8 +5,8 @@
"isDnD":false,
"name":"lcd_function",
"parent":{
"name":"value",
"path":"folders/functions/value.yy",
"name":"math",
"path":"folders/functions/math.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",

View file

@ -5,8 +5,8 @@
"isDnD":false,
"name":"lerp_float",
"parent":{
"name":"value",
"path":"folders/functions/value.yy",
"name":"math",
"path":"folders/functions/math.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",

View file

@ -0,0 +1,149 @@
function materialBox(_onModify) : widget() constructor {
onModify = _onModify;
align = fa_center;
defMat = new __d3dMaterial();
currMat = defMat;
sb_filtering = new scrollBox(["Pixel", "Bilinear"], function(val) { currMat.texFilter = val; onModify(currMat); })
for(var i = 0; i < 5; i++) tb[i] = new textBox(TEXTBOX_INPUT.number, noone).setSlidable();
tb[0].onModify = function(val) { currMat.diffuse = val; onModify(currMat); }
tb[1].onModify = function(val) { currMat.specular = val; onModify(currMat); }
tb[2].onModify = function(val) { currMat.metalic = val; onModify(currMat); }
tb[3].onModify = function(val) { currMat.shine = val; onModify(currMat); }
tb[4].onModify = function(val) { currMat.reflective = val; onModify(currMat); }
tb[0].setLabel("diffuse");
tb[1].setLabel("specular");
tb[2].setLabel("metalic");
tb[3].setLabel("shine");
tb[4].setLabel("reflective");
static setInteract = function(interactable) { #region
self.interactable = interactable;
//sb_filtering.interactable = true;
//for( var i = 0; i < array_length(tb); i++ )
// tb[i].interactable = true;
} #endregion
static register = function(parent = noone) { #region
//sb_filtering.register(parent);
//for( var i = 0; i < array_length(tb); i++ )
// tb[i].register(parent);
} #endregion
static drawParam = function(params) { #region
setParam(params);
//sb_filtering.setParam(params);
//for(var i = 0; i < array_length(tb); i++)
// tb[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m, params.rx, params.ry);
} #endregion
static draw = function(_x, _y, _w, _h, _surface, _display_data, _m, _rx, _ry) { #region
x = _x;
y = _y;
w = _w;
h = _h;
//h = _h + (TEXTBOX_HEIGHT + ui(4)) * 4;
open_rx = _rx;
open_ry = _ry;
if(is_array(_surface) && array_empty(_surface)) return h;
var yy = y;
#region draw surface
draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, _h);
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);
var pad = ui(12);
var sw = min(_w - pad, _h - pad);
var sh = sw;
var sx0 = _x + _w / 2 - sw / 2;
var sx1 = sx0 + sw;
var sy0 = _y + _h / 2 - sh / 2;
var sy1 = sy0 + sh;
var _arrLen = is_array(_surface)? array_length(_surface) : 0;
var _arrInd = is_array(_surface)? safe_mod(round(current_time / 250), array_length(_surface)) : 0;
_surface = is_array(_surface)? _surface[_arrInd] : _surface;
currMat = is_instanceof(_surface, __d3dMaterial)? _surface : defMat;
_surface = struct_try_get(currMat, "surface");
if(is_surface(_surface)) {
var sfw = surface_get_width_safe(_surface);
var sfh = surface_get_height_safe(_surface);
var ss = min(sw / sfw, sh / sfh);
var _sx = sx0 + sw / 2 - ss * sfw / 2;
var _sy = sy0 + sh / 2 - ss * sfh / 2;
draw_surface_ext_safe(_surface, _sx, _sy, ss, ss, 0, c_white, 1);
if(_arrLen) {
var bxw = sx1 - sx0;
draw_sprite_stretched_ext(THEME.palette_mask, 1, sx0, sy1 - 3, bxw, 4, COLORS.panel_bg_clear_inner, 1);
draw_sprite_stretched_ext(THEME.palette_mask, 1, sx0, sy1 - 3, bxw * (_arrInd + 1) / _arrLen, 4, COLORS._main_accent, 1);
}
var _txt = $"[{max(1, _arrLen)}] {sfw}x{sfh}";
draw_set_text(_f_p4, fa_right, fa_bottom, COLORS._main_text_inner);
var _tw = string_width(_txt) + ui(6);
var _th = 14;
var _nx = sx1 - _tw;
var _ny = sy1 - _th;
draw_sprite_stretched_ext(THEME.timeline_node, 0, _nx, _ny, _tw, _th, COLORS.panel_bg_clear_inner, 0.85);
draw_text_add(sx1 - ui(3), sy1 + ui(1), _txt);
}
draw_set_color(COLORS.widget_surface_frame);
draw_rectangle(sx0, sy0, sx1 - 1, sy1 - 1, true);
yy = sy1 + ui(10);
#endregion
//var tbw = _w / 2 - ui(2);
//var tbh = TEXTBOX_HEIGHT;
//draw_set_text(font, fa_left, fa_center, COLORS._main_text_sub);
//var txt = "Interpolation";
//var lbw = string_width(txt) + ui(16);
//draw_text_add(_x, yy + tbh / 2, txt);
//sb_filtering.setFocusHover(iactive, ihover);
//sb_filtering.draw(_x + lbw, yy, _w - lbw, tbh, currMat.texFilter, _m, _rx, _ry);
//yy += TEXTBOX_HEIGHT + ui(4);
//for(var i = 0; i < array_length(tb); i++)
// tb[i].setFocusHover(iactive, ihover);
//tb[0].draw(_x, yy, tbw, tbh, currMat.diffuse, _m);
//tb[1].draw(_x + tbw + ui(4), yy, tbw, tbh, currMat.specular, _m);
//yy += TEXTBOX_HEIGHT + ui(4);
//tb[2].draw(_x, yy, tbw, tbh, currMat.metalic, _m);
//tb[3].draw(_x + tbw + ui(4), yy, tbw, tbh, currMat.shine, _m);
//yy += TEXTBOX_HEIGHT + ui(4);
//tb[4].draw(_x, yy, _w, tbh, currMat.reflective, _m);
resetFocus();
return h;
} #endregion
static clone = function() { #region
var cln = new materialBox(onModify);
return cln;
} #endregion
}

View file

@ -0,0 +1,13 @@
{
"$GMScript":"",
"%Name":"materialBox",
"isCompatibility":false,
"isDnD":false,
"name":"materialBox",
"parent":{
"name":"widgets",
"path":"folders/widgets.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -5,8 +5,8 @@
"isDnD":false,
"name":"math_function",
"parent":{
"name":"value",
"path":"folders/functions/value.yy",
"name":"math",
"path":"folders/functions/math.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",

View file

@ -5,10 +5,10 @@ function Node_3D_Mesh_Cone(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group
inputs[| in_mesh + 0] = nodeValue("Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 8 );
inputs[| in_mesh + 1] = nodeValue("Material Bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 1] = nodeValue("Material Bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 2] = nodeValue("Material Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 2] = nodeValue("Material Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 3] = nodeValue("Smooth Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );

View file

@ -5,22 +5,22 @@ function Node_3D_Mesh_Cube(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group
inputs[| in_mesh + 0] = nodeValue("Material per side", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
inputs[| in_mesh + 1] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 1] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 2] = nodeValue("Material Bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 2] = nodeValue("Material Bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 3] = nodeValue("Material Left", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 3] = nodeValue("Material Left", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 4] = nodeValue("Material Right", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 4] = nodeValue("Material Right", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 5] = nodeValue("Material Back", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 5] = nodeValue("Material Back", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 6] = nodeValue("Material Front", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 6] = nodeValue("Material Front", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
input_display_list = [

View file

@ -5,13 +5,13 @@ function Node_3D_Mesh_Cylinder(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _g
inputs[| in_mesh + 0] = nodeValue("Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 8 );
inputs[| in_mesh + 1] = nodeValue("Material Top", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 1] = nodeValue("Material Top", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 2] = nodeValue("Material Bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 2] = nodeValue("Material Bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 3] = nodeValue("Material Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 3] = nodeValue("Material Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 4] = nodeValue("Smooth Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );

View file

@ -3,7 +3,7 @@ function Node_3D_Mesh_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
object_class = __3dSurfaceExtrude;
inputs[| in_mesh + 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone)
inputs[| in_mesh + 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial())
.setVisible(true, true);
inputs[| in_mesh + 1] = nodeValue("Height map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);

View file

@ -64,7 +64,7 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group)
static createNewInput = function(index = -1) { #region
if(index == -1) index = ds_list_size(inputs);
inputs[| index] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone)
inputs[| index] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial())
.setVisible(true, true);
} #endregion

View file

@ -3,7 +3,7 @@ function Node_3D_Mesh_Plane(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _grou
object_class = __3dPlane;
inputs[| in_mesh + 0] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 0] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 1] = nodeValue("Normal", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2 )
@ -11,7 +11,7 @@ function Node_3D_Mesh_Plane(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _grou
inputs[| in_mesh + 2] = nodeValue("Both side", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false )
inputs[| in_mesh + 3] = nodeValue("Back Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 3] = nodeValue("Back Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
input_display_list = [
__d3d_input_list_mesh, in_mesh + 1,

View file

@ -5,7 +5,7 @@ function Node_3D_Mesh_Sphere_Ico(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
inputs[| in_mesh + 0] = nodeValue("Subdivision", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 );
inputs[| in_mesh + 1] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 1] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 2] = nodeValue("Smooth Normal", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );

View file

@ -7,7 +7,7 @@ function Node_3D_Mesh_Sphere_UV(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _
inputs[| in_mesh + 1] = nodeValue("Vertical Slices", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16 );
inputs[| in_mesh + 2] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 2] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 3] = nodeValue("Smooth Normal", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );

View file

@ -3,7 +3,7 @@ function Node_3D_Mesh_Terrain(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
object_class = __3dTerrain;
inputs[| in_mesh + 0] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
inputs[| in_mesh + 0] = nodeValue("Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true);
inputs[| in_mesh + 1] = nodeValue("Input type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )

View file

@ -1,7 +1,7 @@
function Node_3D_Set_Material(_x, _y, _group = noone) : Node_3D_Modifier(_x, _y, _group) constructor {
name = "Set Material";
inputs[| in_mesh + 0] = nodeValue("Materials", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone)
inputs[| in_mesh + 0] = nodeValue("Materials", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial() )
.setVisible(true, true)
.setArrayDepth(1);

View file

@ -2,17 +2,17 @@ function Node_Animation_Control(_x, _y, _group = noone) : Node(_x, _y, _group) c
name = "Animation Control";
setDimension(96, 96);
inputs[| 0] = nodeValue("Toggle Play / Pause", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0);
inputs[| 0] = nodeValue("Toggle Play / Pause", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false );
inputs[| 1] = nodeValue("Pause", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0);
inputs[| 1] = nodeValue("Pause", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false );
inputs[| 2] = nodeValue("Resume", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0);
inputs[| 2] = nodeValue("Resume", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false );
inputs[| 3] = nodeValue("Play From Beginning", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0);
inputs[| 3] = nodeValue("Play From Beginning", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false );
inputs[| 4] = nodeValue("Play once", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0);
inputs[| 4] = nodeValue("Play once", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false );
inputs[| 5] = nodeValue("Skip Frames", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0);
inputs[| 5] = nodeValue("Skip Frames", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false );
inputs[| 6] = nodeValue("Skip Frames Count", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1);

View file

@ -32,8 +32,8 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "")
.setDisplay(VALUE_DISPLAY.path_load, { filter: "Aseprite file|*.ase;*.aseprite" });
inputs[| 1] = nodeValue("Generate layers", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0)
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", onClick: function() { refreshLayers(); } });
inputs[| 1] = nodeValue("Generate layers", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", UI : true, onClick: function() { refreshLayers(); } });
inputs[| 2] = nodeValue("Current tag", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "");

View file

@ -131,7 +131,7 @@ function upgroupNode(collection, record = true) { #region
collection.remove(remNode);
}
nodeDelete(collection);
collection.destroy();
UNDO_HOLDING = false;
if(record) recordAction(ACTION_TYPE.ungroup, collection, { content: _content });
@ -392,7 +392,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
_node.ungroup();
if(_node.destroy_when_upgroup)
nodeDelete(_node);
_node.destroy();
else
_node.group = group;

View file

@ -90,7 +90,7 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c
_ind++;
}
if(_hash == "") {
nodeDelete(self);
destroy();
return;
}
_hash = md5_string_utf8(_hash);
@ -219,6 +219,7 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c
} #endregion
static drawNodeBG = function(_x, _y, _mx, _my, _s) { #region
refreshGroupBG();
if(array_length(group_vertex) < 3) return false;

View file

@ -179,7 +179,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(!is_instanceof(_in, NodeValue)) continue;
if(_in.type != VALUE_TYPE.trigger) continue;
array_push(input_buttons, _in);
if(_in.runInUI) array_push(input_buttons, _in);
}
input_button_length = array_length(input_buttons);
@ -581,14 +581,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var i = 0;
repeat( input_button_length ) {
var _in = input_buttons[i];
var _in = input_buttons[i++];
if(_in.getStaticValue() && !_in.display_data.output) {
if(_in.getStaticValue()) {
_in.editWidget.onClick();
_in.setValue(false);
}
i++;
}
if(NODE_HAS_INSP1 && inspectInput1.getStaticValue()) {
@ -1417,8 +1415,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
setPreview(surf);
if(!__preview_surf) return;
__preview_sw = surface_get_width(preview_surface);
__preview_sh = surface_get_height(preview_surface);
__preview_sw = surface_get_width_safe(preview_surface);
__preview_sh = surface_get_height_safe(preview_surface);
var bbox = drawGetBbox(xx, yy, _s);
var aa = 0.5 + 0.5 * renderActive;
@ -1427,7 +1425,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var _sw = __preview_sw;
var _sh = __preview_sh;
var _ss = min(bbox.w / _sw, bbox.h / _sh);
draw_surface_ext(preview_surface, bbox.xc - _sw * _ss / 2, bbox.yc - _sh * _ss / 2, _ss, _ss, 0, c_white, 1);
draw_surface_ext_safe(preview_surface, bbox.xc - _sw * _ss / 2, bbox.yc - _sh * _ss / 2, _ss, _ss);
} #endregion
static getNodeDimension = function(showFormat = true) { #region
@ -1435,7 +1433,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var pw = surface_get_width_safe(preview_surface);
var ph = surface_get_height_safe(preview_surface);
var format = surface_get_format(preview_surface);
var format = surface_get_format_safe(preview_surface);
var txt = $"[{pw} x {ph} ";
if(preview_amount) txt = $"{preview_amount} x {txt}";
@ -1619,10 +1617,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static onDestroy = function() {}
static destroy = function(_merge = false) { #region
static destroy = function(_merge = false, record = true) { #region
if(!active) return;
disable();
ds_list_remove(group == noone? PROJECT.nodes : group.getNodeList(), self);
if(PANEL_GRAPH.node_hover == self) PANEL_GRAPH.node_hover = noone;
PANEL_GRAPH.nodes_selecting = [];
@ -1660,6 +1660,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
onDestroy();
if(group) group.refreshNodes();
if(record) recordAction(ACTION_TYPE.node_delete, self);
RENDER_ALL_REORDER
} #endregion
@ -1669,6 +1671,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(active) return;
enable();
ds_list_add(group == noone? PROJECT.nodes : group.getNodeList(), self);
onRestore();
if(group) group.refreshNodes();

View file

@ -154,14 +154,6 @@
return _node;
}
function nodeDelete(node, _merge = false) {
var list = node.group == noone? PROJECT.nodes : node.group.getNodeList();
ds_list_remove(list, node);
node.destroy(_merge);
recordAction(ACTION_TYPE.node_delete, node);
}
function nodeCleanUp() {
var key = ds_map_find_first(PROJECT.nodeMap);
repeat(ds_map_size(PROJECT.nodeMap)) {

View file

@ -402,7 +402,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
} #endregion
static onLoadGroup = function() { #region
if(group == noone) nodeDelete(self);
if(group == noone) destroy();
} #endregion
}

View file

@ -134,6 +134,6 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
} #endregion
static onLoadGroup = function() { #region
if(group == noone) nodeDelete(self);
if(group == noone) destroy();
} #endregion
}

View file

@ -54,8 +54,8 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons
.setDisplay(VALUE_DISPLAY.enum_scroll, ["Loop", "Ping pong", "Hold last frame", "Hide"])
.rejectArray();
inputs[| 5] = nodeValue("Set animation length to match", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0)
.setDisplay(VALUE_DISPLAY.button, { name: "Match length", onClick: function() {
inputs[| 5] = nodeValue("Set animation length to match", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
.setDisplay(VALUE_DISPLAY.button, { name: "Match length", UI : true, onClick: function() {
if(array_length(spr) == 0) return;
TOTAL_FRAMES = array_length(spr);
} });

View file

@ -31,8 +31,8 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "")
.setDisplay(VALUE_DISPLAY.path_load, { filter: "Animated gif|*.gif" });
inputs[| 1] = nodeValue("Set animation length to gif", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0)
.setDisplay(VALUE_DISPLAY.button, { name: "Match length", onClick: function() {
inputs[| 1] = nodeValue("Set animation length to gif", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
.setDisplay(VALUE_DISPLAY.button, { name: "Match length", UI : true, onClick: function() {
if(!spr) return;
if(!sprite_exists(spr)) return;
TOTAL_FRAMES = sprite_get_number(spr);

View file

@ -28,8 +28,8 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru
.setDisplay(VALUE_DISPLAY.enum_scroll, [ new scrollItem("Horizontal", s_node_alignment, 0),
new scrollItem("Vertical", s_node_alignment, 1), ]);
inputs[| 10] = nodeValue("Auto fill", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0, "Automatically set amount based on sprite size.")
.setDisplay(VALUE_DISPLAY.button, { name: "Auto fill", onClick: function() { #region
inputs[| 10] = nodeValue("Auto fill", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false, "Automatically set amount based on sprite size.")
.setDisplay(VALUE_DISPLAY.button, { name: "Auto fill", UI : true, onClick: function() { #region
var _sur = getInputData(0);
if(!is_surface(_sur) || _sur == DEF_SURFACE) return;
var ww = surface_get_width_safe(_sur);
@ -52,8 +52,8 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru
doUpdate();
} }); #endregion
inputs[| 11] = nodeValue("Sync animation", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0)
.setDisplay(VALUE_DISPLAY.button, { name: "Sync frames", onClick: function() {
inputs[| 11] = nodeValue("Sync animation", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
.setDisplay(VALUE_DISPLAY.button, { name: "Sync frames", UI : true, onClick: function() {
var _atl = outputs[| 1].getValue();
var _spd = getInputData(8);
TOTAL_FRAMES = max(1, _spd == 0? 1 : ceil(array_length(_atl) / _spd));

View file

@ -76,17 +76,17 @@ function Node_Iterate_Each_Inline(_x, _y, _group = noone) : Node_Collection_Inli
}
if(input_node == noone || output_node == noone) {
if(input_node) nodeDelete(input_node);
if(output_node) nodeDelete(output_node);
nodeDelete(self);
if(input_node) input_node.destroy();
if(output_node) output_node.destroy();
destroy();
}
} #endregion
static update = function() { #region
if(input_node == noone || output_node == noone) {
if(input_node) nodeDelete(input_node);
if(output_node) nodeDelete(output_node);
nodeDelete(self);
if(input_node) input_node.destroy();
if(output_node) output_node.destroy();
destroy();
return;
}

View file

@ -75,17 +75,17 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In
}
if(input_node == noone || output_node == noone) {
if(input_node) nodeDelete(input_node);
if(output_node) nodeDelete(output_node);
nodeDelete(self);
if(input_node) input_node.destroy();
if(output_node) output_node.destroy();
destroy();
}
} #endregion
static update = function() { #region
if(input_node == noone || output_node == noone) {
if(input_node) nodeDelete(input_node);
if(output_node) nodeDelete(output_node);
nodeDelete(self);
if(input_node) input_node.destroy();
if(output_node) output_node.destroy();
destroy();
return;
}

View file

@ -62,17 +62,17 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli
}
if(input_node == noone || output_node == noone) {
if(input_node) nodeDelete(input_node);
if(output_node) nodeDelete(output_node);
nodeDelete(self);
if(input_node) input_node.destroy();
if(output_node) output_node.destroy();
destroy();
}
} #endregion
static update = function(frame = CURRENT_FRAME) { #region
if(input_node == noone || output_node == noone) {
if(input_node) nodeDelete(input_node);
if(output_node) nodeDelete(output_node);
nodeDelete(self);
if(input_node) input_node.destroy();
if(output_node) output_node.destroy();
destroy();
return;
}

View file

@ -58,6 +58,6 @@ function Node_Iterator_Each_Input(_x, _y, _group = noone) : Node(_x, _y, _group)
} #endregion
static onLoadGroup = function() { #region
if(group == noone) nodeDelete(self);
if(group == noone) destroy();
} #endregion
}

View file

@ -64,6 +64,6 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
} #endregion
static onLoadGroup = function() { #region
if(group == noone) nodeDelete(self);
if(group == noone) destroy();
} #endregion
}

View file

@ -19,6 +19,6 @@ function Node_Iterator_Each_Length(_x, _y, _group = noone) : Node(_x, _y, _group
}
static onLoadGroup = function() { #region
if(group == noone) nodeDelete(self);
if(group == noone) destroy();
} #endregion
}

View file

@ -149,6 +149,13 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
if(array_length(key_map) != _len)
array_resize(key_map, _len);
if(prop.type == VALUE_TYPE.trigger) {
array_fill(key_map, 0, _len, 0);
for( var i = 0, n = ds_list_size(values); i < n; i++ )
key_map[values[| i].time] = true;
return;
}
if(ds_list_size(values) < 2) {
array_fill(key_map, 0, _len, 0);
return;
@ -262,25 +269,16 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
static getValue = function(_time = CURRENT_FRAME) { #region
//if(!prop.is_anim) return staticValue;
length = ds_list_size(values);
///////////////////////////////////////////////////////////// TRIGGER TYPE /////////////////////////////////////////////////////////////
if(prop.type == VALUE_TYPE.trigger) {
if(length == 0)
return false;
if(!prop.is_anim)
return values[| 0].value;
if(length == 0 || !prop.is_anim) return false;
if(array_length(key_map) != TOTAL_FRAMES) updateKeyMap();
var _keyIndex = key_map[_time];
if(_keyIndex == -1 || _keyIndex == 999_999)
return false;
var _key = values[| _keyIndex];
return _key.time == _time? _key.value : false;
return key_map[_time];
}
///////////////////////////////////////////////////////////// OPTIMIZATION /////////////////////////////////////////////////////////////
@ -534,6 +532,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
_key.value = _val;
return false;
} else if(_key.time > _time) {
ds_list_insert(values, i, new valueKey(_time, _val, self));
updateKeyMap();
@ -541,6 +540,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
}
}
//print($"{_time}: {_val} | Insert last");
ds_list_add(values, new valueKey(_time, _val, self));
updateKeyMap();
return true;
@ -610,11 +610,13 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
var val = values[| i].value;
if(prop.type == VALUE_TYPE.struct)
_value_list[1] = json_stringify(val);
else if(is_struct(val))
_value_list[1] = val.serialize();
else if(!sep_axis && typeArray(prop.display_type) && is_array(val)) {
if(prop.type == VALUE_TYPE.struct) {
val = json_stringify(val);
} else if(is_struct(val)) {
val = val.serialize();
} else if(!sep_axis && typeArray(prop.display_type) && is_array(val)) {
var __v = [];
for(var j = 0; j < array_length(val); j++) {
if(is_struct(val[j]) && struct_has(val[j], "serialize"))
@ -622,10 +624,11 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
else
array_push(__v, val[j]);
}
_value_list[1] = __v;
} else
_value_list[1] = values[| i].value;
val = __v;
}
_value_list[1] = val;
_value_list[2] = values[| i].ease_in;
_value_list[3] = values[| i].ease_out;
_value_list[4] = values[| i].ease_in_type;
@ -642,7 +645,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
static deserialize = function(_data, scale = false) { #region
ds_list_clear(values);
if(prop.type == VALUE_TYPE.gradient && LOADING_VERSION < 1340 && !CLONING) { //backward compat: Gradient
if(prop.type == VALUE_TYPE.gradient && LOADING_VERSION < 1340 && !CLONING) { #region //backward compat: Gradient
var _val = [];
var value = _data[0][1];
@ -661,7 +664,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
updateKeyMap();
return;
}
} #endregion
var base = prop.def_val;
@ -693,6 +696,10 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
var grad = new gradientObject();
_val = grad.deserialize(value);
} else if(prop.type == VALUE_TYPE.d3Material) {
var mat = new __d3dMaterial();
_val = mat.deserialize(value);
} else if(prop.type == VALUE_TYPE.color) {
if(is_array(_val)) {
for( var i = 0, n = array_length(_val); i < n; i++ )

View file

@ -210,8 +210,8 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 2] = nodeValue("Spring Force", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 3] = nodeValue("Mesh", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0)
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", onClick: function() { Mesh_setTriangle(); } });
inputs[| 3] = nodeValue("Mesh", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", UI : true, onClick: function() { Mesh_setTriangle(); } });
inputs[| 4] = nodeValue("Diagonal Link", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Include diagonal link to prevent drastic grid deformation.");

View file

@ -202,10 +202,10 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
#endregion
#region draw
surface_set_target(_surf);
DRAW_CLEAR
surface_set_shader(_surf, noone);
BLEND_OVERRIDE
var curr_w = -1;
var curr_h = -1;
switch(pack) {
case SPRITE_STACK.horizontal :
@ -217,6 +217,9 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var _sx = px;
var _sy = py;
curr_w = curr_w == -1? _w : curr_w; curr_h = curr_h == -1? _h : curr_h;
if(curr_w != _w || curr_h == _h) noti_warning("Spritesheet node does not support different surfaces size. Use Stack, Image grid, or pack sprite.");
switch(alig) {
case 1 : _sy = py + (hh - _h) / 2; break;
case 2 : _sy = py + (hh - _h); break;
@ -237,6 +240,9 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var _sx = px;
var _sy = py;
curr_w = curr_w == -1? _w : curr_w; curr_h = curr_h == -1? _h : curr_h;
if(curr_w != _w || curr_h == _h) noti_warning("Spritesheet node does not support different surfaces size. Use Stack, Image grid, or pack sprite.");
switch(alig) {
case 1 : _sx = px + (ww - _w) / 2; break;
case 2 : _sx = px + (ww - _w); break;
@ -270,6 +276,9 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var _w = surface_get_width_safe(inpt[index]);
var _h = surface_get_height_safe(inpt[index]);
curr_w = curr_w == -1? _w : curr_w; curr_h = curr_h == -1? _h : curr_h;
if(curr_w != _w || curr_h == _h) noti_warning("Spritesheet node does not support different surfaces size. Use Stack, Image grid, or pack sprite.");
array_push(_atl, new SurfaceAtlas(inpt[index], px, py));
draw_surface_safe(inpt[index], px, py);
@ -280,14 +289,17 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
}
break;
}
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
#endregion
outputs[| 0].setValue(_surf);
outputs[| 1].setValue(_atl);
} #endregion
anim_curr_w = -1;
anim_curr_h = -1;
static animationInit = function(clear = false) { #region
var inpt = getInputData(0);
var skip = getInputData(2);
@ -344,6 +356,9 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
ww = sw;
hh = sh;
anim_curr_w = sw;
anim_curr_h = sh;
switch(pack) {
case SPRITE_STACK.horizontal :
ww = sw * amo + spac * (amo - 1);
@ -461,6 +476,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var _w = surface_get_width_safe(_surfi);
var _h = surface_get_height_safe(_surfi);
if(anim_curr_w != _w || anim_curr_h == _h) noti_warning("Spritesheet node does not support different surfaces size. Use Stack, Image grid, or pack sprite.");
var px;
var _sx = 0;
var _sy = 0;

View file

@ -51,8 +51,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
.rejectArray()
.setAnimable(false);
inputs[| 9] = nodeValue("Generate mesh", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0)
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", onClick: function() { generateAllMesh(); } });
inputs[| 9] = nodeValue("Generate mesh", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", UI : true, onClick: function() { generateAllMesh(); } });
inputs[| 10] = nodeValue("Mesh expansion", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.slider, { range: [ -2, 2, 0.1 ] })

View file

@ -46,8 +46,8 @@ function Node_Strand_Create(_x, _y, _group = noone) : Node(_x, _y, _group) const
inputs[| 14] = nodeValue("Distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Uniform", "Random" ]);
inputs[| 15] = nodeValue("Bake hair", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0, "Prevent strand reseting to apply manual modification. Unbaking will remove all changes.")
.setDisplay(VALUE_DISPLAY.button, { name: "Bake", onClick: function() {
inputs[| 15] = nodeValue("Bake hair", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false, "Prevent strand reseting to apply manual modification. Unbaking will remove all changes.")
.setDisplay(VALUE_DISPLAY.button, { name: "Bake", UI : true, onClick: function() {
attributes.use_groom = !attributes.use_groom;
if(attributes.use_groom)
groomed = strands.clone();

View file

@ -4,7 +4,7 @@ function Node_Terminal_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) co
draw_padding = 8;
outputs[| 0] = nodeValue("Terminal", self, JUNCTION_CONNECT.output, VALUE_TYPE.trigger, noone);
outputs[| 0] = nodeValue("Terminal", self, JUNCTION_CONNECT.output, VALUE_TYPE.trigger, false );
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);

View file

@ -112,6 +112,7 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
} #endregion
static step = function() { #region
var _font = getSingleValue(1);
var _dimt = getSingleValue(9);
var _path = getSingleValue(13);
@ -122,7 +123,12 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
inputs[| 8].setVisible(_dimt == 0 || _use_path);
inputs[| 9].setVisible(!_use_path);
inputs[| 14].setVisible( _use_path);
inputs[| 15].setVisible(_dimt == 0 && !_use_path);
inputs[| 15].setVisible(_dimt == 0 && !_use_path && _font != "");
inputs[| 2].setVisible(_font != "");
inputs[| 3].setVisible(_font != "");
inputs[| 11].setVisible(_font != "");
inputs[| 12].setVisible(_font != "");
} #endregion
static waveGet = function(_ind) { #region
@ -367,7 +373,7 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
__temp_tx += string_width(_chr) + __temp_trck;
});
_ty += line_get_height() + _line;
_ty += string_height("l") + _line;
} else {
draw_set_text(font, fa_left, fa_top, _col);
tx = _padd[PADDING.left];
@ -397,7 +403,7 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
__temp_tx += (string_width(_chr) + __temp_trck) * __temp_ss;
});
ty += (line_get_height() + _line) * _ss;
ty += (string_height("l") + _line) * _ss;
}
} #endregion
surface_reset_shader();

View file

@ -3,39 +3,23 @@ function Node_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
update_on_frame = true;
setDimension(96, 32 + 24 * 1);
inputs[| 0] = nodeValue("Trigger", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false)
.setVisible(false, false);
inputs[| 0] = nodeValue("Trigger", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
.setDisplay(VALUE_DISPLAY.button, { name: "Trigger" });
inputs[| 1] = nodeValue("Trigger", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false)
.setVisible(true, true)
.setDisplay(VALUE_DISPLAY.button, { name: "Trigger", onClick: function() { onInspector2Update(); } });
outputs[| 0] = nodeValue("Trigger", self, JUNCTION_CONNECT.output, VALUE_TYPE.trigger, false);
outputs[| 0] = nodeValue("Trigger", self, JUNCTION_CONNECT.output, VALUE_TYPE.trigger, false );
insp2UpdateTooltip = "Trigger";
insp2UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
doTrigger = 0;
static onInspector2Update = function() { inputs[| 0].setAnim(true); inputs[| 0].setValue(true); }
static onInspector2Update = function() { #region
inputs[| 0].setAnim(true);
inputs[| 0].setValue(true);
} #endregion
static update = function() {
var _val = inputs[| 0].getValue();
static step = function() { #region
if(doTrigger == 1) {
outputs[| 0].setValue(true);
doTrigger = -1;
} else if(doTrigger == -1) {
outputs[| 0].setValue(false);
doTrigger = 0;
}
} #endregion
//print($"{CURRENT_FRAME}: {ds_list_to_array(inputs[| 0].animator.values)} | {inputs[| 0].animator.getValue(CURRENT_FRAME)}");
static update = function() { #region
var trg = getInputData(0);
if(trg) doTrigger = 1;
} #endregion
outputs[| 0].setValue(_val);
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text);
@ -51,6 +35,6 @@ function Node_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
draw_circle_border(bbox.xc, bbox.yc, rr, 4);
draw_set_circle_precision(32);
if(trg) draw_circle(bbox.xc, bbox.yc, rr - 6, false);
if(trg) draw_circle(bbox.xc - 1, bbox.yc - 1, rr - 6, false);
} #endregion
}

View file

@ -873,11 +873,19 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
editWidget = noone;
switch(display_type) {
case VALUE_DISPLAY.button : #region
editWidget = button(method(node, display_data.onClick));
editWidget.text = display_data.name;
if(!struct_has(display_data, "output")) display_data.output = false;
var _onClick;
if(struct_has(display_data, "onClick"))
_onClick = method(node, display_data.onClick);
else
_onClick = function() { setAnim(true); setValueDirect(true); };
editWidget = button(_onClick).setText(struct_try_get(display_data, "name", "Trigger"));
runInUI = struct_try_get(display_data, "UI", false);
visible = false;
rejectArray();
return; #endregion
}
@ -1132,40 +1140,34 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
break;
case VALUE_TYPE.boolean : #region
case VALUE_TYPE.boolean : #region
if(name == "Active") editWidget = new checkBoxActive(function() { return setValueInspector(!animator.getValue()); } );
else editWidget = new checkBox( function() { return setValueInspector(!animator.getValue()); } );
key_inter = CURVE_TYPE.cut;
extract_node = "Node_Boolean";
break; #endregion
case VALUE_TYPE.color : #region
case VALUE_TYPE.color : #region
switch(display_type) {
case VALUE_DISPLAY._default :
editWidget = new buttonColor(function(color) {
return setValueInspector(color);
} );
editWidget = new buttonColor(function(color) { return setValueInspector(color); } );
graph_h = ui(16);
extract_node = "Node_Color";
break;
case VALUE_DISPLAY.palette :
editWidget = new buttonPalette(function(color) {
return setValueInspector(color);
} );
editWidget = new buttonPalette(function(color) { return setValueInspector(color); } );
extract_node = "Node_Palette";
break;
}
break; #endregion
case VALUE_TYPE.gradient : #region
editWidget = new buttonGradient(function(gradient) {
return setValueInspector(gradient);
} );
case VALUE_TYPE.gradient : #region
editWidget = new buttonGradient(function(gradient) { return setValueInspector(gradient); } );
extract_node = "Node_Gradient_Out";
break; #endregion
case VALUE_TYPE.path : #region
case VALUE_TYPE.path : #region
switch(display_type) {
case VALUE_DISPLAY.path_array :
editWidget = new pathArrayBox(node, display_data.filter, function(path) { setValueInspector(path); } );
@ -1198,40 +1200,28 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break;
case VALUE_DISPLAY.path_font :
editWidget = new fontScrollBox(
function(val) {
return setValueInspector(DIRECTORY + "Fonts/" + FONT_INTERNAL[val]);
}
);
editWidget = new fontScrollBox( function(val) { return setValueInspector(DIRECTORY + "Fonts/" + FONT_INTERNAL[val]); } );
break;
}
break; #endregion
case VALUE_TYPE.curve : #region
case VALUE_TYPE.curve : #region
display_type = VALUE_DISPLAY.curve;
editWidget = new curveBox(function(_modified) {
return setValueInspector(_modified);
});
editWidget = new curveBox(function(_modified) { return setValueInspector(_modified); });
break; #endregion
case VALUE_TYPE.text : #region
case VALUE_TYPE.text : #region
switch(display_type) {
case VALUE_DISPLAY._default :
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) {
return setValueInspector(str);
});
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
extract_node = "Node_String";
break;
case VALUE_DISPLAY.text_box :
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) {
return setValueInspector(str);
});
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
extract_node = "Node_String";
break;
case VALUE_DISPLAY.codeLUA :
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) {
return setValueInspector(str);
});
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
editWidget.font = f_code;
editWidget.format = TEXT_AREA_FORMAT.codeLUA;
@ -1240,9 +1230,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break;
case VALUE_DISPLAY.codeHLSL:
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) {
return setValueInspector(str);
});
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
editWidget.autocomplete_server = hlsl_autocomplete_server;
editWidget.function_guide_server = hlsl_function_guide_server;
@ -1256,9 +1244,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break;
case VALUE_DISPLAY.text_tunnel :
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) {
return setValueInspector(str);
});
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
extract_node = "Node_String";
break;
@ -1267,17 +1253,25 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break;
}
break; #endregion
case VALUE_TYPE.d3Material :
case VALUE_TYPE.surface : #region
editWidget = new surfaceBox(function(ind) {
return setValueInspector(ind);
case VALUE_TYPE.d3Material : #region
editWidget = new materialBox(function(ind) {
var res = setValueInspector(ind);
node.triggerRender();
return res;
} );
if(!struct_has(display_data, "atlas")) display_data.atlas = true;
show_in_inspector = true;
extract_node = "Node_Canvas";
break; #endregion
case VALUE_TYPE.pathnode : #region
case VALUE_TYPE.surface : #region
editWidget = new surfaceBox(function(ind) { return setValueInspector(ind); } );
if(!struct_has(display_data, "atlas")) display_data.atlas = true;
show_in_inspector = true;
extract_node = "Node_Canvas";
break; #endregion
case VALUE_TYPE.pathnode : #region
extract_node = "Node_Path";
break; #endregion
}
@ -1540,15 +1534,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
} #endregion
if(typeFrom == VALUE_TYPE.surface && type == VALUE_TYPE.d3Material) { #region
if(!is_array(value)) return is_surface(value)? new __d3dMaterial(value) : noone;
var _val = array_create(array_length(value));
for( var i = 0, n = array_length(value); i < n; i++ )
_val[i] = is_surface(value[i])? new __d3dMaterial(value[i]) : noone;
return _val;
} #endregion
if((typeFrom == VALUE_TYPE.integer || typeFrom == VALUE_TYPE.float || typeFrom == VALUE_TYPE.boolean) && type == VALUE_TYPE.color)
return value >= 1? value : make_color_hsv(0, 0, value * 255);
@ -1588,7 +1573,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region
if(type == VALUE_TYPE.trigger)
useCache = false;
return _getValue(_time, false, 0, false);
//global.cache_call++;
if(useCache && use_cache) {
@ -1729,6 +1714,21 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion
if(type == VALUE_TYPE.d3Material) { #region
if(nod == self) {
return def_val;
} else if(typ == VALUE_TYPE.surface) {
if(!is_array(val)) return def_val.clone(val);
var _val = array_create(array_length(val));
for( var i = 0, n = array_length(val); i < n; i++ )
_val[i] = def_val.clone(value[i]);
return _val;
}
} #endregion
val = arrayBalance(val);
if(isArray(val) && array_length(val) < 1024) { #region Process data
@ -1747,9 +1747,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
arr[@ 0] = __getAnimValue(_time);
arr[@ 1] = self;
if(type == VALUE_TYPE.trigger && connect_type == JUNCTION_CONNECT.output) //trigger event will not propagate from input to output, need to be done manually
return;
if(value_from_loop && value_from_loop.bypassConnection() && value_from_loop.junc_out)
value_from_loop.getValue(arr);
@ -2173,7 +2170,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static removeFromLoop = function(_remove_list = true) { #region
if(value_from_loop != noone)
nodeDelete(value_from_loop);
value_from_loop.destroy();
PROJECT.modified = true;
} #endregion

View file

@ -31,13 +31,11 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
.setDisplay(VALUE_DISPLAY.path_load, { filter: "audio|*.wav" })
.rejectArray();
inputs[| 1] = nodeValue("Sync length", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0)
.setDisplay(VALUE_DISPLAY.button, { name: "Sync", onClick: function() {
inputs[| 1] = nodeValue("Sync length", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
.setDisplay(VALUE_DISPLAY.button, { name: "Sync", UI : true, onClick: function() {
if(content == noone) return;
var frm = max(1, ceil(content.duration * PROJECT.animator.framerate));
TOTAL_FRAMES = frm;
} })
.rejectArray();
TOTAL_FRAMES = max(1, ceil(content.duration * PROJECT.animator.framerate));
} });
inputs[| 2] = nodeValue("Mono", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);

View file

@ -7,7 +7,7 @@ function Node_Websocket_Receiver(_x, _y, _group = noone) : Node(_x, _y, _group)
outputs[| 0] = nodeValue("Data", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, {});
outputs[| 1] = nodeValue("Receive data", self, JUNCTION_CONNECT.output, VALUE_TYPE.trigger, 0);
outputs[| 1] = nodeValue("Receive data", self, JUNCTION_CONNECT.output, VALUE_TYPE.trigger, false);
input_display_list = [ 1, 0 ];

View file

@ -43,10 +43,10 @@
}
function noti_status(str, icon = noone, flash = false, ref = noone) {
if(TEST_ERROR) return {};
str = string(str);
show_debug_message("STATUS: " + str);
if(TEST_ERROR) return {};
if(PANEL_MAIN == 0) return;
if(flash && PANEL_MENU) {
@ -95,8 +95,10 @@
ds_list_add(STATUSES, noti);
ds_list_add(WARNING, noti);
if(!instance_exists(o_dialog_warning))
dialogCall(o_dialog_warning, mouse_mx + ui(16), mouse_my + ui(16)).warning_text = str;
if(!instance_exists(o_dialog_warning)) {
var dia = dialogCall(o_dialog_warning, mouse_mx + ui(16), mouse_my + ui(16));
if(dia) dia.warning_text = str;
}
if(ref) {
var onClick = function() { PANEL_GRAPH.focusNode(self.ref); };

View file

@ -17,6 +17,8 @@ function Panel_Collection() : PanelContent() constructor {
min_h = ui(40);
roots = [ ["Collections", COLLECTIONS] , ["Assets", global.ASSETS] ];
if(STEAM_ENABLED) array_push(roots, ["Project", STEAM_PROJECTS]);
mode = 0;
root = roots[mode][1];
context = root;
@ -143,26 +145,36 @@ function Panel_Collection() : PanelContent() constructor {
contentPane = new scrollPane(content_w - ui(6), content_h, function(_y, _m) { #region
draw_clear_alpha(c_white, 0);
switch(mode) {
case 0 : if(!COLLECTIONS.scanned) COLLECTIONS.scan([".json", ".pxcc"]); break;
}
var nodes;
if(mode == 0 && context == root) nodes = STEAM_COLLECTION;
else nodes = search_string == ""? context.content : search_list;
var steamNode = [];
for( var i = 0; i < ds_list_size(STEAM_COLLECTION); i++ ) {
var meta = STEAM_COLLECTION[| i].meta;
if(array_exists(meta.tags, context.name))
array_push(steamNode, STEAM_COLLECTION[| i]);
if(mode == 0) {
if(!COLLECTIONS.scanned)
COLLECTIONS.scan([".json", ".pxcc"]);
if(context == root) nodes = STEAM_COLLECTION;
else nodes = context.content;
for( var i = 0; i < ds_list_size(STEAM_COLLECTION); i++ ) {
var meta = STEAM_COLLECTION[| i].meta;
if(array_exists(meta.tags, context.name))
array_push(steamNode, STEAM_COLLECTION[| i]);
}
} else if(mode == 1) {
nodes = context.content;
} else if(mode == 2) {
nodes = context;
}
if(search_string != "") nodes = search_list;
var node_list = ds_list_size(nodes);
var node_count = node_list + array_length(steamNode);
var frame = PREFERENCES.collection_animated? current_time * PREFERENCES.collection_preview_speed / 3000 : 0;
var _cw = contentPane.surface_w;
var _hover = pHOVER && contentPane.hover;
var frame = PREFERENCES.collection_animated? current_time * PREFERENCES.collection_preview_speed / 3000 : 0;
var _cw = contentPane.surface_w;
var _hover = pHOVER && contentPane.hover;
var hh = 0;
updated_prog = lerp_linear(updated_prog, 0, 0.01);
@ -171,6 +183,7 @@ function Panel_Collection() : PanelContent() constructor {
var grid_size = ui(64);
var grid_width = ui(80);
var grid_space = ui(12);
var col = max(1, floor(_cw / (grid_width + grid_space)));
var row = ceil(node_count / col);
var yy = _y + grid_space;
@ -182,6 +195,7 @@ function Panel_Collection() : PanelContent() constructor {
for(var i = 0; i < row; i++) {
name_height = 0;
for(var j = 0; j < col; j++) {
var index = i * col + j;
if(index >= node_count) break;
@ -205,8 +219,17 @@ function Panel_Collection() : PanelContent() constructor {
if(_hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_size)) {
draw_sprite_stretched_ext(THEME.node_active, 0, _boxx, yy, grid_size, grid_size, COLORS._main_accent, 1);
if(mouse_press(mb_left, pFOCUS))
DRAGGING = { type : _node.type == FILE_TYPE.collection? "Collection" : "Asset", data : _node }
if(mouse_press(mb_left, pFOCUS)) {
var _typ = "";
switch(_node.type) {
case FILE_TYPE.collection : _typ = "Collection"; break;
case FILE_TYPE.assets : _typ = "Asset"; break;
case FILE_TYPE.project : _typ = "Project"; break;
}
DRAGGING = { type : _typ, data : _node }
}
if(!DEMO && mouse_press(mb_right, pFOCUS)) {
_menu_node = _node;
@ -262,6 +285,7 @@ function Panel_Collection() : PanelContent() constructor {
hh += hght;
yy += hght;
}
} else {
var list_width = _cw;
var list_height = ui(28);
@ -353,7 +377,9 @@ function Panel_Collection() : PanelContent() constructor {
initSize();
folderPane.resize(group_w - ui(8), content_h);
contentPane.resize(content_w - ui(6), content_h);
if(mode == 2) contentPane.resize(w - ui(16), content_h);
else contentPane.resize(content_w - ui(6), content_h);
} #endregion
function setContext(cont) { #region
@ -374,37 +400,48 @@ function Panel_Collection() : PanelContent() constructor {
draw_clear_alpha(COLORS.panel_bg_clear, 1);
var content_y = ui(48);
draw_sprite_stretched(THEME.ui_panel_bg, 1, group_w, content_y, content_w, content_h);
contentPane.setFocusHover(pFOCUS, pHOVER);
contentPane.draw(group_w, content_y, mx - group_w, my - content_y);
folderPane.setFocusHover(pFOCUS, pHOVER);
folderPane.draw(0, content_y, mx, my - content_y);
if(mode == 2) {
var pad = ui(8);
#region resize width
if(group_w_dragging) {
CURSOR = cr_size_we;
draw_sprite_stretched(THEME.ui_panel_bg, 1, pad, content_y, w - pad * 2, content_h);
contentPane.setFocusHover(pFOCUS, pHOVER);
contentPane.draw(pad, content_y, mx - pad, my - content_y);
var _gw = group_w_sx + (mx - group_w_mx);
_gw = max(ui(180), _gw);
group_w = _gw;
} else {
draw_sprite_stretched(THEME.ui_panel_bg, 1, group_w, content_y, content_w, content_h);
contentPane.setFocusHover(pFOCUS, pHOVER);
contentPane.draw(group_w, content_y, mx - group_w, my - content_y);
onResize();
folderPane.setFocusHover(pFOCUS, pHOVER);
folderPane.draw(0, content_y, mx, my - content_y);
if(mouse_release(mb_left)) {
group_w_dragging = false;
#region resize width
if(group_w_dragging) {
CURSOR = cr_size_we;
var _gw = group_w_sx + (mx - group_w_mx);
_gw = max(ui(180), _gw);
group_w = _gw;
onResize();
if(mouse_release(mb_left)) {
group_w_dragging = false;
}
}
}
if(pHOVER && point_in_rectangle(mx, my, group_w - ui(2), content_y, group_w + ui(2), content_y + content_h)) {
CURSOR = cr_size_we;
if(pFOCUS && mouse_press(mb_left)) {
group_w_dragging = true;
group_w_mx = mx;
group_w_sx = group_w;
if(pHOVER && point_in_rectangle(mx, my, group_w - ui(2), content_y, group_w + ui(2), content_y + content_h)) {
CURSOR = cr_size_we;
if(pFOCUS && mouse_press(mb_left)) {
group_w_dragging = true;
group_w_mx = mx;
group_w_sx = group_w;
}
}
}
#endregion
#endregion
}
var _x = ui(20);
var _y = ui(24);
@ -413,11 +450,11 @@ function Panel_Collection() : PanelContent() constructor {
for( var i = 0, n = array_length(roots); i < n; i++ ) {
var r = roots[i];
var b = buttonInstant(THEME.button_hide_fill, _x - ui(8), _y - bh / 2, string_width(r[0]) + ui(20), bh, [mx, my], pFOCUS, pHOVER);
if(b == 2) {
if(buttonInstant(THEME.button_hide_fill, _x - ui(8), _y - bh / 2, string_width(r[0]) + ui(20), bh, [mx, my], pFOCUS, pHOVER) == 2) {
mode = i;
root = r[1];
context = root;
onResize();
}
draw_set_text(f_p0b, fa_left, fa_center, i == mode? COLORS._main_text : COLORS._main_text_sub);

View file

@ -1024,7 +1024,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var _to = value_focus.value_to_loop[i];
array_push(menu, menuItem($"[{_to.junc_in.node.display_name}] {_to.junc_in.getName()}", function(data) {
nodeDelete(data.params.juncTo);
data.params.juncTo.destroy();
}, _to.icon_24,,, { juncTo: _to }));
}
} else {
@ -1089,7 +1089,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(is_instanceof(junction_hovering, Node_Feedback_Inline)) {
var _jun = junction_hovering.junc_out;
array_push(menu, menuItem($"[{_jun.node.display_name}] {_jun.getName()}", function(data) {
nodeDelete(__junction_hovering);
__junction_hovering.destroy();
}, THEME.feedback));
} else {
var _jun = junction_hovering.value_from;
@ -1194,6 +1194,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
for(var i = 0; i < ds_list_size(nodes_list); i++) {
var _node = nodes_list[| i];
if(is_instanceof(_node, Node_Frame)) continue;
try {
var val = _node.drawNode(gr_x, gr_y, mx, my, graph_s, display_parameter);
@ -1439,7 +1440,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(_connect[0] == -9) {
if(_connect[1].value_from_loop != noone)
nodeDelete(_connect[1].value_from_loop);
_connect[1].value_from_loop.destroy();
var menu = [
menuItem("Feedback", function(data) {
@ -2135,7 +2136,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
function doDelete(_merge = false) { #region
__temp_merge = _merge;
array_foreach(nodes_selecting, function(node) { if(node.manual_deletable) nodeDelete(node, __temp_merge); });
array_foreach(nodes_selecting, function(node) { if(node.manual_deletable) node.destroy(__temp_merge); });
nodes_selecting = [];
} #endregion
@ -2184,10 +2185,12 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
node = nodeBuild("Node_Color", mouse_grid_x, mouse_grid_y, getCurrentContext());
node.inputs[| 0].setValue(DRAGGING.data);
break;
case "Palette":
node = nodeBuild("Node_Palette", mouse_grid_x, mouse_grid_y, getCurrentContext());
node.inputs[| 0].setValue(DRAGGING.data);
break;
case "Gradient":
node = nodeBuild("Node_Gradient_Out", mouse_grid_x, mouse_grid_y, getCurrentContext());
node.inputs[| 0].setValue(DRAGGING.data);
@ -2208,17 +2211,21 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
node.inputs[| 0].setValue(DRAGGING.data);
}
break;
case "Bool":
node = nodeBuild("Node_Boolean", mouse_grid_x, mouse_grid_y, getCurrentContext());
node.inputs[| 0].setValue(DRAGGING.data);
break;
case "Text":
node = nodeBuild("Node_String", mouse_grid_x, mouse_grid_y, getCurrentContext());
node.inputs[| 0].setValue(DRAGGING.data);
break;
case "Path":
node = nodeBuild("Node_Path", mouse_grid_x, mouse_grid_y, getCurrentContext());
break;
case "Struct":
node = nodeBuild("Node_Struct", mouse_grid_x, mouse_grid_y, getCurrentContext());
break;
@ -2226,6 +2233,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
case "Asset":
var app = Node_create_Image_path(mouse_grid_x, mouse_grid_y, DRAGGING.data.path);
break;
case "Collection":
var path = DRAGGING.data.path;
nodes_selecting = [];
@ -2255,6 +2263,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
app.y = mouse_grid_y;
}
break;
case "Project":
run_in(1, function(path) { LOAD_PATH(path); }, [ DRAGGING.data.path ]);
break;
}
if(!key_mod_press(SHIFT) && node && struct_has(DRAGGING, "from") && DRAGGING.from.isLeaf()) {

View file

@ -114,11 +114,13 @@ function Panel_Menu() : PanelContent() constructor {
#region //////// MENU ////////
menus = [
[ __txt("File"), menu_file ],
[ __txt("Edit"), [
menuItem(__txt("Undo"), function() { UNDO(); }, THEME.undo, ["", "Undo"]),
menuItem(__txt("Redo"), function() { REDO(); }, THEME.redo, ["", "Redo"]),
menuItem(__txt("History"), function() { dialogPanelCall(new Panel_History()); }),
]],
[ __txt("Preview"), [
menuItem(__txtx("panel_menu_center_preview", "Center preview"), function() { PANEL_PREVIEW.do_fullView = true; }, THEME.icon_center_canvas, ["Preview", "Focus content"]),
menuItem(__txtx("panel_menu_save_current_preview_as", "Save current preview as..."), function() { PANEL_PREVIEW.saveCurrentFrame(); }, noone, ["Preview", "Save current frame"]),
@ -128,6 +130,7 @@ function Panel_Menu() : PanelContent() constructor {
[ s_menu_black, function() { PANEL_PREVIEW.canvas_bg = c_black; } ],
]),
]],
[ __txt("Animation"), [
menuItem(__txtx("panel_menu_animation_setting", "Animation Settings..."), function() {
var dia = dialogPanelCall(new Panel_Animation_Setting());
@ -138,6 +141,7 @@ function Panel_Menu() : PanelContent() constructor {
dialogPanelCall(new Panel_Animation_Scaler());
}, THEME.animation_timing),
]],
[ __txt("Rendering"), [
menuItem(__txtx("panel_menu_render_all_nodes", "Render all nodes"), function() {
RENDER_ALL_REORDER
@ -158,6 +162,7 @@ function Panel_Menu() : PanelContent() constructor {
function() { PREFERENCES.render_all_export = !PREFERENCES.render_all_export; },,,
function() { return PREFERENCES.render_all_export; } ),
]],
[ __txt("Panels"), [
menuItem(__txt("Workspace"), function(_dat) {
var arr = [], lays = [];
@ -218,6 +223,7 @@ function Panel_Menu() : PanelContent() constructor {
]);
} ).setIsShelf(),
]],
[ __txt("Help"), menu_help ],
];
#endregion
@ -638,7 +644,8 @@ function Panel_Menu() : PanelContent() constructor {
}
}
draw_text_int((_x0 + _x1) / 2, (_y0 + _y1) / 2, txt);
draw_text(round((_x0 + _x1) / 2), round((_y0 + _y1) / 2), txt);
_xx1 = _x0 - ui(8);
} else {
var _xx1 = ui(40);
var y1 = h - ui(20);
@ -678,7 +685,7 @@ function Panel_Menu() : PanelContent() constructor {
if(hori) {
tx0 = nx0;
tx1 = w - ui(16);
tx1 = _xx1;
ty0 = 0;
ty1 = h;
tcx = (tx0 + tx1) / 2;

View file

@ -120,7 +120,7 @@ function Panel_Node_Data_Gen() : PanelContent() constructor {
};
}
try { nodeDelete(_b); } catch(e) {}
try { _b.destroy(); } catch(e) {}
_junc.inputs = _jin;
_junc.outputs = _jot;

View file

@ -679,8 +679,8 @@ function Panel_Preview() : PanelContent() constructor {
var _ps1 = is_surface(preview_surfaces[1]);
if(_ps0) {
var _sw = surface_get_width(preview_surfaces[0]);
var _sh = surface_get_height(preview_surfaces[0]);
var _sw = surface_get_width_safe(preview_surfaces[0]);
var _sh = surface_get_height_safe(preview_surfaces[0]);
preview_surface[0] = surface_verify(preview_surface[0], _sw, _sh);
@ -689,13 +689,13 @@ function Panel_Preview() : PanelContent() constructor {
shader_set_i("keys", array_length(PROJECT.attributes.palette));
shader_set_i("alpha", 1);
draw_surface(preview_surfaces[0], 0, 0);
draw_surface_safe(preview_surfaces[0]);
surface_reset_shader();
}
if(_ps1) {
var _sw = surface_get_width(preview_surfaces[1]);
var _sh = surface_get_height(preview_surfaces[1]);
var _sw = surface_get_width_safe(preview_surfaces[1]);
var _sh = surface_get_height_safe(preview_surfaces[1]);
preview_surface[1] = surface_verify(preview_surface[1], _sw, _sh);
@ -704,7 +704,7 @@ function Panel_Preview() : PanelContent() constructor {
shader_set_i("keys", array_length(PROJECT.attributes.palette));
shader_set_i("alpha", 1);
draw_surface(preview_surfaces[1], 0, 0);
draw_surface_safe(preview_surfaces[1]);
surface_reset_shader();
}

View file

@ -5,6 +5,7 @@ function __initTheme() { #region
var root = DIRECTORY + "Themes";
directory_verify(root);
if(check_version($"{root}/version")) {
log_message("THEME", $"unzipping default theme to {root}.");
zip_unzip("data/Theme.zip", root);

View file

@ -1,8 +1,8 @@
function __initSteamUGC() { #region
globalvar STEAM_SUBS, STEAM_COLLECTION, STEAM_PROJECTS;
STEAM_SUBS = ds_list_create();
STEAM_COLLECTION = ds_list_create();
STEAM_PROJECTS = ds_list_create();
STEAM_SUBS = ds_list_create();
STEAM_COLLECTION = ds_list_create();
STEAM_PROJECTS = ds_list_create();
if(DEMO) return;
if(!STEAM_ENABLED) return;

View file

@ -42,7 +42,7 @@ function string_real(val, digMax = 999, decMin = 5) { #region
return s + "]";
}
if(val == 0) return "0";
if(val == 0 || !is_real(val)) return "0";
var pres, p = 1;
var presMax = min(decMin, digMax - ceil(log10(ceil(abs(val)))));

View file

@ -170,6 +170,18 @@
return surface_get_height(s);
} #endregion
function surface_get_format_safe(s, crop = true) { #region
INLINE
if(is_struct(s)) {
if(is_instanceof(s, dynaSurf)) return s.getFormat();
else if(is_instanceof(s, SurfaceAtlas)) return surface_get_format(s.getSurface());
else return surface_rgba8unorm;
}
return surface_get_format(s);
} #endregion
function surface_get_dimension(s) { #region
INLINE

View file

@ -177,9 +177,6 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
}
var guide = function_guide_server(_fn);
o_dialog_textbox_function_guide.dialog_x = rx + cursor_pos_x + 1;
o_dialog_textbox_function_guide.dialog_y = ry + cursor_pos_y - 12;
if(guide != "") {
o_dialog_textbox_function_guide.activate(self);
o_dialog_textbox_function_guide.prompt = guide;
@ -945,6 +942,11 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
o_dialog_textbox_autocomplete.dialog_x = rx + _x + cursor_pos_x + 1;
o_dialog_textbox_autocomplete.dialog_y = ry + _y + cursor_pos_y + line_get_height() + 1;
}
if(o_dialog_textbox_function_guide.textbox == self) {
o_dialog_textbox_function_guide.dialog_x = rx + _x + cursor_pos_x + 1;
o_dialog_textbox_function_guide.dialog_y = ry + _y + cursor_pos_y - 12;
}
#endregion
if(autocomplete_modi && PREFERENCES.widget_autocomplete_delay >= 0 && autocomplete_delay >= PREFERENCES.widget_autocomplete_delay) {

View file

@ -135,6 +135,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
if(WIDGET_CURRENT != self) return;
apply();
if(is_callable(onRelease))
apply(true);
WIDGET_CURRENT = noone;
UNDO_HOLDING = false;
@ -328,6 +331,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
} else
cursor_select = -1;
move_cursor(-cursor);
} else if(keyboard_check_pressed(vk_end)) {
if(key_mod_press(SHIFT)) {
if(cursor_select == -1)
@ -335,13 +339,17 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
} else
cursor_select = -1;
move_cursor(string_length(_input_text) - cursor);
} else if(keyboard_check_pressed(vk_escape)) {
_input_text = _last_text;
deactivate();
} else if(keyboard_check_pressed(vk_enter))
} else if(keyboard_check_pressed(vk_enter)) {
deactivate();
else if(auto_update && (edited || keyboard_check_pressed(vk_anykey)))
} else if(auto_update && (edited || keyboard_check_pressed(vk_anykey))) {
apply();
}
} #endregion
static display_text = function(_x, _y, _text, _w, _m = -1) { #region

View file

@ -16,10 +16,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
link_inactive_color = noone;
tooltip = new tooltipSelector("Axis", [
__txt("Independent"),
__txt("Linked"),
]);
tooltip = new tooltipSelector("Axis", [ __txt("Independent"), __txt("Linked") ]);
onModifyIndex = function(index, val) {
var v = toNumber(val);