Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique identfier is on wrong field of GElement #26

Open
simplerun opened this issue Jan 7, 2016 · 1 comment
Open

Unique identfier is on wrong field of GElement #26

simplerun opened this issue Jan 7, 2016 · 1 comment

Comments

@simplerun
Copy link

Looked at the source.
Code test uniqueness on element.id but, as is, 'id' in tags is not mandatory.
I think that is way text and interaction tags are not handled.
But I see that image tag in nifty-editor terminal log have id="".

 <image id="" filename="Interface/start-background.png"/>

So, if code test IDgenerator.isUnique() there can be just one tag with id="". Correct ?
If it is correct my proposal is new transient field with generated key. That key is unique. If it is needed.
Code can then test for id uniqueness but not require that 'id' is not empty or null.

@relu91
Copy link
Owner

relu91 commented Jan 8, 2016

Hello, first of all thank you for digging into the code! you are brave 😄 !!! I wrote the code at least one year ago so I don't have a very clear view of the system, sorry. As far as I can tell the id uniqueness is mandatory for the right binding between GElement model and Nifty-gui internal Element instances. So no, the id field shouldn't be optional and should be present both on the Element ( the image tag ) and the GElement itself. I think that the default behavior in the case there's no id attribute is to generate one using the IDgenerator.

Now the real problem: the text and interaction tag are skipped in the loading level, have a look at GUIReader. The unknown elements are not added to the GUI instance, so when you save again the file they disappear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants