LibCommon now being integrated as an add_subdirectory submodule

This commit is contained in:
Jack Andersen 2019-06-04 14:44:39 -10:00
parent 12f4d5a267
commit b507196851
10 changed files with 77 additions and 49 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "externals/LibCommon"]
path = externals/LibCommon
url = ../LibCommon.git

View File

@ -8,6 +8,11 @@ endif()
project(PrimeWorldEditor CXX)
# Ensure submodules checked out
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/externals/LibCommon/CMakeLists.txt)
message(FATAL_ERROR "Please run 'git submodules update --init --recursive' to fetch submodules.")
endif()
include(./dew.cmake)
integrate_dew()
@ -16,7 +21,7 @@ include(cmake/generate_product_version.cmake)
if(MSVC)
add_compile_options(/WX /wd4267 /wd4100 /wd4101 /wd4189)
else()
add_compile_options(-Wno-multichar)
add_compile_options(-Wno-multichar -Wno-undefined-var-template)
endif()
if(APPLE)
@ -28,5 +33,11 @@ endif()
# as defined above.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Directly integrate libcommon and block install targets
set(LIBCOMMON_GENERATE_INSTALL_TARGETS OFF)
set(CODEGEN_GENERATE_INSTALL_TARGETS OFF)
set(CODEGEN_BUILD_PACKAGE_DURING_CONFIGURE ON)
add_subdirectory(externals/LibCommon)
add_subdirectory(src/Core)
add_subdirectory(src/Editor)

View File

@ -2,6 +2,11 @@
Prime World Editor is a custom editor suite for Retro Studios' GameCube and Wii games, including the
Metroid Prime series and Donkey Kong Country Returns.
# Clone Submodules First!
Builders on all platforms should ensure submodules are up to date with the current PrimeWorldEditor
by running `git submodule update --init --recursive`.
# Building on Windows
## Requirements

View File

@ -1,4 +1,5 @@
{
"subdirectories": ["externals/LibCommon"],
"dependencies": [
{
"name": "zlib",
@ -9,10 +10,10 @@
},
{
"name": "assimp",
"url": "https://github.com/jackoalan/assimp",
"url": "https://github.com/assimp/assimp",
"type": "git",
"head": "static-lib-export",
"ref": "d048bccad1ea3f72906da2d970b30f187db91f33",
"head": "master",
"ref": "83237de02ffb97305317d24564c44ce4794af3db",
"dependson": [
"zlib"
],
@ -29,20 +30,6 @@
"head": "master",
"ref": "a1284ae06586b958f36b8ecaba29390835ed2820"
},
{
"name": "CodeGen",
"url": "https://github.com/jackoalan/CodeGen",
"type": "git",
"head": "cmake",
"ref": "abfbe39870a0de99a31d536fa958e5391977b85c"
},
{
"name": "LibCommon",
"url": "https://github.com/jackoalan/LibCommon",
"type": "git",
"head": "dew",
"ref": "09184cc6dd132c831734a3235c4143fcfbd72281"
},
{
"name": "lzokay",
"url": "https://github.com/sfuller/lzokay",

1
externals/LibCommon vendored Submodule

@ -0,0 +1 @@
Subproject commit b4c0cb42f6b13b31c7a085d87e1ebf43defca327

View File

@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.12)
project(pwe_core CXX C)
find_package(libcommon CONFIG REQUIRED)
find_package(codegen CONFIG REQUIRED)
find_package(tinyxml2 CONFIG REQUIRED)
find_package(nod CONFIG REQUIRED)
find_package(logvisor CONFIG REQUIRED)
@ -15,8 +13,6 @@ find_package(ZLIB REQUIRED)
# AssImp's cmake config is pretty awful. It doesn't include necesary libraries. Hopefully this can be fixed later.
find_library(IIRXML_LIBRARY NAMES IrrXMLd IrrXML)
include(codegen)
file(GLOB_RECURSE source_files
"*.c"
"*.cpp"
@ -37,12 +33,11 @@ target_include_directories(pwe_core
target_link_libraries(
pwe_core
libcommon::libcommon
libcommon
nod::nod
logvisor::logvisor
lzokay::lzokay
OpenGL::GL
codegen::codegen
assimp::assimp
${IIRXML_LIBRARY}
${ZLIB_LIBRARY}
@ -57,14 +52,14 @@ target_compile_definitions(
GLEW_STATIC
)
gather_include_directories(pwecore_include_directories pwe_core)
gather_include_directories(pwe_core_include_directories pwe_core)
add_codegen_targets(
"${source_files}"
codegen_generated_files
"${PROJECT_SOURCE_DIR}"
"${PROJECT_BINARY_DIR}"
"${pwecore_include_directories}"
"${pwe_core_include_directories}"
)
add_custom_target(pwe_core_codegen DEPENDS ${codegen_generated_files} SOURCES ${source_files})

View File

@ -83,6 +83,11 @@ void CBasicViewport::mousePressEvent(QMouseEvent *pEvent)
if (IsMouseInputActive())
{
#if __APPLE__
// This will zero out the drag accumulators
gpMouseDragCocoaEventFilter->claimX();
gpMouseDragCocoaEventFilter->claimY();
#endif
SetCursorVisible(false);
mMouseMoved = false;
mMoveTimer.Restart();
@ -266,6 +271,10 @@ void CBasicViewport::ProcessInput()
if (IsMouseInputActive())
{
#ifdef __APPLE__
// QCursor::setPos only works on macOS when the user permits PWE
// to control the computer via Universal Access.
// As an alternative to relying on the delta of a warped mouse,
// use the accumulated delta directly reported by AppKit.
float XMovement = gpMouseDragCocoaEventFilter->claimX() * 0.01f;
float YMovement = gpMouseDragCocoaEventFilter->claimY() * 0.01f;
#else

View File

@ -124,6 +124,20 @@ target_compile_definitions(
UNICODE
)
gather_include_directories(pwe_editor_include_directories pwe_editor)
add_codegen_targets(
"${source_files}"
codegen_generated_files
"${PROJECT_SOURCE_DIR}"
"${PROJECT_BINARY_DIR}"
"${pwe_editor_include_directories}"
)
add_custom_target(pwe_editor_codegen DEPENDS ${codegen_generated_files} SOURCES ${source_files})
# Add the generated sources to the library target
target_sources(pwe_editor PRIVATE ${codegen_generated_files})
if (WIN32 OR APPLE)
set(CPACK_GENERATOR ZIP)
set(CPACK_STRIP_FILES ON)

View File

@ -38,24 +38,6 @@ public:
void SetActiveModel(CModel *pModel);
CModelEditorViewport* Viewport() const;
public slots:
void RefreshViewport();
void SetActiveMaterial(int MatIndex);
void SetActivePass(int PassIndex);
void UpdateMaterial();
void UpdateMaterial(int Value);
void UpdateMaterial(int ValueA, int ValueB);
void UpdateMaterial(double Value);
void UpdateMaterial(bool Value);
void UpdateMaterial(QColor Value);
void UpdateMaterial(QString Value);
void UpdateUI(int Value);
void UpdateAnimParamUI(EUVAnimMode Mode);
private:
void ActivateMatEditUI(bool Active);
void RefreshMaterial();
enum class EModelEditorWidget
{
SetSelectComboBox,
@ -99,6 +81,24 @@ private:
AnimParamDSpinBox,
};
public slots:
void RefreshViewport();
void SetActiveMaterial(int MatIndex);
void SetActivePass(int PassIndex);
void UpdateMaterial();
void UpdateMaterial(int Value);
void UpdateMaterial(int ValueA, int ValueB);
void UpdateMaterial(double Value);
void UpdateMaterial(bool Value);
void UpdateMaterial(QColor Value);
void UpdateMaterial(QString Value);
void UpdateUI(int Value);
void UpdateAnimParamUI(EUVAnimMode Mode);
private:
void ActivateMatEditUI(bool Active);
void RefreshMaterial();
private slots:
void Import();
void ConvertToDDS();

View File

@ -18,6 +18,7 @@ class CPoiMapSidebar : public CWorldEditorSidebar
Q_OBJECT
Ui::CPoiMapSidebar *ui;
public:
enum class EHighlightMode
{
HighlightAll,
@ -25,10 +26,6 @@ class CPoiMapSidebar : public CWorldEditorSidebar
HighlightSelected
};
CPoiMapModel mSourceModel;
QSortFilterProxyModel mModel;
EHighlightMode mHighlightMode;
// Viewport Picking
enum class EPickType
{
@ -36,8 +33,14 @@ class CPoiMapSidebar : public CWorldEditorSidebar
AddMeshes,
RemoveMeshes,
AddPOIs
} mPickType;
};
private:
CPoiMapModel mSourceModel;
QSortFilterProxyModel mModel;
EHighlightMode mHighlightMode;
EPickType mPickType;
CModelNode *mpHoverModel;
static const CColor skNormalColor;