Skip to content

Commit

Permalink
Make loading the default.skin the default option again
Browse files Browse the repository at this point in the history
  • Loading branch information
SomaZ committed Sep 4, 2024
1 parent 3a05dbc commit 4bf6a91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions JAG2Operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def skin_list_cb(self, context):
except Exception as e:
print("Could not open skin files, error: ", e)

return [(" ", "None", "")] + [(skin, skin.split(".")[0], "")
for skin in sorted(skin_files)]
return [(" ", "None", ""), ("DEFAULT", "<modelname>_default", "")] + [(skin, skin.split(".")[0], "")
for skin in sorted(skin_files) if not skin.endswith("_default.skin")]

# properties
filepath: bpy.props.StringProperty(
Expand All @@ -74,7 +74,7 @@ def skin_list_cb(self, context):
skin: bpy.props.EnumProperty(
items=skin_list_cb,
name="Skin",
default=0, # type: ignore
default=1, # type: ignore
description="The skin to load, choose none to use file internal paths"
) # pyright: ignore [reportInvalidTypeForm]
guessTextures: bpy.props.BoolProperty(
Expand Down Expand Up @@ -162,7 +162,9 @@ def execute(self, context):
return {'FINISHED'}
# output to blender
skin = ""
if self.skin.strip() != "":
if self.skin == "DEFAULT":
skin = filepath + "_default.skin"
elif self.skin.strip() != "":
skin = JAFilesystem.PathToFile(filepath, "") + self.skin
success, message = scene.saveToBlender(
scale,
Expand Down Expand Up @@ -203,6 +205,7 @@ def invoke(self, context, event): # type: ignore
prefs = bpy.context.preferences.addons[__name__.split('.')[0]].preferences
self.basepath = prefs.base_path
self.scale = prefs.scale
print(self.skin)
return super().invoke(context, event)


Expand Down
1 change: 1 addition & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class JAAddonPreferences(bpy.types.AddonPreferences):

def draw(self, context):
layout = self.layout
layout.use_property_split = True
row = layout.row()
row.prop(self, "base_path")
row = layout.row()
Expand Down

0 comments on commit 4bf6a91

Please sign in to comment.