2007-10-16 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/json/json-object.c: Automatically transform every
	delimiter into an underscore.

	* clutter/clutter-script.c: Implement the "parent_texture"
	property translation for ClutterCloneTextures, using the
	passed id of the parent texture.
This commit is contained in:
Emmanuele Bassi
2007-10-16 14:40:00 +00:00
parent f6c83a224e
commit 143a5937e2
3 changed files with 63 additions and 7 deletions

View File

@ -127,6 +127,7 @@
#include "clutter-behaviour.h"
#include "clutter-container.h"
#include "clutter-stage.h"
#include "clutter-texture.h"
#include "clutter-script.h"
#include "clutter-script-private.h"
@ -333,7 +334,9 @@ construct_timeline (ClutterScript *script,
PropertyInfo *pinfo = g_slice_new0 (PropertyInfo);
GValue value = { 0, };
pinfo->property_name = g_strdup (name);
pinfo->property_name = g_strdelimit (g_strdup (name),
G_STR_DELIMITERS,
'-');
json_node_get_value (node, &value);
g_value_init (&pinfo->value, G_VALUE_TYPE (&value));
@ -417,7 +420,9 @@ parse_member_to_property (ClutterScript *script,
{
case JSON_NODE_VALUE:
retval = g_slice_new0 (PropertyInfo);
retval->property_name = g_strdup (name);
retval->property_name = g_strdelimit (g_strdup (name),
G_STR_DELIMITERS,
'-');
json_node_get_value (node, &value);
g_value_init (&retval->value, G_VALUE_TYPE (&value));
@ -576,6 +581,7 @@ parse_member_to_property (ClutterScript *script,
retval = g_slice_new0 (PropertyInfo);
retval->property_name = g_strdup (name);
g_value_init (&retval->value, CLUTTER_TYPE_GEOMETRY);
g_value_set_boxed (&retval->value, &geom);
}
@ -723,6 +729,26 @@ translate_property (ClutterScript *script,
return TRUE;
}
if (strcmp (name, "parent_texture") == 0)
{
GObject *texture;
const gchar *string;
if (G_VALUE_HOLDS (src, G_TYPE_STRING))
string = g_value_get_string (src);
else
return FALSE;
texture = clutter_script_get_object (script, string);
if (!texture)
return FALSE;
g_value_init (dest, CLUTTER_TYPE_TEXTURE);
g_value_set_object (dest, texture);
return TRUE;
}
/* pixbufs are specified using the path to the file name; the
* path can be absolute or relative to the current directory.
* we need to load the pixbuf from the file and print a