Skip to content

Commit

Permalink
Release - 1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
simon50keda committed Mar 7, 2017
1 parent d217734 commit 207e1c6
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 115 deletions.
18 changes: 10 additions & 8 deletions 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, "3770dea"),
"version": (1, 7, "785c749"),
"blender": (2, 78, 0),
"location": "File > Import-Export",
"wiki_url": "http://modding.scssoft.com/wiki/Documentation/Tools/SCS_Blender_Tools",
Expand Down Expand Up @@ -170,28 +170,30 @@ def draw(self, context):

col.row().prop(scs_globals, "import_scale")
col.row().separator()
col.row().prop(scs_globals, "import_preserve_path_for_export")
col.row().separator()
col.row().prop(scs_globals, "import_pim_file", toggle=True, icon="FILE_TICK" if scs_globals.import_pim_file else "X")
if scs_globals.import_pim_file:
col.row().prop(scs_globals, "use_normals")
col.row().prop(scs_globals, "use_welding")
if scs_globals.use_welding:
col.row().prop(scs_globals, "welding_precision")
col.row().prop(scs_globals, "import_use_normals")
col.row().prop(scs_globals, "import_use_welding")
if scs_globals.import_use_welding:
col.row().prop(scs_globals, "import_welding_precision")
col.row().separator()
col.row().prop(scs_globals, "import_pit_file", toggle=True, icon="FILE_TICK" if scs_globals.import_pit_file else "X")
if scs_globals.import_pit_file:
col.row().prop(scs_globals, "load_textures")
col.row().prop(scs_globals, "import_load_textures")
col.row().separator()
col.row().prop(scs_globals, "import_pic_file", toggle=True, icon="FILE_TICK" if scs_globals.import_pic_file else "X")
col.row().separator()
col.row().prop(scs_globals, "import_pip_file", toggle=True, icon="FILE_TICK" if scs_globals.import_pip_file else "X")
col.row().separator()
col.row(align=True).prop(scs_globals, "import_pis_file", toggle=True, icon="FILE_TICK" if scs_globals.import_pis_file else "X")
if scs_globals.import_pis_file:
col.row(align=True).prop(scs_globals, "bone_import_scale")
col.row(align=True).prop(scs_globals, "import_bone_scale")
col.row().separator()
col.row().prop(scs_globals, "import_pia_file", toggle=True, icon="FILE_TICK" if scs_globals.import_pia_file else "X")
if scs_globals.import_pia_file:
col.row().prop(scs_globals, "include_subdirs_for_pia")
col.row().prop(scs_globals, "import_include_subdirs_for_pia")

# Common global settings
ui.shared.draw_common_settings(layout, log_level_only=True)
Expand Down
2 changes: 1 addition & 1 deletion addon/io_scs_tools/exp/pia.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def export(scs_root_obj, armature, scs_animation, dirpath, skeleton_filepath):
custom_channels = _get_custom_channels(scs_animation, action)

# DATA CREATION
header_section = _fill_header_section(scs_animation.name, scs_globals.sign_export)
header_section = _fill_header_section(scs_animation.name, scs_globals.export_write_signature)
custom_channel_sections = _fill_channel_sections(custom_channels, "CustomChannel")
bone_channel_sections = _fill_channel_sections(bone_channels, "BoneChannel")
global_section = _fill_global_section(skeleton_filepath, total_time, len(bone_channels), len(custom_channels))
Expand Down
2 changes: 1 addition & 1 deletion addon/io_scs_tools/exp/pic.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def export(collision_locator_list, filepath, filename, used_parts):
print("************************************\n")

# DATA CREATION
header_section = _fill_header_section(filename, scs_globals.sign_export)
header_section = _fill_header_section(filename, scs_globals.export_write_signature)
piece_sections = []
materials = 0
len_vertices = 0
Expand Down
2 changes: 1 addition & 1 deletion addon/io_scs_tools/exp/pim/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def execute(dirpath, root_object, armature_object, skeleton_filepath, mesh_objec

scs_globals = _get_scs_globals()

if scs_globals.output_type == "5":
if scs_globals.export_output_type == "5":
format_version = 5
format_type = ""
else:
Expand Down
2 changes: 1 addition & 1 deletion addon/io_scs_tools/exp/pis.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def export(filepath, scs_root_obj, armature_object, used_bones):
scs_globals = _get_scs_globals()

# DATA CREATION
header_section = _fill_header_section(scs_root_obj.name, scs_globals.sign_export)
header_section = _fill_header_section(scs_root_obj.name, scs_globals.export_write_signature)
bones_section = _fill_bones_sections(scs_root_obj, armature_object, used_bones, scs_globals.export_scale)
global_section = _fill_global_section(len(used_bones))

Expand Down
4 changes: 2 additions & 2 deletions addon/io_scs_tools/exp/pit.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def export(root_object, filepath, used_materials, used_parts):
"""

scs_globals = _get_scs_globals()
output_type = scs_globals.output_type
output_type = scs_globals.export_output_type

file_name = root_object.name

Expand Down Expand Up @@ -628,7 +628,7 @@ def export(root_object, filepath, used_materials, used_parts):
variant_list.append((variant.name, part_list), )

# DATA CREATION
header_section = _fill_header_section(file_name, scs_globals.sign_export)
header_section = _fill_header_section(file_name, scs_globals.export_write_signature)
look_section = _fill_look_sections(look_list)
# part_sections = fill_part_section(part_list)
variant_section = _fill_variant_sections(variant_list)
Expand Down
6 changes: 3 additions & 3 deletions addon/io_scs_tools/imp/pim.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def _create_5_piece(
bm.free()

# NORMALS - has to be applied after bmesh creation as they are set directly to mesh
if _get_scs_globals().use_normals:
if _get_scs_globals().import_use_normals:

mesh.create_normals_split()

Expand Down Expand Up @@ -972,12 +972,12 @@ def load_pim_file(context, filepath, terrain_points_trans=None, preview_model=Fa
points_to_weld_list = []
if mesh_normals:
# print('Piece %i going to "make_posnorm_list"...' % ob_index)
if scs_globals.use_welding:
if scs_globals.import_use_welding:
points_to_weld_list = _mesh_utils.make_points_to_weld_list(mesh_vertices,
mesh_normals,
mesh_rgb,
mesh_rgba,
scs_globals.welding_precision)
scs_globals.import_welding_precision)

objects_data[ob_index] = (
context,
Expand Down
4 changes: 2 additions & 2 deletions addon/io_scs_tools/imp/pis.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def _get_bones(pis_container):
def load(filepath, armature, get_only=False):
scs_globals = _get_scs_globals()
import_scale = scs_globals.import_scale
bone_import_scale = scs_globals.bone_import_scale
connected_bones = scs_globals.connected_bones
bone_import_scale = scs_globals.import_bone_scale
connected_bones = scs_globals.import_connected_bones

print("\n************************************")
print("** SCS PIS Importer **")
Expand Down
13 changes: 12 additions & 1 deletion addon/io_scs_tools/imp/pix.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,17 @@ def load(context, filepath):
if objects or locators or (armature and skeleton):
scs_root_object = _create_scs_root_object(lod_name, loaded_variants, loaded_looks, mats_info, objects, locators, armature)

# Additionally if user wants to have automatically set custom export path, then let him have it :P
if scs_globals.import_preserve_path_for_export:
relative_export_path = _path_utils.relative_path(scs_globals.scs_project_path, path)
if path.startswith(scs_globals.scs_project_path) and relative_export_path != path:
scs_root_object.scs_props.scs_root_object_export_filepath = relative_export_path
scs_root_object.scs_props.scs_root_object_allow_custom_path = True
else:
lprint("W Can not preserve import path for export on import SCS Root %r, "
"as import was done from outside of current SCS Project Base Path!",
(scs_root_object.name,))

# IMPORT PIS
if scs_globals.import_pis_file:
# pis file path is created from directory of pim file and skeleton definition inside pim header
Expand Down Expand Up @@ -378,7 +389,7 @@ def load(context, filepath):
pia_files = []
index = 0
for root, dirs, files in os.walk(basepath):
if not scs_globals.include_subdirs_for_pia:
if not scs_globals.import_include_subdirs_for_pia:
if index > 0:
break
# print(' root: %s - dirs: %s - files: %s' % (str(root), str(dirs), str(files)))
Expand Down
53 changes: 28 additions & 25 deletions addon/io_scs_tools/internals/containers/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,29 +575,30 @@ 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(("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.use_welding))))
section.props.append(("WeldingPrecision", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.welding_precision))))
section.props.append(("UseNormals", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.use_normals))))
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))))
section.props.append(("UseNormals", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_use_normals))))
section.props.append(("ImportPitFile", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_pit_file))))
section.props.append(("LoadTextures", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.load_textures))))
section.props.append(("LoadTextures", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_load_textures))))
section.props.append(("ImportPicFile", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_pic_file))))
section.props.append(("ImportPipFile", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_pip_file))))
section.props.append(("ImportPisFile", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_pis_file))))
section.props.append(("ConnectedBones", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.connected_bones))))
section.props.append(("BoneImportScale", _property_utils.get_by_type(bpy.types.GlobalSCSProps.bone_import_scale)))
section.props.append(("ConnectedBones", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_connected_bones))))
section.props.append(("BoneImportScale", _property_utils.get_by_type(bpy.types.GlobalSCSProps.import_bone_scale)))
section.props.append(("ImportPiaFile", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_pia_file))))
section.props.append(("IncludeSubdirsForPia", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.include_subdirs_for_pia))))
section.props.append(("IncludeSubdirsForPia", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.import_include_subdirs_for_pia))))
return section

def fill_export_section():
"""Fills up "Export" section."""
section = _SectionData("Export")
section.props.append(("ExportScale", _property_utils.get_by_type(bpy.types.GlobalSCSProps.export_scale)))
section.props.append(("ApplyModifiers", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.apply_modifiers))))
section.props.append(("ExcludeEdgesplit", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.exclude_edgesplit))))
section.props.append(("IncludeEdgesplit", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.include_edgesplit))))
section.props.append(("ActiveUVOnly", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.active_uv_only))))
section.props.append(("ApplyModifiers", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.export_apply_modifiers))))
section.props.append(("ExcludeEdgesplit", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.export_exclude_edgesplit))))
section.props.append(("IncludeEdgesplit", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.export_include_edgesplit))))
section.props.append(("ActiveUVOnly", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.export_active_uv_only))))
section.props.append(("ExportVertexGroups", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.export_vertex_groups))))
section.props.append(("ExportVertexColor", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.export_vertex_color))))
section.props.append(("ExportVertexColorType", _property_utils.get_by_type(bpy.types.GlobalSCSProps.export_vertex_color_type)))
Expand All @@ -608,7 +609,7 @@ def fill_export_section():
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))))
section.props.append(("SignExport", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.sign_export))))
section.props.append(("SignExport", int(_property_utils.get_by_type(bpy.types.GlobalSCSProps.export_write_signature))))
return section

def fill_global_display_section():
Expand Down Expand Up @@ -812,46 +813,48 @@ def apply_settings():
pass
elif prop[0] == "ImportScale":
scs_globals.import_scale = float(prop[1])
elif prop[0] == "PreservePathForExport":
scs_globals.import_preserve_path_for_export = prop[1]
elif prop[0] == "ImportPimFile":
scs_globals.import_pim_file = prop[1]
elif prop[0] == "UseWelding":
scs_globals.use_welding = prop[1]
scs_globals.import_use_welding = prop[1]
elif prop[0] == "WeldingPrecision":
scs_globals.welding_precision = prop[1]
scs_globals.import_welding_precision = prop[1]
elif prop[0] == "UseNormals":
scs_globals.use_normals = prop[1]
scs_globals.import_use_normals = prop[1]
elif prop[0] == "ImportPitFile":
scs_globals.import_pit_file = prop[1]
elif prop[0] == "LoadTextures":
scs_globals.load_textures = prop[1]
scs_globals.import_load_textures = prop[1]
elif prop[0] == "ImportPicFile":
scs_globals.import_pic_file = prop[1]
elif prop[0] == "ImportPipFile":
scs_globals.import_pip_file = prop[1]
elif prop[0] == "ImportPisFile":
scs_globals.import_pis_file = prop[1]
elif prop[0] == "ConnectedBones":
scs_globals.connected_bones = prop[1]
scs_globals.import_connected_bones = prop[1]
elif prop[0] == "BoneImportScale":
scs_globals.bone_import_scale = float(prop[1])
scs_globals.import_bone_scale = float(prop[1])
elif prop[0] == "ImportPiaFile":
scs_globals.import_pia_file = prop[1]
elif prop[0] == "IncludeSubdirsForPia":
scs_globals.include_subdirs_for_pia = prop[1]
scs_globals.import_include_subdirs_for_pia = prop[1]
elif section.type == "Export":
for prop in section.props:
if prop[0] in ("", "#"):
pass
elif prop[0] == "ExportScale":
scs_globals.export_scale = float(prop[1])
elif prop[0] == "ApplyModifiers":
scs_globals.apply_modifiers = prop[1]
scs_globals.export_apply_modifiers = prop[1]
elif prop[0] == "ExcludeEdgesplit":
scs_globals.exclude_edgesplit = prop[1]
scs_globals.export_exclude_edgesplit = prop[1]
elif prop[0] == "IncludeEdgesplit":
scs_globals.include_edgesplit = prop[1]
scs_globals.export_include_edgesplit = prop[1]
elif prop[0] == "ActiveUVOnly":
scs_globals.active_uv_only = prop[1]
scs_globals.export_active_uv_only = prop[1]
elif prop[0] == "ExportVertexGroups":
scs_globals.export_vertex_groups = prop[1]
elif prop[0] == "ExportVertexColor":
Expand All @@ -863,15 +866,15 @@ def apply_settings():
elif prop[0] == "ExportPimFile":
scs_globals.export_pim_file = prop[1]
elif prop[0] == "OutputType":
scs_globals.output_type = prop[1]
scs_globals.export_output_type = prop[1]
elif prop[0] == "ExportPitFile":
scs_globals.export_pit_file = prop[1]
elif prop[0] == "ExportPicFile":
scs_globals.export_pic_file = prop[1]
elif prop[0] == "ExportPipFile":
scs_globals.export_pip_file = prop[1]
elif prop[0] == "SignExport":
scs_globals.sign_export = prop[1]
scs_globals.export_write_signature = prop[1]
elif section.type == "GlobalDisplay":
for prop in section.props:
if prop[0] in ("", "#"):
Expand Down
Loading

0 comments on commit 207e1c6

Please sign in to comment.