Fix publishing with live patch enabled
This commit is contained in:
parent
62ff11747b
commit
549040fc09
|
@ -2454,7 +2454,7 @@ Make sure the mesh only has tris/quads.""")
|
|||
else:
|
||||
self.material_to_object_dict[mat] = [bobject]
|
||||
self.material_to_arm_object_dict[mat] = [o]
|
||||
|
||||
|
||||
# Add UniformsManager trait
|
||||
if type is NodeType.MESH:
|
||||
uniformManager = {}
|
||||
|
@ -2672,7 +2672,7 @@ Make sure the mesh only has tris/quads.""")
|
|||
}
|
||||
self.output['traits'].append(out_trait)
|
||||
|
||||
if wrd.arm_live_patch:
|
||||
if arm.utils.is_livepatch_enabled():
|
||||
if 'traits' not in self.output:
|
||||
self.output['traits'] = []
|
||||
out_trait = {'type': 'Script', 'class_name': 'armory.trait.internal.LivePatch'}
|
||||
|
|
|
@ -78,7 +78,7 @@ def build_node_tree(node_group: 'arm.nodes_logic.ArmLogicTree'):
|
|||
f.write('\t\tname = "' + group_name + '";\n')
|
||||
f.write('\t\tthis.functionNodes = new Map();\n')
|
||||
f.write('\t\tthis.functionOutputNodes = new Map();\n')
|
||||
if wrd.arm_live_patch:
|
||||
if arm.utils.is_livepatch_enabled():
|
||||
f.write(f'\t\tarmory.logicnode.LogicTree.nodeTrees["{group_name}"] = this;\n')
|
||||
f.write('\t\tnotifyOnAdd(add);\n')
|
||||
f.write('\t}\n\n')
|
||||
|
@ -113,6 +113,8 @@ def build_node(node: bpy.types.Node, f: TextIO) -> Optional[str]:
|
|||
global parsed_nodes
|
||||
global parsed_ids
|
||||
|
||||
use_live_patch = arm.utils.is_livepatch_enabled()
|
||||
|
||||
if node.type == 'REROUTE':
|
||||
if len(node.inputs) > 0 and len(node.inputs[0].links) > 0:
|
||||
return build_node(node.inputs[0].links[0].from_node, f)
|
||||
|
@ -154,7 +156,7 @@ def build_node(node: bpy.types.Node, f: TextIO) -> Optional[str]:
|
|||
f.write('\t\t' + name + '.name = "' + name[1:] + '";\n')
|
||||
f.write('\t\t' + name + '.watch(true);\n')
|
||||
|
||||
elif wrd.arm_live_patch:
|
||||
elif use_live_patch:
|
||||
f.write('\t\t' + name + '.name = "' + name[1:] + '";\n')
|
||||
f.write(f'\t\tthis.nodes["{name[1:]}"] = {name};\n')
|
||||
|
||||
|
@ -212,8 +214,8 @@ def build_node(node: bpy.types.Node, f: TextIO) -> Optional[str]:
|
|||
from_type = inp.arm_socket_type
|
||||
|
||||
# Add input
|
||||
f.write(f'\t\t{"var __link = " if wrd.arm_live_patch else ""}armory.logicnode.LogicNode.addLink({inp_name}, {name}, {inp_from}, {idx});\n')
|
||||
if wrd.arm_live_patch:
|
||||
f.write(f'\t\t{"var __link = " if use_live_patch else ""}armory.logicnode.LogicNode.addLink({inp_name}, {name}, {inp_from}, {idx});\n')
|
||||
if use_live_patch:
|
||||
to_type = inp.arm_socket_type
|
||||
f.write(f'\t\t__link.fromType = "{from_type}";')
|
||||
f.write(f'\t\t__link.toType = "{to_type}";')
|
||||
|
@ -224,8 +226,8 @@ def build_node(node: bpy.types.Node, f: TextIO) -> Optional[str]:
|
|||
# Linked outputs are already handled after iterating over inputs
|
||||
# above, so only unconnected outputs are handled here
|
||||
if not out.is_linked:
|
||||
f.write(f'\t\t{"var __link = " if wrd.arm_live_patch else ""}armory.logicnode.LogicNode.addLink({name}, {build_default_node(out)}, {idx}, 0);\n')
|
||||
if wrd.arm_live_patch:
|
||||
f.write(f'\t\t{"var __link = " if use_live_patch else ""}armory.logicnode.LogicNode.addLink({name}, {build_default_node(out)}, {idx}, 0);\n')
|
||||
if use_live_patch:
|
||||
out_type = out.arm_socket_type
|
||||
f.write(f'\t\t__link.fromType = "{out_type}";')
|
||||
f.write(f'\t\t__link.toType = "{out_type}";')
|
||||
|
|
|
@ -78,6 +78,15 @@ def convert_image(image, path, file_format='JPEG'):
|
|||
ren.image_settings.file_format = orig_file_format
|
||||
ren.image_settings.color_mode = orig_color_mode
|
||||
|
||||
|
||||
def is_livepatch_enabled():
|
||||
"""Returns whether live patch is enabled and can be used."""
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
# If the game is published, the target is krom-[OS] and not krom,
|
||||
# so there is no live patch when publishing
|
||||
return wrd.arm_live_patch and state.target == 'krom'
|
||||
|
||||
|
||||
def blend_name():
|
||||
return bpy.path.basename(bpy.context.blend_data.filepath).rsplit('.', 1)[0]
|
||||
|
||||
|
@ -981,11 +990,11 @@ def get_visual_studio_from_version(version: str) -> str:
|
|||
def get_list_installed_vs(get_version: bool, get_name: bool, get_path: bool) -> []:
|
||||
err = ''
|
||||
items = []
|
||||
path_file = os.path.join(get_sdk_path(), 'Kha', 'Kinc', 'Tools', 'kincmake', 'Data', 'windows', 'vswhere.exe')
|
||||
path_file = os.path.join(get_sdk_path(), 'Kha', 'Kinc', 'Tools', 'kincmake', 'Data', 'windows', 'vswhere.exe')
|
||||
if not os.path.isfile(path_file):
|
||||
err = 'File "'+ path_file +'" not found.'
|
||||
return items, err
|
||||
|
||||
|
||||
if (not get_version) and (not get_name) and (not get_path):
|
||||
return items, err
|
||||
|
||||
|
@ -1011,8 +1020,8 @@ def get_list_installed_vs(get_version: bool, get_name: bool, get_path: bool) ->
|
|||
return items, err
|
||||
|
||||
for i in range(count_items):
|
||||
v = items_ver[i][0] if len(items_ver) > i else ''
|
||||
v_full = items_ver[i][1] if len(items_ver) > i else ''
|
||||
v = items_ver[i][0] if len(items_ver) > i else ''
|
||||
v_full = items_ver[i][1] if len(items_ver) > i else ''
|
||||
n = items_name[i] if len(items_name) > i else ''
|
||||
p = items_path[i] if len(items_path) > i else ''
|
||||
items.append((v, n, p, v_full))
|
||||
|
|
|
@ -166,10 +166,10 @@ project.addSources('Sources');
|
|||
if enable_dce:
|
||||
khafile.write("project.addParameter('-dce full');\n")
|
||||
|
||||
live_patch = wrd.arm_live_patch and state.target == 'krom'
|
||||
if wrd.arm_debug_console or live_patch:
|
||||
use_live_patch = arm.utils.is_livepatch_enabled()
|
||||
if wrd.arm_debug_console or use_live_patch:
|
||||
import_traits.append('armory.trait.internal.Bridge')
|
||||
if live_patch:
|
||||
if use_live_patch:
|
||||
assets.add_khafile_def('arm_patch')
|
||||
# Include all logic node classes so that they can later
|
||||
# get instantiated
|
||||
|
|
Loading…
Reference in a new issue