Skip to content

Commit

Permalink
Release - 1.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
simon50keda committed Mar 8, 2017
1 parent 207e1c6 commit e3dc726
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 7 deletions.
2 changes: 1 addition & 1 deletion addon/io_scs_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"name": "SCS Tools",
"description": "Setup models, Import-Export SCS data format",
"author": "Simon Lusenc (50keda), Milos Zajic (4museman)",
"version": (1, 7, "785c749"),
"version": (1, 7, "0bc527c"),
"blender": (2, 78, 0),
"location": "File > Import-Export",
"wiki_url": "http://modding.scssoft.com/wiki/Documentation/Tools/SCS_Blender_Tools",
Expand Down
4 changes: 2 additions & 2 deletions addon/io_scs_tools/internals/containers/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def fill_import_section():
"""Fills up "Import" section."""
section = _SectionData("Import")
section.props.append(("ImportScale", _property_utils.get_by_type(bpy.types.GlobalSCSProps.import_scale)))
section.props.append(("PreservePathForExport", _property_utils.get_by_type(bpy.types.GlobalSCSProps.import_preserve_path_for_export)))
section.props.append(("PreservePathForExport", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_preserve_path_for_export))))
section.props.append(("ImportPimFile", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_pim_file))))
section.props.append(("UseWelding", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_use_welding))))
section.props.append(("WeldingPrecision", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_welding_precision))))
Expand Down Expand Up @@ -605,7 +605,7 @@ def fill_export_section():
section.props.append(("ExportVertexColorType7", _property_utils.get_by_type(bpy.types.GlobalSCSProps.export_vertex_color_type_7)))
# section.props.append(("ExportAnimFile", info.get_default_prop_value(bpy.types.GlobalSCSProps.export_anim_file)))
section.props.append(("ExportPimFile", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.export_pim_file))))
section.props.append(("OutputType", _property_utils.get_by_type(bpy.types.GlobalSCSProps.output_type)))
section.props.append(("OutputType", _property_utils.get_by_type(bpy.types.GlobalSCSProps.export_output_type)))
section.props.append(("ExportPitFile", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.export_pit_file))))
section.props.append(("ExportPicFile", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.export_pic_file))))
section.props.append(("ExportPipFile", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.export_pip_file))))
Expand Down
7 changes: 3 additions & 4 deletions addon/io_scs_tools/operators/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import bpy
import os
import subprocess
from distutils import dir_util
from hashlib import sha1
from sys import platform
from bpy.props import StringProperty, CollectionProperty, EnumProperty, IntProperty, BoolProperty
Expand Down Expand Up @@ -872,7 +871,7 @@ def execute(self, context):

for root, dirs, files in os.walk(rsrc_path):
for folder in dirs:
dir_util.remove_tree(root + os.sep + folder)
_path_utils.rmtree(root + os.sep + folder)
for file in files:
os.remove(root + os.sep + file)

Expand Down Expand Up @@ -1271,7 +1270,7 @@ def execute(self, context):
# delete mod folder if previously no archive option was used
mod_filepath_as_dir = mod_filepath[:-4]
if os.path.isdir(mod_filepath_as_dir):
dir_util.remove_tree(mod_filepath_as_dir)
_path_utils.rmtree(mod_filepath_as_dir)

# make sure previous ZIP file is not present
if os.path.isfile(mod_filepath):
Expand All @@ -1286,7 +1285,7 @@ def execute(self, context):
if not os.path.isdir(curr_dir):
continue

dir_util.copy_tree(curr_dir, mod_filepath_as_dir)
_path_utils.copytree(curr_dir, mod_filepath_as_dir)

self.report({'INFO'}, "Packing done, mod copied to: '%s'" % mod_filepath_as_dir)

Expand Down
37 changes: 37 additions & 0 deletions addon/io_scs_tools/utils/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import bpy
import os
import subprocess
import shutil
from sys import platform
from io_scs_tools.utils.printout import lprint
from io_scs_tools.utils import get_scs_globals as _get_scs_globals
Expand Down Expand Up @@ -746,3 +747,39 @@ def ensure_symlink(src, dest):
subprocess.check_call(["mklink", "/J", dest, src], shell=True)
else:
os.symlink(src, dest)


def rmtree(src):
"""Remove directory or file. In case of directory all the content inside will also be removed.
:param src: source path which should be recursively removed
:type src: str
"""
try:
shutil.rmtree(src)
except shutil.Error:
lprint("E Problem removing directory: %r", (readable_norm(src),))


def copytree(src, dest):
"""Recursively copy whole tree of given source path to destination path.
If directories doesn't exists they will be created.
If directores/files exists then content will be overwritten.
:param src: source path to copy from
:type src: str
:param dest: destination path to copy to
:type dest: str
"""

for root, dirs, files in os.walk(src):
if not os.path.isdir(root):
os.makedirs(root)

for file in files:
rel_path = root.replace(src, '').lstrip(os.sep)
dest_path = os.path.join(dest, rel_path)

if not os.path.isdir(dest_path):
os.makedirs(dest_path)

shutil.copyfile(os.path.join(root, file), os.path.join(dest_path, file))

0 comments on commit e3dc726

Please sign in to comment.