forked from LeenkxTeam/LNXSDK
Repe [T3DU] Update - 31f26d171bba0355ce2a77031e3aad4c64dbc7e9
This commit is contained in:
@ -99,7 +99,16 @@ def run_proc(cmd, done: Callable) -> subprocess.Popen:
|
||||
|
||||
|
||||
def compile_shader_pass(res, raw_shaders_path, shader_name, defs, make_variants):
|
||||
os.chdir(raw_shaders_path + '/' + shader_name)
|
||||
if shader_name == 'compositor_pass':
|
||||
wrd = bpy.data.worlds['Lnx']
|
||||
rpdat = wrd.lnx_rplist[wrd.lnx_rplist_index]
|
||||
if rpdat.lnx_custom_compositor:
|
||||
raw_shaders_path = os.path.join(lnx.utils.get_fp(), 'Compositor').replace('\\', '/')
|
||||
os.chdir(raw_shaders_path)
|
||||
else:
|
||||
os.chdir(raw_shaders_path + '/' + shader_name)
|
||||
else:
|
||||
os.chdir(raw_shaders_path + '/' + shader_name)
|
||||
|
||||
# Open json file
|
||||
json_name = shader_name + '.json'
|
||||
@ -255,7 +264,7 @@ def export_data_impl(fp, sdk_path):
|
||||
navigation_found = False
|
||||
ui_found = False
|
||||
network_found = False
|
||||
LeenkxExporter.compress_enabled = state.is_publish and wrd.lnx_asset_compression
|
||||
LeenkxExporter.compress_enabled = wrd.lnx_asset_compression
|
||||
LeenkxExporter.optimize_enabled = state.is_publish and wrd.lnx_optimize_data
|
||||
if not os.path.exists(build_dir + '/compiled/Assets'):
|
||||
os.makedirs(build_dir + '/compiled/Assets')
|
||||
@ -287,10 +296,28 @@ def export_data_impl(fp, sdk_path):
|
||||
|
||||
build_cache = BuildExportCache()
|
||||
|
||||
initial_window_scene = bpy.context.window.scene
|
||||
|
||||
for scene_name, asset_path in scene_targets:
|
||||
# Reset shader comparison arrays to prevent cross-scene shader merging
|
||||
assets.reset_shader_cons()
|
||||
LeenkxExporter.export_scene(bpy.context, asset_path, scene=bpy.data.scenes[scene_name], depsgraph=depsgraph, build_cache=build_cache)
|
||||
|
||||
scene = bpy.data.scenes[scene_name]
|
||||
|
||||
try:
|
||||
if bpy.context.window.scene != scene:
|
||||
bpy.context.window.scene = scene
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
scene_depsgraph = bpy.context.evaluated_depsgraph_get()
|
||||
|
||||
LeenkxExporter.export_scene(bpy.context, asset_path, scene=scene, depsgraph=scene_depsgraph, build_cache=build_cache)
|
||||
|
||||
finally:
|
||||
if bpy.context.window.scene != initial_window_scene:
|
||||
bpy.context.window.scene = initial_window_scene
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
if LeenkxExporter.export_physics:
|
||||
physics_found = True
|
||||
if LeenkxExporter.export_navigation:
|
||||
@ -389,6 +416,12 @@ def export_data_impl(fp, sdk_path):
|
||||
line_deferred_dst = os.path.join(shaders_path, 'line_deferred.frag.glsl')
|
||||
shutil.copyfile(line_deferred_src, line_deferred_dst)
|
||||
|
||||
if rpdat.rp_renderer == 'Deferred':
|
||||
# Copy deferred shader so that it can include compiled.inc
|
||||
line_deferred_src = os.path.join(sdk_path, 'leenkx', 'Shaders', 'render_draw', 'render_line_deferred.frag.glsl')
|
||||
line_deferred_dst = os.path.join(shaders_path, 'render_line_deferred.frag.glsl')
|
||||
shutil.copyfile(line_deferred_src, line_deferred_dst)
|
||||
|
||||
for ref in assets.shader_passes:
|
||||
for s in assets.shader_passes_assets[ref]:
|
||||
assets.add_shader(shaders_path + '/' + s + '.glsl')
|
||||
@ -947,6 +980,22 @@ def build_success():
|
||||
log.clear()
|
||||
wrd = bpy.data.worlds['Lnx']
|
||||
|
||||
sdk_path = lnx.utils.get_sdk_path()
|
||||
target_name = lnx.utils.get_kha_target(state.target)
|
||||
|
||||
files_path = os.path.join(lnx.utils.get_fp_build(), 'debug' if state.is_play else '', target_name)
|
||||
|
||||
if target_name in ('html5', 'krom') and wrd.lnx_minify_js:
|
||||
# Minify JS
|
||||
minifier_path = sdk_path + '/lib/leenkx_tools/uglifyjs/bin/uglifyjs'
|
||||
if target_name == 'html5':
|
||||
jsfile = files_path + '/kha.js'
|
||||
else:
|
||||
jsfile = files_path + '/krom.js'
|
||||
args = [lnx.utils.get_node_path(), minifier_path, jsfile, '-o', jsfile]
|
||||
proc = subprocess.Popen(args)
|
||||
proc.wait()
|
||||
|
||||
if state.is_play:
|
||||
cmd = []
|
||||
width, height = lnx.utils.get_render_resolution(lnx.utils.get_active_scene())
|
||||
@ -1205,21 +1254,6 @@ def build_success():
|
||||
webbrowser.open(url)
|
||||
|
||||
elif state.is_publish:
|
||||
sdk_path = lnx.utils.get_sdk_path()
|
||||
target_name = lnx.utils.get_kha_target(state.target)
|
||||
files_path = os.path.join(lnx.utils.get_fp_build(), target_name)
|
||||
|
||||
if target_name in ('html5', 'krom') and wrd.lnx_minify_js:
|
||||
# Minify JS
|
||||
minifier_path = sdk_path + '/lib/leenkx_tools/uglifyjs/bin/uglifyjs'
|
||||
if target_name == 'html5':
|
||||
jsfile = files_path + '/kha.js'
|
||||
else:
|
||||
jsfile = files_path + '/krom.js'
|
||||
args = [lnx.utils.get_node_path(), minifier_path, jsfile, '-o', jsfile]
|
||||
proc = subprocess.Popen(args)
|
||||
proc.wait()
|
||||
|
||||
if target_name == 'krom':
|
||||
# Copy Krom binaries
|
||||
if state.target == 'krom-windows':
|
||||
|
||||
Reference in New Issue
Block a user