armory/blender/arm/make_utils.py

54 lines
1.7 KiB
Python
Raw Normal View History

2017-03-15 12:30:14 +01:00
import arm.utils
2016-10-19 13:28:06 +02:00
import subprocess
2017-01-31 20:15:58 +01:00
import bpy
2016-10-19 13:28:06 +02:00
def kode_studio():
2017-03-15 12:30:14 +01:00
sdk_path = arm.utils.get_sdk_path()
project_path = arm.utils.get_fp()
2016-10-19 13:28:06 +02:00
2017-03-15 12:30:14 +01:00
if arm.utils.get_os() == 'win':
2016-11-01 12:02:58 +01:00
kode_path = sdk_path + '/win32/Kode Studio.exe'
2017-03-15 12:30:14 +01:00
subprocess.Popen([kode_path, arm.utils.get_fp()])
elif arm.utils.get_os() == 'mac':
2016-11-01 12:02:58 +01:00
kode_path = '"' + sdk_path + '/Kode Studio.app/Contents/MacOS/Electron"'
2017-03-28 14:30:51 +02:00
subprocess.Popen([kode_path + ' "' + arm.utils.get_fp() + '"'], shell=True)
2016-10-19 13:28:06 +02:00
else:
2016-11-01 12:02:58 +01:00
kode_path = sdk_path + '/linux64/kodestudio'
2017-03-15 12:30:14 +01:00
subprocess.Popen([kode_path, arm.utils.get_fp()])
2016-10-19 13:28:06 +02:00
def def_strings_to_array(strdefs):
defs = strdefs.split('_')
defs = defs[1:]
defs = ['_' + d for d in defs] # Restore _
return defs
def get_kha_target(target_name): # TODO: remove
if target_name == 'macos':
return 'osx'
return target_name
2017-01-31 20:15:58 +01:00
def runtime_to_gapi():
wrd = bpy.data.worlds['Arm']
if wrd.arm_play_runtime == 'Krom' or wrd.arm_play_runtime == 'Native':
2017-03-15 12:30:14 +01:00
return 'arm_gapi_' + arm.utils.get_os()
2017-01-31 20:15:58 +01:00
else:
return 'arm_gapi_html5'
def target_to_gapi():
# TODO: align target names
wrd = bpy.data.worlds['Arm']
if wrd.arm_project_target == 'krom':
2017-03-15 12:30:14 +01:00
return 'arm_gapi_' + arm.utils.get_os()
2017-01-31 20:15:58 +01:00
elif wrd.arm_project_target == 'macos':
return 'arm_gapi_mac'
elif wrd.arm_project_target == 'windows':
return 'arm_gapi_win'
2017-06-20 15:50:06 +02:00
elif wrd.arm_project_target == 'windowsapp':
return 'arm_gapi_winapp'
2017-01-31 20:15:58 +01:00
elif wrd.arm_project_target == 'android-native':
return 'arm_gapi_android'
2017-07-01 13:12:22 +02:00
elif wrd.arm_project_target == 'node':
return 'arm_gapi_html5'
2017-01-31 20:15:58 +01:00
else:
return 'arm_gapi_' + wrd.arm_project_target