[script] Convert double to float when parsing

The default floating point type for JSON is double precision; this means
that we need to conver to single precision when setting a property with
type G_TYPE_FLOAT.
This commit is contained in:
Emmanuele Bassi 2009-08-26 16:48:32 +01:00
parent 87831b3427
commit 2ffebad3d9

View File

@ -993,6 +993,19 @@ clutter_script_parse_node (ClutterScript *script,
retval = TRUE;
break;
case G_TYPE_FLOAT:
if (G_VALUE_HOLDS (&node_value, G_TYPE_DOUBLE))
{
g_value_set_float (value, g_value_get_double (&node_value));
retval = TRUE;
}
else if (G_VALUE_HOLDS (&node_value, G_TYPE_INT64))
{
g_value_set_float (value, g_value_get_int64 (&node_value));
retval = TRUE;
}
break;
case G_TYPE_ENUM:
if (G_VALUE_HOLDS (&node_value, G_TYPE_INT64))
{