diff --git a/addon/io_scs_tools/__init__.py b/addon/io_scs_tools/__init__.py index 4c9545b..dda97aa 100644 --- a/addon/io_scs_tools/__init__.py +++ b/addon/io_scs_tools/__init__.py @@ -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", @@ -170,16 +170,18 @@ 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() @@ -187,11 +189,11 @@ def draw(self, context): 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) diff --git a/addon/io_scs_tools/exp/pia.py b/addon/io_scs_tools/exp/pia.py index fe15eaf..a8d4318 100644 --- a/addon/io_scs_tools/exp/pia.py +++ b/addon/io_scs_tools/exp/pia.py @@ -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)) diff --git a/addon/io_scs_tools/exp/pic.py b/addon/io_scs_tools/exp/pic.py index b5b602c..8dd7825 100644 --- a/addon/io_scs_tools/exp/pic.py +++ b/addon/io_scs_tools/exp/pic.py @@ -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 diff --git a/addon/io_scs_tools/exp/pim/exporter.py b/addon/io_scs_tools/exp/pim/exporter.py index 744f330..9435842 100644 --- a/addon/io_scs_tools/exp/pim/exporter.py +++ b/addon/io_scs_tools/exp/pim/exporter.py @@ -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: diff --git a/addon/io_scs_tools/exp/pis.py b/addon/io_scs_tools/exp/pis.py index 658857f..7b43a0b 100644 --- a/addon/io_scs_tools/exp/pis.py +++ b/addon/io_scs_tools/exp/pis.py @@ -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)) diff --git a/addon/io_scs_tools/exp/pit.py b/addon/io_scs_tools/exp/pit.py index aaa6b97..e923b46 100644 --- a/addon/io_scs_tools/exp/pit.py +++ b/addon/io_scs_tools/exp/pit.py @@ -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 @@ -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) diff --git a/addon/io_scs_tools/imp/pim.py b/addon/io_scs_tools/imp/pim.py index d90c4b4..f730f6f 100644 --- a/addon/io_scs_tools/imp/pim.py +++ b/addon/io_scs_tools/imp/pim.py @@ -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() @@ -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, diff --git a/addon/io_scs_tools/imp/pis.py b/addon/io_scs_tools/imp/pis.py index d84ce3d..5e86741 100644 --- a/addon/io_scs_tools/imp/pis.py +++ b/addon/io_scs_tools/imp/pis.py @@ -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 **") diff --git a/addon/io_scs_tools/imp/pix.py b/addon/io_scs_tools/imp/pix.py index 2e293a0..85c839f 100644 --- a/addon/io_scs_tools/imp/pix.py +++ b/addon/io_scs_tools/imp/pix.py @@ -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 @@ -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))) diff --git a/addon/io_scs_tools/internals/containers/config.py b/addon/io_scs_tools/internals/containers/config.py index 778ecd7..d9f78b6 100644 --- a/addon/io_scs_tools/internals/containers/config.py +++ b/addon/io_scs_tools/internals/containers/config.py @@ -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))) @@ -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(): @@ -812,18 +813,20 @@ 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": @@ -831,13 +834,13 @@ def apply_settings(): 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 ("", "#"): @@ -845,13 +848,13 @@ def apply_settings(): 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": @@ -863,7 +866,7 @@ 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": @@ -871,7 +874,7 @@ def apply_settings(): 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 ("", "#"): diff --git a/addon/io_scs_tools/properties/world.py b/addon/io_scs_tools/properties/world.py index 316f2eb..038cd51 100644 --- a/addon/io_scs_tools/properties/world.py +++ b/addon/io_scs_tools/properties/world.py @@ -715,28 +715,32 @@ def import_scale_update(self, context): _config_container.update_item_in_file('Import.ImportScale', float(self.import_scale)) return None + def import_preserve_path_for_export_update(self, context): + _config_container.update_item_in_file('Import.PreservePathForExport', int(self.import_preserve_path_for_export)) + return None + def import_pim_file_update(self, context): _config_container.update_item_in_file('Import.ImportPimFile', int(self.import_pim_file)) return None - def use_welding_update(self, context): - _config_container.update_item_in_file('Import.UseWelding', int(self.use_welding)) + def import_use_welding_update(self, context): + _config_container.update_item_in_file('Import.UseWelding', int(self.import_use_welding)) return None - def welding_precision_update(self, context): - _config_container.update_item_in_file('Import.WeldingPrecision', int(self.welding_precision)) + def import_welding_precision_update(self, context): + _config_container.update_item_in_file('Import.WeldingPrecision', int(self.import_welding_precision)) return None - def use_normals_update(self, context): - _config_container.update_item_in_file('Import.UseNormals', int(self.use_normals)) + def import_use_normals_update(self, context): + _config_container.update_item_in_file('Import.UseNormals', int(self.import_use_normals)) return None def import_pit_file_update(self, context): _config_container.update_item_in_file('Import.ImportPitFile', int(self.import_pit_file)) return None - def load_textures_update(self, context): - _config_container.update_item_in_file('Import.LoadTextures', int(self.load_textures)) + def import_load_textures_update(self, context): + _config_container.update_item_in_file('Import.LoadTextures', int(self.import_load_textures)) return None def import_pic_file_update(self, context): @@ -751,40 +755,40 @@ def import_pis_file_update(self, context): _config_container.update_item_in_file('Import.ImportPisFile', int(self.import_pis_file)) return None - def connected_bones_update(self, context): - _config_container.update_item_in_file('Import.ConnectedBones', int(self.connected_bones)) + def import_connected_bones_update(self, context): + _config_container.update_item_in_file('Import.ConnectedBones', int(self.import_connected_bones)) return None - def bone_import_scale_update(self, context): - _config_container.update_item_in_file('Import.BoneImportScale', float(self.bone_import_scale)) + def import_bone_scale_update(self, context): + _config_container.update_item_in_file('Import.BoneImportScale', float(self.import_bone_scale)) return None def import_pia_file_update(self, context): _config_container.update_item_in_file('Import.ImportPiaFile', int(self.import_pia_file)) return None - def search_subdirs_for_pia_update(self, context): - _config_container.update_item_in_file('Import.IncludeSubdirsForPia', int(self.include_subdirs_for_pia)) + def import_include_subdirs_for_pia_update(self, context): + _config_container.update_item_in_file('Import.IncludeSubdirsForPia', int(self.import_include_subdirs_for_pia)) return None def export_scale_update(self, context): _config_container.update_item_in_file('Export.ExportScale', float(self.export_scale)) return None - def apply_modifiers_update(self, context): - _config_container.update_item_in_file('Export.ApplyModifiers', int(self.apply_modifiers)) + def export_apply_modifiers_update(self, context): + _config_container.update_item_in_file('Export.ApplyModifiers', int(self.export_apply_modifiers)) return None - def exclude_edgesplit_update(self, context): - _config_container.update_item_in_file('Export.ExcludeEdgesplit', int(self.exclude_edgesplit)) + def export_exclude_edgesplit_update(self, context): + _config_container.update_item_in_file('Export.ExcludeEdgesplit', int(self.export_exclude_edgesplit)) return None - def include_edgesplit_update(self, context): - _config_container.update_item_in_file('Export.IncludeEdgesplit', int(self.include_edgesplit)) + def export_include_edgesplit_update(self, context): + _config_container.update_item_in_file('Export.IncludeEdgesplit', int(self.export_include_edgesplit)) return None - def active_uv_only_update(self, context): - _config_container.update_item_in_file('Export.ActiveUVOnly', int(self.active_uv_only)) + def export_active_uv_only_update(self, context): + _config_container.update_item_in_file('Export.ActiveUVOnly', int(self.export_active_uv_only)) return None def export_vertex_groups_update(self, context): @@ -819,8 +823,8 @@ def export_pim_file_update(self, context): _config_container.update_item_in_file('Export.ExportPimFile', int(self.export_pim_file)) return None - def output_type_update(self, context): - _config_container.update_item_in_file('Export.OutputType', self.output_type) + def export_output_type_update(self, context): + _config_container.update_item_in_file('Export.OutputType', self.export_output_type) return None def export_pit_file_update(self, context): @@ -843,8 +847,8 @@ def export_pia_file_update(self, context): _config_container.update_item_in_file('Export.ExportPiaFile', int(self.export_pia_file)) return None - def sign_export_update(self, context): - _config_container.update_item_in_file('Export.SignExport', int(self.sign_export)) + def export_write_signature_update(self, context): + _config_container.update_item_in_file('Export.SignExport', int(self.export_write_signature)) return None # IMPORT OPTIONS @@ -856,31 +860,37 @@ def sign_export_update(self, context): default=1.0, update=import_scale_update, ) + import_preserve_path_for_export = BoolProperty( + name="Preserve Path for Export", + description="Automatically use and set custom export path on SCS Root to the same path that it was imported from.", + default=False, + update=import_preserve_path_for_export_update, + ) import_pim_file = BoolProperty( name="Import Model (PIM)", description="Import Model data from PIM file", default=True, update=import_pim_file_update, ) - use_welding = BoolProperty( + import_use_welding = BoolProperty( name="Use Welding", description="Use automatic routine for welding of divided mesh surfaces", default=True, - update=use_welding_update, + update=import_use_welding_update, ) - welding_precision = IntProperty( + import_welding_precision = IntProperty( name="Welding Precision", description="Number of decimals which has to be equal for welding to take place.", min=1, max=6, default=4, - update=welding_precision_update + update=import_welding_precision_update ) - use_normals = BoolProperty( + import_use_normals = BoolProperty( name="Use Normals", description="When used meshes will get custom normals data from PIM file; " "otherwise Blender calculated normals will be used.", default=True, - update=use_normals_update + update=import_use_normals_update ) import_pit_file = BoolProperty( name="Import Trait (PIT)", @@ -888,11 +898,11 @@ def sign_export_update(self, context): default=True, update=import_pit_file_update, ) - load_textures = BoolProperty( + import_load_textures = BoolProperty( name="Load Textures", description="Load textures", default=True, - update=load_textures_update, + update=import_load_textures_update, ) import_pic_file = BoolProperty( name="Import Collision (PIC)", @@ -912,19 +922,19 @@ def sign_export_update(self, context): default=True, update=import_pis_file_update, ) - connected_bones = BoolProperty( + import_connected_bones = BoolProperty( name="Create Connected Bones", description="Create connected Bones whenever possible", default=False, - update=connected_bones_update, + update=import_connected_bones_update, ) - bone_import_scale = FloatProperty( + import_bone_scale = FloatProperty( name="Bone Scale", description="Import scale for Bones", min=0.0001, max=10.0, soft_min=0.001, soft_max=1.0, default=0.1, - update=bone_import_scale_update, + update=import_bone_scale_update, ) import_pia_file = BoolProperty( name="Import Animations (PIA)", @@ -932,11 +942,11 @@ def sign_export_update(self, context): default=True, update=import_pia_file_update, ) - include_subdirs_for_pia = BoolProperty( + import_include_subdirs_for_pia = BoolProperty( name="Search Subdirectories", description="Search also all subdirectories for animation files (PIA)", default=True, - update=search_subdirs_for_pia_update, + update=import_include_subdirs_for_pia_update, ) # EXPORT OPTIONS @@ -957,33 +967,33 @@ def sign_export_update(self, context): default=1.0, update=export_scale_update, ) - apply_modifiers = BoolProperty( + export_apply_modifiers = BoolProperty( name="Apply Modifiers", description="Export meshes as modifiers were applied", default=True, - update=apply_modifiers_update, + update=export_apply_modifiers_update, ) - exclude_edgesplit = BoolProperty( + export_exclude_edgesplit = BoolProperty( name="Exclude 'Edge Split'", description="When you use Sharp Edge flags, then prevent 'Edge Split' modifier from " "dismemberment of the exported mesh - the correct smoothing will be still " "preserved with use of Sharp Edge Flags", default=True, - update=exclude_edgesplit_update, + update=export_exclude_edgesplit_update, ) - include_edgesplit = BoolProperty( + export_include_edgesplit = BoolProperty( name="Apply Only 'Edge Split'", description="When you use Sharp Edge flags and don't want to apply modifiers, " "then use only 'Edge Split' modifier for dismemberment of the exported mesh " "- the only way to preserve correct smoothing", default=True, - update=include_edgesplit_update, + update=export_include_edgesplit_update, ) - active_uv_only = BoolProperty( + export_active_uv_only = BoolProperty( name="Only Active UVs", description="Export only active UV layer coordinates", default=False, - update=active_uv_only_update, + update=export_active_uv_only_update, ) export_vertex_groups = BoolProperty( name="Vertex Groups", @@ -1024,7 +1034,7 @@ def sign_export_update(self, context): default=True, update=export_pim_file_update, ) - output_type = EnumProperty( + export_output_type = EnumProperty( name="Output Format", items=( ('5', "Game Data Format, ver. 5", "Export PIM (version 5) file formats for SCS Game Engine"), @@ -1034,7 +1044,7 @@ def sign_export_update(self, context): # exchange between different modeling tools"), ), default='5', - update=output_type_update, + update=export_output_type_update, ) export_pit_file = BoolProperty( name="Export PIT", @@ -1066,11 +1076,11 @@ def sign_export_update(self, context): default=True, update=export_pia_file_update, ) - sign_export = BoolProperty( + export_write_signature = BoolProperty( name="Write A Signature To Exported Files", description="Add a signature to the header of the output files with some additional information", default=False, - update=sign_export_update, + update=export_write_signature_update, ) # COMMON SETTINGS - SAVED IN CONFIG diff --git a/addon/io_scs_tools/ui/shared.py b/addon/io_scs_tools/ui/shared.py index 87da469..76fd373 100644 --- a/addon/io_scs_tools/ui/shared.py +++ b/addon/io_scs_tools/ui/shared.py @@ -102,28 +102,28 @@ def draw_export_panel(layout, ignore_extra_boxes=False): row.prop(_get_scs_globals(), 'export_scale') col = box1.column() row = col.row() - row.prop(_get_scs_globals(), 'apply_modifiers') + row.prop(_get_scs_globals(), 'export_apply_modifiers') row_2 = row.row() - if _get_scs_globals().output_type.startswith('def'): - if int(_get_scs_globals().apply_modifiers): + if _get_scs_globals().export_output_type.startswith('def'): + if int(_get_scs_globals().export_apply_modifiers): row_2.enabled = True else: row_2.enabled = False - row_2.prop(_get_scs_globals(), 'exclude_edgesplit') + row_2.prop(_get_scs_globals(), 'export_exclude_edgesplit') else: - if not int(_get_scs_globals().apply_modifiers): + if not int(_get_scs_globals().export_apply_modifiers): row_2.enabled = True else: row_2.enabled = False - row_2.prop(_get_scs_globals(), 'include_edgesplit') + row_2.prop(_get_scs_globals(), 'export_include_edgesplit') ''' - col.prop(_get_scs_globals(), 'active_uv_only') - if not _get_scs_globals().output_type.startswith('def'): + col.prop(_get_scs_globals(), 'export_active_uv_only') + if not _get_scs_globals().export_output_type.startswith('def'): col.prop(_get_scs_globals(), 'export_vertex_groups') col.prop(_get_scs_globals(), 'export_vertex_color') if _get_scs_globals().export_vertex_color: row = box1.row() - if not _get_scs_globals().output_type.startswith('def'): + if not _get_scs_globals().export_output_type.startswith('def'): row.prop(_get_scs_globals(), 'export_vertex_color_type_7') else: row.prop(_get_scs_globals(), 'export_vertex_color_type') @@ -131,12 +131,12 @@ def draw_export_panel(layout, ignore_extra_boxes=False): # row = box1.row() # row.prop(_get_scs_globals(), 'export_anim_file', expand=True) box2 = layout.box() if not ignore_extra_boxes else layout - box2.prop(_get_scs_globals(), 'output_type') + box2.prop(_get_scs_globals(), 'export_output_type') ''' col = box2.column() col.prop(_get_scs_globals(), 'export_pim_file', text="Export Model (PIM)", toggle=True) if _get_scs_globals().export_pim_file: - col.prop(_get_scs_globals(), 'output_type') + col.prop(_get_scs_globals(), 'export_output_type') col.prop(_get_scs_globals(), 'export_pit_file', text="Export Trait (PIT)", toggle=True) col.prop(_get_scs_globals(), 'export_pic_file', text="Export Collision (PIC)", toggle=True) col.prop(_get_scs_globals(), 'export_pip_file', text="Export Prefab (PIP)", toggle=True) @@ -152,10 +152,10 @@ def draw_export_panel(layout, ignore_extra_boxes=False): else: row.enabled = False row.prop(_get_scs_globals(), 'export_pia_file', text="Export Animations (PIA)", toggle=True) - if not _get_scs_globals().output_type.startswith('def'): + if not _get_scs_globals().export_output_type.startswith('def'): box3 = layout.box() row = box3.row() - row.prop(_get_scs_globals(), 'sign_export') + row.prop(_get_scs_globals(), 'export_write_signature') ''' diff --git a/addon/io_scs_tools/utils/object.py b/addon/io_scs_tools/utils/object.py index 0ef2a46..18175b9 100644 --- a/addon/io_scs_tools/utils/object.py +++ b/addon/io_scs_tools/utils/object.py @@ -765,18 +765,18 @@ def get_mesh(obj): if modifier.type == "ARMATURE" and modifier.object in sibling_objs and modifier.object.type == "ARMATURE": disabled_modifiers = disable_modifier(modifier, disabled_modifiers) - if _get_scs_globals().output_type.startswith('def'): - if _get_scs_globals().apply_modifiers: - if _get_scs_globals().exclude_edgesplit: + if _get_scs_globals().export_output_type.startswith('def'): + if _get_scs_globals().export_apply_modifiers: + if _get_scs_globals().export_exclude_edgesplit: disabled_modifiers.append(disable_modifiers(obj, modifier_type_to_disable='EDGE_SPLIT')) mesh = obj.to_mesh(scene, True, 'PREVIEW') else: mesh = obj.data else: - if _get_scs_globals().apply_modifiers: + if _get_scs_globals().export_apply_modifiers: mesh = obj.to_mesh(scene, True, 'PREVIEW') else: - if _get_scs_globals().include_edgesplit: + if _get_scs_globals().export_include_edgesplit: disabled_modifiers.append(disable_modifiers(obj, modifier_type_to_disable='EDGE_SPLIT', inverse=True)) mesh = obj.to_mesh(scene, True, 'PREVIEW') else: