cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=728eff8836163a7c24c10ad8e1ce6e21eca13b01
commit 728eff8836163a7c24c10ad8e1ce6e21eca13b01 Author: perepelits.m <perepelit...@samsung.com> Date: Mon Jan 4 14:03:12 2016 -0800 edje: implementation of Edje_3d Summary: I have a strange feeling that I always commit the same code to edje-3d, I hope it will finish very soon. However here are some important new keywords, descriptors for them, methods for models, structure for providing animation in edje programs and some more changes. Reviewers: raster, Hermet, cedric Reviewed By: cedric Subscribers: jpeg, artem.popov Projects: #efl Differential Revision: https://phab.enlightenment.org/D3437 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/bin/edje/edje_cc.c | 10 +- src/bin/edje/edje_cc.h | 2 + src/bin/edje/edje_cc_handlers.c | 382 +++++++++++++++++++++++++++++++++++++--- src/bin/edje/edje_cc_out.c | 76 ++++++++ src/lib/edje/edje_data.c | 11 +- src/lib/edje/edje_private.h | 18 +- 6 files changed, 472 insertions(+), 27 deletions(-) diff --git a/src/bin/edje/edje_cc.c b/src/bin/edje/edje_cc.c index 237d580..9452fff 100644 --- a/src/bin/edje/edje_cc.c +++ b/src/bin/edje/edje_cc.c @@ -16,6 +16,7 @@ Eina_List *snd_dirs = NULL; Eina_List *mo_dirs = NULL; Eina_List *vibration_dirs = NULL; Eina_List *img_dirs = NULL; +Eina_List *model_dirs = NULL; Eina_List *fnt_dirs = NULL; Eina_List *data_dirs = NULL; Eina_List *defines = NULL; @@ -153,7 +154,9 @@ main(int argc, char **argv) tmp_dir = (char *)eina_environment_tmp_get(); img_dirs = eina_list_append(img_dirs, "."); - + + model_dirs = eina_list_append(model_dirs, "."); + /* add defines to epp so edc files can detect edje_cc version */ defines = eina_list_append(defines, mem_strdup("-DEDJE_VERSION_12=12")); @@ -202,6 +205,11 @@ main(int argc, char **argv) i++; img_dirs = eina_list_append(img_dirs, argv[i]); } + else if ((!strcmp(argv[i], "-mod") || !strcmp(argv[i], "--model_dir")) && (i < (argc - 1))) + { + i++; + model_dirs = eina_list_append(model_dirs, argv[i]); + } else if ((!strcmp(argv[i], "-fd") || !strcmp(argv[i], "--font_dir")) && (i < (argc - 1))) { i++; diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h index 106ea17..b4da941 100644 --- a/src/bin/edje/edje_cc.h +++ b/src/bin/edje/edje_cc.h @@ -187,6 +187,7 @@ void data_queue_image_lookup(char *name, int *dest, Eina_Bool *set); void data_queue_model_lookup(char *name, int *dest, Eina_Bool *set); void data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set); void data_queue_image_remove(int *dest, Eina_Bool *set); +void data_queue_copied_model_lookup(int *src, int *dest, Eina_Bool *set); void data_queue_model_remove(int *dest, Eina_Bool *set); void data_queue_spectrum_lookup(char *name, int *dest); void data_queue_spectrum_slave_lookup(int *master, int *slave); @@ -253,6 +254,7 @@ int get_param_index(char *str); /* global vars */ extern Eina_List *ext_dirs; extern Eina_List *img_dirs; +extern Eina_List *model_dirs; extern Eina_List *fnt_dirs; extern Eina_List *snd_dirs; extern Eina_List *mo_dirs; diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index 007a930..5d830a3 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c @@ -413,11 +413,14 @@ static void st_collections_group_parts_part_description_properties_material(void static void st_collections_group_parts_part_description_properties_normal(void); static void st_collections_group_parts_part_description_properties_shininess(void); static void st_collections_group_parts_part_description_properties_shade(void); +static void st_collections_group_parts_part_description_orientation_angle_axis(void); static void st_collections_group_parts_part_description_orientation_look1(void); static void st_collections_group_parts_part_description_orientation_look2(void); static void st_collections_group_parts_part_description_orientation_look_to(void); static void st_collections_group_parts_part_description_orientation_angle_axis(void); static void st_collections_group_parts_part_description_orientation_quaternion(void); +static void st_collections_group_parts_part_description_scale(void); +static void st_collections_group_parts_part_description_mesh_primitive(void); static void ob_collections_group_parts_part_description_texture(void); static void st_collections_group_parts_part_description_texture_image(void); static void st_collections_group_parts_part_description_texture_wrap1(void); @@ -426,6 +429,7 @@ static void st_collections_group_parts_part_description_texture_filter1(void); static void st_collections_group_parts_part_description_texture_filter2(void); static void st_collections_group_parts_part_description_mesh_assembly(void); static void st_collections_group_parts_part_description_mesh_geometry(void); +static void st_collections_group_parts_part_description_mesh_frame(void); static void st_collections_group_parts_part_description_filter_code(void); static void st_collections_group_parts_part_description_filter_source(void); static void st_collections_group_parts_part_description_filter_data(void); @@ -896,11 +900,13 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.properties.normal", st_collections_group_parts_part_description_properties_normal}, {"collections.group.parts.part.description.properties.shininess", st_collections_group_parts_part_description_properties_shininess}, {"collections.group.parts.part.description.properties.shade", st_collections_group_parts_part_description_properties_shade}, + {"collections.group.parts.part.description.mesh.primitive", st_collections_group_parts_part_description_mesh_primitive}, {"collections.group.parts.part.description.orientation.look1", st_collections_group_parts_part_description_orientation_look1}, {"collections.group.parts.part.description.orientation.look2", st_collections_group_parts_part_description_orientation_look2}, {"collections.group.parts.part.description.orientation.look_to", st_collections_group_parts_part_description_orientation_look_to}, {"collections.group.parts.part.description.orientation.angle_axis", st_collections_group_parts_part_description_orientation_angle_axis}, {"collections.group.parts.part.description.orientation.quaternion", st_collections_group_parts_part_description_orientation_quaternion}, + {"collections.group.parts.part.description.scale", st_collections_group_parts_part_description_scale}, {"collections.group.parts.part.description.texture.image", st_collections_group_parts_part_description_texture_image}, {"collections.group.parts.part.description.texture.wrap1", st_collections_group_parts_part_description_texture_wrap1}, {"collections.group.parts.part.description.texture.wrap2", st_collections_group_parts_part_description_texture_wrap2}, @@ -908,6 +914,7 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.texture.filter2", st_collections_group_parts_part_description_texture_filter2}, {"collections.group.parts.part.description.mesh.assembly", st_collections_group_parts_part_description_mesh_assembly}, {"collections.group.parts.part.description.mesh.geometry", st_collections_group_parts_part_description_mesh_geometry}, + {"collections.group.parts.part.description.mesh.frame", st_collections_group_parts_part_description_mesh_frame}, {"collections.group.parts.part.description.filter.code", st_collections_group_parts_part_description_filter_code}, {"collections.group.parts.part.description.filter.source", st_collections_group_parts_part_description_filter_source}, {"collections.group.parts.part.description.filter.data", st_collections_group_parts_part_description_filter_data}, @@ -1596,6 +1603,157 @@ _edje_part_description_alloc(unsigned char type, const char *collection, const c result = &ed->common; break; } + case EDJE_PART_TYPE_MESH_NODE: + { + Edje_Part_Description_Mesh_Node *ed; + + ed = mem_alloc(SZ(Edje_Part_Description_Mesh_Node)); + + ed->mesh_node.mesh.id = -1; + ed->mesh_node.mesh.primitive = 0; + ed->mesh_node.mesh.assembly = 1; + ed->mesh_node.mesh.frame = 0; + + ed->mesh_node.texture.id = -1; + ed->mesh_node.texture.wrap1 = 0; + ed->mesh_node.texture.wrap2 = 0; + ed->mesh_node.texture.filter1 = 0; + ed->mesh_node.texture.filter2 = 0; + + ed->mesh_node.properties.shade = EVAS_CANVAS3D_SHADE_MODE_VERTEX_COLOR; + ed->mesh_node.properties.ambient.r = 50; + ed->mesh_node.properties.ambient.g = 50; + ed->mesh_node.properties.ambient.b = 50; + ed->mesh_node.properties.ambient.a = 255; + ed->mesh_node.properties.diffuse.r = 255; + ed->mesh_node.properties.diffuse.g = 255; + ed->mesh_node.properties.diffuse.b = 255; + ed->mesh_node.properties.diffuse.a = 255; + ed->mesh_node.properties.specular.r = 255; + ed->mesh_node.properties.specular.g = 255; + ed->mesh_node.properties.specular.b = 255; + ed->mesh_node.properties.specular.a = 255; + + ed->mesh_node.properties.material_attrib = 1; + ed->mesh_node.properties.normal = 1; + ed->mesh_node.properties.shininess = 50; + + ed->mesh_node.aabb1.relative.x = -1.0; + ed->mesh_node.aabb1.relative.y = -1.0; + ed->mesh_node.aabb1.relative.z = -1.0; + ed->mesh_node.aabb1.offset.x = 0; + ed->mesh_node.aabb1.offset.y = 0; + ed->mesh_node.aabb1.offset.z = 0; + ed->mesh_node.aabb1.rel_to = -1; + ed->mesh_node.aabb2.relative.x = 1.0; + ed->mesh_node.aabb2.relative.y = 1.0; + ed->mesh_node.aabb2.relative.z = 1.0; + ed->mesh_node.aabb2.offset.x = 0; + ed->mesh_node.aabb2.offset.y = 0; + ed->mesh_node.aabb2.offset.z = 0; + ed->mesh_node.aabb2.rel_to = -1; + + ed->mesh_node.orientation.type = EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_NONE; + /* x1 is angle for angle_axis and cosine of half angle for quternion, + x2, x3, x4 define axis for angle_axis and quaternion, + x1, x2, x3 are coordinates of point to look at for look_at, + x4, x5, x6 define a vector that indicates the angle at which + the subject is looking at the target for look_at and look_to */ + ed->mesh_node.orientation.data[0] = 1.0; + ed->mesh_node.orientation.data[1] = 0.0; + ed->mesh_node.orientation.data[2] = 0.0; + ed->mesh_node.orientation.data[3] = 0.0; + ed->mesh_node.orientation.data[4] = 1.0; + ed->mesh_node.orientation.data[5] = 0.0; + ed->mesh_node.orientation.look_to = -1; + + ed->mesh_node.scale_3d.x = 1.0; + ed->mesh_node.scale_3d.y = 1.0; + ed->mesh_node.scale_3d.z = 1.0; + + ed->mesh_node.position.point.x = 0.0; + ed->mesh_node.position.point.y = 0.0; + ed->mesh_node.position.point.z = 0.0; + ed->mesh_node.position.space = EVAS_CANVAS3D_SPACE_PARENT; + + result = &ed->common; + break; + } + case EDJE_PART_TYPE_LIGHT: + { + Edje_Part_Description_Light *ed; + + ed = mem_alloc(SZ(Edje_Part_Description_Light)); + + ed->light.properties.ambient.r = 50; + ed->light.properties.ambient.g = 50; + ed->light.properties.ambient.b = 50; + ed->light.properties.ambient.a = 255; + ed->light.properties.diffuse.r = 255; + ed->light.properties.diffuse.g = 255; + ed->light.properties.diffuse.b = 255; + ed->light.properties.diffuse.a = 255; + ed->light.properties.specular.r = 255; + ed->light.properties.specular.g = 255; + ed->light.properties.specular.b = 255; + ed->light.properties.specular.a = 255; + + ed->light.position.point.x = 0.0; + ed->light.position.point.y = 0.0; + ed->light.position.point.z = 1.0; + ed->light.position.space = EVAS_CANVAS3D_SPACE_PARENT; + + ed->light.orientation.type = EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_NONE; + /* x1 is angle for angle_axis and cosine of half angle for quternion, + x2, x3, x4 define axis for angle_axis and quaternion, + x1, x2, x3 are coordinates of point to look at for look_at, + x4, x5, x6 define a vector that indicates the angle at which + the subject is looking at the target for look_at and look_to */ + ed->light.orientation.data[0] = 1.0; + ed->light.orientation.data[1] = 0.0; + ed->light.orientation.data[2] = 0.0; + ed->light.orientation.data[3] = 0.0; + ed->light.orientation.data[4] = 1.0; + ed->light.orientation.data[5] = 0.0; + ed->light.orientation.look_to = -1; + + result = &ed->common; + break; + } + case EDJE_PART_TYPE_CAMERA: + { + Edje_Part_Description_Camera *ed; + + ed = mem_alloc(SZ(Edje_Part_Description_Camera)); + + ed->camera.camera.fovy = 60.0; + ed->camera.camera.aspect = 1.0; + ed->camera.camera.frustum_near = 2.0; + ed->camera.camera.frustum_far = 50.0; + + ed->camera.position.point.x = 0.0; + ed->camera.position.point.y = 0.0; + ed->camera.position.point.z = 5.0; + + ed->camera.position.space = EVAS_CANVAS3D_SPACE_PARENT; + + ed->camera.orientation.type = EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_NONE; + /* x1 is angle for angle_axis and cosine of half angle for quternion, + x2, x3, x4 define axis for angle_axis and quaternion, + x1, x2, x3 are coordinates of point to look at for look_at, + x4, x5, x6 define a vector that indicates the angle at which + the subject is looking at the target for look_at and look_to */ + ed->camera.orientation.data[0] = 1.0; + ed->camera.orientation.data[1] = 0.0; + ed->camera.orientation.data[2] = 0.0; + ed->camera.orientation.data[3] = 0.0; + ed->camera.orientation.data[4] = 1.0; + ed->camera.orientation.data[5] = 0.0; + ed->camera.orientation.look_to = -1; + + result = &ed->common; + break; + } } if (!result) @@ -5659,6 +5817,9 @@ st_collections_group_parts_part_name(void) @li BOX @li TABLE @li EXTERNAL + @li MESH_NODE + @li CAMERA + @li LIGHT @li PROXY @li SPACER @li SNAPSHOT @@ -5668,6 +5829,9 @@ static void st_collections_group_parts_part_type(void) { unsigned int type; + unsigned int i = 0; + + Edje_Part_Collection *pc; check_arg_count(1); @@ -5687,6 +5851,21 @@ st_collections_group_parts_part_type(void) "SNAPSHOT", EDJE_PART_TYPE_SNAPSHOT, NULL); + pc = eina_list_data_get(eina_list_last(edje_collections)); + + if (type == EDJE_PART_TYPE_CAMERA) + { + for (i = 0; i < (pc->parts_count - 1); i++) + { + if (pc->parts[i]->type == EDJE_PART_TYPE_CAMERA) + { + WRN("parse error %s:%i. more then one part of type CAMERA in scene.", + file_in, line - 1); + exit(-1); + } + } + } + _part_type_set(type); } @@ -5986,7 +6165,8 @@ st_collections_group_parts_part_mask_flags(void) such as font size, min/max size of the part, and possibly can be used to scale based on DPI of the target device. The reason to be selective is that some things work well being scaled, others do not, so the - designer gets to choose what works best. + designer gets to choose what works best. For MESH_NODE parts three + parameters specify how much the part will stretched along each axis. @endproperty */ static void @@ -7569,6 +7749,45 @@ st_collections_group_parts_part_description_inherit(void) } break; } + case EDJE_PART_TYPE_CAMERA: + { + Edje_Part_Description_Camera *ced = (Edje_Part_Description_Camera *) ed; + Edje_Part_Description_Camera *cparent = (Edje_Part_Description_Camera *) parent; + + ced->camera = cparent->camera; + + data_queue_copied_part_lookup(pc, &(cparent->camera.orientation.look_to), &(ced->camera.orientation.look_to)); + + break; + } + case EDJE_PART_TYPE_LIGHT: + { + Edje_Part_Description_Light *led = (Edje_Part_Description_Light *) ed; + Edje_Part_Description_Light *lparent = (Edje_Part_Description_Light *) parent; + + led->light = lparent->light; + + data_queue_copied_part_lookup(pc, &(lparent->light.orientation.look_to), &(led->light.orientation.look_to)); + + break; + } + case EDJE_PART_TYPE_MESH_NODE: + { + Edje_Part_Description_Mesh_Node *med = (Edje_Part_Description_Mesh_Node *) ed; + Edje_Part_Description_Mesh_Node *mparent = (Edje_Part_Description_Mesh_Node *) parent; + + med->mesh_node = mparent->mesh_node; + + data_queue_model_remove(&med->mesh_node.mesh.id, &med->mesh_node.mesh.set); + data_queue_copied_model_lookup(&mparent->mesh_node.mesh.id, &med->mesh_node.mesh.id, &med->mesh_node.mesh.set); + + data_queue_image_remove(&med->mesh_node.texture.id, &med->mesh_node.texture.set); + data_queue_copied_model_lookup(&mparent->mesh_node.texture.id, &med->mesh_node.texture.id, &med->mesh_node.texture.set); + + data_queue_copied_part_lookup(pc, &(mparent->mesh_node.orientation.look_to), &(med->mesh_node.orientation.look_to)); + + break; + } } #undef STRDUP @@ -8550,6 +8769,8 @@ st_collections_group_parts_part_description_image_normal(void) { char *name; + ed->image.set = EINA_TRUE; + name = parse_str(0); data_queue_image_remove(&(ed->image.id), &(ed->image.set)); data_queue_image_lookup(name, &(ed->image.id), &(ed->image.set)); @@ -10327,23 +10548,25 @@ st_collections_group_parts_part_description_position_space(void) static void st_collections_group_parts_part_description_camera_properties(void) { - Edje_Part_Description_Camera *ed; - check_arg_count(4); - if (current_part->type != EDJE_PART_TYPE_CAMERA) + if (current_part->type == EDJE_PART_TYPE_CAMERA) + { + Edje_Part_Description_Camera *ed; + + ed = (Edje_Part_Description_Camera*) current_desc; + + ed->camera.camera.fovy = FROM_DOUBLE(parse_float(0)); + ed->camera.camera.aspect = FROM_DOUBLE(parse_float(1)); + ed->camera.camera.frustum_near = FROM_DOUBLE(parse_float(2)); + ed->camera.camera.frustum_far = FROM_DOUBLE(parse_float(3)); + } + else { - ERR("parse error %s:%i. camera attributes in non-CAMERA part.", + ERR("parse error %s:%i. camera attributes in non-CAMERA and non-LIGHT part.", file_in, line - 1); exit(-1); } - - ed = (Edje_Part_Description_Camera*) current_desc; - - ed->camera.camera.fovy = FROM_DOUBLE(parse_float(0)); - ed->camera.camera.aspect = FROM_DOUBLE(parse_float(1)); - ed->camera.camera.frustum_near = FROM_DOUBLE(parse_float(2)); - ed->camera.camera.frustum_far = FROM_DOUBLE(parse_float(3)); } /** @@ -10397,10 +10620,10 @@ st_collections_group_parts_part_description_properties_ambient(void) ed = (Edje_Part_Description_Light*) current_desc; - ed->light.properties.ambient.r = parse_int_range(0, 0, 255); - ed->light.properties.ambient.g = parse_int_range(1, 0, 255); - ed->light.properties.ambient.b = parse_int_range(2, 0, 255); - ed->light.properties.ambient.a = parse_int_range(3, 0, 255); + ed->light.properties.specular.r = parse_int_range(0, 0, 255); + ed->light.properties.specular.g = parse_int_range(1, 0, 255); + ed->light.properties.specular.b = parse_int_range(2, 0, 255); + ed->light.properties.specular.a = parse_int_range(3, 0, 255); break; } case EDJE_PART_TYPE_MESH_NODE: @@ -10409,10 +10632,10 @@ st_collections_group_parts_part_description_properties_ambient(void) ed = (Edje_Part_Description_Mesh_Node*) current_desc; - ed->mesh_node.properties.ambient.r = parse_int_range(0, 0, 255); - ed->mesh_node.properties.ambient.g = parse_int_range(1, 0, 255); - ed->mesh_node.properties.ambient.b = parse_int_range(2, 0, 255); - ed->mesh_node.properties.ambient.a = parse_int_range(3, 0, 255); + ed->mesh_node.properties.specular.r = parse_int_range(0, 0, 255); + ed->mesh_node.properties.specular.g = parse_int_range(1, 0, 255); + ed->mesh_node.properties.specular.b = parse_int_range(2, 0, 255); + ed->mesh_node.properties.specular.a = parse_int_range(3, 0, 255); break; } default: @@ -10907,6 +11130,37 @@ st_collections_group_parts_part_description_orientation_quaternion(void) } /** + @page edcref + @property + scale + @parameters + [scale_x] [scale_y] [scale_z] + @effect + Specifies the scale parametr for MESH_NODE. + @endproperty +*/ +static void +st_collections_group_parts_part_description_scale(void) +{ + if (current_part->type == EDJE_PART_TYPE_MESH_NODE) + { + Edje_Part_Description_Mesh_Node *ed; + + ed = (Edje_Part_Description_Mesh_Node*) current_desc; + + ed->mesh_node.scale_3d.x = FROM_DOUBLE(parse_float_range(0, 0.0, 1000.0)); + ed->mesh_node.scale_3d.y = FROM_DOUBLE(parse_float_range(1, 0.0, 1000.0)); + ed->mesh_node.scale_3d.z = FROM_DOUBLE(parse_float_range(2, 0.0, 1000.0)); + } + else + { + ERR("parse error %s:%i. mesh_node attributes in non-MESH_NODE part.", + file_in, line - 1); + exit(-1); + } +} + +/** @edcsubsection{collections_group_parts_description_texture, Group.Parts.Part.Description.Texture} */ @@ -11184,6 +11438,71 @@ st_collections_group_parts_part_description_texture_filter2(void) } /** + @edcsubsection{collections_group_parts_description_mesh,Mesh} + */ + +/** + @page edcref + + @block + mesh + @context + part { + description { + .. + mesh { + geometry: "file_name"; + primitive: CUBE; + assembly: LINEAR; + } + .. + } + } + @description + @endblock + + @property + primitive + @parameters + [PRIMITIVE] + @effect + Specifies the the type of primitive model to be used. + Valid primitives: + @li NONE + @li CUBE + @li SPHERE + @endproperty +*/ +static void +st_collections_group_parts_part_description_mesh_primitive(void) +{ + unsigned int primitive; + + check_arg_count(1); + + primitive = parse_enum(0, + "NONE", EVAS_CANVAS3D_MESH_PRIMITIVE_NONE, + "CUBE", EVAS_CANVAS3D_MESH_PRIMITIVE_CUBE, + "SPHERE", EVAS_CANVAS3D_MESH_PRIMITIVE_SPHERE, + NULL); + + if (current_part->type == EDJE_PART_TYPE_MESH_NODE) + { + Edje_Part_Description_Mesh_Node *ed; + + ed = (Edje_Part_Description_Mesh_Node*) current_desc; + + ed->mesh_node.mesh.primitive = primitive; + } + else + { + ERR("parse error %s:%i. mesh_node attributes in non-MESH_NODE part.", + file_in, line - 1); + exit(-1); + } +} + +/** @page edcref @property assembly @@ -11277,6 +11596,28 @@ st_collections_group_parts_part_description_mesh_geometry(void) } static void +st_collections_group_parts_part_description_mesh_frame(void) +{ + check_arg_count(1); + + + if (current_part->type == EDJE_PART_TYPE_MESH_NODE) + { + Edje_Part_Description_Mesh_Node *ed; + + ed = (Edje_Part_Description_Mesh_Node*) current_desc; + + ed->mesh_node.mesh.frame = parse_int(0); + } + else + { + ERR("parse error %s:%i. mesh_node attributes in non-MESH_NODE part.", + file_in, line - 1); + exit(-1); + } +} + +static void st_collections_group_parts_part_description_table_min(void) { Edje_Part_Description_Table *ed; @@ -12983,6 +13324,7 @@ ob_collections_group_programs_program(void) ep = mem_alloc(SZ(Edje_Program_Parser)); ep->id = -1; + ep->source_3d_id = -1; ep->tween.mode = EDJE_TWEEN_MODE_LINEAR; ep->tween.use_duration_factor = EINA_FALSE; ep->after = NULL; diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index fb7a9ee..c5c439a 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -627,6 +627,30 @@ check_program(Edje_Part_Collection *pc, Edje_Program *ep, Eet_File *ef) default: break; } + Edje_Program_Target *et; + Eina_List *l; + unsigned int i = 0; + int camera_id = -1; + + for (i = 0; (i < pc->parts_count) && (camera_id < 0); i++) + { + if (pc->parts[i]->type == EDJE_PART_TYPE_CAMERA) + camera_id = i; + } + + EINA_LIST_FOREACH(ep->targets, l, et) + { + if (((ep->action == EDJE_ACTION_TYPE_STATE_SET) || (ep->action == EDJE_ACTION_TYPE_SIGNAL_EMIT)) && + (pc->parts[et->id]->type == EDJE_PART_TYPE_MESH_NODE) && strstr(ep->signal, "mouse")) + { + for (i = 0; (i < pc->parts_count) && (ep->source_3d_id < 0); i++) + { + if (!strcmp(pc->parts[i]->name, ep->source)) + ep->source_3d_id = i; + } + ep->source = mem_strdup(pc->parts[camera_id]->name); + } + } } static void @@ -1306,6 +1330,40 @@ data_write_images(Eet_File *ef, int *image_num) } static void +data_check_models(Eet_File *ef EINA_UNUSED, int *model_num EINA_UNUSED) +{ + int i; + + if (!((edje_file) && (edje_file->model_dir))) return; + + for (i = 0; i < (int)edje_file->model_dir->entries_count; i++) + { + Edje_Model_Directory_Entry *model; + Eina_List *ll; + char *s; + Eina_Bool file_exist = EINA_FALSE; + + model = &edje_file->model_dir->entries[i]; + + EINA_LIST_FOREACH(model_dirs, ll, s) + { + char buf[PATH_MAX]; + + snprintf(buf, sizeof(buf), "%s/%s", s, model->entry); + + file_exist = file_exist || ecore_file_exists(buf); + + } + if (!file_exist) + { + ERR("Unablegstsh to load model \"%s\". Check if path to file is correct (both directory and file name).", + model->entry); + exit(-1); + } + } +} + +static void data_thread_sounds(void *data, Ecore_Thread *thread EINA_UNUSED) { Sound_Write *sw = data; @@ -2410,6 +2468,7 @@ data_write(void) Eet_File *ef; Eet_Error err; int image_num = 0; + int model_num = 0; int sound_num = 0; int mo_num = 0; int vibration_num = 0; @@ -2469,6 +2528,8 @@ data_write(void) INF("fontmap: %3.5f", ecore_time_get() - t); t = ecore_time_get(); data_write_images(ef, &image_num); INF("images: %3.5f", ecore_time_get() - t); t = ecore_time_get(); + data_check_models(ef, &model_num); + INF("models: %3.5f", ecore_time_get() - t); t = ecore_time_get(); data_write_fonts(ef, &font_num); INF("fonts: %3.5f", ecore_time_get() - t); t = ecore_time_get(); data_write_sounds(ef, &sound_num); @@ -3030,6 +3091,19 @@ data_queue_model_remove(int *dest, Eina_Bool *set) } void +data_queue_copied_model_lookup(int *src, int *dest, Eina_Bool *set) +{ + Eina_List *l; + Image_Lookup *il; + + EINA_LIST_FOREACH(model_lookups, l, il) + { + if (il->dest == src) + data_queue_model_lookup(il->name, dest, set); + } +} + +void data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set) { Eina_List *l; @@ -3625,6 +3699,8 @@ free_group: eina_hash_direct_add(images_in_use, set->name, set); break; } + else + *(image->set) = EINA_FALSE; } } } diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c index 905831d..18e014e 100644 --- a/src/lib/edje/edje_data.c +++ b/src/lib/edje/edje_data.c @@ -610,6 +610,7 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "name", name, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "signal", signal, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "source", source, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "source_3d_id", source_3d_id, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "filter_part", filter.part, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "filter_state", filter.state, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "in.from", in.from, EET_T_DOUBLE); @@ -877,7 +878,12 @@ _edje_edd_init(void) #define EET_DATA_DESCRIPTOR_ADD_SUB_NESTED_LOOK(Edd, Type, Dec) \ { \ - EET_DATA_DESCRIPTOR_ADD_BASIC_ARRAY(Edd, Type, #Dec ".orientation.look", Dec.orientation.data, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "Dec##.orientation.look1.x", Dec.orientation.data[0], EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "Dec##.orientation.look1.y", Dec.orientation.data[1], EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "Dec##.orientation.look1.z", Dec.orientation.data[2], EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "Dec##.orientation.look2.x", Dec.orientation.data[3], EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "Dec##.orientation.look2.y", Dec.orientation.data[4], EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "Dec##.orientation.look2.z", Dec.orientation.data[5], EDJE_T_FLOAT); \ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, #Dec ".orientation.look_to", Dec.orientation.look_to, EET_T_INT); \ } @@ -950,6 +956,7 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_mesh_node, Edje_Part_Description_Mesh_Node, "mesh_node.aabb2.rel_to", mesh_node.aabb2.rel_to, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_mesh_node, Edje_Part_Description_Mesh_Node, "mesh_node.orientation.type", mesh_node.orientation.type, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_SUB_NESTED_LOOK(_edje_edd_edje_part_description_mesh_node, Edje_Part_Description_Mesh_Node, mesh_node); + EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(_edje_edd_edje_part_description_mesh_node, Edje_Part_Description_Mesh_Node, "mesh_node.scale_3d", mesh_node.scale_3d, _edje_edd_edje_part_description_3d_vec); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_mesh_node, Edje_Part_Description_Mesh_Node, "mesh_node.texture.id", mesh_node.texture.id, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_mesh_node, Edje_Part_Description_Mesh_Node, "mesh_node.texture.set", mesh_node.texture.set, EET_T_UCHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_mesh_node, Edje_Part_Description_Mesh_Node, "mesh_node.texture.wrap1", mesh_node.texture.wrap1, EET_T_UCHAR); @@ -962,6 +969,7 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_mesh_node, Edje_Part_Description_Mesh_Node, "mesh_node.mesh.assembly", mesh_node.mesh.assembly, EET_T_UCHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_mesh_node, Edje_Part_Description_Mesh_Node, "mesh_node.mesh.id", mesh_node.mesh.id, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_mesh_node, Edje_Part_Description_Mesh_Node, "mesh_node.mesh.set", mesh_node.mesh.set, EET_T_UCHAR); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_mesh_node, Edje_Part_Description_Mesh_Node, "mesh_node.mesh.frame", mesh_node.mesh.frame, EET_T_INT); EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Light); eddc.func.mem_free = mem_free_light; @@ -1289,7 +1297,6 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "ignore_flags", ignore_flags, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "mask_flags", mask_flags, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "scale", scale, EET_T_UCHAR); - EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(_edje_edd_edje_part, Edje_Part, "scale_3d", scale_3d, _edje_edd_edje_part_description_3d_vec); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "precise_is_inside", precise_is_inside, EET_T_UCHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "use_alternate_font_metrics", use_alternate_font_metrics, EET_T_UCHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "pointer_mode", pointer_mode, EET_T_UCHAR); diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 5f1d6d4..68c3f35 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -752,6 +752,7 @@ struct _Edje_Program /* a conditional program to be run */ const char *signal; /* if signal emission name matches the glob here... */ const char *source; /* if part that emitted this (name) matches this glob */ + int source_3d_id; /* id of real 3D part */ const char *sample_name; const char *tone_name; double duration; @@ -1407,14 +1408,15 @@ struct _Edje_Part_Description_Spec_Table struct _Edje_Part_Description_Spec_Mesh_Node { struct { - Edje_Part_Image_Id **tweens; - unsigned int tweens_count; - int id; + Edje_Part_Image_Id **tweens; + unsigned int tweens_count; + int id; - Eina_Bool set; + Eina_Bool set; Evas_Canvas3D_Mesh_Primitive primitive; Evas_Canvas3D_Vertex_Assembly assembly; + int frame; } mesh; struct { @@ -1452,6 +1454,8 @@ struct _Edje_Part_Description_Spec_Mesh_Node int look_to; /* -1 = whole part collection, or part ID */ } orientation; + Edje_3D_Vec scale_3d; + struct { Edje_3D_Vec point; @@ -1774,6 +1778,12 @@ struct _Edje_Calc_Params int size; // 4 Edje_Color color2, color3; // 8 } text; // 36 + struct { + int frame; //4 + FLOAT_T data[6]; + Edje_3D_Vec point; + Edje_3D_Vec scale_3d; + } node; // 4 } type; // 40 const Edje_Calc_Params_Map *map; // 88 #ifdef HAVE_EPHYSICS --