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;
meta = METADATA.clone();
meta = PROJECT.meta.clone();
meta_expand = false;
updating = noone;
update_note = "Updated";

View File

@ -8,9 +8,7 @@
#region draw TB
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"));
//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_auth.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)) {
LOAD_PATH(_project.path, true);
PROJECT.thumbnail = _project.spr_path[0];
METADATA.steam = txt == "Workshop";
if(txt == "Workshop")
METADATA.file_id = _meta.file_id;
if(txt == "Workshop") {
PROJECT.meta.file_id = _meta.file_id;
PROJECT.meta.steam = FILE_STEAM_TYPE.steamOpen;
}
instance_destroy();
}
}

View File

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

View File

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

View File

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

View File

@ -7,6 +7,12 @@
collection,
assets
}
enum FILE_STEAM_TYPE {
local,
steamUpload,
steamOpen
}
#endregion
function MetaDataManager() constructor {
@ -20,7 +26,7 @@ function MetaDataManager() constructor {
file_id = 0;
tags = [];
version = SAVE_VERSION;
steam = false;
steam = FILE_STEAM_TYPE.local;
static displays = [
[ "Description", function(meta) { return meta.description; } , line_get_height() * 5],
@ -54,8 +60,6 @@ function MetaDataManager() constructor {
tags = struct_try_get(m, "tags", tags);
version = struct_try_get(m, "version", version);
//if(STEAM_ENABLED && author_steam_id == STEAM_USER_ID) steam = true;
return self;
}
@ -225,9 +229,6 @@ function MetaDataManager() constructor {
}
#region
globalvar METADATA;
METADATA = noone;
function __getdefaultMetaData() {
var meta = new MetaDataManager();
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 += "-o " + string_quote(target_path);
array_remove(RENDERING, node_id);
render_process_id = shell_execute_async(webp, cmd, self);
render_type = "webp";
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 use_gifski = false;
array_remove(RENDERING, node_id);
if(use_gifski) {
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)}";
print($"{ffmpeg} {shell_cmd}")
array_remove(RENDERING, node_id);
render_process_id = shell_execute_async(ffmpeg, shell_cmd, self);
render_type = "mp4";
render_target = target_path;
@ -675,9 +671,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var form = getInputData(3);
if(form == NODE_EXPORT_FORMAT.single) {
array_push(RENDERING, node_id);
Render();
array_remove(RENDERING, node_id);
export();
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);
PANEL_MENU.setNotiIcon(THEME.noti_icon_tick);
render_process_id = 0;
array_remove(RENDERING, node_id);
} else {
//var stdOut = ExecutedProcessReadFromStandardOutput(render_process_id);
//print(stdOut);
}
}
} #endregion
@ -774,9 +763,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
export();
if(LAST_FRAME) {
if(anim == NODE_EXPORT_FORMAT.sequence)
array_remove(RENDERING, node_id);
else if(anim == NODE_EXPORT_FORMAT.animation)
if(anim == NODE_EXPORT_FORMAT.animation)
renderCompleted();
}
} #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;
} #endregion
static postProcess = function(frame = CURRENT_FRAME) {
if(LAST_FRAME) array_remove(RENDERING, node_id);
}
static update = function(frame = CURRENT_FRAME) { #region
var inpt = getInputData(0);
var grup = getInputData(1);

View File

@ -82,7 +82,7 @@ function Panel_Collection() : PanelContent() constructor {
}
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() {
var dia = dialogCall(o_dialog_file_name_collection, mouse_mx + ui(8), mouse_my + ui(-320));
var meta = _menu_node.getMetadata();

View File

@ -206,7 +206,7 @@ function Panel_Inspector() : PanelContent() constructor {
var _hover = pHOVER && contentPane.hover;
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;
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_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 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) {
var path = DIRECTORY + "meta.json";
json_save_struct(path, METADATA.serialize());
json_save_struct(path, PROJECT.meta.serialize());
}
by += ui(36);
@ -828,12 +833,12 @@ function Panel_Inspector() : PanelContent() constructor {
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);
} 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) {
var s = PANEL_PREVIEW.getNodePreviewSurface();
if(is_surface(s)) {
METADATA.author_steam_id = STEAM_USER_ID;
METADATA.steam = true;
PROJECT.meta.author_steam_id = STEAM_USER_ID;
PROJECT.meta.steam = FILE_STEAM_TYPE.steamUpload;
SAVE_AT(PROJECT, PROJECT.path);
steam_ugc_create_project();
@ -843,8 +848,8 @@ function Panel_Inspector() : PanelContent() constructor {
}
}
if(METADATA.steam && METADATA.author_steam_id == STEAM_USER_ID) {
if(METADATA.file_id == 0) {
if(PROJECT.meta.steam && PROJECT.meta.author_steam_id == STEAM_USER_ID) {
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);
} 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);

View File

@ -6,6 +6,7 @@
function Project() constructor {
active = true; /// @is {bool}
meta = __getdefaultMetaData();
path = ""; /// @is {string}
thumbnail = "";
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;
_map.animator = _anim_map;
_map.metadata = METADATA.serialize();
_map.metadata = PROJECT.meta.serialize();
_map.global_node = project.globalNode.serialize();
_map.onion_skin = project.onion_skin;
@ -110,8 +110,8 @@ function SAVE_AT(project = PROJECT, path = "", log = "save at ") { #region
if(DEMO) return false;
SAVING = true;
if(TESTING && string_char_at(filename_name(path), 1) != "[")
path = $"{filename_dir(path)}/[{VERSION_STRING}] {filename_name(path)}";
//if(TESTING && string_char_at(filename_name(path), 1) != "[")
// path = $"{filename_dir(path)}/[{VERSION_STRING}] {filename_name(path)}";
if(file_exists(path)) file_delete(path);
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);
var meta = file.getMetadata();
meta.steam = true;
meta.steam = FILE_STEAM_TYPE.steamOpen;
meta.file_id = file_id;
}
@ -86,6 +86,6 @@ function __loadSteamUGCProject(file_id, f, path) {
ds_list_add(STEAM_PROJECTS, file);
var meta = file.getMetadata();
meta.steam = true;
meta.steam = FILE_STEAM_TYPE.steamOpen;
meta.file_id = file_id;
}

View File

@ -2,7 +2,7 @@ function steam_ugc_create_project() { #region
if(STEAM_UGC_ITEM_UPLOADING) return;
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";
STEAM_UGC_UPDATE = false;
@ -10,7 +10,9 @@ function steam_ugc_create_project() { #region
STEAM_UGC_ITEM_FILE = file;
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));
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
if(STEAM_UGC_ITEM_UPLOADING) return;
var file = new FileObject(string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""), PROJECT.path);
file.meta = METADATA;
var file = new FileObject(filename_name_only(PROJECT.path), PROJECT.path);
file.meta = PROJECT.meta;
STEAM_UGC_UPDATE = true;
STEAM_UGC_ITEM_UPLOADING = true;
STEAM_UGC_ITEM_FILE = file;
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));
if(file_exists(PROJECT.thumbnail))
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_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);
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_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_content(STEAM_UGC_UPDATE_HANDLE, DIRECTORY + "steamUGC");

View File

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