Fast build, fix scene patch
This commit is contained in:
parent
887133625a
commit
59c043ea22
|
@ -3,7 +3,7 @@ armory
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/armory3d/armory.svg?branch=master)](https://travis-ci.org/armory3d/armory)
|
[![Build Status](https://travis-ci.org/armory3d/armory.svg?branch=master)](https://travis-ci.org/armory3d/armory)
|
||||||
|
|
||||||
[armory3d.org](http://armory3d.org) - [Manual](http://armory3d.org/manual/) - [Forums](http://forums.armory3d.org)
|
[armory3d.org](http://armory3d.org) - [Manual](http://armory3d.org/manual/html/) - [Forums](http://forums.armory3d.org)
|
||||||
|
|
||||||
In development! Armory is a real-time 3D engine aimed at creation of 3D games and applications - featuring full Blender integration, state of art rendering and ultra portability. The engine is currently available in a form of [early preview](http://armory3d.org/download.html).
|
In development! Armory is a real-time 3D engine aimed at creation of 3D games and applications - featuring full Blender integration, state of art rendering and ultra portability. The engine is currently available in a form of [early preview](http://armory3d.org/download.html).
|
||||||
|
|
||||||
|
|
|
@ -53,10 +53,6 @@ def add_shader(file):
|
||||||
if file not in shaders:
|
if file not in shaders:
|
||||||
shaders.append(file)
|
shaders.append(file)
|
||||||
|
|
||||||
wrd = bpy.data.worlds['Arm']
|
|
||||||
if not wrd.arm_recompile_trigger and file not in shaders_last:
|
|
||||||
wrd.arm_recompile_trigger = True
|
|
||||||
|
|
||||||
def add_shader_data(file):
|
def add_shader_data(file):
|
||||||
global shader_datas
|
global shader_datas
|
||||||
if file not in shader_datas:
|
if file not in shader_datas:
|
||||||
|
|
|
@ -2068,6 +2068,8 @@ class ArmoryExporter:
|
||||||
|
|
||||||
o['cast_shadow'] = objref.cycles.cast_shadow
|
o['cast_shadow'] = objref.cycles.cast_shadow
|
||||||
o['near_plane'] = objref.lamp_clip_start
|
o['near_plane'] = objref.lamp_clip_start
|
||||||
|
if (o['near_plane'] <= 0.11 and o['type'] == 'point'):
|
||||||
|
o['near_plane'] /= 10 # Prevent acne on close surfaces
|
||||||
o['far_plane'] = objref.lamp_clip_end
|
o['far_plane'] = objref.lamp_clip_end
|
||||||
o['fov'] = objref.lamp_fov
|
o['fov'] = objref.lamp_fov
|
||||||
o['shadows_bias'] = objref.lamp_shadows_bias
|
o['shadows_bias'] = objref.lamp_shadows_bias
|
||||||
|
|
|
@ -11,6 +11,7 @@ import arm.make as make
|
||||||
import arm.make_state as state
|
import arm.make_state as state
|
||||||
import arm.space_armory as space_armory
|
import arm.space_armory as space_armory
|
||||||
import arm.make_renderer as make_renderer
|
import arm.make_renderer as make_renderer
|
||||||
|
import arm.assets as assets
|
||||||
try:
|
try:
|
||||||
import barmory
|
import barmory
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -77,7 +78,9 @@ def on_scene_update_post(context):
|
||||||
operators_changed:
|
operators_changed:
|
||||||
# Otherwise rebuild scene
|
# Otherwise rebuild scene
|
||||||
if bridge.send_operator(last_operator) == False:
|
if bridge.send_operator(last_operator) == False:
|
||||||
|
assets.invalidate_enabled = False
|
||||||
make.play_project(in_viewport=True)
|
make.play_project(in_viewport=True)
|
||||||
|
assets.invalidate_enabled = True
|
||||||
|
|
||||||
# Use frame rate for update frequency for now
|
# Use frame rate for update frequency for now
|
||||||
fps_mult = 2.0 if (state.krom_running and arm.utils.get_os() == 'win') else 1.0 # Handlers called less frequently on Windows?
|
fps_mult = 2.0 if (state.krom_running and arm.utils.get_os() == 'win') else 1.0 # Handlers called less frequently on Windows?
|
||||||
|
@ -177,6 +180,8 @@ def on_load_post(context):
|
||||||
make_renderer.reload_blend_data()
|
make_renderer.reload_blend_data()
|
||||||
|
|
||||||
wrd = bpy.data.worlds['Arm']
|
wrd = bpy.data.worlds['Arm']
|
||||||
|
wrd.arm_recompile = True
|
||||||
|
|
||||||
for lib in wrd.my_librarytraitlist:
|
for lib in wrd.my_librarytraitlist:
|
||||||
if lib.enabled_prop:
|
if lib.enabled_prop:
|
||||||
fp = arm.utils.get_fp() + '/Libraries/' + lib.name
|
fp = arm.utils.get_fp() + '/Libraries/' + lib.name
|
||||||
|
|
|
@ -178,10 +178,9 @@ def compile_project(target_name=None, is_publish=False, watch=False, patch=False
|
||||||
|
|
||||||
if patch:
|
if patch:
|
||||||
if state.compileproc == None:
|
if state.compileproc == None:
|
||||||
# Quick build - disable krafix and haxe
|
|
||||||
cmd.append('--nohaxe')
|
cmd.append('--nohaxe')
|
||||||
cmd.append('--noshaders')
|
|
||||||
cmd.append('--noproject')
|
cmd.append('--noproject')
|
||||||
|
# cmd.append('--noshaders')
|
||||||
state.compileproc = subprocess.Popen(cmd, stderr=subprocess.PIPE)
|
state.compileproc = subprocess.Popen(cmd, stderr=subprocess.PIPE)
|
||||||
if state.playproc == None:
|
if state.playproc == None:
|
||||||
if state.in_viewport:
|
if state.in_viewport:
|
||||||
|
@ -319,7 +318,6 @@ def watch_compile(mode):
|
||||||
def watch_patch(mode):
|
def watch_patch(mode):
|
||||||
state.compileproc.wait()
|
state.compileproc.wait()
|
||||||
log.print_progress(100)
|
log.print_progress(100)
|
||||||
# result = state.compileproc.poll()
|
|
||||||
state.compileproc = None
|
state.compileproc = None
|
||||||
state.compileproc_finished = True
|
state.compileproc_finished = True
|
||||||
on_compiled(mode)
|
on_compiled(mode)
|
||||||
|
@ -335,11 +333,11 @@ def runtime_to_target(in_viewport):
|
||||||
|
|
||||||
def get_khajs_path(in_viewport, target):
|
def get_khajs_path(in_viewport, target):
|
||||||
if in_viewport:
|
if in_viewport:
|
||||||
return arm.utils.build_dir() + '/build/krom/krom.js'
|
return arm.utils.build_dir() + '/krom/krom.js'
|
||||||
elif target == 'krom':
|
elif target == 'krom':
|
||||||
return arm.utils.build_dir() + '/window/krom/krom.js'
|
return arm.utils.build_dir() + '/window/krom/krom.js'
|
||||||
else: # browser, electron
|
else: # browser, electron
|
||||||
return arm.utils.build_dir() + '/build/html5/kha.js'
|
return arm.utils.build_dir() + '/html5/kha.js'
|
||||||
|
|
||||||
def play_project(in_viewport):
|
def play_project(in_viewport):
|
||||||
global scripts_mtime
|
global scripts_mtime
|
||||||
|
@ -358,16 +356,13 @@ def play_project(in_viewport):
|
||||||
state.in_viewport = in_viewport
|
state.in_viewport = in_viewport
|
||||||
|
|
||||||
khajs_path = get_khajs_path(in_viewport, state.target)
|
khajs_path = get_khajs_path(in_viewport, state.target)
|
||||||
if wrd.arm_recompile or \
|
if not wrd.arm_cache_compiler or \
|
||||||
wrd.arm_recompile_trigger or \
|
|
||||||
not wrd.arm_cache_compiler or \
|
|
||||||
not wrd.arm_cache_shaders or \
|
|
||||||
not os.path.isfile(khajs_path) or \
|
not os.path.isfile(khajs_path) or \
|
||||||
state.last_target != state.target or \
|
state.last_target != state.target or \
|
||||||
state.last_in_viewport != state.in_viewport:
|
state.last_in_viewport != state.in_viewport or \
|
||||||
|
state.target == 'native':
|
||||||
wrd.arm_recompile = True
|
wrd.arm_recompile = True
|
||||||
|
|
||||||
wrd.arm_recompile_trigger = False
|
|
||||||
state.last_target = state.target
|
state.last_target = state.target
|
||||||
state.last_in_viewport = state.in_viewport
|
state.last_in_viewport = state.in_viewport
|
||||||
|
|
||||||
|
@ -380,15 +375,11 @@ def play_project(in_viewport):
|
||||||
scripts_mtime = mtime
|
scripts_mtime = mtime
|
||||||
wrd.arm_recompile = True
|
wrd.arm_recompile = True
|
||||||
|
|
||||||
if state.krom_running: # TODO: Temp live-patch fix till compiler cache is disabled
|
# New compile requred - traits changed
|
||||||
compile_project(target_name=state.target, patch=True)
|
if wrd.arm_recompile:
|
||||||
# New compile requred - traits or materials changed
|
|
||||||
elif wrd.arm_recompile or state.target == 'native':
|
|
||||||
|
|
||||||
# Unable to live-patch, stop player
|
# Unable to live-patch, stop player
|
||||||
if state.krom_running:
|
if state.krom_running:
|
||||||
bpy.ops.arm.space_stop('EXEC_DEFAULT')
|
bpy.ops.arm.space_stop('EXEC_DEFAULT')
|
||||||
# play_project(in_viewport=True) # Restart
|
|
||||||
return
|
return
|
||||||
|
|
||||||
mode = 'play'
|
mode = 'play'
|
||||||
|
|
|
@ -62,46 +62,45 @@ def update_mat_cache(self, context):
|
||||||
if self.is_cached == True:
|
if self.is_cached == True:
|
||||||
self.lock_cache = True
|
self.lock_cache = True
|
||||||
else:
|
else:
|
||||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
pass
|
||||||
|
|
||||||
def update_gapi_win(self, context):
|
def update_gapi_win(self, context):
|
||||||
if os.path.isdir(arm.utils.get_fp_build() + '/windows-build'):
|
if os.path.isdir(arm.utils.get_fp_build() + '/windows-build'):
|
||||||
shutil.rmtree(arm.utils.get_fp_build() + '/windows-build')
|
shutil.rmtree(arm.utils.get_fp_build() + '/windows-build')
|
||||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
bpy.data.worlds['Arm'].arm_recompile = True
|
||||||
assets.invalidate_compiled_data(self, context)
|
assets.invalidate_compiled_data(self, context)
|
||||||
|
|
||||||
def update_gapi_linux(self, context):
|
def update_gapi_linux(self, context):
|
||||||
if os.path.isdir(arm.utils.get_fp_build() + '/linux-build'):
|
if os.path.isdir(arm.utils.get_fp_build() + '/linux-build'):
|
||||||
shutil.rmtree(arm.utils.get_fp_build() + '/linux-build')
|
shutil.rmtree(arm.utils.get_fp_build() + '/linux-build')
|
||||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
bpy.data.worlds['Arm'].arm_recompile = True
|
||||||
assets.invalidate_compiled_data(self, context)
|
assets.invalidate_compiled_data(self, context)
|
||||||
|
|
||||||
def update_gapi_mac(self, context):
|
def update_gapi_mac(self, context):
|
||||||
if os.path.isdir(arm.utils.get_fp_build() + '/osx-build'):
|
if os.path.isdir(arm.utils.get_fp_build() + '/osx-build'):
|
||||||
shutil.rmtree(arm.utils.get_fp_build() + '/osx-build')
|
shutil.rmtree(arm.utils.get_fp_build() + '/osx-build')
|
||||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
bpy.data.worlds['Arm'].arm_recompile = True
|
||||||
assets.invalidate_compiled_data(self, context)
|
assets.invalidate_compiled_data(self, context)
|
||||||
|
|
||||||
def update_gapi_android(self, context):
|
def update_gapi_android(self, context):
|
||||||
if os.path.isdir(arm.utils.get_fp_build() + '/android-build'):
|
if os.path.isdir(arm.utils.get_fp_build() + '/android-build'):
|
||||||
shutil.rmtree(arm.utils.get_fp_build() + '/android-build')
|
shutil.rmtree(arm.utils.get_fp_build() + '/android-build')
|
||||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
bpy.data.worlds['Arm'].arm_recompile = True
|
||||||
assets.invalidate_compiled_data(self, context)
|
assets.invalidate_compiled_data(self, context)
|
||||||
|
|
||||||
def update_gapi_ios(self, context):
|
def update_gapi_ios(self, context):
|
||||||
if os.path.isdir(arm.utils.get_fp_build() + '/ios-build'):
|
if os.path.isdir(arm.utils.get_fp_build() + '/ios-build'):
|
||||||
shutil.rmtree(arm.utils.get_fp_build() + '/ios-build')
|
shutil.rmtree(arm.utils.get_fp_build() + '/ios-build')
|
||||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
bpy.data.worlds['Arm'].arm_recompile = True
|
||||||
assets.invalidate_compiled_data(self, context)
|
assets.invalidate_compiled_data(self, context)
|
||||||
|
|
||||||
def update_gapi_html5(self, context):
|
def update_gapi_html5(self, context):
|
||||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
bpy.data.worlds['Arm'].arm_recompile = True
|
||||||
assets.invalidate_compiled_data(self, context)
|
assets.invalidate_compiled_data(self, context)
|
||||||
|
|
||||||
def init_properties():
|
def init_properties():
|
||||||
global arm_version
|
global arm_version
|
||||||
bpy.types.World.arm_recompile = bpy.props.BoolProperty(name="Recompile", description="Recompile sources on next play", default=True)
|
bpy.types.World.arm_recompile = bpy.props.BoolProperty(name="Recompile", description="Recompile sources on next play", default=True)
|
||||||
bpy.types.World.arm_recompile_trigger = bpy.props.BoolProperty(name="Recompile Trigger", description="Force upcoming recomilation", default=False)
|
|
||||||
bpy.types.World.arm_progress = bpy.props.FloatProperty(name="Progress", description="Current build progress", default=100.0, min=0.0, max=100.0, soft_min=0.0, soft_max=100.0, subtype='PERCENTAGE', get=log.get_progress)
|
bpy.types.World.arm_progress = bpy.props.FloatProperty(name="Progress", description="Current build progress", default=100.0, min=0.0, max=100.0, soft_min=0.0, soft_max=100.0, subtype='PERCENTAGE', get=log.get_progress)
|
||||||
bpy.types.World.arm_version = StringProperty(name="Version", description="Armory SDK version", default="")
|
bpy.types.World.arm_version = StringProperty(name="Version", description="Armory SDK version", default="")
|
||||||
bpy.types.World.arm_project_target = EnumProperty(
|
bpy.types.World.arm_project_target = EnumProperty(
|
||||||
|
@ -159,7 +158,7 @@ def init_properties():
|
||||||
bpy.types.World.arm_lod_gen_levels = IntProperty(name="Levels", description="Number of levels to generate", default=3, min=1)
|
bpy.types.World.arm_lod_gen_levels = IntProperty(name="Levels", description="Number of levels to generate", default=3, min=1)
|
||||||
bpy.types.World.arm_lod_gen_ratio = FloatProperty(name="Decimate Ratio", description="Decimate ratio", default=0.8)
|
bpy.types.World.arm_lod_gen_ratio = FloatProperty(name="Decimate Ratio", description="Decimate ratio", default=0.8)
|
||||||
bpy.types.World.arm_cache_shaders = BoolProperty(name="Cache Shaders", description="Do not rebuild existing shaders", default=True, update=assets.invalidate_shader_cache)
|
bpy.types.World.arm_cache_shaders = BoolProperty(name="Cache Shaders", description="Do not rebuild existing shaders", default=True, update=assets.invalidate_shader_cache)
|
||||||
bpy.types.World.arm_cache_compiler = BoolProperty(name="Cache Compiler", description="Only recompile sources when required", default=False)
|
bpy.types.World.arm_cache_compiler = BoolProperty(name="Cache Compiler", description="Only recompile sources when required", default=True)
|
||||||
bpy.types.World.arm_gpu_processing = BoolProperty(name="GPU Processing", description="Utilize GPU for asset pre-processing at build time", default=True, update=assets.invalidate_compiled_data)
|
bpy.types.World.arm_gpu_processing = BoolProperty(name="GPU Processing", description="Utilize GPU for asset pre-processing at build time", default=True, update=assets.invalidate_compiled_data)
|
||||||
bpy.types.World.arm_play_live_patch = BoolProperty(name="Live Patching", description="Sync running player data to Blender", default=True)
|
bpy.types.World.arm_play_live_patch = BoolProperty(name="Live Patching", description="Sync running player data to Blender", default=True)
|
||||||
bpy.types.World.arm_play_auto_build = BoolProperty(name="Auto Build", description="Rebuild scene on operator changes", default=True)
|
bpy.types.World.arm_play_auto_build = BoolProperty(name="Auto Build", description="Rebuild scene on operator changes", default=True)
|
||||||
|
|
|
@ -92,6 +92,10 @@ project.addSources('Sources');
|
||||||
if dce_full:
|
if dce_full:
|
||||||
f.write("project.addParameter('-dce full');")
|
f.write("project.addParameter('-dce full');")
|
||||||
|
|
||||||
|
if wrd.arm_cache_compiler and (is_play or (state.target == 'html5' and not is_publish)):
|
||||||
|
# Load shaders manually
|
||||||
|
f.write("project.addDefine('arm_debug');\n")
|
||||||
|
|
||||||
for ref in shader_references:
|
for ref in shader_references:
|
||||||
f.write("project.addShaders('" + ref + "');\n")
|
f.write("project.addShaders('" + ref + "');\n")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue