Blender - Light change hierarchy-placement on save

Version: BLENDER 3.6.18 / MSFS 2024 PlugIn 1.32

Frequency: Consistently

Severity: Semi-Blocker (have to re-do work every time I open a scene)

Bug description: When saving a Blender file - MSFS 2024 lights are moved to the last collection selected.

Repro steps:
Open Blender 3.6.
Add a MSFS 2024 light.
Put it into a collection.
Create another collection.
Select the new (empty) collection.
Save the Blender file.
Re-open same Blender file.
= Light have moved to the collection selected prior to saving

1 Like

Hello,

This will be fixed in next Core SDK 2024 !

Thank you

Yasmine

1 Like

Thanks, Yasmine :slight_smile:

further to this - if you have one light then - every time you open the blend file it will add more “HIDDEN” lights that will be associated to the light objects.

I have two lights in the original blend file - open the file and you have two objects, but as many lights as you have collections. To get rid of them do a file clean up - and purge that orphan data.

For the brave and ones who can’t wait. try this Skip the existing MSFS lights. However it will still move and duplicate any NON MSFS Lights. Non MSFS lights will be made MSFS lights.

in msfs_scene_utils.py

add the lines

        # skip if already an MSFS light
        if light_data.msfs_light_type != "NONE":
            continue

here below

        light_objects = list(filter(lambda object: object.type == "LIGHT", bpy.data.objects))
        for light_object in light_objects:
            light_data = light_object.data
            #print("convert_lights_to_msfs2024 - light data", light_data, light_object.users_collection, light_object.type, light_data.type, light_data.msfs_light_type)
            # skip if already an MSFS light
            if light_data.msfs_light_type != "NONE":
                continue
            bpy.ops.msfs2024.add_light(name=light_object.name, msfs_light_type="streetLight")