[ Fixed ] Transparency of Draft_Layer has incorrect type

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

[ Fixed ] Transparency of Draft_Layer has incorrect type

Post by Roy_043 »

The Transparency of a layer has the wrong type: "App::PropertyInteger" instead of "App::PropertyPercent". Easy to fix in the code of course. But I wonder if this requires a migrate function or is that overkill?

Code: Select all

    # To be added to the Layer class and called from onDocumentRestored (layer.py).
    def _migrate_0_19_to_0_20(self, obj):
        if App.GuiUp:
            vobj = obj.ViewObject
            if (hasattr(vobj, "Transparency")
                    and vobj.getTypeIdOfProperty("Transparency") == "App::PropertyInteger"):
                trans = vobj.Transparency
                vobj.removeProperty("Transparency")
                vobj.Proxy.set_visual_properties(vobj, vobj.PropertiesList)
                vobj.Transparency = trans
Last edited by Roy_043 on Thu Sep 23, 2021 6:50 pm, edited 1 time in total.
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: Transparency of Draft_Layer has incorrect type

Post by Roy_043 »

User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: [ Fixed ] Transparency of Draft_Layer has incorrect type

Post by Roy_043 »

Merged.
Post Reply