Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standalone: Fix icon display, disable embedded windows, disable binary export, fix CI #54

Merged
merged 13 commits into from
May 28, 2022
36 changes: 28 additions & 8 deletions .github/actions/install-swiftshader/action.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,49 @@
name: Install SwiftShader
description: Install SwiftShader and set environment to
name: Install Vulkan and Swiftshader
description: Install Vulkan and SwiftShader and set appropriate environment variables
inputs:
install_swiftshader:
description: If swiftshader should be installed
default: false
path:
description: The absolute folder path to extract the SwiftShader shared library to.
default: '${{ github.workspace }}'
bits:
decription: 32 or 64 (only on Windows)
default: 64
install_vulkan_sdk:
description: Whether or not the vulkan SDK should also be installed
default: false
vulkan_sdk_version:
description: If installing the SDK, which version to install
default: 1.3.204.1

# backend:
# description: Vulkan or GLES.
# default: "Vulkan"
runs:
using: "composite"
steps:
- name: Scons Build
- name: Install Vulkan SDK
shell: bash
if: inputs.install_vulkan_sdk == 'true'
run : |
wget "https://sdk.lunarg.com/sdk/download/${{ inputs.vulkan_sdk_version }}/mac/vulkansdk-macos-${{ inputs.vulkan_sdk_version }}.dmg?Human=true" -O vulkansdk.dmg
hdiutil attach vulkansdk.dmg
sudo /Volumes/vulkansdk-macos-${{ inputs.vulkan_sdk_version }}/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $GITHUB_WORKSPACE/vulkansdk-macos-${{ inputs.vulkan_sdk_version }} --accept-licenses --default-answer --confirm-command install
hdiutil detach /Volumes/vulkansdk-macos-${{ inputs.vulkan_sdk_version }}
echo "VULKAN_SDK_PATH=$GITHUB_WORKSPACE/vulkansdk-macos-${{ inputs.vulkan_sdk_version }}" >> $GITHUB_ENV
echo "VULKAN_SDK=$VULKAN_SDK_PATH/macOS" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$VULKAN_SDK/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PATH=$VULKAN_SDK/bin:$PATH" >> $GITHUB_ENV

- name: Install Swiftshader
env:
SWIFTSHADER_WINDOWS_URL: https://github.com/nikitalita/swiftshader-dist-win/releases/download/2021-12-09_00-02/swiftshader-2021-12-09_00-02-subzero.7z.zip
SWIFTSHADER_LINUX_URL: https://github.com/qarmin/gtk_library_store/releases/download/3.24.0/swiftshader2.zip
SWIFTSHADER_MACOS_URL: https://github.com/nikitalita/swiftshader-builds/releases/download/1.0.0/swiftshader-vulkan-r6216.7997cbc34b-macos-10.15.zip
VULKAN_VERSION: 1.3.204.1
shell: bash
if: inputs.install_swiftshader == 'true'
run: |
export SWIFTSHADER_DEST_DIR='${{ inputs.path }}'
mkdir -p $SWIFTSHADER_DEST_DIR
Expand All @@ -39,11 +64,6 @@ runs:
rm -rf temp-ss-dl/
sed -i '' "s/..\/..\/..\/lib\/libvk_swiftshader.dylib/.\/libvk_swiftshader.dylib/" "$SWIFTSHADER_DEST_DIR/vk_swiftshader_icd.json"
echo "VK_ICD_FILENAMES=$SWIFTSHADER_DEST_DIR/vk_swiftshader_icd.json" >> $GITHUB_ENV
wget https://sdk.lunarg.com/sdk/download/1.2.189.0/mac/vulkansdk-macos-1.2.189.0.dmg?Human=true -O vulkansdk-macos-1.2.189.0.dmg
hdiutil attach vulkansdk-macos-1.2.189.0.dmg
sudo /Volumes/vulkansdk-macos-1.2.189.0/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $GITHUB_WORKSPACE/vulkansdk-macos-1.2.189.0 --accept-licenses --default-answer --confirm-command install
hdiutil detach /Volumes/vulkansdk-macos-1.2.189.0
echo "DYLD_LIBRARY_PATH=$GITHUB_WORKSPACE/vulkansdk-macos-1.2.189.0/macOS/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
elif [ "$RUNNER_OS" == "Windows" ]; then
arch="x64"
if [ "${{ inputs.bits }}" == "32" ]; then
Expand Down
33 changes: 18 additions & 15 deletions .github/workflows/all_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ env:
GODOT_BASE_BRANCH: master
GODOT_MAIN_SYNC_REF: ff75a49227d8d81f99b728fc89b1e4e6e79ed5be
SCONSFLAGS: verbose=yes warnings=all werror=no module_text_server_fb_enabled=yes debug_symbols=no
SCONSFLAGS_TEMPLATE: no_editor_splash=yes module_bmp_enabled=no module_bullet_enabled=no module_camera_enabled=no module_cvtt_enabled=no module_mbedtls_enabled=no module_tga_enabled=no module_enet_enabled=no module_mobile_vr_enabled=no module_upnp_enabled=no module_gdnative_enabled=no module_opensimplex_enabled=no module_pvr_enabled=no module_webm_enabled=no module_websocket_enabled=no module_xatlas_unwrap_enabled=no module_squish_enabled=no use_static_cpp=yes builtin_freetype=yes builtin_libpng=yes builtin_zlib=yes builtin_libwebp=yes builtin_libogg=yes module_csg_enabled=yes module_gridmap_enabled=yes disable_3d=no
SCONSFLAGS_TEMPLATE: no_editor_splash=yes module_bmp_enabled=no module_camera_enabled=no module_cvtt_enabled=no module_mbedtls_enabled=no module_tga_enabled=no module_enet_enabled=no module_mobile_vr_enabled=no module_upnp_enabled=no module_noise_enabled=no module_websocket_enabled=no module_xatlas_unwrap_enabled=no module_squish_enabled=no use_static_cpp=yes builtin_freetype=yes builtin_libpng=yes builtin_zlib=yes builtin_libwebp=yes builtin_libogg=yes module_csg_enabled=yes module_gridmap_enabled=yes disable_3d=no
SCONS_CACHE_MSVC_CONFIG: true

concurrency:
Expand All @@ -45,26 +45,24 @@ jobs:
os: "windows-latest"
platform: windows
sconsflags-template: ""
command-export: . ${env:GITHUB_WORKSPACE}\bin\godot.windows.opt.tools.64.exe
command-postfix: ''
command-export: ${env:GITHUB_WORKSPACE}\bin\godot.windows.opt.tools.64.exe
export-preset: "Windows Desktop"
export-name: .export\gdre_tools.exe

- name: "🐧 Linux"
os: "ubuntu-20.04"
platform: linux
sconsflags-template: optimize=size use_lto=yes
command-export: DRI_PRIME=0 xvfb-run $GITHUB_WORKSPACE/bin/godot.linuxbsd.opt.tools.64
command-postfix: '|| echo OK'
command-export: ${env:GITHUB_WORKSPACE}/bin/godot.linuxbsd.opt.tools.64
export-preset: "Linux/X11"
export-name: .export/gdre_tools.x86_64

- name: "🍎 macOS"
os: "macos-latest"
platform: osx
sconsflags-template: optimize=size use_lto=yes
command-export: $GITHUB_WORKSPACE/bin/godot.osx.opt.tools.64
command-postfix: '|| echo OK'
sconsflags: use_volk=no VULKAN_SDK_PATH=$VULKAN_SDK_PATH
sconsflags-template: optimize=size use_lto=yes use_volk=no VULKAN_SDK_PATH=$VULKAN_SDK_PATH
command-export: ${env:GITHUB_WORKSPACE}/bin/godot.osx.opt.tools.64
export-preset: "macOS"
export-name: .export/gdre_tools.x86_64.zip

Expand Down Expand Up @@ -105,10 +103,12 @@ jobs:
- name: Setup python and scons
uses: ./.github/actions/godot-deps

# - name: Install swiftshader
# uses: ./.github/actions/install-swiftshader
# with:
# path: ${{ github.workspace }}/bin
- name: Install Vulkan SDK
uses: ./.github/actions/install-swiftshader
if: matrix.platform == 'osx'
with:
install_vulkan_sdk: true
install_swiftshader: false

- name: Compilation
uses: ./.github/actions/godot-build
Expand Down Expand Up @@ -157,12 +157,15 @@ jobs:

- name: Export standalone GDRE Tools
continue-on-error: true
shell: pwsh
run: |
cd ${{github.workspace}}/modules/gdsdecomp/standalone
mkdir .export
${{ matrix.command-export }} --headless -e -q ${{ matrix.command-postfix }}
${{ matrix.command-export }} --headless --export "${{ matrix.export-preset }}" ${{ matrix.export-name }} ${{ matrix.command-postfix }}

$proc = Start-Process -PassThru -FilePath ${{ matrix.command-export }} -ArgumentList '--headless -e --quit'
Wait-Process -Id $proc.id -Timeout 300
$proc = Start-Process -PassThru -FilePath ${{ matrix.command-export }} -ArgumentList '--headless --export "${{ matrix.export-preset }}" ${{ matrix.export-name }}'
Wait-Process -Id $proc.id -Timeout 300

- uses: actions/upload-artifact@v2
continue-on-error: true
with:
Expand Down
20 changes: 19 additions & 1 deletion SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,31 @@
Import("env")
Import("env_modules")

from platform_methods import run_in_subprocess
import gdre_icon_builder

mmp3thirdparty_dir = "#thirdparty/minimp3/"
liboggthirdparty_dir = "#thirdparty/libogg/"

env_gdsdecomp = env_modules.Clone()

env_gdsdecomp.Append(CPPPATH=["."])
env_gdsdecomp.Append(CPPPATH=["#thirdparty/nanosvg/"])
env_gdsdecomp.Append(CPPPATH=["#thirdparty/thorsvg/"])

env_gdsdecomp["BUILDERS"]["MakeGDREIconsBuilder"] = Builder(
action=env_gdsdecomp.Run(
gdre_icon_builder.make_gdre_icons_action, "Generating default project theme icons header."
),
suffix=".h",
src_suffix=".svg",
)

icon_sources = Glob("icons/*.svg")

env_gdsdecomp.Alias(
"gdre_icons",
[env_gdsdecomp.MakeGDREIconsBuilder("editor/gdre_icons.gen.h", icon_sources)],
)

if env["builtin_libogg"]:
env_gdsdecomp.Prepend(CPPPATH=[liboggthirdparty_dir])
Expand Down
86 changes: 57 additions & 29 deletions editor/gdre_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "utility/resource_loader_compat.h"
#include "utility/texture_loader_compat.h"

#include "gdre_icons.gen.h"

#if VERSION_MAJOR < 4
#error Unsupported Godot version
#endif
Expand Down Expand Up @@ -252,6 +254,22 @@ static int _get_pad(int p_alignment, int p_n) {
return pad;
}

static Ref<ImageTexture> generate_icon(int p_index) {
Ref<ImageTexture> icon = memnew(ImageTexture);
Ref<Image> img = memnew(Image);

#ifdef MODULE_SVG_ENABLED
// Upsample icon generation only if the scale isn't an integer multiplier.
// Generating upsampled icons is slower, and the benefit is hardly visible
// with integer scales.
ImageLoaderSVG img_loader;
img_loader.create_image_from_string(img, gdre_icons_sources[p_index], 1.0, false, false);
#endif
icon->create_from_image(img);

return icon;
}

#ifdef TOOLS_ENABLED
GodotREEditor::GodotREEditor(EditorNode *p_editor) {
singleton = this;
Expand All @@ -269,9 +287,19 @@ GodotREEditor::GodotREEditor(Control *p_control, HBoxContainer *p_menu) {
init_gui(p_control, p_menu, true);
}

void init_icons() {
}

void GodotREEditor::init_gui(Control *p_control, HBoxContainer *p_menu, bool p_long_menu) {
//Init dialogs

// Convert the generated icon sources to a dictionary for easier access.
// Unlike the editor icons, there is no central repository of icons in the Theme resource itself to keep it tidy.
Dictionary icons;
for (int i = 0; i < gdre_icons_count; i++) {
icons[gdre_icons_names[i]] = generate_icon(i);
}

ovd = memnew(OverwriteDialog);
p_control->add_child(ovd);

Expand Down Expand Up @@ -375,7 +403,7 @@ void GodotREEditor::init_gui(Control *p_control, HBoxContainer *p_menu, bool p_l
TextureRect *about_icon = memnew(TextureRect);
about_hbc->add_child(about_icon);
about_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED);
about_icon->set_texture(p_control->get_theme_icon("RELogoBig", "EditorIcons"));
about_icon->set_texture(icons["RELogoBig"]);

Label *about_label = memnew(Label);
about_hbc->add_child(about_label);
Expand Down Expand Up @@ -410,72 +438,72 @@ void GodotREEditor::init_gui(Control *p_control, HBoxContainer *p_menu, bool p_l
if (p_long_menu) {
menu_button = memnew(MenuButton);
menu_button->set_text(RTR("RE Tools"));
menu_button->set_icon(p_control->get_theme_icon("RELogo", "EditorIcons"));
menu_button->set_icon(icons["RELogo"]);
menu_popup = menu_button->get_popup();
menu_popup->add_icon_item(p_control->get_theme_icon("RELogo", "EditorIcons"), RTR("About Godot RE Tools"), MENU_ABOUT_RE);
menu_popup->add_icon_item(p_control->get_theme_icon("RELogo", "EditorIcons"), RTR("Quit"), MENU_EXIT_RE);
menu_popup->add_icon_item(icons["RELogo"], RTR("About Godot RE Tools"), MENU_ABOUT_RE);
menu_popup->add_icon_item(icons["RELogo"], RTR("Quit"), MENU_EXIT_RE);
menu_popup->connect("id_pressed", callable_mp(this, &GodotREEditor::menu_option_pressed));
p_menu->add_child(menu_button);

menu_button = memnew(MenuButton);
menu_button->set_text(RTR("PCK"));
menu_button->set_icon(p_control->get_theme_icon("REPack", "EditorIcons"));
menu_button->set_icon(icons["REPack"]);
menu_popup = menu_button->get_popup();
menu_popup->add_icon_item(p_control->get_theme_icon("REPack", "EditorIcons"), RTR("Set encryption key..."), MENU_KEY);
menu_popup->add_icon_item(icons["REPack"], RTR("Set encryption key..."), MENU_KEY);
menu_popup->add_separator();
menu_popup->add_icon_item(p_control->get_theme_icon("REPack", "EditorIcons"), RTR("Create PCK archive from folder..."), MENU_CREATE_PCK);
menu_popup->add_icon_item(p_control->get_theme_icon("REPack", "EditorIcons"), RTR("Explore PCK archive..."), MENU_EXT_PCK);
menu_popup->add_icon_item(icons["REPack"], RTR("Create PCK archive from folder..."), MENU_CREATE_PCK);
menu_popup->add_icon_item(icons["REPack"], RTR("Explore PCK archive..."), MENU_EXT_PCK);

menu_popup->connect("id_pressed", callable_mp(this, &GodotREEditor::menu_option_pressed));
p_menu->add_child(menu_button);

menu_button = memnew(MenuButton);
menu_button->set_text(RTR("GDScript"));
menu_button->set_icon(p_control->get_theme_icon("REScript", "EditorIcons"));
menu_button->set_icon(icons["REScript"]);
menu_popup = menu_button->get_popup();
menu_popup->add_icon_item(p_control->get_theme_icon("REScript", "EditorIcons"), RTR("Decompile .GDC/.GDE script files..."), MENU_DECOMP_GDS);
menu_popup->add_icon_item(p_control->get_theme_icon("REScript", "EditorIcons"), RTR("Compile .GD script files..."), MENU_COMP_GDS);
menu_popup->add_icon_item(icons["REScript"], RTR("Decompile .GDC/.GDE script files..."), MENU_DECOMP_GDS);
menu_popup->add_icon_item(icons["REScript"], RTR("Compile .GD script files..."), MENU_COMP_GDS);
menu_popup->set_item_disabled(menu_popup->get_item_index(MENU_COMP_GDS), true); //TEMP RE-ENABLE WHEN IMPLEMENTED

menu_popup->connect("id_pressed", callable_mp(this, &GodotREEditor::menu_option_pressed));
p_menu->add_child(menu_button);

menu_button = memnew(MenuButton);
menu_button->set_text(RTR("Resources"));
menu_button->set_icon(p_control->get_theme_icon("REResBT", "EditorIcons"));
menu_button->set_icon(icons["REResBT"]);
menu_popup = menu_button->get_popup();
menu_popup->add_icon_item(p_control->get_theme_icon("REResBT", "EditorIcons"), RTR("Convert binary resources to text..."), MENU_CONV_TO_TXT);
menu_popup->add_icon_item(p_control->get_theme_icon("REResTB", "EditorIcons"), RTR("Convert text resources to binary..."), MENU_CONV_TO_BIN);
menu_popup->add_icon_item(icons["REResBT"], RTR("Convert binary resources to text..."), MENU_CONV_TO_TXT);
menu_popup->add_icon_item(icons["REResTB"], RTR("Convert text resources to binary..."), MENU_CONV_TO_BIN);
menu_popup->add_separator();
menu_popup->add_icon_item(p_control->get_theme_icon("REResOther", "EditorIcons"), RTR("Convert stream textures to PNG..."), MENU_STEX_TO_PNG);
menu_popup->add_icon_item(p_control->get_theme_icon("REResOther", "EditorIcons"), RTR("Convert OGG Samples to OGG..."), MENU_OSTR_TO_OGG);
menu_popup->add_icon_item(p_control->get_theme_icon("REResOther", "EditorIcons"), RTR("Convert WAV Samples to WAV..."), MENU_SMPL_TO_WAV);
menu_popup->add_icon_item(icons["REResOther"], RTR("Convert stream textures to PNG..."), MENU_STEX_TO_PNG);
menu_popup->add_icon_item(icons["REResOther"], RTR("Convert OGG Samples to OGG..."), MENU_OSTR_TO_OGG);
menu_popup->add_icon_item(icons["REResOther"], RTR("Convert WAV Samples to WAV..."), MENU_SMPL_TO_WAV);
menu_popup->connect("id_pressed", callable_mp(this, &GodotREEditor::menu_option_pressed));
p_menu->add_child(menu_button);
} else {
menu_button = memnew(MenuButton);
menu_button->set_text(RTR("RE Tools"));
menu_button->set_icon(p_control->get_theme_icon("RELogo", "EditorIcons"));
menu_button->set_icon(icons["RELogo"]);
menu_popup = menu_button->get_popup();
menu_popup->add_icon_item(p_control->get_theme_icon("RELogo", "EditorIcons"), RTR("About Godot RE Tools"), MENU_ABOUT_RE);
menu_popup->add_icon_item(icons["RELogo"], RTR("About Godot RE Tools"), MENU_ABOUT_RE);
menu_popup->add_separator();

menu_popup->add_icon_item(p_control->get_theme_icon("REPack", "EditorIcons"), RTR("Set encryption key..."), MENU_KEY);
menu_popup->add_icon_item(icons["REPack"], RTR("Set encryption key..."), MENU_KEY);
menu_popup->add_separator();

menu_popup->add_icon_item(p_control->get_theme_icon("REPack", "EditorIcons"), RTR("Create PCK archive from folder..."), MENU_CREATE_PCK);
menu_popup->add_icon_item(p_control->get_theme_icon("REPack", "EditorIcons"), RTR("Explore PCK archive..."), MENU_EXT_PCK);
menu_popup->add_icon_item(icons["REPack"], RTR("Create PCK archive from folder..."), MENU_CREATE_PCK);
menu_popup->add_icon_item(icons["REPack"], RTR("Explore PCK archive..."), MENU_EXT_PCK);
menu_popup->add_separator();
menu_popup->add_icon_item(p_control->get_theme_icon("REScript", "EditorIcons"), RTR("Decompile .GDC/.GDE script files..."), MENU_DECOMP_GDS);
menu_popup->add_icon_item(p_control->get_theme_icon("REScript", "EditorIcons"), RTR("Compile .GD script files..."), MENU_COMP_GDS);
menu_popup->add_icon_item(icons["REScript"], RTR("Decompile .GDC/.GDE script files..."), MENU_DECOMP_GDS);
menu_popup->add_icon_item(icons["REScript"], RTR("Compile .GD script files..."), MENU_COMP_GDS);
menu_popup->set_item_disabled(menu_popup->get_item_index(MENU_COMP_GDS), true); //TEMP RE-ENABLE WHEN IMPLEMENTED
menu_popup->add_separator();
menu_popup->add_icon_item(p_control->get_theme_icon("REResBT", "EditorIcons"), RTR("Convert binary resources to text..."), MENU_CONV_TO_TXT);
menu_popup->add_icon_item(p_control->get_theme_icon("REResTB", "EditorIcons"), RTR("Convert text resources to binary..."), MENU_CONV_TO_BIN);
menu_popup->add_icon_item(icons["REResBT"], RTR("Convert binary resources to text..."), MENU_CONV_TO_TXT);
menu_popup->add_icon_item(icons["REResTB"], RTR("Convert text resources to binary..."), MENU_CONV_TO_BIN);
menu_popup->add_separator();
menu_popup->add_icon_item(p_control->get_theme_icon("REResOther", "EditorIcons"), RTR("Convert stream textures to PNG..."), MENU_STEX_TO_PNG);
menu_popup->add_icon_item(p_control->get_theme_icon("REResOther", "EditorIcons"), RTR("Convert OGG Samples to OGG..."), MENU_OSTR_TO_OGG);
menu_popup->add_icon_item(p_control->get_theme_icon("REResOther", "EditorIcons"), RTR("Convert WAV Samples to WAV..."), MENU_SMPL_TO_WAV);
menu_popup->add_icon_item(icons["REResOther"], RTR("Convert stream textures to PNG..."), MENU_STEX_TO_PNG);
menu_popup->add_icon_item(icons["REResOther"], RTR("Convert OGG Samples to OGG..."), MENU_OSTR_TO_OGG);
menu_popup->add_icon_item(icons["REResOther"], RTR("Convert WAV Samples to WAV..."), MENU_SMPL_TO_WAV);
menu_popup->connect("id_pressed", callable_mp(this, &GodotREEditor::menu_option_pressed));
p_menu->add_child(menu_button);
if (p_menu->get_child_count() >= 2) {
Expand Down
Loading