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) 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) include(./dew.cmake)
integrate_dew() integrate_dew()
@ -16,7 +21,7 @@ include(cmake/generate_product_version.cmake)
if(MSVC) if(MSVC)
add_compile_options(/WX /wd4267 /wd4100 /wd4101 /wd4189) add_compile_options(/WX /wd4267 /wd4100 /wd4101 /wd4189)
else() else()
add_compile_options(-Wno-multichar) add_compile_options(-Wno-multichar -Wno-undefined-var-template)
endif() endif()
if(APPLE) if(APPLE)
@ -28,5 +33,11 @@ endif()
# as defined above. # as defined above.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 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/Core)
add_subdirectory(src/Editor) 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 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. 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 # Building on Windows
## Requirements ## Requirements

View File

@ -1,4 +1,5 @@
{ {
"subdirectories": ["externals/LibCommon"],
"dependencies": [ "dependencies": [
{ {
"name": "zlib", "name": "zlib",
@ -9,10 +10,10 @@
}, },
{ {
"name": "assimp", "name": "assimp",
"url": "https://github.com/jackoalan/assimp", "url": "https://github.com/assimp/assimp",
"type": "git", "type": "git",
"head": "static-lib-export", "head": "master",
"ref": "d048bccad1ea3f72906da2d970b30f187db91f33", "ref": "83237de02ffb97305317d24564c44ce4794af3db",
"dependson": [ "dependson": [
"zlib" "zlib"
], ],
@ -29,20 +30,6 @@
"head": "master", "head": "master",
"ref": "a1284ae06586b958f36b8ecaba29390835ed2820" "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", "name": "lzokay",
"url": "https://github.com/sfuller/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) project(pwe_core CXX C)
find_package(libcommon CONFIG REQUIRED)
find_package(codegen CONFIG REQUIRED)
find_package(tinyxml2 CONFIG REQUIRED) find_package(tinyxml2 CONFIG REQUIRED)
find_package(nod CONFIG REQUIRED) find_package(nod CONFIG REQUIRED)
find_package(logvisor 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. # 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) find_library(IIRXML_LIBRARY NAMES IrrXMLd IrrXML)
include(codegen)
file(GLOB_RECURSE source_files file(GLOB_RECURSE source_files
"*.c" "*.c"
"*.cpp" "*.cpp"
@ -37,12 +33,11 @@ target_include_directories(pwe_core
target_link_libraries( target_link_libraries(
pwe_core pwe_core
libcommon::libcommon libcommon
nod::nod nod::nod
logvisor::logvisor logvisor::logvisor
lzokay::lzokay lzokay::lzokay
OpenGL::GL OpenGL::GL
codegen::codegen
assimp::assimp assimp::assimp
${IIRXML_LIBRARY} ${IIRXML_LIBRARY}
${ZLIB_LIBRARY} ${ZLIB_LIBRARY}
@ -57,14 +52,14 @@ target_compile_definitions(
GLEW_STATIC GLEW_STATIC
) )
gather_include_directories(pwecore_include_directories pwe_core) gather_include_directories(pwe_core_include_directories pwe_core)
add_codegen_targets( add_codegen_targets(
"${source_files}" "${source_files}"
codegen_generated_files codegen_generated_files
"${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}"
"${PROJECT_BINARY_DIR}" "${PROJECT_BINARY_DIR}"
"${pwecore_include_directories}" "${pwe_core_include_directories}"
) )
add_custom_target(pwe_core_codegen DEPENDS ${codegen_generated_files} SOURCES ${source_files}) 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 (IsMouseInputActive())
{ {
#if __APPLE__
// This will zero out the drag accumulators
gpMouseDragCocoaEventFilter->claimX();
gpMouseDragCocoaEventFilter->claimY();
#endif
SetCursorVisible(false); SetCursorVisible(false);
mMouseMoved = false; mMouseMoved = false;
mMoveTimer.Restart(); mMoveTimer.Restart();
@ -266,6 +271,10 @@ void CBasicViewport::ProcessInput()
if (IsMouseInputActive()) if (IsMouseInputActive())
{ {
#ifdef __APPLE__ #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 XMovement = gpMouseDragCocoaEventFilter->claimX() * 0.01f;
float YMovement = gpMouseDragCocoaEventFilter->claimY() * 0.01f; float YMovement = gpMouseDragCocoaEventFilter->claimY() * 0.01f;
#else #else

View File

@ -124,6 +124,20 @@ target_compile_definitions(
UNICODE 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) if (WIN32 OR APPLE)
set(CPACK_GENERATOR ZIP) set(CPACK_GENERATOR ZIP)
set(CPACK_STRIP_FILES ON) set(CPACK_STRIP_FILES ON)

View File

@ -38,24 +38,6 @@ public:
void SetActiveModel(CModel *pModel); void SetActiveModel(CModel *pModel);
CModelEditorViewport* Viewport() const; 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 enum class EModelEditorWidget
{ {
SetSelectComboBox, SetSelectComboBox,
@ -99,6 +81,24 @@ private:
AnimParamDSpinBox, 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: private slots:
void Import(); void Import();
void ConvertToDDS(); void ConvertToDDS();

View File

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