mirror of https://github.com/AxioDL/metaforce.git
addon distribution changes
This commit is contained in:
parent
112368c903
commit
4bf4834b86
|
@ -1,3 +1,2 @@
|
||||||
DataSpecRegistry.hpp
|
DataSpecRegistry.hpp
|
||||||
blender/hecl.zip
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
add_executable(bintoc bintoc.c)
|
add_executable(bintoc bintoc.c)
|
||||||
macro(bintoc out in sym)
|
macro(bintoc out in sym)
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${out}
|
if(IS_ABSOLUTE ${out})
|
||||||
COMMAND $<TARGET_FILE:bintoc> ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${in} ${CMAKE_CURRENT_BINARY_DIR}/${out} ${sym}
|
set(theOut ${out})
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${in})
|
else()
|
||||||
|
set(theOut ${CMAKE_CURRENT_BINARY_DIR}/${out})
|
||||||
|
endif()
|
||||||
|
if(IS_ABSOLUTE ${in})
|
||||||
|
set(theIn ${in})
|
||||||
|
else()
|
||||||
|
set(theIn ${CMAKE_CURRENT_SOURCE_DIR}/${in})
|
||||||
|
endif()
|
||||||
|
add_custom_command(OUTPUT ${theOut}
|
||||||
|
COMMAND $<TARGET_FILE:bintoc> ARGS ${theIn} ${theOut} ${sym}
|
||||||
|
DEPENDS ${theIn})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
|
@ -123,6 +123,8 @@ void BlenderConnection::_closePipe()
|
||||||
|
|
||||||
BlenderConnection::BlenderConnection(bool silenceBlender)
|
BlenderConnection::BlenderConnection(bool silenceBlender)
|
||||||
{
|
{
|
||||||
|
BlenderLog.report(LogVisor::Info, "Establishing BlenderConnection...");
|
||||||
|
|
||||||
/* Put hecl_blendershell.py in temp dir */
|
/* Put hecl_blendershell.py in temp dir */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
wchar_t* TMPDIR = _wgetenv(L"TEMP");
|
wchar_t* TMPDIR = _wgetenv(L"TEMP");
|
||||||
|
@ -143,6 +145,7 @@ BlenderConnection::BlenderConnection(bool silenceBlender)
|
||||||
|
|
||||||
HECL::SystemString blenderAddonPath(TMPDIR);
|
HECL::SystemString blenderAddonPath(TMPDIR);
|
||||||
blenderAddonPath += _S("/hecl_blenderaddon.zip");
|
blenderAddonPath += _S("/hecl_blenderaddon.zip");
|
||||||
|
InstallAddon(blenderAddonPath.c_str());
|
||||||
|
|
||||||
int installAttempt = 0;
|
int installAttempt = 0;
|
||||||
while (true)
|
while (true)
|
||||||
|
@ -182,12 +185,8 @@ BlenderConnection::BlenderConnection(bool silenceBlender)
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t cmdLine[2048];
|
wchar_t cmdLine[2048];
|
||||||
if (installAttempt == 1)
|
_snwprintf(cmdLine, 2048, L" --background -P \"%s\" -- %" PRIuPTR " %" PRIuPTR " \"%s\"",
|
||||||
_snwprintf(cmdLine, 2048, L" --background -P \"%s\" -- %" PRIuPTR " %" PRIuPTR " \"%s\"",
|
blenderShellPath.c_str(), uintptr_t(writehandle), uintptr_t(readhandle), blenderAddonPath.c_str());
|
||||||
blenderShellPath.c_str(), uintptr_t(writehandle), uintptr_t(readhandle), blenderAddonPath.c_str());
|
|
||||||
else
|
|
||||||
_snwprintf(cmdLine, 2048, L" --background -P \"%s\" -- %" PRIuPTR " %" PRIuPTR,
|
|
||||||
blenderShellPath.c_str(), uintptr_t(writehandle), uintptr_t(readhandle));
|
|
||||||
|
|
||||||
STARTUPINFO sinfo = {sizeof(STARTUPINFO)};
|
STARTUPINFO sinfo = {sizeof(STARTUPINFO)};
|
||||||
HANDLE nulHandle = NULL;
|
HANDLE nulHandle = NULL;
|
||||||
|
@ -238,14 +237,9 @@ BlenderConnection::BlenderConnection(bool silenceBlender)
|
||||||
/* Try user-specified blender first */
|
/* Try user-specified blender first */
|
||||||
if (blenderBin)
|
if (blenderBin)
|
||||||
{
|
{
|
||||||
if (installAttempt == 1)
|
execlp(blenderBin, blenderBin,
|
||||||
execlp(blenderBin, blenderBin,
|
"--background", "-P", blenderShellPath.c_str(),
|
||||||
"--background", "-P", blenderShellPath.c_str(),
|
"--", readfds, writefds, blenderAddonPath.c_str(), NULL);
|
||||||
"--", readfds, writefds, blenderAddonPath.c_str(), NULL);
|
|
||||||
else
|
|
||||||
execlp(blenderBin, blenderBin,
|
|
||||||
"--background", "-P", blenderShellPath.c_str(),
|
|
||||||
"--", readfds, writefds, NULL);
|
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
{
|
{
|
||||||
snprintf(errbuf, 256, "NOLAUNCH %s\n", strerror(errno));
|
snprintf(errbuf, 256, "NOLAUNCH %s\n", strerror(errno));
|
||||||
|
@ -255,14 +249,9 @@ BlenderConnection::BlenderConnection(bool silenceBlender)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise default blender */
|
/* Otherwise default blender */
|
||||||
if (installAttempt == 1)
|
execlp(DEFAULT_BLENDER_BIN, DEFAULT_BLENDER_BIN,
|
||||||
execlp(DEFAULT_BLENDER_BIN, DEFAULT_BLENDER_BIN,
|
"--background", "-P", blenderShellPath.c_str(),
|
||||||
"--background", "-P", blenderShellPath.c_str(),
|
"--", readfds, writefds, blenderAddonPath.c_str(), NULL);
|
||||||
"--", readfds, writefds, blenderAddonPath.c_str(), NULL);
|
|
||||||
else
|
|
||||||
execlp(DEFAULT_BLENDER_BIN, DEFAULT_BLENDER_BIN,
|
|
||||||
"--background", "-P", blenderShellPath.c_str(),
|
|
||||||
"--", readfds, writefds, NULL);
|
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
{
|
{
|
||||||
snprintf(errbuf, 256, "NOLAUNCH %s\n", strerror(errno));
|
snprintf(errbuf, 256, "NOLAUNCH %s\n", strerror(errno));
|
||||||
|
|
|
@ -13,20 +13,18 @@ list(APPEND PY_SOURCES
|
||||||
|
|
||||||
bintoc(hecl_blendershell.c hecl_blendershell.py HECL_BLENDERSHELL)
|
bintoc(hecl_blendershell.c hecl_blendershell.py HECL_BLENDERSHELL)
|
||||||
|
|
||||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/hecl.zip)
|
add_custom_command(OUTPUT hecl.zip DEPENDS ${PY_SOURCES}
|
||||||
message("-- Generating addon package")
|
COMMAND python ARGS zip_package.py ${CMAKE_CURRENT_BINARY_DIR}/hecl.zip
|
||||||
execute_process(COMMAND python zip_package.py
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
COMMENT "Generating addon package")
|
||||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/hecl.zip)
|
bintoc(hecl_addon.c "${CMAKE_CURRENT_BINARY_DIR}/hecl.zip" HECL_ADDON)
|
||||||
message(FATAL_ERROR "Unable to generate ${CMAKE_CURRENT_SOURCE_DIR}/hecl.zip; is python installed?")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
bintoc(hecl_addon.c hecl.zip HECL_ADDON)
|
|
||||||
|
|
||||||
add_library(HECLBlender
|
add_library(HECLBlender
|
||||||
BlenderConnection.cpp
|
BlenderConnection.cpp
|
||||||
BlenderConnection.hpp
|
BlenderConnection.hpp
|
||||||
hecl_blendershell.py
|
hecl_blendershell.py
|
||||||
hecl_blendershell.c
|
hecl_blendershell.c
|
||||||
|
zip_package.py
|
||||||
|
hecl.zip
|
||||||
hecl_addon.c
|
hecl_addon.c
|
||||||
${PY_SOURCES})
|
${PY_SOURCES})
|
||||||
|
|
|
@ -8,7 +8,7 @@ def zipdir(path, ziph):
|
||||||
ziph.write(os.path.join(root, file))
|
ziph.write(os.path.join(root, file))
|
||||||
|
|
||||||
package_path = 'hecl'
|
package_path = 'hecl'
|
||||||
target_zip = 'hecl.zip'
|
target_zip = sys.argv[1]
|
||||||
|
|
||||||
zf = zipfile.ZipFile(target_zip, mode='w', compression=zipfile.ZIP_DEFLATED)
|
zf = zipfile.ZipFile(target_zip, mode='w', compression=zipfile.ZIP_DEFLATED)
|
||||||
print('GENERATING', target_zip)
|
print('GENERATING', target_zip)
|
||||||
|
|
Loading…
Reference in New Issue