summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBogdan Devichev <b.devichev@samsung.com>2014-11-27 15:16:03 +0200
committerBogdan Devichev <b.devichev@samsung.com>2014-12-05 11:09:56 +0200
commit291291e027ade52033670f5b09cab4712926bf0b (patch)
tree4d8de3eb7c936d623de99bd91ec8e25363e3830b
parent2f502b7f0e360341cecb1a6969b838776dc34a41 (diff)
Model_save_load. Step 3. lib/evas/common/evas_model_<action>.c is added. Functions are renamed similar to functions in image_save_load process.
-rw-r--r--src/Makefile_Evas.am2
-rw-r--r--src/lib/evas/canvas/evas_3d_mesh.c35
-rw-r--r--src/lib/evas/common/evas_model_load.c34
-rw-r--r--src/lib/evas/common/evas_model_save.c32
-rw-r--r--src/lib/evas/include/evas_private.h11
-rw-r--r--src/modules/evas/model_loaders/eet/evas_model_load_eet.c2
-rw-r--r--src/modules/evas/model_loaders/md2/evas_model_load_md2.c2
-rw-r--r--src/modules/evas/model_loaders/obj/evas_model_load_obj.c2
-rw-r--r--src/modules/evas/model_loaders/ply/evas_model_load_ply.c2
-rw-r--r--src/modules/evas/model_savers/eet/evas_model_save_eet.c6
-rw-r--r--src/modules/evas/model_savers/obj/evas_model_save_obj.c2
-rw-r--r--src/modules/evas/model_savers/ply/evas_model_save_ply.c2
12 files changed, 90 insertions, 42 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index c5ccf9cd89..c33eaa6835 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -234,6 +234,8 @@ lib/evas/common/evas_image_save.c \
234lib/evas/common/evas_image_main.c \ 234lib/evas/common/evas_image_main.c \
235lib/evas/common/evas_image_data.c \ 235lib/evas/common/evas_image_data.c \
236lib/evas/common/evas_image_scalecache.c \ 236lib/evas/common/evas_image_scalecache.c \
237lib/evas/common/evas_model_load.c \
238lib/evas/common/evas_model_save.c \
237lib/evas/common/evas_line_main.c \ 239lib/evas/common/evas_line_main.c \
238lib/evas/common/evas_polygon_main.c \ 240lib/evas/common/evas_polygon_main.c \
239lib/evas/common/evas_rectangle_main.c \ 241lib/evas/common/evas_rectangle_main.c \
diff --git a/src/lib/evas/canvas/evas_3d_mesh.c b/src/lib/evas/canvas/evas_3d_mesh.c
index f72d959dd2..66f6e0704e 100644
--- a/src/lib/evas/canvas/evas_3d_mesh.c
+++ b/src/lib/evas/canvas/evas_3d_mesh.c
@@ -777,24 +777,7 @@ _evas_3d_mesh_file_set(Eo *obj, Evas_3D_Mesh_Data *pd, Evas_3D_Mesh_File_Type ty
777 777
778 if (file == NULL) return; 778 if (file == NULL) return;
779 779
780 switch (type) 780 evas_common_load_model_to_file(obj, file, type);
781 {
782 case EVAS_3D_MESH_FILE_TYPE_MD2:
783 evas_3d_mesh_file_md2_set(obj, file);
784 break;
785 case EVAS_3D_MESH_FILE_TYPE_OBJ:
786 evas_3d_mesh_file_obj_set(obj, file);
787 break;
788 case EVAS_3D_MESH_FILE_TYPE_EET:
789 evas_3d_mesh_file_eet_set(obj, file);
790 break;
791 case EVAS_3D_MESH_FILE_TYPE_PLY:
792 evas_3d_mesh_file_ply_set(obj, file);
793 break;
794 default:
795 ERR("Invalid mesh file type.");
796 break;
797 }
798} 781}
799 782
800EOLIAN static void 783EOLIAN static void
@@ -811,21 +794,7 @@ _evas_3d_mesh_save(Eo *obj, Evas_3D_Mesh_Data *pd, Evas_3D_Mesh_File_Type type,
811 return; 794 return;
812 } 795 }
813 796
814 switch (type) 797 evas_common_save_model_to_file(obj, file, f, type);
815 {
816 case EVAS_3D_MESH_FILE_TYPE_OBJ:
817 evas_3d_mesh_save_obj(obj, file, f);//file without extension!
818 break;
819 case EVAS_3D_MESH_FILE_TYPE_EET:
820 evas_3d_mesh_save_eet(obj, file, f);
821 break;
822 case EVAS_3D_MESH_FILE_TYPE_PLY:
823 evas_3d_mesh_save_ply(obj, file, f);
824 break;
825 default:
826 ERR("Invalid mesh file type.");
827 break;
828 }
829} 798}
830 799
831static inline void 800static inline void
diff --git a/src/lib/evas/common/evas_model_load.c b/src/lib/evas/common/evas_model_load.c
new file mode 100644
index 0000000000..1f35cb0d97
--- /dev/null
+++ b/src/lib/evas/common/evas_model_load.c
@@ -0,0 +1,34 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include "evas_options.h"
6
7#include "evas_common_private.h"
8#include "evas_private.h"
9
10
11void
12evas_common_load_model_to_file(Evas_3D_Mesh *model,
13 const char *file,
14 Evas_3D_Mesh_File_Type type)
15{
16 switch (type)
17 {
18 case EVAS_3D_MESH_FILE_TYPE_MD2:
19 evas_model_load_file_md2(model, file);
20 break;
21 case EVAS_3D_MESH_FILE_TYPE_OBJ:
22 evas_model_load_file_obj(model, file);
23 break;
24 case EVAS_3D_MESH_FILE_TYPE_EET:
25 evas_model_load_file_eet(model, file);
26 break;
27 case EVAS_3D_MESH_FILE_TYPE_PLY:
28 evas_model_load_file_ply(model, file);
29 break;
30 default:
31 ERR("Invalid mesh file type.");
32 break;
33 }
34}
diff --git a/src/lib/evas/common/evas_model_save.c b/src/lib/evas/common/evas_model_save.c
new file mode 100644
index 0000000000..85b9b4113f
--- /dev/null
+++ b/src/lib/evas/common/evas_model_save.c
@@ -0,0 +1,32 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include "evas_options.h"
6
7#include "evas_common_private.h"
8#include "evas_private.h"
9
10
11void
12evas_common_save_model_to_file(Evas_3D_Mesh *model,
13 const char *file,
14 Evas_3D_Mesh_Frame *f,
15 Evas_3D_Mesh_File_Type type)
16{
17 switch (type)
18 {
19 case EVAS_3D_MESH_FILE_TYPE_OBJ:
20 evas_model_save_file_obj(model, file, f);
21 break;
22 case EVAS_3D_MESH_FILE_TYPE_EET:
23 evas_model_save_file_eet(model, file, f);
24 break;
25 case EVAS_3D_MESH_FILE_TYPE_PLY:
26 evas_model_save_file_ply(model, file, f);
27 break;
28 default:
29 ERR("Invalid mesh file type.");
30 break;
31 }
32}
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index aa9c85210f..d5f9dba9e2 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1636,6 +1636,17 @@ void _evas_3d_eet_file_init(void);
1636void _evas_3d_eet_descriptor_shutdown(void); 1636void _evas_3d_eet_descriptor_shutdown(void);
1637void _evas_3d_eet_file_free(void); 1637void _evas_3d_eet_file_free(void);
1638 1638
1639/* Temporary save/load functions */
1640void evas_common_load_model_to_file(Evas_3D_Mesh *model, const char *file, Evas_3D_Mesh_File_Type type);
1641void evas_common_save_model_to_file(Evas_3D_Mesh *model, const char *file, Evas_3D_Mesh_Frame *f, Evas_3D_Mesh_File_Type type);
1642void evas_model_load_file_eet(Evas_3D_Mesh *mesh, const char *file);
1643void evas_model_load_file_md2(Evas_3D_Mesh *mesh, const char *file);
1644void evas_model_load_file_obj(Evas_3D_Mesh *mesh, const char *file);
1645void evas_model_load_file_ply(Evas_3D_Mesh *mesh, const char *file);
1646void evas_model_save_file_eet(Evas_3D_Mesh *mesh, const char *file, Evas_3D_Mesh_Frame *f);
1647void evas_model_save_file_obj(Evas_3D_Mesh *mesh, const char *file, Evas_3D_Mesh_Frame *f);
1648void evas_model_save_file_ply(Evas_3D_Mesh *mesh, const char *file, Evas_3D_Mesh_Frame *f);
1649
1639extern int _evas_alloc_error; 1650extern int _evas_alloc_error;
1640extern int _evas_event_counter; 1651extern int _evas_event_counter;
1641 1652
diff --git a/src/modules/evas/model_loaders/eet/evas_model_load_eet.c b/src/modules/evas/model_loaders/eet/evas_model_load_eet.c
index 26c3569e04..fadd6aacd9 100644
--- a/src/modules/evas/model_loaders/eet/evas_model_load_eet.c
+++ b/src/modules/evas/model_loaders/eet/evas_model_load_eet.c
@@ -104,7 +104,7 @@ _set_material_to_mesh_from_eet_file(Evas_3D_Mesh *mesh,
104} 104}
105 105
106void 106void
107evas_3d_mesh_file_eet_set(Evas_3D_Mesh *mesh, const char *file) 107evas_model_load_file_eet(Evas_3D_Mesh *mesh, const char *file)
108{ 108{
109 Eet_File *ef; 109 Eet_File *ef;
110 110
diff --git a/src/modules/evas/model_loaders/md2/evas_model_load_md2.c b/src/modules/evas/model_loaders/md2/evas_model_load_md2.c
index 4a356b75c3..11d28451f5 100644
--- a/src/modules/evas/model_loaders/md2/evas_model_load_md2.c
+++ b/src/modules/evas/model_loaders/md2/evas_model_load_md2.c
@@ -343,7 +343,7 @@ error:
343} 343}
344 344
345void 345void
346evas_3d_mesh_file_md2_set(Evas_3D_Mesh *mesh, const char *file) 346evas_model_load_file_md2(Evas_3D_Mesh *mesh, const char *file)
347{ 347{
348 MD2_Loader loader; 348 MD2_Loader loader;
349 int i, j, k; 349 int i, j, k;
diff --git a/src/modules/evas/model_loaders/obj/evas_model_load_obj.c b/src/modules/evas/model_loaders/obj/evas_model_load_obj.c
index c6733a7c3a..36977464ba 100644
--- a/src/modules/evas/model_loaders/obj/evas_model_load_obj.c
+++ b/src/modules/evas/model_loaders/obj/evas_model_load_obj.c
@@ -202,7 +202,7 @@ _count_elements(char *start, long length)//count elements of mesh in .obj
202} 202}
203 203
204void 204void
205evas_3d_mesh_file_obj_set(Evas_3D_Mesh *mesh, const char *file) 205evas_model_load_file_obj(Evas_3D_Mesh *mesh, const char *file)
206{ 206{
207 long length, i; 207 long length, i;
208 char * start = _file_to_buf(file, &length); 208 char * start = _file_to_buf(file, &length);
diff --git a/src/modules/evas/model_loaders/ply/evas_model_load_ply.c b/src/modules/evas/model_loaders/ply/evas_model_load_ply.c
index b4bbe18c28..a294f6eb0a 100644
--- a/src/modules/evas/model_loaders/ply/evas_model_load_ply.c
+++ b/src/modules/evas/model_loaders/ply/evas_model_load_ply.c
@@ -198,7 +198,7 @@ _read_header(char *start)//Check properties of mesh in .ply file.
198} 198}
199 199
200void 200void
201evas_3d_mesh_file_ply_set(Evas_3D_Mesh *mesh, const char *file) 201evas_model_load_file_ply(Evas_3D_Mesh *mesh, const char *file)
202{ 202{
203 long length; 203 long length;
204 Evas_3D_Mesh_Data *pd; 204 Evas_3D_Mesh_Data *pd;
diff --git a/src/modules/evas/model_savers/eet/evas_model_save_eet.c b/src/modules/evas/model_savers/eet/evas_model_save_eet.c
index c801ac1025..e445dca249 100644
--- a/src/modules/evas/model_savers/eet/evas_model_save_eet.c
+++ b/src/modules/evas/model_savers/eet/evas_model_save_eet.c
@@ -148,9 +148,9 @@ _set_frame_to_eet_file_from_mesh(Evas_3D_Mesh_Eet *eet_mesh)
148} 148}
149 149
150void 150void
151evas_3d_mesh_save_eet(Evas_3D_Mesh *mesh, 151evas_model_save_file_eet(Evas_3D_Mesh *mesh,
152 const char *file, 152 const char *file,
153 Evas_3D_Mesh_Frame *f) 153 Evas_3D_Mesh_Frame *f)
154{ 154{
155 Evas_3D_Mesh_Data *pd = eo_data_scope_get(mesh, EVAS_3D_MESH_CLASS); 155 Evas_3D_Mesh_Data *pd = eo_data_scope_get(mesh, EVAS_3D_MESH_CLASS);
156 Eet_File *ef = eet_open(file, EET_FILE_MODE_WRITE); 156 Eet_File *ef = eet_open(file, EET_FILE_MODE_WRITE);
diff --git a/src/modules/evas/model_savers/obj/evas_model_save_obj.c b/src/modules/evas/model_savers/obj/evas_model_save_obj.c
index c7699b3292..35773e304f 100644
--- a/src/modules/evas/model_savers/obj/evas_model_save_obj.c
+++ b/src/modules/evas/model_savers/obj/evas_model_save_obj.c
@@ -129,7 +129,7 @@ _save_material(Evas_3D_Mesh_Data *pd EINA_UNUSED, const char *file, Evas_3D_Mesh
129} 129}
130 130
131void 131void
132evas_3d_mesh_save_obj(Evas_3D_Mesh *mesh, const char *file, Evas_3D_Mesh_Frame *f) 132evas_model_save_file_obj(Evas_3D_Mesh *mesh, const char *file, Evas_3D_Mesh_Frame *f)
133{ 133{
134 Evas_3D_Mesh_Data *pd = eo_data_scope_get(mesh, EVAS_3D_MESH_CLASS); 134 Evas_3D_Mesh_Data *pd = eo_data_scope_get(mesh, EVAS_3D_MESH_CLASS);
135 _save_mesh(pd, file, f); 135 _save_mesh(pd, file, f);
diff --git a/src/modules/evas/model_savers/ply/evas_model_save_ply.c b/src/modules/evas/model_savers/ply/evas_model_save_ply.c
index a0ba9457d3..b99f080eec 100644
--- a/src/modules/evas/model_savers/ply/evas_model_save_ply.c
+++ b/src/modules/evas/model_savers/ply/evas_model_save_ply.c
@@ -10,7 +10,7 @@
10#include "evas_private.h" 10#include "evas_private.h"
11 11
12void 12void
13evas_3d_mesh_save_ply(Evas_3D_Mesh *mesh, const char *file, Evas_3D_Mesh_Frame *f) 13evas_model_save_file_ply(Evas_3D_Mesh *mesh, const char *file, Evas_3D_Mesh_Frame *f)
14{ 14{
15 float *src_pos, *src_nor, *src_tex, *src_col; 15 float *src_pos, *src_nor, *src_tex, *src_col;
16 int i; 16 int i;