Skip to content

Commit

Permalink
Release - v2.2 Final #2
Browse files Browse the repository at this point in the history
  • Loading branch information
simon50keda committed Aug 9, 2021
1 parent eb964f6 commit becf03f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 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, "61827700"),
"version": (2, 2, "696fffa5"),
"blender": (2, 90, 0),
"location": "File > Import-Export",
"wiki_url": "http://modding.scssoft.com/wiki/Documentation/Tools/SCS_Blender_Tools",
Expand Down
1 change: 1 addition & 0 deletions addon/io_scs_tools/imp/pim.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ def _create_piece(
mesh.loops.foreach_get("normal", clnors)
mesh.normals_split_custom_set(tuple(zip(*(iter(clnors),) * 3)))
mesh.use_auto_smooth = True
mesh.auto_smooth_angle = 3.14

mesh.free_normals_split()
else:
Expand Down
1 change: 1 addition & 0 deletions addon/io_scs_tools/imp/pim_ef.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ def _create_piece(
mesh.loops.foreach_get("normal", clnors)
mesh.normals_split_custom_set(tuple(zip(*(iter(clnors),) * 3)))
mesh.use_auto_smooth = True
mesh.auto_smooth_angle = 3.14

mesh.free_normals_split()
else:
Expand Down
50 changes: 24 additions & 26 deletions addon/io_scs_tools/utils/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,9 @@ def disable_modifier(modifier, disabled_modifiers):
:param modifier: modifier to disable
:type modifier: bpy.types.Modifier
:param disabled_modifiers: dictonary of modifiers with show states disabled
:type disabled_modifiers: dict[bpy.types.Object, tuple]
:type disabled_modifiers: dict[bpy.types.Modifier, tuple]
:returns: updated dictionary with newly disabled modifier
:rtype: dict[bpy.types.Object, tuple]
:rtype: dict[bpy.types.Modifier, tuple]
"""
if modifier not in disabled_modifiers:
disabled_modifiers[modifier] = (modifier.show_viewport, modifier.show_render)
Expand All @@ -647,43 +647,41 @@ def disable_modifier(modifier, disabled_modifiers):
return disabled_modifiers


def disable_modifiers(objs, modifier_type_to_disable='EDGE_SPLIT', inverse=False):
"""Disables all instances of given modifier type on provided objects and
returns disabled modifiers initial visibility states.
If 'inverse' is True, it disables all Modifiers except given modifier type.
def disable_modifiers(objs):
"""Disables modifiers on providded object depending on scs global settings and
returns disabled modifiers initial visibility states for all disabled modifiers.
:param objs: list of objects to disable modifiers
:type objs: iterable[bpy.types.Object]
:param modifier_type_to_disable: modifier type to disable
:type modifier_type_to_disable: str
:param inverse: flag indicating whether to disabel given type or all the rest except given type
:type inverse: bool
:return:
:returns: dictionary with disabled modifiers
:rtype: dict[bpy.types.Modifier, tuple]
"""

disabled_modifiers = dict()

modifier_type_to_disable = 'NONE'
inverse = False

if _get_scs_globals().export_output_type.startswith('EF'):
if _get_scs_globals().export_apply_modifiers:
if _get_scs_globals().export_exclude_edgesplit:
modifier_type_to_disable = 'EDGE_SPLIT'
else:
if not _get_scs_globals().export_apply_modifiers:
if _get_scs_globals().export_include_edgesplit:
modifier_type_to_disable = 'EDGE_SPLIT'
inverse = True
else:
modifier_type_to_disable = 'ANY'

for obj in objs:
# always disable armature modifiers from SCS animations
# to prevent vertex rest position change because of the animation
for modifier in obj.modifiers:
# always disable armature modifiers from SCS animations
# to prevent vertex rest position change because of the animation
if modifier.type == "ARMATURE" and modifier.object and modifier.object.type == "ARMATURE":
if modifier.object in get_siblings(obj):
disabled_modifiers = disable_modifier(modifier, disabled_modifiers)

if _get_scs_globals().export_output_type.startswith('EF'):
if _get_scs_globals().export_apply_modifiers:
if _get_scs_globals().export_exclude_edgesplit:
disabled_modifiers.update(disable_modifiers(obj, modifier_type_to_disable='EDGE_SPLIT'))
else:
if not _get_scs_globals().export_apply_modifiers:
if _get_scs_globals().export_include_edgesplit:
disabled_modifiers.update(disable_modifiers(obj, modifier_type_to_disable='EDGE_SPLIT', inverse=True))
else:
disabled_modifiers.update(disable_modifiers(obj, modifier_type_to_disable='ANY', inverse=True))

for modifier in obj.modifiers:
if modifier_type_to_disable == 'ANY':
disabled_modifiers = disable_modifier(modifier, disabled_modifiers)
else:
Expand Down

0 comments on commit becf03f

Please sign in to comment.