mirror of https://github.com/AxioDL/metaforce.git
Blender Python API updates and better CMake dependency handling
This commit is contained in:
parent
7cc157c8b9
commit
387f8fa864
|
@ -16,7 +16,7 @@ endif()
|
||||||
|
|
||||||
include(ApplicationTools.cmake)
|
include(ApplicationTools.cmake)
|
||||||
|
|
||||||
configure_file(DataSpecRegistry.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/DataSpecRegistry.hpp @ONLY)
|
configure_file(DataSpecRegistry.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/DataSpecRegistry.hpp @ONLY)
|
||||||
|
|
||||||
unset(HECL_APPLICATION_REPS_INCLUDES_LOCAL)
|
unset(HECL_APPLICATION_REPS_INCLUDES_LOCAL)
|
||||||
foreach(theHeader ${HECL_APPLICATION_REPS_INCLUDES_LIST})
|
foreach(theHeader ${HECL_APPLICATION_REPS_INCLUDES_LIST})
|
||||||
|
@ -46,13 +46,6 @@ endforeach()
|
||||||
|
|
||||||
configure_file(include/hecl/ApplicationReps.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/ApplicationReps.hpp @ONLY)
|
configure_file(include/hecl/ApplicationReps.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/ApplicationReps.hpp @ONLY)
|
||||||
|
|
||||||
set(ATHENA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/athena/include)
|
|
||||||
set(ATHENA_INCLUDE_DIR ${ATHENA_INCLUDE_DIR} PARENT_SCOPE)
|
|
||||||
set(SQUISH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/libSquish)
|
|
||||||
set(SQUISH_INCLUDE_DIR ${SQUISH_INCLUDE_DIR} PARENT_SCOPE)
|
|
||||||
|
|
||||||
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/boo/include)
|
|
||||||
|
|
||||||
add_subdirectory(bintoc)
|
add_subdirectory(bintoc)
|
||||||
|
|
||||||
if(NOT TARGET bintoc)
|
if(NOT TARGET bintoc)
|
||||||
|
@ -70,9 +63,6 @@ if(NOT TARGET atdna)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(${BOO_SYS_DEFINES})
|
|
||||||
include_directories(include blender shaderc ${LOGVISOR_INCLUDE_DIR} ${ATHENA_INCLUDE_DIR}
|
|
||||||
${BOO_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${BOO_SYS_INCLUDES})
|
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
add_subdirectory(blender)
|
add_subdirectory(blender)
|
||||||
add_subdirectory(driver)
|
add_subdirectory(driver)
|
||||||
|
|
|
@ -22,7 +22,6 @@ add_custom_command(OUTPUT hecl.zip DEPENDS ${PY_SOURCES}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
COMMENT "Generating addon package")
|
COMMENT "Generating addon package")
|
||||||
bintoc(hecl_addon.cpp "${CMAKE_CURRENT_BINARY_DIR}/hecl.zip" HECL_ADDON)
|
bintoc(hecl_addon.cpp "${CMAKE_CURRENT_BINARY_DIR}/hecl.zip" HECL_ADDON)
|
||||||
bintoc(hecl_startup.cpp hecl_startup.blend HECL_STARTUP)
|
|
||||||
|
|
||||||
add_library(hecl-blender-addon
|
add_library(hecl-blender-addon
|
||||||
hecl_blendershell.py
|
hecl_blendershell.py
|
||||||
|
@ -30,5 +29,4 @@ add_library(hecl-blender-addon
|
||||||
zip_package.py
|
zip_package.py
|
||||||
hecl.zip
|
hecl.zip
|
||||||
hecl_addon.cpp
|
hecl_addon.cpp
|
||||||
hecl_startup.cpp
|
|
||||||
${PY_SOURCES})
|
${PY_SOURCES})
|
||||||
|
|
|
@ -35,10 +35,9 @@ def cook(writebuf, mesh_obj, use_luv=False):
|
||||||
|
|
||||||
# Copy mesh (and apply mesh modifiers with triangulation)
|
# Copy mesh (and apply mesh modifiers with triangulation)
|
||||||
copy_name = mesh_obj.name + "_hmdltri"
|
copy_name = mesh_obj.name + "_hmdltri"
|
||||||
copy_mesh = bpy.data.meshes.new(copy_name)
|
copy_mesh = bpy.data.meshes.new_from_object(mesh_obj, preserve_all_data_layers=True,
|
||||||
|
depsgraph=bpy.context.evaluated_depsgraph_get())
|
||||||
copy_obj = bpy.data.objects.new(copy_name, copy_mesh)
|
copy_obj = bpy.data.objects.new(copy_name, copy_mesh)
|
||||||
copy_obj.data = mesh_obj.to_mesh(bpy.context.depsgraph, True)
|
|
||||||
copy_mesh = copy_obj.data
|
|
||||||
copy_obj.scale = mesh_obj.scale
|
copy_obj.scale = mesh_obj.scale
|
||||||
bpy.context.scene.collection.objects.link(copy_obj)
|
bpy.context.scene.collection.objects.link(copy_obj)
|
||||||
bpy.ops.object.select_all(action='DESELECT')
|
bpy.ops.object.select_all(action='DESELECT')
|
||||||
|
@ -48,7 +47,7 @@ def cook(writebuf, mesh_obj, use_luv=False):
|
||||||
bpy.ops.mesh.select_all(action='SELECT')
|
bpy.ops.mesh.select_all(action='SELECT')
|
||||||
bpy.ops.mesh.quads_convert_to_tris()
|
bpy.ops.mesh.quads_convert_to_tris()
|
||||||
bpy.ops.mesh.select_all(action='DESELECT')
|
bpy.ops.mesh.select_all(action='DESELECT')
|
||||||
bpy.context.scene.update()
|
bpy.context.scene.update_tag()
|
||||||
bpy.ops.object.mode_set(mode='OBJECT')
|
bpy.ops.object.mode_set(mode='OBJECT')
|
||||||
copy_mesh.calc_normals_split()
|
copy_mesh.calc_normals_split()
|
||||||
rna_loops = copy_mesh.loops
|
rna_loops = copy_mesh.loops
|
||||||
|
@ -132,10 +131,9 @@ def cookcol(writebuf, mesh_obj):
|
||||||
|
|
||||||
# Copy mesh (and apply mesh modifiers with triangulation)
|
# Copy mesh (and apply mesh modifiers with triangulation)
|
||||||
copy_name = mesh_obj.name + "_hmdltri"
|
copy_name = mesh_obj.name + "_hmdltri"
|
||||||
copy_mesh = bpy.data.meshes.new(copy_name)
|
copy_mesh = bpy.data.meshes.new_from_object(mesh_obj, preserve_all_data_layers=True,
|
||||||
|
depsgraph=bpy.context.evaluated_depsgraph_get())
|
||||||
copy_obj = bpy.data.objects.new(copy_name, copy_mesh)
|
copy_obj = bpy.data.objects.new(copy_name, copy_mesh)
|
||||||
copy_obj.data = mesh_obj.to_mesh(bpy.context.depsgraph, True)
|
|
||||||
copy_mesh = copy_obj.data
|
|
||||||
copy_obj.scale = mesh_obj.scale
|
copy_obj.scale = mesh_obj.scale
|
||||||
bpy.context.scene.collection.objects.link(copy_obj)
|
bpy.context.scene.collection.objects.link(copy_obj)
|
||||||
bpy.ops.object.select_all(action='DESELECT')
|
bpy.ops.object.select_all(action='DESELECT')
|
||||||
|
@ -145,7 +143,7 @@ def cookcol(writebuf, mesh_obj):
|
||||||
bpy.ops.mesh.select_all(action='SELECT')
|
bpy.ops.mesh.select_all(action='SELECT')
|
||||||
bpy.ops.mesh.quads_convert_to_tris()
|
bpy.ops.mesh.quads_convert_to_tris()
|
||||||
bpy.ops.mesh.select_all(action='DESELECT')
|
bpy.ops.mesh.select_all(action='DESELECT')
|
||||||
bpy.context.scene.update()
|
bpy.context.scene.update_tag()
|
||||||
bpy.ops.object.mode_set(mode='OBJECT')
|
bpy.ops.object.mode_set(mode='OBJECT')
|
||||||
copy_mesh.calc_normals_split()
|
copy_mesh.calc_normals_split()
|
||||||
rna_loops = copy_mesh.loops
|
rna_loops = copy_mesh.loops
|
||||||
|
|
|
@ -257,10 +257,9 @@ def cook(writebuf, mesh_obj):
|
||||||
|
|
||||||
# Copy mesh (and apply mesh modifiers with triangulation)
|
# Copy mesh (and apply mesh modifiers with triangulation)
|
||||||
copy_name = mesh_obj.name + "_hmdltri"
|
copy_name = mesh_obj.name + "_hmdltri"
|
||||||
copy_mesh = bpy.data.meshes.new(copy_name)
|
copy_mesh = bpy.data.meshes.new_from_object(mesh_obj, preserve_all_data_layers=True,
|
||||||
|
depsgraph=bpy.context.evaluated_depsgraph_get())
|
||||||
copy_obj = bpy.data.objects.new(copy_name, copy_mesh)
|
copy_obj = bpy.data.objects.new(copy_name, copy_mesh)
|
||||||
copy_obj.data = mesh_obj.to_mesh(bpy.context.depsgraph, True)
|
|
||||||
copy_mesh = copy_obj.data
|
|
||||||
copy_obj.scale = mesh_obj.scale
|
copy_obj.scale = mesh_obj.scale
|
||||||
bpy.context.scene.collection.objects.link(copy_obj)
|
bpy.context.scene.collection.objects.link(copy_obj)
|
||||||
bpy.ops.object.select_all(action='DESELECT')
|
bpy.ops.object.select_all(action='DESELECT')
|
||||||
|
@ -270,7 +269,7 @@ def cook(writebuf, mesh_obj):
|
||||||
bpy.ops.mesh.select_all(action='SELECT')
|
bpy.ops.mesh.select_all(action='SELECT')
|
||||||
bpy.ops.mesh.quads_convert_to_tris()
|
bpy.ops.mesh.quads_convert_to_tris()
|
||||||
bpy.ops.mesh.select_all(action='DESELECT')
|
bpy.ops.mesh.select_all(action='DESELECT')
|
||||||
bpy.context.scene.update()
|
bpy.context.scene.update_tag()
|
||||||
bpy.ops.object.mode_set(mode='OBJECT')
|
bpy.ops.object.mode_set(mode='OBJECT')
|
||||||
copy_mesh.calc_normals_split()
|
copy_mesh.calc_normals_split()
|
||||||
rna_loops = copy_mesh.loops
|
rna_loops = copy_mesh.loops
|
||||||
|
|
|
@ -179,7 +179,7 @@ def write_action_aabb(writebuf, arm_obj, mesh_obj):
|
||||||
scene.frame_set(frame_idx)
|
scene.frame_set(frame_idx)
|
||||||
|
|
||||||
root_bone.location = (0.0,0.0,0.0)
|
root_bone.location = (0.0,0.0,0.0)
|
||||||
scene.update()
|
scene.update_tag()
|
||||||
if root_bone.rotation_mode == 'QUATERNION':
|
if root_bone.rotation_mode == 'QUATERNION':
|
||||||
root_bone.rotation_quaternion = (1.0,0.0,0.0,0.0)
|
root_bone.rotation_quaternion = (1.0,0.0,0.0,0.0)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -479,10 +479,9 @@ try:
|
||||||
elif cmdargs[0] == 'CREATE':
|
elif cmdargs[0] == 'CREATE':
|
||||||
if len(cmdargs) >= 4:
|
if len(cmdargs) >= 4:
|
||||||
bpy.ops.wm.open_mainfile(filepath=cmdargs[3])
|
bpy.ops.wm.open_mainfile(filepath=cmdargs[3])
|
||||||
loaded_blend = cmdargs[1]
|
|
||||||
else:
|
else:
|
||||||
bpy.ops.wm.read_homefile()
|
bpy.ops.wm.read_homefile()
|
||||||
loaded_blend = None
|
loaded_blend = cmdargs[1]
|
||||||
bpy.context.preferences.filepaths.save_version = 0
|
bpy.context.preferences.filepaths.save_version = 0
|
||||||
if 'FINISHED' in bpy.ops.wm.save_as_mainfile(filepath=cmdargs[1]):
|
if 'FINISHED' in bpy.ops.wm.save_as_mainfile(filepath=cmdargs[1]):
|
||||||
bpy.ops.file.hecl_patching_load()
|
bpy.ops.file.hecl_patching_load()
|
||||||
|
|
Binary file not shown.
|
@ -1,8 +1,4 @@
|
||||||
if(NOT WINDOWS_STORE)
|
if(NOT WINDOWS_STORE)
|
||||||
if(TARGET nod)
|
|
||||||
include_directories(${NOD_INCLUDE_DIR})
|
|
||||||
add_definitions(-DHECL_HAS_NOD=1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(hecl main.cpp
|
add_executable(hecl main.cpp
|
||||||
ToolBase.hpp
|
ToolBase.hpp
|
||||||
|
@ -27,16 +23,13 @@ if(APPLE)
|
||||||
list(APPEND PLAT_LIBS ${CF_LIBRARY})
|
list(APPEND PLAT_LIBS ${CF_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(hecl
|
target_link_libraries(hecl PUBLIC ${DATA_SPEC_LIBS} hecl-full)
|
||||||
${DATA_SPEC_LIBS}
|
|
||||||
hecl-full hecl-blender-addon athena-core nod
|
|
||||||
logvisor athena-libyaml ${PNG_LIB} squish xxhash zeus boo
|
|
||||||
${ZLIB_LIBRARIES} lzokay ${PLAT_LIBS} ${BOO_SYS_LIBS})
|
|
||||||
|
|
||||||
set_target_properties(hecl PROPERTIES COMPILE_DEFINITIONS HECL_DLPACKAGE="${HECL_DLPACKAGE}")
|
if(TARGET nod)
|
||||||
|
target_link_libraries(hecl PUBLIC nod)
|
||||||
|
target_compile_definitions(hecl PUBLIC HECL_HAS_NOD=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_compile_definitions(hecl PRIVATE HECL_DLPACKAGE="${HECL_DLPACKAGE}")
|
||||||
|
|
||||||
if(COMMAND cotire)
|
|
||||||
set_target_properties(hecl PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
|
||||||
cotire(hecl)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -111,7 +111,7 @@ public:
|
||||||
};
|
};
|
||||||
if (id[0] == 'G') {
|
if (id[0] == 'G') {
|
||||||
fileOut += _SYS_STR(".gcm");
|
fileOut += _SYS_STR(".gcm");
|
||||||
if (nod::DiscBuilderGCN::CalculateTotalSizeRequired(outPath.getAbsolutePath()) == -1)
|
if (nod::DiscBuilderGCN::CalculateTotalSizeRequired(outPath.getAbsolutePath()) == UINT64_MAX)
|
||||||
return 1;
|
return 1;
|
||||||
LogModule.report(logvisor::Info, _SYS_STR("Generating %s as GameCube image"), fileOut.c_str());
|
LogModule.report(logvisor::Info, _SYS_STR("Generating %s as GameCube image"), fileOut.c_str());
|
||||||
nod::DiscBuilderGCN db(fileOut, progFunc);
|
nod::DiscBuilderGCN db(fileOut, progFunc);
|
||||||
|
@ -120,7 +120,7 @@ public:
|
||||||
} else {
|
} else {
|
||||||
fileOut += _SYS_STR(".iso");
|
fileOut += _SYS_STR(".iso");
|
||||||
bool dualLayer;
|
bool dualLayer;
|
||||||
if (nod::DiscBuilderWii::CalculateTotalSizeRequired(outPath.getAbsolutePath(), dualLayer) == -1)
|
if (nod::DiscBuilderWii::CalculateTotalSizeRequired(outPath.getAbsolutePath(), dualLayer) == UINT64_MAX)
|
||||||
return 1;
|
return 1;
|
||||||
LogModule.report(logvisor::Info, _SYS_STR("Generating %s as %s-layer Wii image"), fileOut.c_str(),
|
LogModule.report(logvisor::Info, _SYS_STR("Generating %s as %s-layer Wii image"), fileOut.c_str(),
|
||||||
dualLayer ? _SYS_STR("dual") : _SYS_STR("single"));
|
dualLayer ? _SYS_STR("dual") : _SYS_STR("single"));
|
||||||
|
|
|
@ -31,7 +31,7 @@ logvisor::Module LogModule("hecl::Driver");
|
||||||
|
|
||||||
/* Static reference to dataspec additions
|
/* Static reference to dataspec additions
|
||||||
* (used by MSVC to definitively link DataSpecs) */
|
* (used by MSVC to definitively link DataSpecs) */
|
||||||
#include "../DataSpecRegistry.hpp"
|
#include "DataSpecRegistry.hpp"
|
||||||
|
|
||||||
bool XTERM_COLOR = false;
|
bool XTERM_COLOR = false;
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9bbd7af9f6c5ff34b37752906b0d78295c44938d
|
Subproject commit 727f057fa7774cb394f5ee795b2141a930d427ad
|
|
@ -1 +1 @@
|
||||||
Subproject commit 99519d3882d2346695f46a7136978a51cc261c42
|
Subproject commit 29a67b9ea856468a7c971af3f2244a5c278fad79
|
|
@ -1 +1 @@
|
||||||
Subproject commit 01bf9e65294f7abae61a84d5b855202565fe1267
|
Subproject commit fd5e6f4fe294bcdde24e591fcef37dd5d740e060
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0a4371546155b870a3ee636de1c43a3ff843e096
|
Subproject commit 532d3dcafb9f4652217a442e84fbbf546fb3cfc8
|
|
@ -28,7 +28,7 @@
|
||||||
#include "hecl/Backend.hpp"
|
#include "hecl/Backend.hpp"
|
||||||
#include "athena/Types.hpp"
|
#include "athena/Types.hpp"
|
||||||
#include "athena/MemoryWriter.hpp"
|
#include "athena/MemoryWriter.hpp"
|
||||||
#include "optional.hpp"
|
#include <optional>
|
||||||
#include "Token.hpp"
|
#include "Token.hpp"
|
||||||
|
|
||||||
namespace hecl::blender {
|
namespace hecl::blender {
|
||||||
|
@ -708,7 +708,6 @@ class Connection {
|
||||||
BlendType m_loadedType = BlendType::None;
|
BlendType m_loadedType = BlendType::None;
|
||||||
bool m_loadedRigged = false;
|
bool m_loadedRigged = false;
|
||||||
ProjectPath m_loadedBlend;
|
ProjectPath m_loadedBlend;
|
||||||
std::string m_startupBlend;
|
|
||||||
hecl::SystemString m_errPath;
|
hecl::SystemString m_errPath;
|
||||||
uint32_t _readStr(char* buf, uint32_t bufSz);
|
uint32_t _readStr(char* buf, uint32_t bufSz);
|
||||||
uint32_t _writeStr(const char* str, uint32_t len, int wpipe);
|
uint32_t _writeStr(const char* str, uint32_t len, int wpipe);
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct SDNABlock : public athena::io::DNA<athena::Little> {
|
||||||
};
|
};
|
||||||
Vector<SDNAStruct, AT_DNA_COUNT(numStrcs)> strcs;
|
Vector<SDNAStruct, AT_DNA_COUNT(numStrcs)> strcs;
|
||||||
|
|
||||||
const SDNAStruct* lookupStruct(const char* n, int& idx) const;
|
const SDNAStruct* lookupStruct(const char* n, atUint32& idx) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FileBlock : public athena::io::DNA<athena::Little> {
|
struct FileBlock : public athena::io::DNA<athena::Little> {
|
||||||
|
|
|
@ -31,8 +31,8 @@ public:
|
||||||
bool operator!=(const FourCC& other) const { return num != other.num; }
|
bool operator!=(const FourCC& other) const { return num != other.num; }
|
||||||
bool operator==(const char* other) const { return num == *(uint32_t*)other; }
|
bool operator==(const char* other) const { return num == *(uint32_t*)other; }
|
||||||
bool operator!=(const char* other) const { return num != *(uint32_t*)other; }
|
bool operator!=(const char* other) const { return num != *(uint32_t*)other; }
|
||||||
bool operator==(int32_t other) const { return num == other; }
|
bool operator==(int32_t other) const { return num == uint32_t(other); }
|
||||||
bool operator!=(int32_t other) const { return num != other; }
|
bool operator!=(int32_t other) const { return num != uint32_t(other); }
|
||||||
bool operator==(uint32_t other) const { return num == other; }
|
bool operator==(uint32_t other) const { return num == other; }
|
||||||
bool operator!=(uint32_t other) const { return num != other; }
|
bool operator!=(uint32_t other) const { return num != other; }
|
||||||
std::string toString() const { return std::string(fcc, 4); }
|
std::string toString() const { return std::string(fcc, 4); }
|
||||||
|
|
|
@ -1258,13 +1258,15 @@ static inline int32_t SBig(int32_t val) { return bswap32(val); }
|
||||||
static inline uint32_t SBig(uint32_t val) { return bswap32(val); }
|
static inline uint32_t SBig(uint32_t val) { return bswap32(val); }
|
||||||
static inline int64_t SBig(int64_t val) { return bswap64(val); }
|
static inline int64_t SBig(int64_t val) { return bswap64(val); }
|
||||||
static inline uint64_t SBig(uint64_t val) { return bswap64(val); }
|
static inline uint64_t SBig(uint64_t val) { return bswap64(val); }
|
||||||
static inline float SBig(float val) {
|
inline float SBig(float val) {
|
||||||
int32_t ival = bswap32(*((int32_t*)(&val)));
|
union { float f; atInt32 i; } uval1 = {val};
|
||||||
return *((float*)(&ival));
|
union { atInt32 i; float f; } uval2 = {bswap32(uval1.i)};
|
||||||
|
return uval2.f;
|
||||||
}
|
}
|
||||||
static inline double SBig(double val) {
|
inline double SBig(double val) {
|
||||||
int64_t ival = bswap64(*((int64_t*)(&val)));
|
union { double f; atInt64 i; } uval1 = {val};
|
||||||
return *((double*)(&ival));
|
union { atInt64 i; double f; } uval2 = {bswap64(uval1.i)};
|
||||||
|
return uval2.f;
|
||||||
}
|
}
|
||||||
#ifndef SBIG
|
#ifndef SBIG
|
||||||
#define SBIG(q) (((q)&0x000000FF) << 24 | ((q)&0x0000FF00) << 8 | ((q)&0x00FF0000) >> 8 | ((q)&0xFF000000) >> 24)
|
#define SBIG(q) (((q)&0x000000FF) << 24 | ((q)&0x0000FF00) << 8 | ((q)&0x00FF0000) >> 8 | ((q)&0xFF000000) >> 24)
|
||||||
|
|
|
@ -75,14 +75,6 @@ static void InstallAddon(const SystemChar* path) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InstallStartup(const char* path) {
|
|
||||||
FILE* fp = fopen(path, "wb");
|
|
||||||
if (!fp)
|
|
||||||
BlenderLog.report(logvisor::Fatal, "Unable to place hecl_startup.blend at '%s'", path);
|
|
||||||
fwrite(HECL_STARTUP, 1, HECL_STARTUP_SZ, fp);
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Read(int fd, void* buf, size_t size) {
|
static int Read(int fd, void* buf, size_t size) {
|
||||||
int intrCount = 0;
|
int intrCount = 0;
|
||||||
do {
|
do {
|
||||||
|
@ -245,7 +237,6 @@ Connection::Connection(int verbosityLevel) {
|
||||||
m_startupBlend = hecl::WideToUTF8(TMPDIR);
|
m_startupBlend = hecl::WideToUTF8(TMPDIR);
|
||||||
#else
|
#else
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
m_startupBlend = TMPDIR;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hecl::SystemString blenderShellPath(TMPDIR);
|
hecl::SystemString blenderShellPath(TMPDIR);
|
||||||
|
@ -253,13 +244,11 @@ Connection::Connection(int verbosityLevel) {
|
||||||
|
|
||||||
hecl::SystemString blenderAddonPath(TMPDIR);
|
hecl::SystemString blenderAddonPath(TMPDIR);
|
||||||
blenderAddonPath += _SYS_STR("/hecl_blenderaddon.zip");
|
blenderAddonPath += _SYS_STR("/hecl_blenderaddon.zip");
|
||||||
m_startupBlend += "/hecl_startup.blend";
|
|
||||||
|
|
||||||
bool FalseCmp = false;
|
bool FalseCmp = false;
|
||||||
if (BlenderFirstInit.compare_exchange_strong(FalseCmp, true)) {
|
if (BlenderFirstInit.compare_exchange_strong(FalseCmp, true)) {
|
||||||
InstallBlendershell(blenderShellPath.c_str());
|
InstallBlendershell(blenderShellPath.c_str());
|
||||||
InstallAddon(blenderAddonPath.c_str());
|
InstallAddon(blenderAddonPath.c_str());
|
||||||
InstallStartup(m_startupBlend.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int installAttempt = 0;
|
int installAttempt = 0;
|
||||||
|
@ -549,9 +538,7 @@ bool Connection::createBlend(const ProjectPath& path, BlendType type) {
|
||||||
BlenderLog.report(logvisor::Fatal, "BlenderConnection::createBlend() musn't be called with stream active");
|
BlenderLog.report(logvisor::Fatal, "BlenderConnection::createBlend() musn't be called with stream active");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_writeStr(("CREATE \""s + path.getAbsolutePathUTF8().data() + "\" " + BlendTypeStrs[int(type)] + " \"" +
|
_writeStr(("CREATE \""s + path.getAbsolutePathUTF8().data() + "\" " + BlendTypeStrs[int(type)]).c_str());
|
||||||
m_startupBlend + "\"")
|
|
||||||
.c_str());
|
|
||||||
char lineBuf[256];
|
char lineBuf[256];
|
||||||
_readStr(lineBuf, sizeof(lineBuf));
|
_readStr(lineBuf, sizeof(lineBuf));
|
||||||
if (!strcmp(lineBuf, "FINISHED")) {
|
if (!strcmp(lineBuf, "FINISHED")) {
|
||||||
|
@ -1072,7 +1059,7 @@ uint32_t Mesh::SkinBanks::addSurface(const Mesh& mesh, const Surface& surf, int
|
||||||
continue;
|
continue;
|
||||||
if (!VertInBank(bank.m_skinIdxs, v.iSkin) && !VertInBank(toAdd, v.iSkin)) {
|
if (!VertInBank(bank.m_skinIdxs, v.iSkin) && !VertInBank(toAdd, v.iSkin)) {
|
||||||
toAdd.push_back(v.iSkin);
|
toAdd.push_back(v.iSkin);
|
||||||
if (skinSlotCount > 0 && bank.m_skinIdxs.size() + toAdd.size() > skinSlotCount) {
|
if (skinSlotCount > 0 && bank.m_skinIdxs.size() + toAdd.size() > size_t(skinSlotCount)) {
|
||||||
toAdd.clear();
|
toAdd.clear();
|
||||||
done = false;
|
done = false;
|
||||||
break;
|
break;
|
||||||
|
@ -1190,7 +1177,7 @@ MapArea::Surface::Surface(Connection& conn) {
|
||||||
uint32_t borderCount;
|
uint32_t borderCount;
|
||||||
conn._readBuf(&borderCount, 4);
|
conn._readBuf(&borderCount, 4);
|
||||||
borders.reserve(borderCount);
|
borders.reserve(borderCount);
|
||||||
for (int i = 0; i < borderCount; ++i) {
|
for (uint32_t i = 0; i < borderCount; ++i) {
|
||||||
borders.emplace_back();
|
borders.emplace_back();
|
||||||
std::pair<Index, Index>& idx = borders.back();
|
std::pair<Index, Index>& idx = borders.back();
|
||||||
conn._readBuf(&idx, 8);
|
conn._readBuf(&idx, 8);
|
||||||
|
@ -1208,7 +1195,7 @@ MapArea::MapArea(Connection& conn) {
|
||||||
uint32_t vertCount;
|
uint32_t vertCount;
|
||||||
conn._readBuf(&vertCount, 4);
|
conn._readBuf(&vertCount, 4);
|
||||||
verts.reserve(vertCount);
|
verts.reserve(vertCount);
|
||||||
for (int i = 0; i < vertCount; ++i)
|
for (uint32_t i = 0; i < vertCount; ++i)
|
||||||
verts.emplace_back(conn);
|
verts.emplace_back(conn);
|
||||||
|
|
||||||
uint8_t isIdx;
|
uint8_t isIdx;
|
||||||
|
@ -1221,13 +1208,13 @@ MapArea::MapArea(Connection& conn) {
|
||||||
uint32_t surfCount;
|
uint32_t surfCount;
|
||||||
conn._readBuf(&surfCount, 4);
|
conn._readBuf(&surfCount, 4);
|
||||||
surfaces.reserve(surfCount);
|
surfaces.reserve(surfCount);
|
||||||
for (int i = 0; i < surfCount; ++i)
|
for (uint32_t i = 0; i < surfCount; ++i)
|
||||||
surfaces.emplace_back(conn);
|
surfaces.emplace_back(conn);
|
||||||
|
|
||||||
uint32_t poiCount;
|
uint32_t poiCount;
|
||||||
conn._readBuf(&poiCount, 4);
|
conn._readBuf(&poiCount, 4);
|
||||||
pois.reserve(poiCount);
|
pois.reserve(poiCount);
|
||||||
for (int i = 0; i < poiCount; ++i)
|
for (uint32_t i = 0; i < poiCount; ++i)
|
||||||
pois.emplace_back(conn);
|
pois.emplace_back(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1244,7 +1231,7 @@ MapUniverse::World::World(Connection& conn) {
|
||||||
uint32_t hexCount;
|
uint32_t hexCount;
|
||||||
conn._readBuf(&hexCount, 4);
|
conn._readBuf(&hexCount, 4);
|
||||||
hexagons.reserve(hexCount);
|
hexagons.reserve(hexCount);
|
||||||
for (int i = 0; i < hexCount; ++i)
|
for (uint32_t i = 0; i < hexCount; ++i)
|
||||||
hexagons.emplace_back(conn);
|
hexagons.emplace_back(conn);
|
||||||
|
|
||||||
color.read(conn);
|
color.read(conn);
|
||||||
|
@ -1278,7 +1265,7 @@ MapUniverse::MapUniverse(Connection& conn) {
|
||||||
uint32_t worldCount;
|
uint32_t worldCount;
|
||||||
conn._readBuf(&worldCount, 4);
|
conn._readBuf(&worldCount, 4);
|
||||||
worlds.reserve(worldCount);
|
worlds.reserve(worldCount);
|
||||||
for (int i = 0; i < worldCount; ++i)
|
for (uint32_t i = 0; i < worldCount; ++i)
|
||||||
worlds.emplace_back(conn);
|
worlds.emplace_back(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -354,7 +354,7 @@ void MeshOptimizer::optimize(Mesh& mesh, int max_skin_banks) const {
|
||||||
const Vertex& v = verts[loops[l].vert];
|
const Vertex& v = verts[loops[l].vert];
|
||||||
uint32_t skin_idx = get_skin_idx(v);
|
uint32_t skin_idx = get_skin_idx(v);
|
||||||
if (skin_slot_set.find(skin_idx) == skin_slot_set.end()) {
|
if (skin_slot_set.find(skin_idx) == skin_slot_set.end()) {
|
||||||
if (max_skin_banks > 0 && skin_slot_set.size() == max_skin_banks) {
|
if (max_skin_banks > 0 && skin_slot_set.size() == size_t(max_skin_banks)) {
|
||||||
brk = true;
|
brk = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ const SDNABlock::SDNAStruct::SDNAField* SDNABlock::SDNAStruct::lookupField(const
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SDNABlock::SDNAStruct* SDNABlock::lookupStruct(const char* n, int& idx) const {
|
const SDNABlock::SDNAStruct* SDNABlock::lookupStruct(const char* n, atUint32& idx) const {
|
||||||
idx = 0;
|
idx = 0;
|
||||||
for (const SDNAStruct& strc : strcs) {
|
for (const SDNAStruct& strc : strcs) {
|
||||||
const auto& name = types[strc.type];
|
const auto& name = types[strc.type];
|
||||||
|
@ -131,7 +131,7 @@ BlendType GetBlendType(SystemStringView path) {
|
||||||
if (!r)
|
if (!r)
|
||||||
return BlendType::None;
|
return BlendType::None;
|
||||||
|
|
||||||
int idPropIdx;
|
atUint32 idPropIdx;
|
||||||
const auto* idPropStruct = r.sdnaBlock().lookupStruct("IDProperty", idPropIdx);
|
const auto* idPropStruct = r.sdnaBlock().lookupStruct("IDProperty", idPropIdx);
|
||||||
if (!idPropStruct)
|
if (!idPropStruct)
|
||||||
return BlendType::None;
|
return BlendType::None;
|
||||||
|
@ -148,7 +148,7 @@ BlendType GetBlendType(SystemStringView path) {
|
||||||
return BlendType::None;
|
return BlendType::None;
|
||||||
atUint32 dataOffset = dataField->offset;
|
atUint32 dataOffset = dataField->offset;
|
||||||
|
|
||||||
int idPropDataIdx;
|
atUint32 idPropDataIdx;
|
||||||
const auto* idPropDataStruct = r.sdnaBlock().lookupStruct("IDPropertyData", idPropDataIdx);
|
const auto* idPropDataStruct = r.sdnaBlock().lookupStruct("IDPropertyData", idPropDataIdx);
|
||||||
if (!idPropDataStruct)
|
if (!idPropDataStruct)
|
||||||
return BlendType::None;
|
return BlendType::None;
|
||||||
|
|
|
@ -6,8 +6,6 @@ macro(hecl_add_list rel_path a_list)
|
||||||
set(${a_list} "${tmp_list}" PARENT_SCOPE)
|
set(${a_list} "${tmp_list}" PARENT_SCOPE)
|
||||||
endmacro(hecl_add_list)
|
endmacro(hecl_add_list)
|
||||||
|
|
||||||
include_directories(../extern/boo/glslang ../extern/boo)
|
|
||||||
|
|
||||||
add_subdirectory(Blender)
|
add_subdirectory(Blender)
|
||||||
add_subdirectory(Runtime)
|
add_subdirectory(Runtime)
|
||||||
|
|
||||||
|
@ -15,10 +13,6 @@ if(WIN32)
|
||||||
list(APPEND PLAT_SRCS winsupport.cpp ../include/hecl/winsupport.hpp)
|
list(APPEND PLAT_SRCS winsupport.cpp ../include/hecl/winsupport.hpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
atdna(atdna_HMDLMeta.cpp ../include/hecl/HMDLMeta.hpp)
|
|
||||||
atdna(atdna_CVar.cpp ../include/hecl/CVar.hpp)
|
|
||||||
atdna(atdna_SDNARead.cpp ../include/hecl/Blender/SDNARead.hpp)
|
|
||||||
|
|
||||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||||
add_definitions(-DHECL_MULTIPROCESSOR)
|
add_definitions(-DHECL_MULTIPROCESSOR)
|
||||||
endif()
|
endif()
|
||||||
|
@ -62,9 +56,7 @@ set(COMMON_SOURCES
|
||||||
SteamFinder.cpp
|
SteamFinder.cpp
|
||||||
WideStringConvert.cpp
|
WideStringConvert.cpp
|
||||||
Compilers.cpp
|
Compilers.cpp
|
||||||
Pipeline.cpp
|
Pipeline.cpp)
|
||||||
atdna_HMDLMeta.cpp
|
|
||||||
atdna_CVar.cpp)
|
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
list(APPEND PLAT_SRCS closefrom.c)
|
list(APPEND PLAT_SRCS closefrom.c)
|
||||||
|
@ -74,19 +66,29 @@ add_library(hecl-full
|
||||||
${FRONTEND_SOURCES}
|
${FRONTEND_SOURCES}
|
||||||
${RUNTIME_SOURCES}
|
${RUNTIME_SOURCES}
|
||||||
${BLENDER_SOURCES}
|
${BLENDER_SOURCES}
|
||||||
atdna_SDNARead.cpp
|
|
||||||
${COMMON_SOURCES}
|
${COMMON_SOURCES}
|
||||||
${HECL_HEADERS}
|
${HECL_HEADERS}
|
||||||
${PLAT_SRCS})
|
${PLAT_SRCS})
|
||||||
|
target_include_directories(hecl-full PUBLIC ../include)
|
||||||
|
target_link_libraries(hecl-full PUBLIC ${HECL_APPLICATION_REPS_TARGETS_LIST}
|
||||||
|
hecl-blender-addon boo athena-core logvisor)
|
||||||
|
target_atdna(hecl-full atdna_HMDLMeta_full.cpp ../include/hecl/HMDLMeta.hpp)
|
||||||
|
target_atdna(hecl-full atdna_CVar_full.cpp ../include/hecl/CVar.hpp)
|
||||||
|
target_atdna(hecl-full atdna_SDNARead_full.cpp ../include/hecl/Blender/SDNARead.hpp)
|
||||||
|
|
||||||
add_library(hecl-light
|
add_library(hecl-light
|
||||||
${RUNTIME_SOURCES}
|
${RUNTIME_SOURCES}
|
||||||
${COMMON_SOURCES}
|
${COMMON_SOURCES}
|
||||||
${HECL_HEADERS}
|
${HECL_HEADERS}
|
||||||
${PLAT_SRCS})
|
${PLAT_SRCS})
|
||||||
add_library(hecl-compilers Compilers.cpp WideStringConvert.cpp)
|
target_include_directories(hecl-light PUBLIC ../include)
|
||||||
|
target_link_libraries(hecl-light PUBLIC ${HECL_APPLICATION_REPS_TARGETS_LIST} boo athena-core logvisor)
|
||||||
|
target_atdna(hecl-light atdna_HMDLMeta_light.cpp ../include/hecl/HMDLMeta.hpp)
|
||||||
|
target_atdna(hecl-light atdna_CVar_light.cpp ../include/hecl/CVar.hpp)
|
||||||
|
|
||||||
add_dependencies(hecl-full ${HECL_APPLICATION_REPS_TARGETS_LIST})
|
add_library(hecl-compilers Compilers.cpp WideStringConvert.cpp)
|
||||||
add_dependencies(hecl-light ${HECL_APPLICATION_REPS_TARGETS_LIST})
|
target_include_directories(hecl-compilers PUBLIC ../include)
|
||||||
|
target_link_libraries(hecl-compilers PUBLIC boo athena-core logvisor)
|
||||||
|
|
||||||
if(COMMAND add_sanitizers)
|
if(COMMAND add_sanitizers)
|
||||||
add_sanitizers(hecl-full)
|
add_sanitizers(hecl-full)
|
||||||
|
|
|
@ -39,7 +39,7 @@ static const int maxscale = 7;
|
||||||
|
|
||||||
std::string HumanizeNumber(int64_t quotient, size_t len, const char* suffix, int scale, HNFlags flags) {
|
std::string HumanizeNumber(int64_t quotient, size_t len, const char* suffix, int scale, HNFlags flags) {
|
||||||
const char *prefixes, *sep;
|
const char *prefixes, *sep;
|
||||||
int i, r, remainder, s1, s2, sign;
|
int i, remainder, s1, s2, sign;
|
||||||
int divisordeccut;
|
int divisordeccut;
|
||||||
int64_t divisor, max;
|
int64_t divisor, max;
|
||||||
size_t baselen;
|
size_t baselen;
|
||||||
|
@ -143,11 +143,10 @@ std::string HumanizeNumber(int64_t quotient, size_t len, const char* suffix, int
|
||||||
(flags & HNFlags::Decimal) != HNFlags::None) {
|
(flags & HNFlags::Decimal) != HNFlags::None) {
|
||||||
s1 = (int)quotient + ((remainder * 10 + divisor / 2) / divisor / 10);
|
s1 = (int)quotient + ((remainder * 10 + divisor / 2) / divisor / 10);
|
||||||
s2 = ((remainder * 10 + divisor / 2) / divisor) % 10;
|
s2 = ((remainder * 10 + divisor / 2) / divisor) % 10;
|
||||||
r = snprintf(&ret[0], len, "%d%s%d%s%s%s", sign * s1, localeconv()->decimal_point, s2, sep, SCALE2PREFIX(i),
|
snprintf(&ret[0], len, "%d%s%d%s%s%s", sign * s1, localeconv()->decimal_point, s2, sep, SCALE2PREFIX(i), suffix);
|
||||||
suffix);
|
|
||||||
} else
|
} else
|
||||||
r = snprintf(&ret[0], len, "%" PRId64 "%s%s%s", sign * (quotient + (remainder + divisor / 2) / divisor), sep,
|
snprintf(&ret[0], len, "%" PRId64 "%s%s%s", sign * (quotient + (remainder + divisor / 2) / divisor), sep,
|
||||||
SCALE2PREFIX(i), suffix);
|
SCALE2PREFIX(i), suffix);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ static std::vector<boo::VertexElementDescriptor> ReadVertexFormat(ShaderCacheZip
|
||||||
uint32_t count = r.readUint32Big();
|
uint32_t count = r.readUint32Big();
|
||||||
ret.reserve(count);
|
ret.reserve(count);
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i) {
|
for (uint32_t i = 0; i < count; ++i) {
|
||||||
ret.emplace_back();
|
ret.emplace_back();
|
||||||
ret.back().semantic = boo::VertexSemantic(r.readUint32Big());
|
ret.back().semantic = boo::VertexSemantic(r.readUint32Big());
|
||||||
ret.back().semanticIdx = int(r.readUint32Big());
|
ret.back().semanticIdx = int(r.readUint32Big());
|
||||||
|
|
|
@ -69,7 +69,7 @@ std::u16string Char16Format(const wchar_t* format, ...) {
|
||||||
wchar_t resultBuf[FORMAT_BUF_SZ];
|
wchar_t resultBuf[FORMAT_BUF_SZ];
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
int printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va);
|
size_t printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
std::u16string res;
|
std::u16string res;
|
||||||
res.reserve(printSz);
|
res.reserve(printSz);
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
include_directories(../include
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../extern/athena/include
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../extern/boo
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../extern/boo/include
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../extern/boo/logvisor/include)
|
|
||||||
add_library(shaderc_lib shaderc.cpp shaderc.hpp)
|
add_library(shaderc_lib shaderc.cpp shaderc.hpp)
|
||||||
|
target_link_libraries(shaderc_lib PUBLIC hecl-compilers athena-core logvisor)
|
||||||
add_executable(shaderc main.cpp)
|
add_executable(shaderc main.cpp)
|
||||||
target_link_libraries(shaderc shaderc_lib hecl-compilers glslang soxr xxhash OSDependent OGLCompiler
|
target_link_libraries(shaderc shaderc_lib)
|
||||||
SPIRV glslang-default-resource-limits athena-core logvisor)
|
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
target_link_libraries(shaderc pthread)
|
target_link_libraries(shaderc pthread)
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||||
|
|
Loading…
Reference in New Issue