I have an enhancement request.
This has happened to me two times now - If I have 2024 exporter enabled and I have 2020 exporter disabled. If I load a 2020 project (aircraft) my materials are automatically updated to 2024 materials.
With the new load_handler in msfs_handlers.py the code will only not run if MSFS 2020 exporter is enabled. I thought that we should not have both exporters enabled. (I see there is now a function/button “Covert scene to MSFS 2024”)
Then why is there an automatic conversion? I believe you should change this. perhaps instead of checking if 2020 is installed AND Active - just check if 2020 is installed and DO NOT automatically change materials.
Code example
@persistent
def load_handler(dummy):
#region Presets compatibility
presets = bpy.context.scene.msfs_multi_exporter_presets
for preset in presets:
if preset.preset_name == "":
preset.preset_name = preset.name
preset.name = str(uuid.uuid4())
#endregion
#region Object LODS compatibility
lod_groups = bpy.context.scene.msfs_multi_exporter_lod_groups
for lod_group in lod_groups:
if lod_group.group_name != "":
lod_group.name = lod_group.group_name
#endregion
addon_name = 'io_scene_gltf2_msfs'
(loaded_default, loaded_state) = addon_utils.check(addon_name)
# We don't want to convert materials or scene if MSFS2020 is activated
#if not loaded_default and not loaded_state:
# We don't want to convert materials or scene if MSFS2020 is activated - we don't care if activated - assume user does not want automatic
# conversion when you have 2020 in the blender addons - may or may not be active.
# to make automatic conversion work - remove 2020 completely
if not loaded_default:
MSFS2024_SceneUtils.convert_scene_to_msfs2024()
EDIT: !!!
Seems like this is also a bug as addon_name is not correct.
EDIT2:
Possible blender logic error in check - if the addon is disabled it can’t find the addon and hence the return will always be false. There is no check for an addon being disabled. so loaded_state is useless.
EDIT3:
bug has been reported to Blender