Workaround for '.' folders

This commit is contained in:
Lubos Lenco 2017-03-20 13:23:31 +01:00
parent 6565a5b4de
commit 5cb78a8a91
3 changed files with 24 additions and 7 deletions

View file

@ -157,7 +157,7 @@ def make_deferred(cam):
# Handling node data
def check_default():
if bpy.data.node_groups.get('armory_default') == None and len(bpy.data.cameras) > 0:
if (bpy.data.node_groups.get('armory_default') == None or bpy.data.filepath == '') and len(bpy.data.cameras) > 0: # Old RP nodes can be saved in startup file, reload those when fp is ''
make_renderer(bpy.data.cameras[0])
def reload_blend_data():

View file

@ -89,17 +89,19 @@ def get_node_path():
else:
return get_sdk_path() + '/nodejs/node-linux64'
def get_khamake_path():
def get_kha_path():
if os.path.exists('Kha'):
return 'Kha/make'
return 'Kha'
if get_os() == 'win':
return get_sdk_path() + '/win32/Kha/make'
return get_sdk_path() + '/win32/Kha'
elif get_os() == 'mac':
return get_sdk_path() + '/Kode Studio.app/Contents/Kha/make'
return get_sdk_path() + '/Kode Studio.app/Contents/Kha'
else:
return get_sdk_path() + '/linux64/Kha/make'
return get_sdk_path() + '/linux64/Kha'
def get_khamake_path():
return get_kha_path() + '/make'
def fetch_bundled_script_names():
wrd = bpy.data.worlds['Arm']

View file

@ -1,5 +1,6 @@
import bpy
import os
import shutil
import arm.utils
import arm.assets as assets
import arm.make_state as state
@ -66,6 +67,20 @@ project.addSources('Sources');
for ref in shader_references:
f.write("project.addShaders('" + ref + "');\n")
# TODO: Khamake bug workaround - assets & shaders located in folder starting with '.' get discarded - copy them to project
if '/.' in sdk_path:
if not os.path.exists('build/compiled/KhaShaders'):
kha_shaders_path = arm.utils.get_kha_path() + '/Sources/Shaders'
shutil.copytree(kha_shaders_path, 'build/compiled/KhaShaders')
f.write("project.addShaders('build/compiled/KhaShaders/**');\n")
arm_assets = 'build/compiled/ArmoryAssets'
if not os.path.exists('build/compiled/ArmoryAssets'):
shutil.copytree(sdk_path + '/armory/Assets', arm_assets)
for i in range(0, len(asset_references)): # Redirect paths to local copy
if '/.' in asset_references[i]:
fname = asset_references[i].rsplit('/', 1)[1]
asset_references[i] = arm_assets + '/' + fname
for ref in shader_data_references:
ref = ref.replace('\\', '/')