Having been using ClutterScript as part of my project for a while, I
have a suggestion that would make it much more flexible.
My main problem with using ClutterScript is that if you define an actor
with a large number of properties, and then want to create a number of
similar actors that have mainly the same properties, your only option is
copy and paste, resulting in a large, unmaintainable script file.
What would be nice would be to provide some sort of template / macro
functionality. So that you could define a base actor, then have other
actors "inherit" from it. When inheriting, the descendant would not be
able to specify the type, but all other properties could be overridden, e.g.
{
"id" : "text-base",
"type" : "ClutterText",
"color" : "#ffffffff",
"line-alignment" : "center",
...
}
{
"id" : "red-text",
"inherits" : "text-base",
"color" : "#ff0000ff
}
I think this would be relatively simple to implement. An descendant
would simply use its ancestor to create an initial gobject, then set its
overridding properties after this.
This would also work well when you realize that a single ClutterScript
can read from many files. This would allow you to define "base" files
with an general scene layout, which could then be tweaked by many
different "theme" files which inherit from the actors defined in the base.
Does this sound like a worthwhile feature? Or is there a mechanism that
can already achieve this?
Cheers,
Stephen
--
To unsubscribe send a mail to [email protected]