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:
|
else:
|
||||||
self.material_to_object_dict[mat] = [bobject]
|
self.material_to_object_dict[mat] = [bobject]
|
||||||
self.material_to_arm_object_dict[mat] = [o]
|
self.material_to_arm_object_dict[mat] = [o]
|
||||||
|
|
||||||
# Add UniformsManager trait
|
# Add UniformsManager trait
|
||||||
if type is NodeType.MESH:
|
if type is NodeType.MESH:
|
||||||
uniformManager = {}
|
uniformManager = {}
|
||||||
|
@ -2672,7 +2672,7 @@ Make sure the mesh only has tris/quads.""")
|
||||||
}
|
}
|
||||||
self.output['traits'].append(out_trait)
|
self.output['traits'].append(out_trait)
|
||||||
|
|
||||||
if wrd.arm_live_patch:
|
if arm.utils.is_livepatch_enabled():
|
||||||
if 'traits' not in self.output:
|
if 'traits' not in self.output:
|
||||||
self.output['traits'] = []
|
self.output['traits'] = []
|
||||||
out_trait = {'type': 'Script', 'class_name': 'armory.trait.internal.LivePatch'}
|
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\tname = "' + group_name + '";\n')
|
||||||
f.write('\t\tthis.functionNodes = new Map();\n')
|
f.write('\t\tthis.functionNodes = new Map();\n')
|
||||||
f.write('\t\tthis.functionOutputNodes = 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(f'\t\tarmory.logicnode.LogicTree.nodeTrees["{group_name}"] = this;\n')
|
||||||
f.write('\t\tnotifyOnAdd(add);\n')
|
f.write('\t\tnotifyOnAdd(add);\n')
|
||||||
f.write('\t}\n\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_nodes
|
||||||
global parsed_ids
|
global parsed_ids
|
||||||
|
|
||||||
|
use_live_patch = arm.utils.is_livepatch_enabled()
|
||||||
|
|
||||||
if node.type == 'REROUTE':
|
if node.type == 'REROUTE':
|
||||||
if len(node.inputs) > 0 and len(node.inputs[0].links) > 0:
|
if len(node.inputs) > 0 and len(node.inputs[0].links) > 0:
|
||||||
return build_node(node.inputs[0].links[0].from_node, f)
|
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 + '.name = "' + name[1:] + '";\n')
|
||||||
f.write('\t\t' + name + '.watch(true);\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('\t\t' + name + '.name = "' + name[1:] + '";\n')
|
||||||
f.write(f'\t\tthis.nodes["{name[1:]}"] = {name};\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
|
from_type = inp.arm_socket_type
|
||||||
|
|
||||||
# Add input
|
# 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')
|
f.write(f'\t\t{"var __link = " if use_live_patch else ""}armory.logicnode.LogicNode.addLink({inp_name}, {name}, {inp_from}, {idx});\n')
|
||||||
if wrd.arm_live_patch:
|
if use_live_patch:
|
||||||
to_type = inp.arm_socket_type
|
to_type = inp.arm_socket_type
|
||||||
f.write(f'\t\t__link.fromType = "{from_type}";')
|
f.write(f'\t\t__link.fromType = "{from_type}";')
|
||||||
f.write(f'\t\t__link.toType = "{to_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
|
# Linked outputs are already handled after iterating over inputs
|
||||||
# above, so only unconnected outputs are handled here
|
# above, so only unconnected outputs are handled here
|
||||||
if not out.is_linked:
|
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')
|
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 wrd.arm_live_patch:
|
if use_live_patch:
|
||||||
out_type = out.arm_socket_type
|
out_type = out.arm_socket_type
|
||||||
f.write(f'\t\t__link.fromType = "{out_type}";')
|
f.write(f'\t\t__link.fromType = "{out_type}";')
|
||||||
f.write(f'\t\t__link.toType = "{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.file_format = orig_file_format
|
||||||
ren.image_settings.color_mode = orig_color_mode
|
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():
|
def blend_name():
|
||||||
return bpy.path.basename(bpy.context.blend_data.filepath).rsplit('.', 1)[0]
|
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) -> []:
|
def get_list_installed_vs(get_version: bool, get_name: bool, get_path: bool) -> []:
|
||||||
err = ''
|
err = ''
|
||||||
items = []
|
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):
|
if not os.path.isfile(path_file):
|
||||||
err = 'File "'+ path_file +'" not found.'
|
err = 'File "'+ path_file +'" not found.'
|
||||||
return items, err
|
return items, err
|
||||||
|
|
||||||
if (not get_version) and (not get_name) and (not get_path):
|
if (not get_version) and (not get_name) and (not get_path):
|
||||||
return items, err
|
return items, err
|
||||||
|
|
||||||
|
@ -1011,8 +1020,8 @@ def get_list_installed_vs(get_version: bool, get_name: bool, get_path: bool) ->
|
||||||
return items, err
|
return items, err
|
||||||
|
|
||||||
for i in range(count_items):
|
for i in range(count_items):
|
||||||
v = items_ver[i][0] 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 ''
|
v_full = items_ver[i][1] if len(items_ver) > i else ''
|
||||||
n = items_name[i] if len(items_name) > i else ''
|
n = items_name[i] if len(items_name) > i else ''
|
||||||
p = items_path[i] if len(items_path) > i else ''
|
p = items_path[i] if len(items_path) > i else ''
|
||||||
items.append((v, n, p, v_full))
|
items.append((v, n, p, v_full))
|
||||||
|
|
|
@ -166,10 +166,10 @@ project.addSources('Sources');
|
||||||
if enable_dce:
|
if enable_dce:
|
||||||
khafile.write("project.addParameter('-dce full');\n")
|
khafile.write("project.addParameter('-dce full');\n")
|
||||||
|
|
||||||
live_patch = wrd.arm_live_patch and state.target == 'krom'
|
use_live_patch = arm.utils.is_livepatch_enabled()
|
||||||
if wrd.arm_debug_console or live_patch:
|
if wrd.arm_debug_console or use_live_patch:
|
||||||
import_traits.append('armory.trait.internal.Bridge')
|
import_traits.append('armory.trait.internal.Bridge')
|
||||||
if live_patch:
|
if use_live_patch:
|
||||||
assets.add_khafile_def('arm_patch')
|
assets.add_khafile_def('arm_patch')
|
||||||
# Include all logic node classes so that they can later
|
# Include all logic node classes so that they can later
|
||||||
# get instantiated
|
# get instantiated
|
||||||
|
|
Loading…
Reference in a new issue