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