XPlane2Blender icon indicating copy to clipboard operation
XPlane2Blender copied to clipboard

XPlaneAttributes does not behave expectly when adding attributes with same name

Open tngreene opened this issue 4 years ago • 1 comments

I don't know if this is a problem, but, it could be.

1, Make an Object, give it 3 datarefs (dref_1, show), (dref_2, hide), (dref_3, show`) 2. You expect to see "ANIM_show, ANIM_hide, ANIM_show", however you get show,show, hide!

The reason is in XPlaneAttributes:

    def add(self, attr: XPlaneAttribute):
        if attr.name in self:
            self[attr.name].addValues(attr.getValues())
        else:
            self[attr.name] = attr

You'd expect the calls to add

add(show)
add(hide)
add(show)

To be 3 separate entries. I'm not sure what the use of this is, but I've always been very suspicious of this API.

Right now I can't think of anything off hand, but, this is a state machine, so re-ordering something that in the UI has order I see as a problem!

tngreene avatar Jan 07 '21 21:01 tngreene

Yes this is a bug! Since these are using different datarefs they have to be evaluated and considered in order. So, to re-order what the user put in the UI is a bug!

tngreene avatar Jan 07 '21 22:01 tngreene