This commit is contained in:
Tanasart 2023-12-05 19:49:18 +07:00
parent b65a2f685c
commit 591314ab8e
13 changed files with 61 additions and 43 deletions

View file

@ -340,9 +340,9 @@ event_inherited();
content_pane = new scrollPane(dialog_w - category_width - ui(8), dialog_h - ui(66), function(_y, _m) { #region content_pane = new scrollPane(dialog_w - category_width - ui(8), dialog_h - ui(66), function(_y, _m) { #region
draw_clear_alpha(c_white, 0); draw_clear_alpha(c_white, 0);
var hh = 0;
var _hover = sHOVER && content_pane.hover; var _hover = sHOVER && content_pane.hover;
var _list = node_list; var _list = node_list;
var hh = 0;
if(ADD_NODE_PAGE == -2) { #region if(ADD_NODE_PAGE == -2) { #region
var context = PANEL_GRAPH.getCurrentContext(); var context = PANEL_GRAPH.getCurrentContext();
@ -412,10 +412,7 @@ event_inherited();
var node_count = ds_list_size(_list); var node_count = ds_list_size(_list);
var group_labels = []; var group_labels = [];
var _hoverContent = _hover; var _hoverContent = _hover;
//if(ADD_NODE_PAGE >= 0 && PREFERENCES.dialog_add_node_grouping)
// _hoverContent &= _m[1] > ui(8 + 24);
if(PREFERENCES.dialog_add_node_view == 0) { #region grid if(PREFERENCES.dialog_add_node_view == 0) { #region grid
var grid_size = ui(64); var grid_size = ui(64);

View file

@ -1,10 +1,5 @@
/// @description init /// @description init
#region prefload #region prefload
RECENT_LOAD();
LOAD_SAMPLE();
INIT_FOLDERS();
__migration_check(); __migration_check();
if(!file_exists(file_open_parameter) && PREFERENCES.show_splash) if(!file_exists(file_open_parameter) && PREFERENCES.show_splash)

View file

@ -25,6 +25,10 @@
DIRECTORY = struct_has(PRESIST_PREF, "path")? PRESIST_PREF.path : ""; DIRECTORY = struct_has(PRESIST_PREF, "path")? PRESIST_PREF.path : "";
} }
if(DIRECTORY != "") {
var _ch = string_char_last(DIRECTORY);
if(_ch != "\\" && _ch != "/") DIRECTORY += "\\";
show_debug_message($"Env directory: {DIRECTORY}"); show_debug_message($"Env directory: {DIRECTORY}");
var dir_valid = DIRECTORY != "" && directory_exists(DIRECTORY); var dir_valid = DIRECTORY != "" && directory_exists(DIRECTORY);
var tmp = file_text_open_write(DIRECTORY + "val_check.txt"); var tmp = file_text_open_write(DIRECTORY + "val_check.txt");
@ -41,6 +45,8 @@
show_debug_message("Invalid directory revert back to default %APPDATA%"); show_debug_message("Invalid directory revert back to default %APPDATA%");
DIRECTORY = APP_DIRECTORY; DIRECTORY = APP_DIRECTORY;
} }
} else
DIRECTORY = APP_DIRECTORY;
directory_verify(DIRECTORY); directory_verify(DIRECTORY);
@ -86,6 +92,10 @@
log_message("SESSION", "> init Ins Renderer"); __initInstanceRenderer(); log_message("SESSION", "> init Ins Renderer"); __initInstanceRenderer();
log_message("SESSION", "> init Addons"); loadAddon(); log_message("SESSION", "> init Addons"); loadAddon();
log_message("SESSION", "> init sample"); LOAD_SAMPLE();
log_message("SESSION", "> init folders"); INIT_FOLDERS();
log_message("SESSION", "> init recents"); RECENT_LOAD();
log_message("SESSION", ">> Initialization complete"); log_message("SESSION", ">> Initialization complete");
__initPanel(); __initPanel();

View file

@ -1,4 +1,6 @@
function directory_verify(path) { function directory_verify(path) {
INLINE
if(directory_exists(path)) return; if(directory_exists(path)) return;
directory_create(path); directory_create(path);
} }

View file

@ -142,10 +142,8 @@
#region presets #region presets
function INIT_FOLDERS() { function INIT_FOLDERS() {
if(!directory_exists(DIRECTORY + "Palettes")) directory_verify(DIRECTORY + "Palettes");
directory_create(DIRECTORY + "Palettes"); directory_verify(DIRECTORY + "Gradients");
if(!directory_exists(DIRECTORY + "Gradients"))
directory_create(DIRECTORY + "Gradients");
} }
#endregion #endregion

View file

@ -1,9 +1,10 @@
function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Group Input"; name = "Group Input";
color = COLORS.node_blend_collection; color = COLORS.node_blend_collection;
preview_draw = false;
is_group_io = true; is_group_io = true;
destroy_when_upgroup = true;
destroy_when_upgroup = true;
inParent = undefined; inParent = undefined;
attributes.input_priority = 0; attributes.input_priority = 0;

View file

@ -1,6 +1,7 @@
function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Group Output"; name = "Group Output";
color = COLORS.node_blend_collection; color = COLORS.node_blend_collection;
preview_draw = false;
is_group_io = true; is_group_io = true;
destroy_when_upgroup = true; destroy_when_upgroup = true;

View file

@ -981,7 +981,7 @@ function __initNodes() {
addNodeObject(hid, "Onion Skin", s_node_cache, "Node_Onion_Skin", [1, Node_Onion_Skin]).setVersion(1147).hideRecent(); addNodeObject(hid, "Onion Skin", s_node_cache, "Node_Onion_Skin", [1, Node_Onion_Skin]).setVersion(1147).hideRecent();
//addNodeObject(hid, "Pixel Builder", s_node_pixel_builder, "Node_Pixel_Builder", [1, Node_Pixel_Builder]).setVersion(1150).hideRecent(); //addNodeObject(hid, "Pixel Builder", s_node_pixel_builder, "Node_Pixel_Builder", [1, Node_Pixel_Builder]).setVersion(1150).hideRecent();
ds_list_add(values, "DynaSurf"); ds_list_add(hid, "DynaSurf");
addNodeObject(hid, "Input", s_node_pixel_builder, "Node_DynaSurf_In", [1, Node_DynaSurf_In]).hideRecent(); addNodeObject(hid, "Input", s_node_pixel_builder, "Node_DynaSurf_In", [1, Node_DynaSurf_In]).hideRecent();
addNodeObject(hid, "Output", s_node_pixel_builder, "Node_DynaSurf_Out", [1, Node_DynaSurf_Out]).hideRecent(); addNodeObject(hid, "Output", s_node_pixel_builder, "Node_DynaSurf_Out", [1, Node_DynaSurf_Out]).hideRecent();
addNodeObject(hid, "getWidth", s_node_pixel_builder, "Node_DynaSurf_Out_Width", [1, Node_DynaSurf_Out_Width]).hideRecent(); addNodeObject(hid, "getWidth", s_node_pixel_builder, "Node_DynaSurf_Out_Width", [1, Node_DynaSurf_Out_Width]).hideRecent();

View file

@ -7,6 +7,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
w = 96; w = 96;
inputs[| 0] = nodeValue("Name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) inputs[| 0] = nodeValue("Name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" )
.setDisplay(VALUE_DISPLAY.text_tunnel)
.rejectArray(); .rejectArray();
inputs[| 1] = nodeValue("Value in", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, noone ) inputs[| 1] = nodeValue("Value in", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, noone )

View file

@ -7,6 +7,7 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
w = 96; w = 96;
inputs[| 0] = nodeValue("Name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ) inputs[| 0] = nodeValue("Name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" )
.setDisplay(VALUE_DISPLAY.text_tunnel)
.rejectArray(); .rejectArray();
outputs[| 0] = nodeValue("Value out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, noone ); outputs[| 0] = nodeValue("Value out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, noone );

View file

@ -103,6 +103,7 @@ enum VALUE_DISPLAY {
codeHLSL, codeHLSL,
text_array, text_array,
text_box, text_box,
text_tunnel,
//path //path
path_save, path_save,
@ -1185,6 +1186,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
editWidget.min_lines = 4; editWidget.min_lines = 4;
extract_node = "Node_String"; extract_node = "Node_String";
break; break;
case VALUE_DISPLAY.codeHLSL: case VALUE_DISPLAY.codeHLSL:
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { editWidget = new textArea(TEXTBOX_INPUT.text, function(str) {
return setValueDirect(str); return setValueDirect(str);
@ -1201,6 +1203,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
extract_node = "Node_String"; extract_node = "Node_String";
break; break;
case VALUE_DISPLAY.text_tunnel :
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) {
return setValueDirect(str);
});
extract_node = "Node_String";
break;
case VALUE_DISPLAY.text_array : case VALUE_DISPLAY.text_array :
editWidget = new textArrayBox(function() { return animator.values[| 0].value; }, display_data.data, function() { node.doUpdate(); }); editWidget = new textArrayBox(function() { return animator.values[| 0].value; }, display_data.data, function() { node.doUpdate(); });
break; break;

View file

@ -3,8 +3,8 @@
SAMPLE_PROJECTS = ds_list_create(); SAMPLE_PROJECTS = ds_list_create();
#endregion #endregion
function LOAD_FOLDER(list, folder) { function LOAD_FOLDER(list, folder) { #region
var path = DIRECTORY + "Welcome files/" + folder; var path = $"{DIRECTORY}Welcome files/{folder}";
var file = file_find_first(path + "/*", fa_directory); var file = file_find_first(path + "/*", fa_directory);
while(file != "") { while(file != "") {
@ -25,13 +25,16 @@ function LOAD_FOLDER(list, folder) {
file = file_find_next(); file = file_find_next();
} }
file_find_close(); file_find_close();
} } #endregion
function LOAD_SAMPLE() { function LOAD_SAMPLE() { #region
ds_list_clear(SAMPLE_PROJECTS); ds_list_clear(SAMPLE_PROJECTS);
var zzip = "Welcome files.zip";
var targ = $"{DIRECTORY}Welcome files";
zip_unzip("Welcome files.zip", DIRECTORY + "Welcome files") directory_verify(targ);
zip_unzip(zzip, targ);
LOAD_FOLDER(SAMPLE_PROJECTS, "Getting started"); LOAD_FOLDER(SAMPLE_PROJECTS, "Getting started");
LOAD_FOLDER(SAMPLE_PROJECTS, "Sample Projects"); LOAD_FOLDER(SAMPLE_PROJECTS, "Sample Projects");
} } #endregion

View file

@ -1,10 +1,10 @@
function value_snap_real(val, snap = 1) { function value_snap_real(val, snap = 1) {
gml_pragma("forceinline") INLINE
return snap == 0? val : round(val / snap) * snap; return snap == 0? val : round(val / snap) * snap;
} }
function value_snap(val, snap = 1) { function value_snap(val, snap = 1) {
gml_pragma("forceinline") INLINE
if(!is_array(val)) if(!is_array(val))
return value_snap_real(val, snap); return value_snap_real(val, snap);