Editor update: Dynamic Properties

Sorry for the long time since the last post! I’ve been really busy!

A quick update: I’ve just finished a dynamic property system for the editor, which allows you to expose properties from your Lua objects that can be changed in the editor.

editor_properties

Previously I had a separate property form for each object and tool, but creating the forms at runtime is much cleaner and makes it easier to add new objects. It is also a big step towards implementing the custom UI that I am working on.

On a related subject I have done the a similar thing with the serialization of objects. By exposing the important properties of Lua objects though a simple function, they can be saved along with the rest of the level.

--
-- Returns a table contining the properties that should
-- be serialized
--
function Light:Serialize()
	local t = {}
	t.ConnectedObject = self.ConnectedObject
	t.Scale = self.Scale
	t.Color = self.Color
	return t
end

Above is an example from a light object which is created in Lua. When the level is saved, the “Light:Serialize” function is called, and the table which is returned is saved along with the other objects.

Advertisements
Explore posts in the same categories: Boxycraft, Level Editor

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: