1 decade ago by tjw
I would like the Weltmeister editor to automatically populate the Key / Value settings so that I know what values are editable, instead of digging into the Entity's source code, risking the chance of a typo, and typing out the key name each time.
Additionally, I would like an easy way to hide Entities from the Weltmeister drop-down Entity menu. The Particle Entity is a perfect example of one that you do not want in the editor, it's meant to be a base class.
Ok, so I'm kind of teasing here... I've actually written these features in my local branch of Impact and want to know how to share them. It contains patches to the Weltmeister editor's code that I don't feel comfortable with sharing unless Dominic gives me the thumbs up.
Here is how I ended adding these features into my branch.
In Weltmeister I check for a new magic key on the Entity
Then when loading the settings I check to see if this key already exists in the Entity's _wmSettings, if so I use that value, if not I check to see if the key exists on the Entity itself, if so I default it to that value, if not I default it to an empty string. Now when I go to write the entity back out, if you haven't changed the value, the value isn't actually saved to the settings and nothing additional or unnecessary is serialized out to the level file.
I have a solution for hiding classes as well. Just add a static class property named
The code I have for the Entity keys is a nice starting point, but It would be even better to expand on the idea and allow for providing descriptions for each key that show up in Weltmeister, and to color code the keys so you know if it is a custom value or a default value sitting in the key. Additionally, it would be nice to provide a type hint for each key so you could have custom widgets for the value type... So the editor knows it's dealing with numbers, arrays, objects, etc. and can give a better input control for manipulating the values.
Let me know how I can share, and maybe we need to start talking about Weltmeister plugins as a whole!? (Or maybe we already did and I missed it)
Additionally, I would like an easy way to hide Entities from the Weltmeister drop-down Entity menu. The Particle Entity is a perfect example of one that you do not want in the editor, it's meant to be a base class.
Ok, so I'm kind of teasing here... I've actually written these features in my local branch of Impact and want to know how to share them. It contains patches to the Weltmeister editor's code that I don't feel comfortable with sharing unless Dominic gives me the thumbs up.
Here is how I ended adding these features into my branch.
In Weltmeister I check for a new magic key on the Entity
_wmKeys
, this key is an array of strings, each being the name of an editable key that I care about on this Entity. i.e._wmKeys: ['name', 'strength', 'duration'],
Then when loading the settings I check to see if this key already exists in the Entity's _wmSettings, if so I use that value, if not I check to see if the key exists on the Entity itself, if so I default it to that value, if not I default it to an empty string. Now when I go to write the entity back out, if you haven't changed the value, the value isn't actually saved to the settings and nothing additional or unnecessary is serialized out to the level file.
I have a solution for hiding classes as well. Just add a static class property named
_wmIgnoreClass = true
and when the Entity list is loaded, skip it if the key === true.The code I have for the Entity keys is a nice starting point, but It would be even better to expand on the idea and allow for providing descriptions for each key that show up in Weltmeister, and to color code the keys so you know if it is a custom value or a default value sitting in the key. Additionally, it would be nice to provide a type hint for each key so you could have custom widgets for the value type... So the editor knows it's dealing with numbers, arrays, objects, etc. and can give a better input control for manipulating the values.
Let me know how I can share, and maybe we need to start talking about Weltmeister plugins as a whole!? (Or maybe we already did and I missed it)