open-stage / blender-dmx

Blender addon to design and render DMX lighting.
GNU General Public License v3.0
195 stars 14 forks source link

Files created on alpha/beta won't work at vanilla #28

Closed hugoaboud closed 1 year ago

hugoaboud commented 1 year ago

Description

When trying to open a file created at earlier versions, BlenderDMX breaks in many different ways.

This happens mostly due to the new structure that finds the GDTF "root geometry" and flags it as a "Root" object. On earlier versions, we would assume an object called "Body" as the fixture root. This should be seen especially on BlenderDMX GDTFs, which were created under this assumption.

Workaround

There's no safe way to make this backwards compatible, so we're not solving it. However, the following script should fix most cases:

#
# [BlenderDMX v1]
# 
# Update Fixtures from earlier versions.
# Please note this might not work for some fixtures.
#

import bpy
dmx = bpy.context.scene.dmx

for fixture in dmx.fixtures:
    for obj in fixture.objects:
        if (obj.name == 'Body'):
            obj.name = 'Root'

    # This line refers to the issue #26, and should not be necessary on later versions
    fixture.emitter_materials.clear()

    fixture.build(
        fixture.name,
        fixture.profile,
        fixture.mode,
        fixture.universe,
        fixture.address,
        fixture.gel_color,
        fixture.display_beams
    )
hugoaboud commented 1 year ago

I'm keeping the Issue open for feedback on the patch. If necessary, I'll make updates to it.

vanous commented 1 year ago

Fixed in main, feel free to close or leave for others to read as they come by...

vanous commented 1 year ago

Seems like no more issues on this. I will close this now.