New feature in trunk: Scripting from *.os files

cdleonard

06-01-2009 07:05:42

I recently merged a branch I've been working on for some time: Scripting support. You can now define a caelum_sky_system inside an .os file and assign values to properties. You can also assign properties for various subcomponents. This is only available when compiling against Ogre 1.6; Caelum will still compile with Ogre 1.4 but scripting will not be available.

The same scripting features from material files apply: you can override properties; use variables etc. But you can't actually delete a subcomponent when overriding (just like you can't remove a pass). You can look in samples/resources/TestSkyScript.os for samples of what you can do. Property names are all copied from get/set functions and adapted for ogre_scripting_conventions.

The main purpose of this whole scripting stuff is to avoid having to set constants in code and recompiling when you change them. It's nicer to have such values in a separate file you can easily tweak. Relying on defaults inside Caelum.dll is very unpleasant to maintain. I guess you could also define one basic set of caelum_sky_system properties and override some parameters on a per-scene basis.

Under the hood this relies on a custom reflection-like mechanism to access properties. This means that it is possible to add saving and generic editing support without per-property code. That would be very nice; it would make Caelum very easy to tweak.

In other news I think I'll release 0.4 soon (after some additional bugfixes). There's not a lot of new stuff graphically but trunk has been fairly stable for a while and releasing seems appropriate. After this maybe I'll get the HDR branch to work in an useful way. Being able to load parameters from text files helps with that.

guru

10-01-2009 14:21:39

Thats great news, cdleonard. You are doing a terrific job with caelum. :wink: