Use local libs if present

This commit is contained in:
Lubos Lenco 2017-02-09 00:33:19 +01:00
parent 0581c9df81
commit 5a0de8a427
4 changed files with 44 additions and 21 deletions

View file

@ -76,14 +76,33 @@ def get_ffmpeg_path():
addon_prefs = user_preferences.addons['armory'].preferences
return addon_prefs.ffmpeg_path
def get_node_path():
if get_os() == 'win':
return get_sdk_path() + '/nodejs/node.exe'
elif get_os() == 'mac':
return get_sdk_path() + '/nodejs/node-osx'
else:
return get_sdk_path() + '/nodejs/node-linux64'
def get_khamake_path():
if os.path.exists('Kha'):
return 'Kha/make'
if get_os() == 'win':
return get_sdk_path() + '/win32/Kha/make'
elif get_os() == 'mac':
return get_sdk_path() + '/Kode Studio.app/Contents/Kha/make'
else:
return get_sdk_path() + '/linux64/Kha/make'
def fetch_script_names():
if bpy.data.filepath == "":
return
sdk_path = get_sdk_path()
wrd = bpy.data.worlds['Arm']
wrd.bundled_scripts_list.clear()
os.chdir(sdk_path + '/armory/Sources/armory/trait')
os.chdir(get_sdk_path() + '/armory/Sources/armory/trait')
for file in glob.glob('*.hx'):
wrd.bundled_scripts_list.add().name = file.rsplit('.')[0]
wrd.scripts_list.clear()

View file

@ -132,7 +132,6 @@ def export_data(fp, sdk_path, is_play=False, is_publish=False, in_viewport=False
write_data.write_main(is_play, in_viewport, is_publish)
def compile_project(target_name=None, is_publish=False, watch=False, patch=False):
sdk_path = armutils.get_sdk_path()
ffmpeg_path = armutils.get_ffmpeg_path()
wrd = bpy.data.worlds['Arm']
@ -142,15 +141,8 @@ def compile_project(target_name=None, is_publish=False, watch=False, patch=False
elif target_name == 'native':
target_name = ''
if armutils.get_os() == 'win':
node_path = sdk_path + '/nodejs/node.exe'
khamake_path = sdk_path + '/win32/Kha/make'
elif armutils.get_os() == 'mac':
node_path = sdk_path + '/nodejs/node-osx'
khamake_path = sdk_path + '/Kode Studio.app/Contents/Kha/make'
else:
node_path = sdk_path + '/nodejs/node-linux64'
khamake_path = sdk_path + '/linux64/Kha/make'
node_path = armutils.get_node_path()
khamake_path = armutils.get_khamake_path()
kha_target_name = make_utils.get_kha_target(target_name)
cmd = [node_path, khamake_path, kha_target_name]

View file

@ -141,30 +141,36 @@ def init_properties():
name="Runtime", description="Player runtime used when launching in new window", default='Krom', update=assets.invalidate_shader_cache)
bpy.types.World.arm_loadbar = BoolProperty(name="Load Bar", description="Show asset loading progress on published builds", default=True)
bpy.types.World.arm_gapi_win = EnumProperty(
items = [('opengl2', 'OpenGL', 'opengl2'),
items = [('opengl2', 'Auto', 'opengl2'),
('opengl2', 'OpenGL', 'opengl2'),
('vulkan', 'Vulkan', 'vulkan'),
('direct3d9', 'Direct3D9', 'direct3d9'),
('direct3d11', 'Direct3D11', 'direct3d11'),
('direct3d12', 'Direct3D12', 'direct3d12')],
name="Graphics API", default='opengl2', description='Based on currently selected target', update=update_gapi_win)
bpy.types.World.arm_gapi_linux = EnumProperty(
items = [('opengl2', 'OpenGL', 'opengl2'),
items = [('opengl2', 'Auto', 'opengl2'),
('opengl2', 'OpenGL', 'opengl2'),
('vulkan', 'Vulkan', 'vulkan')],
name="Graphics API", default='opengl2', description='Based on currently selected target', update=update_gapi_linux)
bpy.types.World.arm_gapi_android = EnumProperty(
items = [('opengl2', 'OpenGL', 'opengl2'),
items = [('opengl2', 'Auto', 'opengl2'),
('opengl2', 'OpenGL', 'opengl2'),
('vulkan', 'Vulkan', 'vulkan')],
name="Graphics API", default='opengl2', description='Based on currently selected target', update=update_gapi_android)
bpy.types.World.arm_gapi_mac = EnumProperty(
items = [('opengl2', 'OpenGL', 'opengl2'),
items = [('opengl2', 'Auto', 'opengl2'),
('opengl2', 'OpenGL', 'opengl2'),
('metal', 'Metal', 'metal')],
name="Graphics API", default='opengl2', description='Based on currently selected target', update=update_gapi_mac)
bpy.types.World.arm_gapi_ios = EnumProperty(
items = [('opengl2', 'OpenGL', 'opengl2'),
items = [('opengl2', 'Auto', 'opengl2'),
('opengl2', 'OpenGL', 'opengl2'),
('metal', 'Metal', 'metal')],
name="Graphics API", default='opengl2', description='Based on currently selected target', update=update_gapi_ios)
bpy.types.World.arm_gapi_html5 = EnumProperty(
items = [('webgl', 'WebGL', 'webgl')],
items = [('webgl', 'Auto', 'webgl'),
('webgl', 'WebGL', 'webgl')],
name="Graphics API", default='webgl', description='Based on currently selected target', update=update_gapi_html5)
# For object

View file

@ -25,9 +25,15 @@ let project = new Project('""" + wrd.arm_project_name + """');
project.addSources('Sources');
""")
f.write(add_armory_library(sdk_path, 'armory'))
f.write(add_armory_library(sdk_path, 'iron'))
if os.path.exists('Libraries/armory'):
f.write('project.addLibrary("armory")')
else:
f.write(add_armory_library(sdk_path, 'armory'))
if os.path.exists('Libraries/iron'):
f.write('project.addLibrary("iron")')
else:
f.write(add_armory_library(sdk_path, 'iron'))
if export_physics:
f.write("project.addDefine('arm_physics');\n")