mirror of
https://github.com/LinoSchmidt/StickExporterTX.git
synced 2026-03-20 17:44:29 +01:00
Added download script for blender
This commit is contained in:
9
.gitignore
vendored
9
.gitignore
vendored
@@ -263,8 +263,9 @@ out/
|
||||
|
||||
output/
|
||||
|
||||
blender-win/
|
||||
blender-linux/
|
||||
blender/
|
||||
dependencies/windows/
|
||||
dependencies/darwin/
|
||||
dependencies/linux/
|
||||
|
||||
index.build.js
|
||||
index.build.js
|
||||
index.build.js.LICENSE.txt
|
||||
19
package.json
19
package.json
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"version": "0.6.2",
|
||||
"version": "0.8.1",
|
||||
"name": "stickexportertx",
|
||||
"productName": "StickExporterTX",
|
||||
"description": "3D stick exporter for EdgeTX/OpenTX logs",
|
||||
"main": "src/index.build.js",
|
||||
"scripts": {
|
||||
"install:deps": "python ./scripts/download-blender.py",
|
||||
"build:main": "cross-env NODE_ENV=production webpack --config configs/webpack.main.prod.config.babel.js",
|
||||
"build:renderer": "cross-env NODE_ENV=production webpack --config configs/webpack.renderer.prod.config.babel.js",
|
||||
"build": "cross-env npm run build:main && cross-env npm run build:renderer",
|
||||
@@ -29,8 +30,8 @@
|
||||
"package.json"
|
||||
],
|
||||
"extraFiles": [
|
||||
"assets/template.blend",
|
||||
"assets/blenderScript.py"
|
||||
"dependencies/template.blend",
|
||||
"dependencies/blenderScript.py"
|
||||
],
|
||||
"win": {
|
||||
"icon": "icon.png",
|
||||
@@ -39,8 +40,8 @@
|
||||
],
|
||||
"extraFiles": [
|
||||
{
|
||||
"from": "assets/blender/",
|
||||
"to": "assets/blender/",
|
||||
"from": "dependencies/windows/",
|
||||
"to": "dependencies/windows/",
|
||||
"filter": [
|
||||
"**/*"
|
||||
]
|
||||
@@ -62,8 +63,8 @@
|
||||
],
|
||||
"extraFiles": [
|
||||
{
|
||||
"from": "assets/blender/",
|
||||
"to": "assets/blender/",
|
||||
"from": "dependencies/linux/",
|
||||
"to": "dependencies/linux/",
|
||||
"filter": [
|
||||
"**/*"
|
||||
]
|
||||
@@ -78,8 +79,8 @@
|
||||
],
|
||||
"extraFiles": [
|
||||
{
|
||||
"from": "assets/blender/",
|
||||
"to": "assets/blender/",
|
||||
"from": "dependencies/darwin/",
|
||||
"to": "dependencies/darwin/",
|
||||
"filter": [
|
||||
"**/*"
|
||||
]
|
||||
|
||||
44
scripts/download-blender.py
Normal file
44
scripts/download-blender.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from io import BytesIO
|
||||
import urllib.request
|
||||
from zipfile import ZipFile
|
||||
import tarfile
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
|
||||
windowsURL = 'https://ftp.halifax.rwth-aachen.de/blender/release/Blender3.2/blender-3.2.0-windows-x64.zip'
|
||||
linuxURL = 'https://ftp.halifax.rwth-aachen.de/blender/release/Blender3.2/blender-3.2.0-linux-x64.tar.xz'
|
||||
|
||||
# Windows
|
||||
if(os.path.exists('./dependencies/windows')):
|
||||
print("Removing old windows folder")
|
||||
shutil.rmtree('./dependencies/windows')
|
||||
|
||||
print("Downloading windows version")
|
||||
with urllib.request.urlopen(windowsURL) as zipresp:
|
||||
with ZipFile(BytesIO(zipresp.read())) as zfile:
|
||||
zfile.extractall('./dependencies/windows')
|
||||
|
||||
print("Adjust windows version")
|
||||
oldWindowsName = windowsURL.split('/')[-1].replace('.zip', '')
|
||||
os.rename('./dependencies/windows/' + oldWindowsName, './dependencies/windows/blender')
|
||||
|
||||
# Linux
|
||||
if(os.path.exists('./dependencies/linux')):
|
||||
print("Removing old linux folder")
|
||||
shutil.rmtree('./dependencies/linux')
|
||||
|
||||
print("Downloading linux version")
|
||||
os.mkdir('./dependencies/linux')
|
||||
|
||||
urllib.request.urlretrieve(linuxURL, './dependencies/linux/blender.tar.xz')
|
||||
print("Extracting linux version")
|
||||
with tarfile.open('./dependencies/linux/blender.tar.xz') as tfile:
|
||||
tfile.extractall('./dependencies/linux')
|
||||
|
||||
print("Adjust linux version")
|
||||
oldLinuxName = linuxURL.split('/')[-1].replace('.tar.xz', '')
|
||||
os.rename('./dependencies/linux/' + oldLinuxName, './dependencies/linux/blender')
|
||||
|
||||
print("Clean up linux folder")
|
||||
os.remove('./dependencies/linux/blender.tar.xz')
|
||||
@@ -6,6 +6,15 @@ export const SettingPath = path.join(dataPath, "settings.xml");
|
||||
|
||||
export const defaultOutputPath = path.join(app.getPath('videos'), "StickExporterTX");
|
||||
|
||||
export const blenderPath = path.join("assets", "blender", "blender");
|
||||
export const templatePath = path.join("assets", "template.blend");
|
||||
export const blenderScriptPath = path.join("assets", "blenderScript.py");
|
||||
let platformFolder = "";
|
||||
if(process.platform === "win32"){
|
||||
platformFolder = "windows";
|
||||
} else if(process.platform === "darwin"){
|
||||
platformFolder = "darwin";
|
||||
} else if(process.platform === "linux"){
|
||||
platformFolder = "linux";
|
||||
}
|
||||
|
||||
export const blenderPath = path.join("dependencies", platformFolder, "blender", "blender");
|
||||
export const templatePath = path.join("dependencies", "template.blend");
|
||||
export const blenderScriptPath = path.join("dependencies", "blenderScript.py");
|
||||
Reference in New Issue
Block a user