Set file encoding to utf-8

This commit is contained in:
Moritz Brückner 2020-10-18 17:50:35 +02:00
parent e9c351c7e0
commit 863ec518f8
4 changed files with 9 additions and 9 deletions

View file

@ -62,7 +62,7 @@ def build_node_tree(node_group):
if node_group.arm_cached and os.path.isfile(file):
return
with open(file, 'w') as f:
with open(file, 'w', encoding="utf-8") as f:
f.write('package ' + pack_path + '.node;\n\n')
f.write('@:keep class ' + group_name + ' extends armory.logicnode.LogicTree {\n\n')
f.write('\tvar functionNodes:Map<String, armory.logicnode.FunctionNode>;\n\n')

View file

@ -313,9 +313,9 @@ class ArmEditBundledScriptButton(bpy.types.Operator):
if not os.path.isfile(target_hx_path):
# Rewrite package and copy
sf = open(source_hx_path)
sf = open(source_hx_path, encoding="utf-8")
sf.readline()
tf = open(target_hx_path, 'w')
tf = open(target_hx_path, 'w', encoding="utf-8")
tf.write('package ' + pkg + ';\n')
shutil.copyfileobj(sf, tf)
sf.close()
@ -502,7 +502,7 @@ class ArmNewTreeNodeDialog(bpy.types.Operator):
def draw(self, context):
self.layout.prop(self, "class_name")
class ArmEditTreeNodeDialog(bpy.types.Operator):
bl_idname = "arm.edit_treenode"
bl_label = "Edit Node Tree"
@ -833,7 +833,7 @@ def draw_traits(layout, obj, is_object):
op = column.operator("arm.new_treenode", text="New Node Tree", icon="ADD")
op.is_object = is_object
# At least one check is active Logic Node Editor
is_check_logic_node_editor = False
is_check_logic_node_editor = False
context_screen = bpy.context.screen
# Loop for all spaces
if context_screen is not None:
@ -861,7 +861,7 @@ def draw_traits(layout, obj, is_object):
if item is None:
column.enabled = False
else:
column.enabled = is_check_logic_node_editor
column.enabled = is_check_logic_node_editor
op = column.operator("arm.get_treenode", text="From Node Editor", icon="IMPORT")
op.is_object = is_object

View file

@ -273,7 +273,7 @@ script_props = {}
script_props_defaults = {}
script_warnings = {}
def fetch_script_props(file):
with open(file) as f:
with open(file, encoding="utf-8") as f:
name = file.rsplit('.', 1)[0]
if 'Sources' in name:
name = name[name.index('Sources') + 8:]

View file

@ -43,7 +43,7 @@ def write_khafilejs(is_play, export_physics, export_navigation, export_ui, is_pu
rel_path = arm.utils.get_relative_paths() # Convert absolute paths to relative
wrd = bpy.data.worlds['Arm']
with open('khafile.js', 'w') as khafile:
with open('khafile.js', 'w', encoding="utf-8") as khafile:
khafile.write(
"""// Auto-generated
let project = new Project('""" + arm.utils.safestr(wrd.arm_project_name) + """');
@ -380,7 +380,7 @@ def write_mainhx(scene_name, resx, resy, is_play, is_publish):
elif rpdat.rp_driver != 'Armory':
pathpack = rpdat.rp_driver.lower()
with open('Sources/Main.hx', 'w') as f:
with open('Sources/Main.hx', 'w', encoding="utf-8") as f:
f.write(
"""// Auto-generated
package ;