1.16rc5 again

This commit is contained in:
Tanasart 2023-11-27 20:50:20 +07:00
parent 27c9c6fb8d
commit ac0be33bee
16 changed files with 48 additions and 54 deletions

View file

@ -12,7 +12,7 @@ event_inherited();
destroy_on_click_out = false; destroy_on_click_out = false;
meta = METADATA.clone(); meta = PROJECT.meta.clone();
meta_expand = false; meta_expand = false;
updating = noone; updating = noone;
update_note = "Updated"; update_note = "Updated";

View file

@ -9,8 +9,6 @@
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_icon); draw_set_text(f_p0, fa_left, fa_center, COLORS._main_icon);
draw_text_add(dialog_x + ui(16), dialog_y + ui(32), __txt("Name")); draw_text_add(dialog_x + ui(16), dialog_y + ui(32), __txt("Name"));
//var is_author = !meta.steam || meta.author_steam_id == 0 || meta.author_steam_id == STEAM_USER_ID;
t_desc.interactable = !STEAM_UGC_ITEM_UPLOADING; t_desc.interactable = !STEAM_UGC_ITEM_UPLOADING;
t_auth.interactable = !STEAM_UGC_ITEM_UPLOADING; t_auth.interactable = !STEAM_UGC_ITEM_UPLOADING;
t_cont.interactable = !STEAM_UGC_ITEM_UPLOADING; t_cont.interactable = !STEAM_UGC_ITEM_UPLOADING;

View file

@ -150,9 +150,11 @@ event_inherited();
if(mouse_press(mb_left, sFOCUS)) { if(mouse_press(mb_left, sFOCUS)) {
LOAD_PATH(_project.path, true); LOAD_PATH(_project.path, true);
PROJECT.thumbnail = _project.spr_path[0]; PROJECT.thumbnail = _project.spr_path[0];
METADATA.steam = txt == "Workshop";
if(txt == "Workshop") if(txt == "Workshop") {
METADATA.file_id = _meta.file_id; PROJECT.meta.file_id = _meta.file_id;
PROJECT.meta.steam = FILE_STEAM_TYPE.steamOpen;
}
instance_destroy(); instance_destroy();
} }
} }

View file

@ -44,7 +44,6 @@
directory_verify(DIRECTORY); directory_verify(DIRECTORY);
//directory_set_current_working(DIRECTORY); //directory_set_current_working(DIRECTORY);
METADATA = __getdefaultMetaData();
APP_LOCATION = program_directory; APP_LOCATION = program_directory;
if(string_pos("GameMakerStudio2\\Cache\\runtimes", APP_LOCATION)) if(string_pos("GameMakerStudio2\\Cache\\runtimes", APP_LOCATION))
APP_LOCATION = working_directory; APP_LOCATION = working_directory;

View file

@ -109,6 +109,7 @@ _HOVERING_ELEMENT = noone;
} }
} }
if(LAST_FRAME) RENDERING = [];
UPDATE = RENDER_TYPE.none; UPDATE = RENDER_TYPE.none;
#endregion #endregion

View file

@ -140,7 +140,7 @@ function __LOAD_PATH(path, readonly = false, override = false) { #region
try { try {
if(struct_has(_load_content, "metadata")) if(struct_has(_load_content, "metadata"))
METADATA.deserialize(_load_content.metadata); PROJECT.meta.deserialize(_load_content.metadata);
} catch(e) { } catch(e) {
log_warning("LOAD, metadata", exception_print(e)); log_warning("LOAD, metadata", exception_print(e));
} }

View file

@ -7,6 +7,12 @@
collection, collection,
assets assets
} }
enum FILE_STEAM_TYPE {
local,
steamUpload,
steamOpen
}
#endregion #endregion
function MetaDataManager() constructor { function MetaDataManager() constructor {
@ -20,7 +26,7 @@ function MetaDataManager() constructor {
file_id = 0; file_id = 0;
tags = []; tags = [];
version = SAVE_VERSION; version = SAVE_VERSION;
steam = false; steam = FILE_STEAM_TYPE.local;
static displays = [ static displays = [
[ "Description", function(meta) { return meta.description; } , line_get_height() * 5], [ "Description", function(meta) { return meta.description; } , line_get_height() * 5],
@ -54,8 +60,6 @@ function MetaDataManager() constructor {
tags = struct_try_get(m, "tags", tags); tags = struct_try_get(m, "tags", tags);
version = struct_try_get(m, "version", version); version = struct_try_get(m, "version", version);
//if(STEAM_ENABLED && author_steam_id == STEAM_USER_ID) steam = true;
return self; return self;
} }
@ -225,9 +229,6 @@ function MetaDataManager() constructor {
} }
#region #region
globalvar METADATA;
METADATA = noone;
function __getdefaultMetaData() { function __getdefaultMetaData() {
var meta = new MetaDataManager(); var meta = new MetaDataManager();
var path = DIRECTORY + "meta.json"; var path = DIRECTORY + "meta.json";

View file

@ -309,7 +309,6 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
cmd += "-bgcolor 0,0,0,0 "; cmd += "-bgcolor 0,0,0,0 ";
cmd += "-o " + string_quote(target_path); cmd += "-o " + string_quote(target_path);
array_remove(RENDERING, node_id);
render_process_id = shell_execute_async(webp, cmd, self); render_process_id = shell_execute_async(webp, cmd, self);
render_type = "webp"; render_type = "webp";
render_target = target_path; render_target = target_path;
@ -330,8 +329,6 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var loop_str = loop? 0 : 1; var loop_str = loop? 0 : 1;
var use_gifski = false; var use_gifski = false;
array_remove(RENDERING, node_id);
if(use_gifski) { if(use_gifski) {
var shell_cmd = $"-o {string_quote(target_path)} -r {rate} --repeat {loop_str} -Q {qual} {string_quote(temp_path)}"; var shell_cmd = $"-o {string_quote(target_path)} -r {rate} --repeat {loop_str} -Q {qual} {string_quote(temp_path)}";
@ -364,7 +361,6 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var shell_cmd = $"-hide_banner -loglevel quiet -framerate {rate} -i \"{temp_path}%05d.png\" -c:v libx264 -r {rate} -pix_fmt yuv420p {string_quote(target_path)}"; var shell_cmd = $"-hide_banner -loglevel quiet -framerate {rate} -i \"{temp_path}%05d.png\" -c:v libx264 -r {rate} -pix_fmt yuv420p {string_quote(target_path)}";
print($"{ffmpeg} {shell_cmd}") print($"{ffmpeg} {shell_cmd}")
array_remove(RENDERING, node_id);
render_process_id = shell_execute_async(ffmpeg, shell_cmd, self); render_process_id = shell_execute_async(ffmpeg, shell_cmd, self);
render_type = "mp4"; render_type = "mp4";
render_target = target_path; render_target = target_path;
@ -675,9 +671,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var form = getInputData(3); var form = getInputData(3);
if(form == NODE_EXPORT_FORMAT.single) { if(form == NODE_EXPORT_FORMAT.single) {
array_push(RENDERING, node_id);
Render(); Render();
array_remove(RENDERING, node_id);
export(); export();
updatedOutTrigger.setValue(true); updatedOutTrigger.setValue(true);
@ -748,11 +742,6 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer); noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer);
PANEL_MENU.setNotiIcon(THEME.noti_icon_tick); PANEL_MENU.setNotiIcon(THEME.noti_icon_tick);
render_process_id = 0; render_process_id = 0;
array_remove(RENDERING, node_id);
} else {
//var stdOut = ExecutedProcessReadFromStandardOutput(render_process_id);
//print(stdOut);
} }
} }
} #endregion } #endregion
@ -774,9 +763,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
export(); export();
if(LAST_FRAME) { if(LAST_FRAME) {
if(anim == NODE_EXPORT_FORMAT.sequence) if(anim == NODE_EXPORT_FORMAT.animation)
array_remove(RENDERING, node_id);
else if(anim == NODE_EXPORT_FORMAT.animation)
renderCompleted(); renderCompleted();
} }
} #endregion } #endregion

View file

@ -70,10 +70,6 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
update_on_frame = grup == 0; update_on_frame = grup == 0;
} #endregion } #endregion
static postProcess = function(frame = CURRENT_FRAME) {
if(LAST_FRAME) array_remove(RENDERING, node_id);
}
static update = function(frame = CURRENT_FRAME) { #region static update = function(frame = CURRENT_FRAME) { #region
var inpt = getInputData(0); var inpt = getInputData(0);
var grup = getInputData(1); var grup = getInputData(1);

View file

@ -82,7 +82,7 @@ function Panel_Collection() : PanelContent() constructor {
} }
if(STEAM_ENABLED) { if(STEAM_ENABLED) {
if(!meta.steam) { if(meta.steam == FILE_STEAM_TYPE.local) {
array_push(contentMenu, menuItem(__txtx("panel_collection_workshop_upload", "Upload to Steam Workshop") + "...", function() { array_push(contentMenu, menuItem(__txtx("panel_collection_workshop_upload", "Upload to Steam Workshop") + "...", function() {
var dia = dialogCall(o_dialog_file_name_collection, mouse_mx + ui(8), mouse_my + ui(-320)); var dia = dialogCall(o_dialog_file_name_collection, mouse_mx + ui(8), mouse_my + ui(-320));
var meta = _menu_node.getMetadata(); var meta = _menu_node.getMetadata();

View file

@ -206,7 +206,7 @@ function Panel_Inspector() : PanelContent() constructor {
var _hover = pHOVER && contentPane.hover; var _hover = pHOVER && contentPane.hover;
var context = PANEL_GRAPH.getCurrentContext(); var context = PANEL_GRAPH.getCurrentContext();
var meta = context == noone? METADATA : context.metadata; var meta = context == noone? PROJECT.meta : context.metadata;
if(meta == noone) return 0; if(meta == noone) return 0;
current_meta = meta; current_meta = meta;
@ -815,12 +815,17 @@ function Panel_Inspector() : PanelContent() constructor {
draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text); draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text);
draw_text_add(w / 2, ui(30), txt); draw_text_add(w / 2, ui(30), txt);
if(PROJECT.meta.steam == FILE_STEAM_TYPE.steamOpen) {
var _tw = string_width(txt) / 2;
draw_sprite_ui(THEME.steam, 0, w / 2 - _tw - ui(16), ui(32),,,, COLORS._main_icon);
}
var bx = w - ui(44); var bx = w - ui(44);
var by = ui(12); var by = ui(12);
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_set_default", "Set Metadata as default"), THEME.save, 0, COLORS._main_icon) == 2) { if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_set_default", "Set Metadata as default"), THEME.save, 0, COLORS._main_icon) == 2) {
var path = DIRECTORY + "meta.json"; var path = DIRECTORY + "meta.json";
json_save_struct(path, METADATA.serialize()); json_save_struct(path, PROJECT.meta.serialize());
} }
by += ui(36); by += ui(36);
@ -828,12 +833,12 @@ function Panel_Inspector() : PanelContent() constructor {
if(PROJECT.path == "") { if(PROJECT.path == "") {
buttonInstant(noone, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_save", "Save file before upload"), THEME.workshop_upload, 0, COLORS._main_icon, 0.5); buttonInstant(noone, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_save", "Save file before upload"), THEME.workshop_upload, 0, COLORS._main_icon, 0.5);
} else { } else {
if(!METADATA.steam) { //project made locally if(PROJECT.meta.steam == FILE_STEAM_TYPE.local) { //project made locally
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_upload", "Upload to Steam Workshop"), THEME.workshop_upload, 0, COLORS._main_icon) == 2) { if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_upload", "Upload to Steam Workshop"), THEME.workshop_upload, 0, COLORS._main_icon) == 2) {
var s = PANEL_PREVIEW.getNodePreviewSurface(); var s = PANEL_PREVIEW.getNodePreviewSurface();
if(is_surface(s)) { if(is_surface(s)) {
METADATA.author_steam_id = STEAM_USER_ID; PROJECT.meta.author_steam_id = STEAM_USER_ID;
METADATA.steam = true; PROJECT.meta.steam = FILE_STEAM_TYPE.steamUpload;
SAVE_AT(PROJECT, PROJECT.path); SAVE_AT(PROJECT, PROJECT.path);
steam_ugc_create_project(); steam_ugc_create_project();
@ -843,8 +848,8 @@ function Panel_Inspector() : PanelContent() constructor {
} }
} }
if(METADATA.steam && METADATA.author_steam_id == STEAM_USER_ID) { if(PROJECT.meta.steam && PROJECT.meta.author_steam_id == STEAM_USER_ID) {
if(METADATA.file_id == 0) { if(PROJECT.meta.steam == FILE_STEAM_TYPE.steamUpload) {
buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], false, pHOVER, __txtx("panel_inspector_workshop_restart", "Open project from the workshop tab to update."), THEME.workshop_update, 0, COLORS._main_icon); buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], false, pHOVER, __txtx("panel_inspector_workshop_restart", "Open project from the workshop tab to update."), THEME.workshop_update, 0, COLORS._main_icon);
} else if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_update", "Update Steam Workshop content"), THEME.workshop_update, 0, COLORS._main_icon) == 2) { } else if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_update", "Update Steam Workshop content"), THEME.workshop_update, 0, COLORS._main_icon) == 2) {
SAVE_AT(PROJECT, PROJECT.path); SAVE_AT(PROJECT, PROJECT.path);

View file

@ -6,6 +6,7 @@
function Project() constructor { function Project() constructor {
active = true; /// @is {bool} active = true; /// @is {bool}
meta = __getdefaultMetaData();
path = ""; /// @is {string} path = ""; /// @is {string}
thumbnail = ""; thumbnail = "";
version = SAVE_VERSION; /// @is {number} version = SAVE_VERSION; /// @is {number}

View file

@ -32,7 +32,7 @@ function save_serialize(project = PROJECT, _outMap = false) { #region
_anim_map.framerate = project.animator.framerate; _anim_map.framerate = project.animator.framerate;
_map.animator = _anim_map; _map.animator = _anim_map;
_map.metadata = METADATA.serialize(); _map.metadata = PROJECT.meta.serialize();
_map.global_node = project.globalNode.serialize(); _map.global_node = project.globalNode.serialize();
_map.onion_skin = project.onion_skin; _map.onion_skin = project.onion_skin;
@ -110,8 +110,8 @@ function SAVE_AT(project = PROJECT, path = "", log = "save at ") { #region
if(DEMO) return false; if(DEMO) return false;
SAVING = true; SAVING = true;
if(TESTING && string_char_at(filename_name(path), 1) != "[") //if(TESTING && string_char_at(filename_name(path), 1) != "[")
path = $"{filename_dir(path)}/[{VERSION_STRING}] {filename_name(path)}"; // path = $"{filename_dir(path)}/[{VERSION_STRING}] {filename_name(path)}";
if(file_exists(path)) file_delete(path); if(file_exists(path)) file_delete(path);
file_text_write_all(path, save_serialize(project)); file_text_write_all(path, save_serialize(project));

View file

@ -73,7 +73,7 @@ function __loadSteamUGCCollection(file_id, f, path) {
ds_list_add(STEAM_COLLECTION, file); ds_list_add(STEAM_COLLECTION, file);
var meta = file.getMetadata(); var meta = file.getMetadata();
meta.steam = true; meta.steam = FILE_STEAM_TYPE.steamOpen;
meta.file_id = file_id; meta.file_id = file_id;
} }
@ -86,6 +86,6 @@ function __loadSteamUGCProject(file_id, f, path) {
ds_list_add(STEAM_PROJECTS, file); ds_list_add(STEAM_PROJECTS, file);
var meta = file.getMetadata(); var meta = file.getMetadata();
meta.steam = true; meta.steam = FILE_STEAM_TYPE.steamOpen;
meta.file_id = file_id; meta.file_id = file_id;
} }

View file

@ -2,7 +2,7 @@ function steam_ugc_create_project() { #region
if(STEAM_UGC_ITEM_UPLOADING) return; if(STEAM_UGC_ITEM_UPLOADING) return;
var file = new FileObject(string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""), PROJECT.path); var file = new FileObject(string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""), PROJECT.path);
file.meta = METADATA; file.meta = PROJECT.meta;
file.spr_path[0] = DIRECTORY + "steamUGC/thumbnail.png"; file.spr_path[0] = DIRECTORY + "steamUGC/thumbnail.png";
STEAM_UGC_UPDATE = false; STEAM_UGC_UPDATE = false;
@ -10,7 +10,9 @@ function steam_ugc_create_project() { #region
STEAM_UGC_ITEM_FILE = file; STEAM_UGC_ITEM_FILE = file;
STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.project; STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.project;
directory_verify(DIRECTORY + "steamUGC"); directory_destroy(DIRECTORY + "steamUGC");
directory_create(DIRECTORY + "steamUGC");
file_copy(file.path, DIRECTORY + "steamUGC/" + filename_name(file.path)); file_copy(file.path, DIRECTORY + "steamUGC/" + filename_name(file.path));
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface(); var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
@ -23,15 +25,17 @@ function steam_ugc_create_project() { #region
function steam_ugc_update_project(update_preview = false, update_note = "Updated") { #region function steam_ugc_update_project(update_preview = false, update_note = "Updated") { #region
if(STEAM_UGC_ITEM_UPLOADING) return; if(STEAM_UGC_ITEM_UPLOADING) return;
var file = new FileObject(string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""), PROJECT.path); var file = new FileObject(filename_name_only(PROJECT.path), PROJECT.path);
file.meta = METADATA; file.meta = PROJECT.meta;
STEAM_UGC_UPDATE = true; STEAM_UGC_UPDATE = true;
STEAM_UGC_ITEM_UPLOADING = true; STEAM_UGC_ITEM_UPLOADING = true;
STEAM_UGC_ITEM_FILE = file; STEAM_UGC_ITEM_FILE = file;
STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.project; STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.project;
directory_verify(DIRECTORY + "steamUGC"); directory_destroy(DIRECTORY + "steamUGC");
directory_create(DIRECTORY + "steamUGC");
file_copy(file.path, DIRECTORY + "steamUGC/" + filename_name(file.path)); file_copy(file.path, DIRECTORY + "steamUGC/" + filename_name(file.path));
if(file_exists(PROJECT.thumbnail)) if(file_exists(PROJECT.thumbnail))
file_copy(PROJECT.thumbnail, DIRECTORY + "steamUGC/thumbnail.png"); file_copy(PROJECT.thumbnail, DIRECTORY + "steamUGC/thumbnail.png");
@ -39,7 +43,7 @@ function steam_ugc_update_project(update_preview = false, update_note = "Updated
STEAM_UGC_PUBLISH_ID = file.meta.file_id; STEAM_UGC_PUBLISH_ID = file.meta.file_id;
STEAM_UGC_UPDATE_HANDLE = steam_ugc_start_item_update(STEAM_APP_ID, STEAM_UGC_PUBLISH_ID); STEAM_UGC_UPDATE_HANDLE = steam_ugc_start_item_update(STEAM_APP_ID, STEAM_UGC_PUBLISH_ID);
steam_ugc_set_item_title(STEAM_UGC_UPDATE_HANDLE, STEAM_UGC_ITEM_FILE.meta.name); steam_ugc_set_item_title(STEAM_UGC_UPDATE_HANDLE, STEAM_UGC_ITEM_FILE.name);
steam_ugc_set_item_description(STEAM_UGC_UPDATE_HANDLE, STEAM_UGC_ITEM_FILE.meta.description); steam_ugc_set_item_description(STEAM_UGC_UPDATE_HANDLE, STEAM_UGC_ITEM_FILE.meta.description);
var tgs = STEAM_UGC_ITEM_FILE.meta.tags; var tgs = STEAM_UGC_ITEM_FILE.meta.tags;
@ -47,7 +51,7 @@ function steam_ugc_update_project(update_preview = false, update_note = "Updated
array_insert_unique(tgs, 0, "Project"); array_insert_unique(tgs, 0, "Project");
array_push_unique(tgs, VERSION_STRING); array_push_unique(tgs, VERSION_STRING);
steam_ugc_collection_generate(PROJECT.thumbnail); steam_ugc_project_generate(PROJECT.thumbnail);
steam_ugc_set_item_tags(STEAM_UGC_UPDATE_HANDLE, tgs); steam_ugc_set_item_tags(STEAM_UGC_UPDATE_HANDLE, tgs);
steam_ugc_set_item_content(STEAM_UGC_UPDATE_HANDLE, DIRECTORY + "steamUGC"); steam_ugc_set_item_content(STEAM_UGC_UPDATE_HANDLE, DIRECTORY + "steamUGC");

View file

@ -165,7 +165,7 @@ function __test_metadata_current_collections() { #region
print("---------- COLLECTION UPDATING STARTED ----------"); print("---------- COLLECTION UPDATING STARTED ----------");
var sel = PANEL_GRAPH.getFocusingNode(), outj = noone; var sel = PANEL_GRAPH.getFocusingNode(), outj = noone;
var _meta = METADATA.serialize(); var _meta = PROJECT.meta.serialize();
if(sel != noone) outj = sel.outputs[| 0]; if(sel != noone) outj = sel.outputs[| 0];
while(!ds_stack_empty(st)) { while(!ds_stack_empty(st)) {