From 0f93df28538594b94987b07202233cfcbc1014ca Mon Sep 17 00:00:00 2001 From: luboslenco Date: Tue, 5 May 2026 17:16:08 +0200 Subject: [PATCH] paint: player fixes --- paint/sources/base.c | 22 ++++++++++++++-------- paint/sources/config.c | 4 ++++ paint/sources/export_player.c | 7 ++++++- paint/sources/functions.h | 1 + paint/sources/main.c | 1 + paint/sources/player.c | 6 ++++++ paint/sources/tab_meshes.c | 8 ++++---- 7 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 paint/sources/player.c diff --git a/paint/sources/base.c b/paint/sources/base.c index 1319c255..469c8de6 100644 --- a/paint/sources/base.c +++ b/paint/sources/base.c @@ -58,7 +58,6 @@ void base_on_drop_files(char *drop_path) { } void base_init_on_start_arm(void *_) { - import_arm_run_project(project_filepath); g_context->tool = TOOL_TYPE_CURSOR; // Auto-run script if (g_project->script_datas != NULL && g_project->script_datas->length > 0) { @@ -312,6 +311,10 @@ void base_update(void *_) { } compass_update(); + + if (base_player_lock) { + player_update(); + } } gpu_texture_t *base_get_drag_image() { @@ -438,6 +441,7 @@ void base_render(void *_) { bool using_menu = ui_menu_show && mouse_y > ui_header_h; base_ui_enabled = !ui_box_show && !using_menu && ui->combo_selected_handle == NULL; + if (ui_box_show) { ui_box_render(); } @@ -1079,7 +1083,7 @@ void ui_base_update(void *_) { // g_config->workspace = WORKSPACE_PLAYER; // base_update_workspace(); // } - if (g_config->experimental && keyboard_started("f5")) { + if (g_config->experimental && keyboard_started("f5") && !base_player_lock) { base_run_in_player(); } @@ -1724,11 +1728,11 @@ void base_init() { } if (args_player) { - sys_notify_on_next_frame(&base_init_on_start_arm, NULL); - make_material_parse_paint_material(true); + base_player_lock = true; g_config->workspace = WORKSPACE_PLAYER; base_update_workspace(); - base_player_lock = true; + make_material_parse_paint_material(true); + sys_notify_on_next_frame(&base_init_on_start_arm, NULL); } } @@ -2075,9 +2079,9 @@ tab_draw_array_t_array_t *ui_base_init_hwnd_tabs() { } void ui_base_toggle_distract_free() { - if (base_player_lock) { - return; - } + // if (base_player_lock) { + // return; + // } ui_base_show = !ui_base_show; if (ui_base_show) { @@ -2273,9 +2277,11 @@ void base_update_workspace() { float h = UI_ELEMENT_H() + UI_ELEMENT_OFFSET() + 2; g_config->layout->buffer[LAYOUT_SIZE_SIDEBAR_H0] = iron_window_height() - h; g_config->layout->buffer[LAYOUT_SIZE_SIDEBAR_H1] = h; + render_path_resize(); } else if (g_config->workspace == WORKSPACE_PLAYER) { ui_base_show = false; + render_path_resize(); } base_resize(); diff --git a/paint/sources/config.c b/paint/sources/config.c index 1d5ba122..9e2eb9d8 100644 --- a/paint/sources/config.c +++ b/paint/sources/config.c @@ -41,6 +41,10 @@ void config_load() { } void config_save() { + if (base_player_lock) { + return; + } + // Use system application data folder // when running from protected path like "Program Files" char *path; diff --git a/paint/sources/export_player.c b/paint/sources/export_player.c index d87f6665..840f8c1e 100644 --- a/paint/sources/export_player.c +++ b/paint/sources/export_player.c @@ -109,6 +109,11 @@ static char *export_player_index = "\ static void export_player_run_on_download(char *url, buffer_t *ab) {} void export_player_run(char *path) { + #ifndef NDEBUG + console_error(tr("Not available in debug build")); + return; + #endif + char *path_base = path_base_dir(path); char *_project_filepath = string_copy(project_filepath); @@ -143,6 +148,6 @@ void export_player_run(char *path) { file_copy(player_bin_src, player_bin_to); } else if (box_export_h_export_player_target->i == PLAYER_TARGET_MACOS) { - console_error("Not implemented"); + console_error(tr("Not implemented")); } } diff --git a/paint/sources/functions.h b/paint/sources/functions.h index 9166b48b..adee61d5 100644 --- a/paint/sources/functions.h +++ b/paint/sources/functions.h @@ -448,6 +448,7 @@ void util_mesh_pack_uvs(i16_array_t *texa); void ui_header_init(); void ui_header_render_ui(); void ui_header_draw_tool_properties(); +void player_update(); plugin_t *plugin_create(); void plugin_start(char *plugin); void plugin_stop(char *plugin); diff --git a/paint/sources/main.c b/paint/sources/main.c index df1b557b..52b5b977 100644 --- a/paint/sources/main.c +++ b/paint/sources/main.c @@ -150,6 +150,7 @@ #include "physics_sim.c" #include "physics_world.c" #include "pipes.c" +#include "player.c" #include "plugin.c" #include "project.c" #include "render_path_base.c" diff --git a/paint/sources/player.c b/paint/sources/player.c new file mode 100644 index 00000000..8dfed4d0 --- /dev/null +++ b/paint/sources/player.c @@ -0,0 +1,6 @@ + +#include "global.h" + +void player_update() { + +} diff --git a/paint/sources/tab_meshes.c b/paint/sources/tab_meshes.c index 6f66f50a..b9a764c0 100644 --- a/paint/sources/tab_meshes.c +++ b/paint/sources/tab_meshes.c @@ -168,10 +168,10 @@ void tab_meshes_draw_context_menu() { } if (changed) { - rot = vec4_mult(rot, 3.141592 / 180.0); - g_context->selected_object->transform->rot = quat_from_euler(rot.x, rot.y, rot.z); - transform_build_matrix(g_context->selected_object->transform); - transform_compute_dim(g_context->selected_object->transform); + rot = vec4_mult(rot, 3.141592 / 180.0); + t->rot = quat_from_euler(rot.x, rot.y, rot.z); + transform_build_matrix(t); + transform_compute_dim(t); // physics_body_t *pb = any_imap_get(physics_body_object_map, g_context->selected_object->uid); // if (pb != NULL) {