diff options
Diffstat (limited to 'src/others/mimesh/libg3d-0.0.8/plugins/import/imp_maya/imp_maya_var.c')
-rw-r--r-- | src/others/mimesh/libg3d-0.0.8/plugins/import/imp_maya/imp_maya_var.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_maya/imp_maya_var.c b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_maya/imp_maya_var.c new file mode 100644 index 0000000..03bb8bf --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_maya/imp_maya_var.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* $Id$ */ | ||
2 | |||
3 | /* | ||
4 | libg3d - 3D object loading library | ||
5 | |||
6 | Copyright (C) 2005-2009 Markus Dahms <mad@automagically.de> | ||
7 | |||
8 | This library is free software; you can redistribute it and/or | ||
9 | modify it under the terms of the GNU Lesser General Public | ||
10 | License as published by the Free Software Foundation; either | ||
11 | version 2.1 of the License, or (at your option) any later version. | ||
12 | |||
13 | This library is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | Lesser General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU Lesser General Public | ||
19 | License along with this library; if not, write to the Free Software | ||
20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
21 | */ | ||
22 | #include <glib.h> | ||
23 | |||
24 | #include "imp_maya_obj.h" | ||
25 | |||
26 | gboolean maya_var_set(MayaObject *obj, const gchar *var, gpointer value) | ||
27 | { | ||
28 | g_hash_table_replace(obj->vars, g_strdup(var), value); | ||
29 | |||
30 | return TRUE; | ||
31 | } | ||
32 | |||
33 | gpointer maya_var_get(MayaObject *obj, const gchar *var) | ||
34 | { | ||
35 | gpointer val; | ||
36 | |||
37 | val = g_hash_table_lookup(obj->vars, var); | ||
38 | return val; | ||
39 | } | ||
40 | |||
41 | gboolean maya_var_set_double(MayaObject *obj, const gchar *var, gdouble value) | ||
42 | { | ||
43 | gdouble *pval; | ||
44 | |||
45 | pval = g_new0(gdouble, 1); | ||
46 | *pval = value; | ||
47 | |||
48 | return maya_var_set(obj, var, pval); | ||
49 | } | ||
50 | |||
51 | gdouble maya_var_get_double(MayaObject *obj, const gchar *var, gdouble defval) | ||
52 | { | ||
53 | gdouble *pval; | ||
54 | |||
55 | pval = maya_var_get(obj, var); | ||
56 | if(pval == NULL) | ||
57 | return defval; | ||
58 | |||
59 | return *pval; | ||
60 | } | ||