Skip to content

Commit

Permalink
Release - 2.2 Final
Browse files Browse the repository at this point in the history
  • Loading branch information
simon50keda committed Aug 6, 2021
1 parent 66c7fbc commit eb964f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 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": (2, 2, "325a3a7a"),
"version": (2, 2, "61827700"),
"blender": (2, 90, 0),
"location": "File > Import-Export",
"wiki_url": "http://modding.scssoft.com/wiki/Documentation/Tools/SCS_Blender_Tools",
Expand Down
6 changes: 3 additions & 3 deletions addon/io_scs_tools/exp/pit.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# ##### END GPL LICENSE BLOCK #####

# Copyright (C) 2013-2014: SCS Software
# Copyright (C) 2013-2021: SCS Software

import bpy
import os
Expand Down Expand Up @@ -162,9 +162,9 @@ def get_texture_path_from_material(material, texture_type, export_path):

# search for relative path inside current scs project base and
# possible dlc/mod parent folders; use first found
for infix in _path_utils.get_possible_project_infixes(include_zero_infix=True):
for infix in _path_utils.get_possible_project_infixes(include_zero_infix=True, append_sep=True):

curr_path = os.path.join(scs_project_path, infix + os.sep + texture_raw_path[2:] + ext)
curr_path = os.path.join(scs_project_path, infix + texture_raw_path[2:] + ext)

if os.path.isfile(curr_path):

Expand Down
14 changes: 10 additions & 4 deletions addon/io_scs_tools/utils/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# ##### END GPL LICENSE BLOCK #####

# Copyright (C) 2013-2019: SCS Software
# Copyright (C) 2013-2021: SCS Software


import bpy
Expand Down Expand Up @@ -96,7 +96,7 @@ def relative_path(base_path, path):
return repaired_path


def get_possible_project_infixes(include_zero_infix=False):
def get_possible_project_infixes(include_zero_infix=False, append_sep=False):
"""Gets possible project infixes in relation to currently selected SCS Project Path.
If path is ending with "dlc_" prefixed directory, then first infix is parent dlc.
Then possible base prefixes are added (sibling and parent known bases).
Expand All @@ -105,6 +105,8 @@ def get_possible_project_infixes(include_zero_infix=False):
:param include_zero_infix: should empty infix be included into the list
:type include_zero_infix: bool
:param append_sep: should we add final separator to the paths for easy path concatenation
:type append_sep: bool
:return: list of possible project infixes
:rtype: list[str]
"""
Expand All @@ -120,13 +122,17 @@ def get_possible_project_infixes(include_zero_infix=False):
project_path = _get_scs_globals().scs_project_path
project_path_basename = os.path.basename(project_path)

final_sep = ""
if append_sep:
final_sep = os.sep

# dlc infixes
if project_path_basename.startswith("dlc_"):
infixes.append(str((os.pardir + os.sep) * 2) + project_path_basename)
infixes.append(str((os.pardir + os.sep) * 2) + project_path_basename + final_sep)

# base infixes
for known_base in _KNOWN_PROJECT_BASES:
infixes.extend((os.pardir + os.sep + known_base, str((os.pardir + os.sep) * 2) + known_base))
infixes.extend((os.pardir + os.sep + known_base + final_sep, str((os.pardir + os.sep) * 2) + known_base + final_sep))

return infixes

Expand Down

0 comments on commit eb964f6

Please sign in to comment.