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
draw_clear_alpha(c_white, 0);
var hh = 0;
var _hover = sHOVER && content_pane.hover;
var _list = node_list;
var hh = 0;
if(ADD_NODE_PAGE == -2) { #region
var context = PANEL_GRAPH.getCurrentContext();
@ -412,10 +412,7 @@ event_inherited();
var node_count = ds_list_size(_list);
var group_labels = [];
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
var grid_size = ui(64);

View file

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

View file

@ -25,22 +25,28 @@
DIRECTORY = struct_has(PRESIST_PREF, "path")? PRESIST_PREF.path : "";
}
show_debug_message($"Env directory: {DIRECTORY}");
var dir_valid = DIRECTORY != "" && directory_exists(DIRECTORY);
var tmp = file_text_open_write(DIRECTORY + "val_check.txt");
if(DIRECTORY != "") {
var _ch = string_char_last(DIRECTORY);
if(_ch != "\\" && _ch != "/") DIRECTORY += "\\";
if(tmp == -1) {
dir_valid = false;
show_message($"WARNING: Inaccessible main directory ({DIRECTORY}) this may be caused by non existing folder, or Pixel Composer has no permission to open the folder.");
} else {
file_text_close(tmp);
file_delete($"{DIRECTORY}val_check.txt");
}
show_debug_message($"Env directory: {DIRECTORY}");
var dir_valid = DIRECTORY != "" && directory_exists(DIRECTORY);
var tmp = file_text_open_write(DIRECTORY + "val_check.txt");
if(!dir_valid) {
show_debug_message("Invalid directory revert back to default %APPDATA%");
if(tmp == -1) {
dir_valid = false;
show_message($"WARNING: Inaccessible main directory ({DIRECTORY}) this may be caused by non existing folder, or Pixel Composer has no permission to open the folder.");
} else {
file_text_close(tmp);
file_delete($"{DIRECTORY}val_check.txt");
}
if(!dir_valid) {
show_debug_message("Invalid directory revert back to default %APPDATA%");
DIRECTORY = APP_DIRECTORY;
}
} else
DIRECTORY = APP_DIRECTORY;
}
directory_verify(DIRECTORY);
@ -86,6 +92,10 @@
log_message("SESSION", "> init Ins Renderer"); __initInstanceRenderer();
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");
__initPanel();

View file

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

View file

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

View file

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

View file

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

View file

@ -248,7 +248,7 @@ function __initNodes() {
addNodeObject(group, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]).hideRecent();
addNodeObject(group, "Thumbnail", s_node_group_thumbnail, "Node_Group_Thumbnail", [1, Node_Group_Thumbnail]).hideRecent();
#endregion
var iter = ds_list_create(); #region
addNodeCatagory("Loop", iter, ["Node_Iterate"]);
ds_list_add(iter, "Groups");
@ -262,7 +262,7 @@ function __initNodes() {
addNodeObject(iter, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]).hideRecent();
addNodeObject(iter, "Loop amount", s_node_iterator_amount, "Node_Iterator_Length", [1, Node_Iterator_Length]).hideRecent();
#endregion
var itere = ds_list_create(); #region
addNodeCatagory("Loop", itere, ["Node_Iterate_Each"]);
ds_list_add(itere, "Groups");
@ -274,7 +274,7 @@ function __initNodes() {
addNodeObject(itere, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]).hideRecent();
addNodeObject(itere, "Array Length", s_node_iterator_length, "Node_Iterator_Each_Length", [1, Node_Iterator_Each_Length]).hideRecent();
#endregion
var filter = ds_list_create(); #region
addNodeCatagory("Filter", filter, ["Node_Iterate_Filter"]);
ds_list_add(filter, "Groups");
@ -286,7 +286,7 @@ function __initNodes() {
addNodeObject(filter, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]).hideRecent();
addNodeObject(filter, "Array Length", s_node_iterator_length, "Node_Iterator_Each_Length", [1, Node_Iterator_Each_Length]).hideRecent();
#endregion
var feed = ds_list_create(); #region
addNodeCatagory("Feedback", feed, ["Node_Feedback"]);
ds_list_add(feed, "Groups");
@ -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, "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, "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();

View file

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

View file

@ -103,6 +103,7 @@ enum VALUE_DISPLAY {
codeHLSL,
text_array,
text_box,
text_tunnel,
//path
path_save,
@ -1185,6 +1186,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
editWidget.min_lines = 4;
extract_node = "Node_String";
break;
case VALUE_DISPLAY.codeHLSL:
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) {
return setValueDirect(str);
@ -1194,13 +1196,20 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
editWidget.function_guide_server = hlsl_function_guide_server;
editWidget.parser_server = hlsl_document_parser;
editWidget.autocomplete_object = node;
editWidget.font = f_code;
editWidget.format = TEXT_AREA_FORMAT.codeHLSL;
editWidget.min_lines = 4;
extract_node = "Node_String";
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 :
editWidget = new textArrayBox(function() { return animator.values[| 0].value; }, display_data.data, function() { node.doUpdate(); });
break;

View file

@ -3,8 +3,8 @@
SAMPLE_PROJECTS = ds_list_create();
#endregion
function LOAD_FOLDER(list, folder) {
var path = DIRECTORY + "Welcome files/" + folder;
function LOAD_FOLDER(list, folder) { #region
var path = $"{DIRECTORY}Welcome files/{folder}";
var file = file_find_first(path + "/*", fa_directory);
while(file != "") {
@ -25,13 +25,16 @@ function LOAD_FOLDER(list, folder) {
file = file_find_next();
}
file_find_close();
}
} #endregion
function LOAD_SAMPLE() {
function LOAD_SAMPLE() { #region
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, "Sample Projects");
}
} #endregion

View file

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