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

Google Summer of Code 2024 - Final Evaluation: Procedural Fragment Shader Generation Using Classic Machine Learning #237

Draft
wants to merge 56 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
a5f1ecd
fix grpc cpp plugin location
k0T0z Aug 11, 2024
4562153
merge fix-building-issues branch that has all batches that brings RGM…
k0T0z Aug 25, 2024
b7ad041
adding tests dir
k0T0z Aug 25, 2024
8292ab1
add VisualShader editor base code (along with https://github.com/enig…
k0T0z Aug 30, 2024
4e33db8
reverting unknown change
k0T0z Aug 30, 2024
dfd0414
Add TODO for improving the server plugin later
k0T0z Sep 1, 2024
8d1e810
fixed and improved QtNodes add_subdirectory support
k0T0z Sep 1, 2024
5a0b5e8
initial prototype: integrated the simple_graph_model example
k0T0z Sep 1, 2024
0a2eb94
add a TODO for finalizing the project later on
k0T0z Sep 1, 2024
f3fadff
Suppress 'QMetaObject::connectSlotsByName: No matching signal for on_…
k0T0z Sep 2, 2024
1ad871a
added the floating bar and few improvements
k0T0z Sep 3, 2024
f7f3832
implemented the tree nodes dialog and switched to V layout instead of…
k0T0z Sep 4, 2024
06d3ea5
added available nodes to add dialogs functionalities and deleted the …
k0T0z Sep 5, 2024
073017c
few improvements and bug fixes
k0T0z Sep 8, 2024
179fc45
created add_node_custom function and few other improvements
k0T0z Sep 9, 2024
8c5b01e
fully integration between VisualShader and VisualShaderEditor is now …
k0T0z Sep 9, 2024
44543bd
Implemented the graphics view from scratch to get rid of the nodeedit…
k0T0z Sep 12, 2024
56d2878
Few bug fixes and improvements
k0T0z Sep 13, 2024
3a784aa
completed the connection graphics rendering algorithm and large impro…
k0T0z Sep 14, 2024
890c817
Finished all nodes rendering code
k0T0z Sep 15, 2024
eb1684f
Fixed the text alignment
k0T0z Sep 15, 2024
ae9433a
almost done
k0T0z Sep 15, 2024
749c6a0
bug fixes and few improvements
k0T0z Sep 17, 2024
78cbc42
fixed a crash due to unset pointer
k0T0z Sep 17, 2024
4429aa9
Bug fixes and few improvements
k0T0z Sep 19, 2024
f33b2ad
Fixed clang-format double key
k0T0z Sep 19, 2024
f78d473
Added RGM-Tests target, improved the VisualShaderEditor, and fixed ma…
k0T0z Sep 20, 2024
85a5e51
Fixed how we calculate the connection cubic path and improved colors …
k0T0z Sep 21, 2024
497406e
Few improvements and bug fixes
k0T0z Sep 21, 2024
b0eb611
Added drop down to set the functions and operations and few improveme…
k0T0z Sep 22, 2024
6a8c6ea
Remove the nodeeditor package
k0T0z Sep 23, 2024
1568baf
Changed the name of the Visual Shader message so that it doesnt confl…
k0T0z Sep 25, 2024
88e810e
add the save button
k0T0z Sep 25, 2024
0a80517
Fixed some delete nodes bugs and improved tests
k0T0z Sep 27, 2024
1f05b4b
Added the UI for both the matching image and the rendering shader for…
k0T0z Sep 27, 2024
948dda8
Fixed a crash due to accessing invalid pointer
k0T0z Sep 27, 2024
56f0389
Added debugging rects to make sure of accurate calculations
k0T0z Sep 27, 2024
690e09d
Improved a comment
k0T0z Sep 27, 2024
3a65416
Finished the rendering of shaders using Qt GL and few other improveme…
k0T0z Sep 28, 2024
cef01a1
Bug fixes and few improvements
k0T0z Sep 29, 2024
2fea664
few improvements
k0T0z Sep 29, 2024
9585ef4
Added support for controlling noises parameters
k0T0z Sep 29, 2024
7831a1a
Added support for more control on parameters
k0T0z Sep 30, 2024
6e135b2
Added support for multiple connection at output ports
k0T0z Sep 30, 2024
c316264
consistency ...
k0T0z Sep 30, 2024
3696a7e
Added support for vector operations and functions
k0T0z Sep 30, 2024
0227038
Added a TODO for replacing ShaderPreviewerWidget class with ENIGMA Gr…
k0T0z Oct 1, 2024
308886a
bug fixes and few improvements
k0T0z Oct 3, 2024
0a0bc40
Add Dot node
k0T0z Oct 3, 2024
d3f963c
Bug fixes and few improvements
k0T0z Oct 4, 2024
cb810b6
Added last nodes
k0T0z Oct 4, 2024
d9faf00
few improvements
k0T0z Oct 4, 2024
f9acab2
fixed a corner case where the ports are lost when changing the operat…
k0T0z Oct 4, 2024
c681947
Fixed another ... if i continue talking, i am gonna lose it
k0T0z Oct 4, 2024
f442010
few improvements
k0T0z Oct 5, 2024
598f996
format code
k0T0z Oct 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
AllowShortCaseLabelsOnASingleLine: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/build/
/Submodules/
/.vscode/

# C++ objects and libs
*.slo
Expand Down
163 changes: 129 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,85 @@
###################################################################################
## ##
## Copyright (C) 2024 Saif Kandil (k0T0z) ##
## ##
## This file is a part of the ENIGMA Development Environment. ##
## ##
## ##
## ENIGMA is free software: you can redistribute it and/or modify it under the ##
## terms of the GNU General Public License as published by the Free Software ##
## Foundation, version 3 of the license or any later version. ##
## ##
## This application and its source code is distributed AS-IS, WITHOUT ANY ##
## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ##
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ##
## details. ##
## ##
## You should have recieved a copy of the GNU General Public License along ##
## with this code. If not, see <http://www.gnu.org/licenses/> ##
## ##
## ENIGMA is an environment designed to create games and other programs with a ##
## high-level, fully compilable language. Developers of ENIGMA or anything ##
## associated with ENIGMA are in no way responsible for its users or ##
## applications created by its users, or damages caused by the environment ##
## or programs made in the environment. ##
## ##
###################################################################################

cmake_minimum_required(VERSION 3.14)
project(RadialGM)

# Uncomment to give priority to the local CMake modules
# set(CMAKE_PREFIX_PATH "/usr/local/lib")

include(CMakeDependentOption)

option(RGM_BUILD_EMAKE "Build Emake and the compiler." ON)
option(RGM_BUILD_TESTS "Build tests." OFF)

# FIXME: MSVC dynamic linking requires US TO DLLEXPORT our funcs
# since we currently don't, I'm force disabling the option on MSVC
cmake_dependent_option(RGM_BUILD_STATIC "Build static libs." ON "MSVC" OFF)

# Check https://stackoverflow.com/q/33062728/14629018 for more information.
# if(MSVC)
# set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
# endif()

if (RGM_BUILD_STATIC)
set(LIB_TYPE STATIC)
set(LIB_TYPE STATIC CACHE STRING "Static Library type")
else()
set(LIB_TYPE SHARED CACHE STRING "Shared Library type")
endif()

# Set default build type
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Build type not set - defaulting to Debug")
set(
CMAKE_BUILD_TYPE "Debug"
CACHE
STRING
"Choose the type of build from: Debug Release MinSizeRel RelWithDebInfo."
FORCE)
else()
set(LIB_TYPE SHARED)
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT CMAKE_BUILD_TYPE MATCHES "Release" AND NOT CMAKE_BUILD_TYPE MATCHES "MinSizeRel" AND NOT CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
message(FATAL_ERROR "Invalid build type: ${CMAKE_BUILD_TYPE}")
endif()
endif()

set(CMAKE_DEBUG_POSTFIX "d")
set(CMAKE_RELEASE_POSTFIX "")
set(CMAKE_MINSIZEREL_POSTFIX "s")
set(CMAKE_RELWITHDEBINFO_POSTFIX "rd")

if (CMAKE_BUILD_TYPE MATCHES "Debug")
set(EXE "RadialGM-Debug")
set(EXE "RadialGM-Debug" CACHE STRING "RGM Executable name")
add_definitions(-DRGM_DEBUG)
else()
set(EXE "RadialGM")
elseif(CMAKE_BUILD_TYPE MATCHES "MinSizeRel")
set(EXE "RadialGM-MinSizeRel" CACHE STRING "RGM Executable name")
elseif(CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
set(EXE "RadialGM-RelWithDebInfo" CACHE STRING "RGM Executable name")
else() # Release
set(EXE "RadialGM" CACHE STRING "RGM Executable name")
endif()

set(EXE_DESCRIPTION "ENIGMA IDE")
Expand All @@ -40,10 +100,30 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/Dialogs")
# TODO: Do we need to disable exceptions in RGM like we do in ENIGMA?
# if(MSVC)
# string(APPEND CMAKE_CXX_FLAGS " /EHsc /wd26812")
# string(APPEND CMAKE_C_FLAGS " /EHsc /wd26812")
# endif()

# # Disable C++ exceptions.
# if(MSVC)
# string(REGEX REPLACE "/EHsc" "/EHs-c-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# add_definitions(-D_HAS_EXCEPTIONS=0)
# else()
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables")
# endif()

set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/" "${CMAKE_CURRENT_SOURCE_DIR}/Dialogs" "${CMAKE_CURRENT_SOURCE_DIR}/Editors")

# Uncomment to be able to use local grpc_cpp_plugin
# set(GRPC_EXE "/usr/local/bin/grpc_cpp_plugin")

set(RGM_ROOTDIR "${CMAKE_CURRENT_SOURCE_DIR}")

# The ENIGMA_DIR is sent to the C++ code as a define
# Include ENIGMA things
set(ENIGMA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Submodules/enigma-dev)
set(ENIGMA_DIR ${RGM_ROOTDIR}/Submodules/enigma-dev CACHE PATH "ENIGMA directory")
include_directories("${CMAKE_BINARY_DIR}/Submodules/enigma-dev/shared/protos/" "${ENIGMA_DIR}/CommandLine/libEGM" "${ENIGMA_DIR}/shared")

# Populate a CMake variable with the sources
Expand Down Expand Up @@ -81,12 +161,14 @@ set(RGM_SOURCES
Editors/ScriptEditor.cpp
Editors/CodeEditor.cpp
Editors/TimelineEditor.cpp
Editors/VisualShaderEditor.cpp
main.cpp
Plugins/RGMPlugin.cpp
Plugins/ServerPlugin.cpp
Dialogs/EventArgumentsDialog.cpp
Dialogs/TimelineChangeMoment.cpp
Dialogs/PreferencesDialog.cpp
Dialogs/PreferencesKeys.cpp
Dialogs/KeyBindingPreferences.cpp
Utils/ProtoManip.cpp
Utils/FieldPath.cpp
MainWindow.cpp
Expand Down Expand Up @@ -117,7 +199,6 @@ set(RGM_HEADERS
Models/ModelMapper.h
Models/RepeatedSortFilterProxyModel.h
Models/TreeSortFilterProxyModel.h
main.h
Components/RecentFiles.h
Components/QMenuView_p.h
Components/Utility.h
Expand All @@ -139,13 +220,14 @@ set(RGM_HEADERS
Editors/FontEditor.h
Editors/SpriteEditor.h
Editors/BackgroundEditor.h
Plugins/ServerPlugin.h
Editors/VisualShaderEditor.h
Plugins/RGMPlugin.h
MainWindow.h
Dialogs/EventArgumentsDialog.h
Dialogs/PreferencesDialog.h
Dialogs/PreferencesKeys.h
Dialogs/TimelineChangeMoment.h
Dialogs/KeyBindingPreferences.h
Utils/SafeCasts.h
Utils/ProtoManip.h
Utils/FieldPath.h
Expand Down Expand Up @@ -196,14 +278,14 @@ else()
set(EDITOR_SOURCES Widgets/CodeWidgetScintilla.cpp)
endif()

set(RGM_SOURCES ${RGM_SOURCES} Plugins/ServerPlugin.cpp)
set(RGM_HEADERS ${RGM_HEADERS} Plugins/ServerPlugin.h)
set(RGM_SOURCES ${RGM_SOURCES} Plugins/ServerPlugin.cpp)
set(RGM_HEADERS ${RGM_HEADERS} Plugins/ServerPlugin.h)

# Tell CMake to create the RadialGM executable
add_executable(${EXE} WIN32 ${RGM_UI} ${RGM_HEADERS} ${RGM_SOURCES} ${EDITOR_SOURCES} ${RGM_RC})

# we do this even in release mode for "Editor Diagnostics"
target_compile_definitions(${EXE} PUBLIC QT_MESSAGELOGCONTEXT)
target_compile_definitions(${EXE} PUBLIC QT_MESSAGELOGCONTEXT ENIGMA_DIR="${ENIGMA_DIR}")

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT WIN32)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
Expand Down Expand Up @@ -244,14 +326,13 @@ include_directories(${EXE} PRIVATE ${RAPIDJSON_INCLUDE_DIRS})
find_package(yaml-cpp CONFIG REQUIRED)
target_link_libraries(${EXE} PRIVATE yaml-cpp)

#Find gRPC
find_package(gRPC CONFIG REQUIRED)
target_link_libraries(${EXE} PRIVATE gRPC::gpr gRPC::grpc gRPC::grpc++)
# Find gRPC
find_package(gRPC CONFIG REQUIRED)
target_link_libraries(${EXE} PRIVATE gRPC::gpr gRPC::grpc gRPC::grpc++)

# Find Protobuf
include(FindProtobuf)
include_directories(${Protobuf_INCLUDE_DIRS})
target_link_libraries(${EXE} PRIVATE ${Protobuf_LIBRARIES})
find_package(Protobuf CONFIG REQUIRED)
target_link_libraries(${EXE} PRIVATE protobuf::libprotobuf)

# Find OpenSSL
find_package(OpenSSL REQUIRED)
Expand All @@ -262,11 +343,13 @@ find_package(Qt5 COMPONENTS Core Widgets Gui PrintSupport Multimedia REQUIRED)
target_link_libraries(${EXE} PRIVATE Qt5::Core Qt5::Widgets Qt5::Gui Qt5::PrintSupport Qt5::Multimedia)

# LibProto
add_subdirectory(Submodules/enigma-dev/shared)
add_subdirectory(Submodules/enigma-dev/shared/protos)
add_subdirectory(Submodules/enigma-dev/CommandLine/libEGM)
add_dependencies(${EXE} "EGM")
target_link_libraries(${EXE} PRIVATE "EGM" "Protocols" "ENIGMAShared")
# Arrangement of these is important: shared depends on proto and emake depends on all of them
# We need to cache the library names first so we can build on top of them
add_subdirectory(${ENIGMA_DIR}/shared/protos)
add_subdirectory(${ENIGMA_DIR}/shared)
add_subdirectory(${ENIGMA_DIR}/CommandLine/libEGM)
add_dependencies(${EXE} ${LIB_EGM})
target_link_libraries(${EXE} PRIVATE ${LIB_EGM} ${LIB_PROTO} ${SHARED_LIB})

# Find FreeType
find_package(Freetype REQUIRED)
Expand All @@ -289,6 +372,10 @@ target_link_libraries(${EXE} PRIVATE ${LIB_PCRE2})
find_library(LIB_DOUBLE_CONVERSION NAMES double-conversion)
target_link_libraries(${EXE} PRIVATE ${LIB_DOUBLE_CONVERSION})

if(RGM_BUILD_TESTS)
add_subdirectory(Tests)
endif()

if(WIN32)
# Windows is a turd
target_link_libraries(${EXE} PRIVATE Ws2_32 Wtsapi32 Wldap32 Crypt32 Winmm Userenv Netapi32 version Dwmapi Imm32)
Expand All @@ -300,16 +387,24 @@ if(MSVC)
endif()

if (RGM_BUILD_EMAKE)
add_subdirectory(Submodules/enigma-dev/CompilerSource)
add_subdirectory(Submodules/enigma-dev/CommandLine/emake)
if (CMAKE_BUILD_TYPE MATCHES "Debug")
set(CLI_TARGET "emake-debug")
else()
set(CLI_TARGET "emake")
endif()
add_subdirectory(${ENIGMA_DIR}/CompilerSource)
add_subdirectory(${ENIGMA_DIR}/CommandLine/emake)
add_dependencies(${EXE} ${CLI_TARGET})
endif()

add_custom_command(
TARGET ${EXE}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/Submodules/enigma-dev/CommandLine/emake/${CLI_TARGET}${CMAKE_EXECUTABLE_SUFFIX}
${CMAKE_BINARY_DIR}/Submodules/enigma-dev/CommandLine/libEGM/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_EGM}$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>,${CMAKE_DEBUG_POSTFIX},$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},MinSizeRel>,${CMAKE_MINSIZEREL_POSTFIX},$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},RelWithDebInfo>,${CMAKE_RELWITHDEBINFO_POSTFIX},>>>${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_BINARY_DIR}/Submodules/enigma-dev/CompilerSource/${CMAKE_SHARED_LIBRARY_PREFIX}${COMPILER_LIB}$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>,${CMAKE_DEBUG_POSTFIX},$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},MinSizeRel>,${CMAKE_MINSIZEREL_POSTFIX},$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},RelWithDebInfo>,${CMAKE_RELWITHDEBINFO_POSTFIX},>>>${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_BINARY_DIR}/Submodules/enigma-dev/shared/protos/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_PROTO}$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>,${CMAKE_DEBUG_POSTFIX},$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},MinSizeRel>,${CMAKE_MINSIZEREL_POSTFIX},$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},RelWithDebInfo>,${CMAKE_RELWITHDEBINFO_POSTFIX},>>>${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_BINARY_DIR}/Submodules/enigma-dev/shared/${CMAKE_SHARED_LIBRARY_PREFIX}${SHARED_LIB}$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>,${CMAKE_DEBUG_POSTFIX},$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},MinSizeRel>,${CMAKE_MINSIZEREL_POSTFIX},$<IF:$<STREQUAL:${CMAKE_BUILD_TYPE},RelWithDebInfo>,${CMAKE_RELWITHDEBINFO_POSTFIX},>>>${CMAKE_SHARED_LIBRARY_SUFFIX}
${ENIGMA_DIR}
COMMENT "Copying exes to ${ENIGMA_DIR}"
)

install(TARGETS ${EXE} RUNTIME DESTINATION .)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${EXE}.dir/Debug/${EXE}.pdb" DESTINATION . OPTIONAL)

Expand All @@ -324,9 +419,9 @@ file(TO_CMAKE_PATH ${VCPKG_ROOT} VCPKG_ROOT)
set(SEARCH_PATHS "${VCPKG_ROOT}/installed/x64-windows/bin/")
endif()
else()
set(LIBS "${CMAKE_INSTALL_PREFIX}/${CMAKE_SHARED_LIBRARY_PREFIX}EGM${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${CMAKE_INSTALL_PREFIX}/${CMAKE_SHARED_LIBRARY_PREFIX}Protocols${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${CMAKE_INSTALL_PREFIX}/${CMAKE_SHARED_LIBRARY_PREFIX}ENIGMAShared${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(LIBS "${CMAKE_INSTALL_PREFIX}/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_EGM}${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${CMAKE_INSTALL_PREFIX}/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_PROTO}${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${CMAKE_INSTALL_PREFIX}/${CMAKE_SHARED_LIBRARY_PREFIX}${SHARED_LIB}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()

if (WIN32)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "KeybindingPreferences.h"
#include "KeyBindingPreferences.h"

#include "ui_MainWindow.h"
#include "ui_SpriteEditor.h"
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions Dialogs/PreferencesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#include "ui_PreferencesDialog.h"

#include "PreferencesKeys.h"
#include "KeybindingPreferences.h"
#include "main.h"
#include "KeyBindingPreferences.h"
#include "Components/Logger.h"

#include <QFileDialog>
Expand Down
30 changes: 30 additions & 0 deletions Dialogs/PreferencesKeys.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*********************************************************************************/
/* */
/* Copyright (C) 2024 Saif Kandil (k0T0z) */
/* */
/* This file is a part of the ENIGMA Development Environment. */
/* */
/* */
/* ENIGMA is free software: you can redistribute it and/or modify it under the */
/* terms of the GNU General Public License as published by the Free Software */
/* Foundation, version 3 of the license or any later version. */
/* */
/* This application and its source code is distributed AS-IS, WITHOUT ANY */
/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS */
/* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more */
/* details. */
/* */
/* You should have recieved a copy of the GNU General Public License along */
/* with this code. If not, see <http://www.gnu.org/licenses/> */
/* */
/* ENIGMA is an environment designed to create games and other programs with a */
/* high-level, fully compilable language. Developers of ENIGMA or anything */
/* associated with ENIGMA are in no way responsible for its users or */
/* applications created by its users, or damages caused by the environment */
/* or programs made in the environment. */
/* */
/*********************************************************************************/

#include "Dialogs/PreferencesKeys.h"

QString defaultStyle = "";
5 changes: 5 additions & 0 deletions Dialogs/PreferencesKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

#include <QString>

// Qt doesn't have a way of getting the default style
// so we store it for later when the user restores
// default settings so we can apply it again
extern QString defaultStyle;

// these are settings key helpers to prevent typos and promote
// consistency, or at least turn such mistakes into compile-time
// errors and not difficult-to-diagnose issues at runtime
Expand Down
2 changes: 2 additions & 0 deletions Editors/BaseEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <QDebug>
#include <QMessageBox>

BaseEditor::BaseEditor(QWidget* parent) : QWidget(parent) {}

BaseEditor::BaseEditor(MessageModel* resource_model, QWidget* parent)
: QWidget(parent), _model(resource_model->GetParentModel<MessageModel>()), _nodeMapper(new ModelMapper(_model, this)) {
_resMapper = new ModelMapper(resource_model, this);
Expand Down
4 changes: 3 additions & 1 deletion Editors/BaseEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ static const QHash<int, int> ResTypeFields = {
{TypeCase::kPath, TreeNode::kPathFieldNumber}, {TypeCase::kFont, TreeNode::kFontFieldNumber},
{TypeCase::kScript, TreeNode::kScriptFieldNumber}, {TypeCase::kTimeline, TreeNode::kTimelineFieldNumber},
{TypeCase::kObject, TreeNode::kObjectFieldNumber}, {TypeCase::kRoom, TreeNode::kRoomFieldNumber},
{TypeCase::kSettings, TreeNode::kSettingsFieldNumber}, {TypeCase::kShader, TreeNode::kShaderFieldNumber}};
{TypeCase::kSettings, TreeNode::kSettingsFieldNumber}, {TypeCase::kShader, TreeNode::kShaderFieldNumber},
{TypeCase::kVisualShader, TreeNode::kVisualShaderFieldNumber}};

class BaseEditor : public QWidget {
Q_OBJECT

public:
explicit BaseEditor(QWidget *parent = nullptr);
explicit BaseEditor(MessageModel *treeNodeModel, QWidget *parent);
~BaseEditor();
void ReplaceBuffer(google::protobuf::Message *buffer);
Expand Down
Loading
Loading