Ok so this is something I've been trying to break down to a science for a while now, but I'm having some trouble.
How would you guys go about managing objects in a custom level editor?
I've come up with a couple ways of doing this, but man, it gets complicated and sloppy really fast.
My ideal..system..of object management in a custom level editor would be very similar to how it's done in Construct's built-in layout editor.
There would be a listbox with small icons and names which represent each object. When you click on one of these icons, another list to the right would show the selected object's PVs. You would then be able to adjust these values, set the object's properties (angle and such, which I've already figured out) and place it on the map.
Sounds incredibly simple, no? Well it's not.
I'll explain how I did this in my past level editors, and see what you guys think. Keep in mind none of these methods were very good, but if you have any suggestions on how to improve them or know some completely different and better way of doing this, I'd love to hear!
-Objects were placed on a "table" in the layout editor, on a separate layer you can hide or reveal.
-Each object was in the family "E_Objects", and had only 2 PVs: Name, and Value. I made the value "Name" because you can't retrieve an object's name yet, so this value was set to it.
-There's a separate object called "ObjectValues" which stores an object's data when selected. It goes something like this: (I will refer to "ObjectValues" object as OV)
-"E_Object" is selected from the table: Set "OV" value 'Name' to "E_Object's" value 'Name'
-Now you can use a single edit box on the left to type in something for the Object's value called 'Value'
-Now you can place the object like so..
Left clicked on grid: Create object by name OV.value('Name')
Set E_Object's value 'Value' to editbox.text
So. That method is actually pretty simple, but since you can't retrieve an object's PV's, I could only find a way to edit ONE value before the object was placed. Also, the editbox caused a lot of problems. Once you click it, all of my hotkeys would be entered into the editbox, and using it's action 'unfocus' would lock up all keyboard/mouse input and pretty much ruin everything.
Trying to explain this would make little sense, which probably means it was a terrible method to begin with. But on a glossy surface level, it worked like this:
There's a list box which, when created, would list all of the object's names. You can click on a name, and a list object to the right brings up it's PVs which were added via the event editor. You can click on one of the PVs names, and type in it's value via an edit box. Upon pressing enter, the PV name would have the editbox text appended to it, delimited by a comma. I then used the text manipulator object to turn these into substrings, which can then be individually retrieved to set the object's values when placed.
Actually that sounds pretty good. Problem is I haven't gotten it to work yet. I might in the future, but I'm already having some problems with it and I'm not so confident it'll work out in the end.
To top it off I'm using an array to save the level data. Each cell has multiple values (object properties) which are essentially substrings retrieved by the text manipulator object. It just makes things so much more complicated.
Anyhow. If anyone has gotten something like this to work, or has any ideas, please let me know!