Skip to content

Commit

Permalink
fixed upgrade props again
Browse files Browse the repository at this point in the history
  • Loading branch information
scut committed Jan 21, 2024
1 parent c4fdb82 commit 52c42b2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions fast64_internal/sm64/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ..panels import SM64_Panel, sm64GoalTypeEnum, sm64GoalImport
from ..render_settings import on_update_render_settings
from .sm64_level_parser import parseLevelAtPointer
from .sm64_constants import level_enums, level_pointers, defaultExtendSegment4
from .sm64_constants import level_enums, level_pointers, defaultExtendSegment4, enumLevelNames

from ..utility import (
prop_split,
Expand All @@ -15,6 +15,7 @@
encodeSegmentedAddr,
raisePluginError,
enumExportType,
enumExportHeaderType,
enumCompressionFormat,
)

Expand Down Expand Up @@ -213,7 +214,7 @@ class SM64_Properties(PropertyGroup):
"""Global SM64 Scene Properties found under scene.fast64.sm64"""

version: IntProperty(name="SM64_Properties Version", default=0)
cur_version = 1 # version after property migration
cur_version = 2 # version after property migration

# UI Selection
showImportingMenus: BoolProperty(name="Show Importing Menus", default=False)
Expand All @@ -227,18 +228,22 @@ def upgrade_changed_props():
if bpy.context.scene.fast64.sm64.version != SM64_Properties.cur_version:
bpy.context.scene.fast64.sm64.exportType = get_legacy_export_type()
bpy.context.scene.fast64.sm64.version = SM64_Properties.cur_version
# props upgrade for combined export panel
if bpy.context.scene.get("geoName", None):
# props upgrade for combined export panel
combined_props = bpy.context.scene.fast64.sm64.combined_export
old_scene_props_to_new = {
"geoExportHeaderType": "export_header_type",
"geoLevelName": "custom_export_name",
"geoExportPath": "custom_export_path",
"geoLevelOption": "level_name",
"geoName": "object_name",
}
for old, new in old_scene_props_to_new.items():
setattr(combined_props, new, bpy.context.scene.get(old, getattr(combined_props, new)))
export_type = bpy.context.scene.get("geoExportHeaderType", None)
if export_type is not None:
combined_props.export_header_type = enumExportHeaderType[export_type][0]

level_name = bpy.context.scene.get("geoLevelOption", None)
if level_name is not None:
combined_props.level_name = enumLevelNames[level_name][0]


sm64_classes = (
Expand Down

0 comments on commit 52c42b2

Please sign in to comment.