Anonymous/ElementDocument-bound data models #290
Replies: 1 comment 2 replies
-
Hi. Thanks for the suggestion, this is indeed a use case I would like to support better. Here comes my thoughts and suggestions. I believe a solution along your first one should indeed be quite simple to implement. I'd suggest something akin to As you say, this approach would be a bit cumbersome to use since we have to make a new data-model for every open window. And all of these data-models would be structured the same, so we would be repeating ourselves a bit. We might also need to close the window and reopen it to point it to another entity. On first glance, I don't see how solutions 2 and 3 would be implemented, so I'm a bit worried they could easily become complicated. My immediate reaction is solution 2 could be worth looking into, but probably not solution 3. I have one other suggestion. This would be based on top of another feature request someone has asked about previously, namely allowing indexing into an Array using an arbitrary data address instead of just a number. The other component we would need is to somehow fetch a unique ID for the current document. Somehow we need to let the client bind a callback function which should take the current document (or even the current element) and return an integer ID. It would be similar to the current With these two components we could simply index into an array of structs with the current ID based on the current document. If we want to change the entity, we update the ID (and dirty the corresponding data variable) and it all just works out. No need to create a new data model or re-open the window. These two features could probably be useful in other cases as well which is why I kind of like it. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I've run into a bit of a wall regarding data models. My intent was to be able to have multiple ElementDocuments utilizing the same .rml source, but be bound to different data models. The goal here is to be able to have, say, multiple inventory screens that a player can transfer items between, or multiple entity viewer windows that show simple stats about each entity.
I'd figured that there were a few possible angles to approach this from:
Is there perhaps a more elegant way to accomplish this that I'm overlooking? Thank you.
Beta Was this translation helpful? Give feedback.
All reactions