-
Notifications
You must be signed in to change notification settings - Fork 22
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
Custom properties for game objects #163
Custom properties for game objects #163
Conversation
Hi @Dgzt I understand this is still a work in progress but it looks like this would be adding properties map to every single GameObject rather then an optional ECS style component that can be added/removed from GameObjects. Wanted to bring that up before you got too far Ping me on discord if you have questions about that |
# Conflicts: # editor/CHANGES
Errors in editor code:
Removed unused import and its fine now. Starting to test. |
Here are some observations in the EDITOR:
Output in the RUNTIME (Desktop) is:
|
This breaks GWT compatibility on the runtime. Will not compile:
|
Thank you for your test and response!
I don't know how I didn't see this. Thank you, removed it.
Fixed.
I tried to use libGDX's OrderedMap to store sorting, but seen it doesn't work. Currently I don't know good and easy solution for it. But if someone has an idea for it just please write.
The libGDX's json parser does this, but them work in editor and runtime also so I think it is not problem.
I didn't set limit for field. I think the limit is that what visui's VisTextField or libGDX's json parser can handle. I don' know how many is but more then enough for us.
Strange. I've tried with this:
and this also:
Could you post codes near line 492 in DemoCrashScreen.java? Where you used this component. I will try to reproduce this error. |
So my bad. I updated the It was pointing to master snapshot sources from JTK's repo. That is why it couldnt find the new type during GWT compile. I wouldnt worry about the ordering of the properties. So everything works fine. Good work. Thank you for doing this. I will leave it up to @JamesTKhan to do final review and PR merge. |
The sort order changing sounds a little strange. When I have some time to review I will try to replicate as I am wondering what is causing it. |
…tom-properties # Conflicts: # editor/CHANGES # gdx-runtime/CHANGES
I think I found the reason of order problem. It called ObjectMap's putAll method instead of OrderedMap's method. I pushed the fix. |
I should be able to test this out tomorrow |
Looks good. I tested on Desktop and GWT and was able to retrieve data. If we find any edge case issues with it once it starts being used more we can patch it as needed. Thanks. @Dgzt I created a Wiki page using one of my old PR's and this PR to create a developer guide on how to add components to make it easier in the future. Let me know if it looks good since this is still fresh in your head. https://github.com/JamesTKhan/Mundus/wiki/Steps-to-add-a-new-Component |
Implementation of #150 feature request.
Usage in editor:
Click to the Add component button on a game object in inspector:
Select CUSTOM PROPERTIES item in the dropdown and click to the Add component button:
See the new custom properties component in inspector:
You can remove added custom properties component with the X button on the left side. And you can collapse this widget with ˇ button on the right side.
Can add new custom property key-value pair with Add button. It will create an empty key-value pair and can change their texts.
There is only one restriction: can not be 2 keys with same text. In this case if the user click out from the key field the key's value change back to the previous valid value.
Usage in runtime:
This is not braking change, you can use in any project without data lost.