summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Edje.am3
-rw-r--r--src/lib/edje/edje_calc.c112
-rw-r--r--src/lib/edje/edje_embryo.c48
-rw-r--r--src/lib/edje/edje_load.c37
-rw-r--r--src/lib/edje/edje_main.c137
-rw-r--r--src/lib/edje/edje_private.h79
-rw-r--r--src/lib/edje/edje_program.c103
-rw-r--r--src/lib/edje/edje_smart.c18
8 files changed, 407 insertions, 130 deletions
diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am
index f6dd2f7..989df6d 100644
--- a/src/Makefile_Edje.am
+++ b/src/Makefile_Edje.am
@@ -51,6 +51,7 @@ EDJE_COMMON_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
51-DPACKAGE_DATA_DIR=\"$(datadir)/edje\" \ 51-DPACKAGE_DATA_DIR=\"$(datadir)/edje\" \
52-DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \ 52-DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \
53-DPACKAGE_SRC_DIR=\"$(abs_top_srcdir)\" \ 53-DPACKAGE_SRC_DIR=\"$(abs_top_srcdir)\" \
54@EDJE_LUA_CFLAGS@ \
54@EDJE_CFLAGS@ 55@EDJE_CFLAGS@
55 56
56installed_edjemainheadersdir = $(includedir)/edje-@VMAJ@ 57installed_edjemainheadersdir = $(includedir)/edje-@VMAJ@
@@ -97,7 +98,7 @@ lib/edje/edje_containers.c
97 98
98 99
99lib_edje_libedje_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl $(EDJE_COMMON_CPPFLAGS) 100lib_edje_libedje_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl $(EDJE_COMMON_CPPFLAGS)
100lib_edje_libedje_la_LIBADD = @EDJE_LIBS@ 101lib_edje_libedje_la_LIBADD = @EDJE_LIBS@ @EDJE_LUA_LIBS@
101lib_edje_libedje_la_DEPENDENCIES = @EDJE_INTERNAL_LIBS@ 102lib_edje_libedje_la_DEPENDENCIES = @EDJE_INTERNAL_LIBS@
102lib_edje_libedje_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ 103lib_edje_libedje_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
103 104
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index e5f022d..66b1cee 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -3357,7 +3357,8 @@ static Eina_Bool
3357_edje_physics_world_geometry_check(EPhysics_World *world) 3357_edje_physics_world_geometry_check(EPhysics_World *world)
3358{ 3358{
3359 Evas_Coord w, h, d; 3359 Evas_Coord w, h, d;
3360 ephysics_world_render_geometry_get(world, NULL, NULL, NULL, &w, &h, &d); 3360 if (!EPH_LOAD()) return EINA_FALSE;
3361 EPH_CALL(ephysics_world_render_geometry_get)(world, NULL, NULL, NULL, &w, &h, &d);
3361 return w && h && d; 3362 return w && h && d;
3362} 3363}
3363 3364
@@ -3365,14 +3366,17 @@ static void
3365_edje_physics_body_props_update(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *pf, 3366_edje_physics_body_props_update(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *pf,
3366 Eina_Bool pos_update) 3367 Eina_Bool pos_update)
3367{ 3368{
3368 ephysics_body_linear_movement_enable_set(ep->body, 3369 if (!EPH_LOAD()) return;
3369 pf->physics->mov_freedom.lin.x, 3370 EPH_CALL(ephysics_body_linear_movement_enable_set)
3370 pf->physics->mov_freedom.lin.y, 3371 (ep->body,
3371 pf->physics->mov_freedom.lin.z); 3372 pf->physics->mov_freedom.lin.x,
3372 ephysics_body_angular_movement_enable_set(ep->body, 3373 pf->physics->mov_freedom.lin.y,
3373 pf->physics->mov_freedom.ang.x, 3374 pf->physics->mov_freedom.lin.z);
3374 pf->physics->mov_freedom.ang.y, 3375 EPH_CALL(ephysics_body_angular_movement_enable_set)
3375 pf->physics->mov_freedom.ang.z); 3376 (ep->body,
3377 pf->physics->mov_freedom.ang.x,
3378 pf->physics->mov_freedom.ang.y,
3379 pf->physics->mov_freedom.ang.z);
3376 3380
3377 /* Boundaries geometry and mass shouldn't be changed */ 3381 /* Boundaries geometry and mass shouldn't be changed */
3378 if (ep->part->physics_body < EDJE_PART_PHYSICS_BODY_BOUNDARY_TOP) 3382 if (ep->part->physics_body < EDJE_PART_PHYSICS_BODY_BOUNDARY_TOP)
@@ -3381,62 +3385,65 @@ _edje_physics_body_props_update(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *
3381 3385
3382 if (pos_update) 3386 if (pos_update)
3383 { 3387 {
3384 ephysics_body_move(ep->body, 3388 EPH_CALL(ephysics_body_move)
3385 ed->x + pf->final.x, 3389 (ep->body,
3386 ed->y + pf->final.y, 3390 ed->x + pf->final.x,
3387 pf->physics->z); 3391 ed->y + pf->final.y,
3392 pf->physics->z);
3388 ep->x = pf->final.x; 3393 ep->x = pf->final.x;
3389 ep->y = pf->final.y; 3394 ep->y = pf->final.y;
3390 ep->w = pf->final.w; 3395 ep->w = pf->final.w;
3391 ep->h = pf->final.h; 3396 ep->h = pf->final.h;
3392 } 3397 }
3393 3398
3394 ephysics_body_geometry_get(ep->body, &x, &y, &z, &w, &h, &d); 3399 EPH_CALL(ephysics_body_geometry_get)(ep->body, &x, &y, &z, &w, &h, &d);
3395 if ((d) && (d != pf->physics->depth)) 3400 if ((d) && (d != pf->physics->depth))
3396 ephysics_body_resize(ep->body, w, h, pf->physics->depth); 3401 EPH_CALL(ephysics_body_resize)(ep->body, w, h, pf->physics->depth);
3397 if (z != pf->physics->z) 3402 if (z != pf->physics->z)
3398 ephysics_body_move(ep->body, x, y, pf->physics->z); 3403 EPH_CALL(ephysics_body_move)(ep->body, x, y, pf->physics->z);
3399 3404
3400 ephysics_body_material_set(ep->body, pf->physics->material); 3405 EPH_CALL(ephysics_body_material_set)(ep->body, pf->physics->material);
3401 if (!pf->physics->material) 3406 if (!pf->physics->material)
3402 { 3407 {
3403 if (pf->physics->density) 3408 if (pf->physics->density)
3404 ephysics_body_density_set(ep->body, pf->physics->density); 3409 EPH_CALL(ephysics_body_density_set)(ep->body, pf->physics->density);
3405 else 3410 else
3406 ephysics_body_mass_set(ep->body, pf->physics->mass); 3411 EPH_CALL(ephysics_body_mass_set)(ep->body, pf->physics->mass);
3407 } 3412 }
3408 3413
3409 if ((ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_BOX) || 3414 if ((ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_BOX) ||
3410 (ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_SPHERE) || 3415 (ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_SPHERE) ||
3411 (ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_CYLINDER) || 3416 (ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_CYLINDER) ||
3412 (ep->part->physics_body == EDJE_PART_PHYSICS_BODY_CLOTH)) 3417 (ep->part->physics_body == EDJE_PART_PHYSICS_BODY_CLOTH))
3413 ephysics_body_soft_body_hardness_set(ep->body, 3418 EPH_CALL(ephysics_body_soft_body_hardness_set)
3414 pf->physics->hardness * 100); 3419 (ep->body, pf->physics->hardness * 100);
3415 } 3420 }
3416 3421
3417 if (!pf->physics->material) 3422 if (!pf->physics->material)
3418 { 3423 {
3419 ephysics_body_restitution_set(ep->body, pf->physics->restitution); 3424 EPH_CALL(ephysics_body_restitution_set)(ep->body, pf->physics->restitution);
3420 ephysics_body_friction_set(ep->body, pf->physics->friction); 3425 EPH_CALL(ephysics_body_friction_set)(ep->body, pf->physics->friction);
3421 } 3426 }
3422 3427
3423 ephysics_body_damping_set(ep->body, pf->physics->damping.linear, 3428 EPH_CALL(ephysics_body_damping_set)(ep->body, pf->physics->damping.linear,
3424 pf->physics->damping.angular); 3429 pf->physics->damping.angular);
3425 ephysics_body_sleeping_threshold_set(ep->body, pf->physics->sleep.linear, 3430 EPH_CALL(ephysics_body_sleeping_threshold_set)(ep->body, pf->physics->sleep.linear,
3426 pf->physics->sleep.angular); 3431 pf->physics->sleep.angular);
3427 ephysics_body_light_set(ep->body, pf->physics->light_on); 3432 EPH_CALL(ephysics_body_light_set)(ep->body, pf->physics->light_on);
3428 ephysics_body_back_face_culling_set(ep->body, pf->physics->backcull); 3433 EPH_CALL(ephysics_body_back_face_culling_set)(ep->body, pf->physics->backcull);
3429} 3434}
3430 3435
3431static void 3436static void
3432_edje_physics_body_update_cb(void *data, EPhysics_Body *body, void *event_info EINA_UNUSED) 3437_edje_physics_body_update_cb(void *data, EPhysics_Body *body, void *event_info EINA_UNUSED)
3433{ 3438{
3434 Edje_Real_Part *rp = data; 3439 Edje_Real_Part *rp = data;
3435 Edje *ed = ephysics_body_data_get(body); 3440 Edje *ed;
3436 3441
3437 ephysics_body_geometry_get(body, &(rp->x), &(rp->y), NULL, 3442 if (!EPH_LOAD()) return;
3438 &(rp->w), &(rp->h), NULL); 3443 ed = EPH_CALL(ephysics_body_data_get(body));
3439 ephysics_body_evas_object_update(body); 3444 EPH_CALL(ephysics_body_geometry_get)(body, &(rp->x), &(rp->y), NULL,
3445 &(rp->w), &(rp->h), NULL);
3446 EPH_CALL(ephysics_body_evas_object_update)(body);
3440 ed->dirty = EINA_TRUE; 3447 ed->dirty = EINA_TRUE;
3441} 3448}
3442 3449
@@ -3447,63 +3454,64 @@ _edje_physics_body_add(Edje *ed, Edje_Real_Part *rp, EPhysics_World *world)
3447 Edje_Physics_Face *pface; 3454 Edje_Physics_Face *pface;
3448 Eina_List *l; 3455 Eina_List *l;
3449 3456
3457 if (!EPH_LOAD()) return;
3450 switch (rp->part->physics_body) 3458 switch (rp->part->physics_body)
3451 { 3459 {
3452 case EDJE_PART_PHYSICS_BODY_RIGID_BOX: 3460 case EDJE_PART_PHYSICS_BODY_RIGID_BOX:
3453 rp->body = ephysics_body_box_add(world); 3461 rp->body = EPH_CALL(ephysics_body_box_add)(world);
3454 break; 3462 break;
3455 3463
3456 case EDJE_PART_PHYSICS_BODY_RIGID_SPHERE: 3464 case EDJE_PART_PHYSICS_BODY_RIGID_SPHERE:
3457 rp->body = ephysics_body_sphere_add(world); 3465 rp->body = EPH_CALL(ephysics_body_sphere_add)(world);
3458 break; 3466 break;
3459 3467
3460 case EDJE_PART_PHYSICS_BODY_RIGID_CYLINDER: 3468 case EDJE_PART_PHYSICS_BODY_RIGID_CYLINDER:
3461 rp->body = ephysics_body_cylinder_add(world); 3469 rp->body = EPH_CALL(ephysics_body_cylinder_add)(world);
3462 break; 3470 break;
3463 3471
3464 case EDJE_PART_PHYSICS_BODY_SOFT_BOX: 3472 case EDJE_PART_PHYSICS_BODY_SOFT_BOX:
3465 rp->body = ephysics_body_soft_box_add(world); 3473 rp->body = EPH_CALL(ephysics_body_soft_box_add)(world);
3466 break; 3474 break;
3467 3475
3468 case EDJE_PART_PHYSICS_BODY_SOFT_SPHERE: 3476 case EDJE_PART_PHYSICS_BODY_SOFT_SPHERE:
3469 rp->body = ephysics_body_soft_sphere_add(world, 0); 3477 rp->body = EPH_CALL(ephysics_body_soft_sphere_add)(world, 0);
3470 break; 3478 break;
3471 3479
3472 case EDJE_PART_PHYSICS_BODY_SOFT_CYLINDER: 3480 case EDJE_PART_PHYSICS_BODY_SOFT_CYLINDER:
3473 rp->body = ephysics_body_soft_cylinder_add(world); 3481 rp->body = EPH_CALL(ephysics_body_soft_cylinder_add)(world);
3474 break; 3482 break;
3475 3483
3476 case EDJE_PART_PHYSICS_BODY_CLOTH: 3484 case EDJE_PART_PHYSICS_BODY_CLOTH:
3477 rp->body = ephysics_body_cloth_add(world, 0, 0); 3485 rp->body = EPH_CALL(ephysics_body_cloth_add)(world, 0, 0);
3478 break; 3486 break;
3479 3487
3480 case EDJE_PART_PHYSICS_BODY_BOUNDARY_TOP: 3488 case EDJE_PART_PHYSICS_BODY_BOUNDARY_TOP:
3481 rp->body = ephysics_body_top_boundary_add(world); 3489 rp->body = EPH_CALL(ephysics_body_top_boundary_add)(world);
3482 resize = EINA_FALSE; 3490 resize = EINA_FALSE;
3483 break; 3491 break;
3484 3492
3485 case EDJE_PART_PHYSICS_BODY_BOUNDARY_BOTTOM: 3493 case EDJE_PART_PHYSICS_BODY_BOUNDARY_BOTTOM:
3486 rp->body = ephysics_body_bottom_boundary_add(world); 3494 rp->body = EPH_CALL(ephysics_body_bottom_boundary_add)(world);
3487 resize = EINA_FALSE; 3495 resize = EINA_FALSE;
3488 break; 3496 break;
3489 3497
3490 case EDJE_PART_PHYSICS_BODY_BOUNDARY_RIGHT: 3498 case EDJE_PART_PHYSICS_BODY_BOUNDARY_RIGHT:
3491 rp->body = ephysics_body_right_boundary_add(world); 3499 rp->body = EPH_CALL(ephysics_body_right_boundary_add)(world);
3492 resize = EINA_FALSE; 3500 resize = EINA_FALSE;
3493 break; 3501 break;
3494 3502
3495 case EDJE_PART_PHYSICS_BODY_BOUNDARY_LEFT: 3503 case EDJE_PART_PHYSICS_BODY_BOUNDARY_LEFT:
3496 rp->body = ephysics_body_left_boundary_add(world); 3504 rp->body = EPH_CALL(ephysics_body_left_boundary_add)(world);
3497 resize = EINA_FALSE; 3505 resize = EINA_FALSE;
3498 break; 3506 break;
3499 3507
3500 case EDJE_PART_PHYSICS_BODY_BOUNDARY_FRONT: 3508 case EDJE_PART_PHYSICS_BODY_BOUNDARY_FRONT:
3501 rp->body = ephysics_body_front_boundary_add(world); 3509 rp->body = EPH_CALL(ephysics_body_front_boundary_add)(world);
3502 resize = EINA_FALSE; 3510 resize = EINA_FALSE;
3503 break; 3511 break;
3504 3512
3505 case EDJE_PART_PHYSICS_BODY_BOUNDARY_BACK: 3513 case EDJE_PART_PHYSICS_BODY_BOUNDARY_BACK:
3506 rp->body = ephysics_body_back_boundary_add(world); 3514 rp->body = EPH_CALL(ephysics_body_back_boundary_add)(world);
3507 resize = EINA_FALSE; 3515 resize = EINA_FALSE;
3508 break; 3516 break;
3509 3517
@@ -3525,15 +3533,15 @@ _edje_physics_body_add(Edje *ed, Edje_Real_Part *rp, EPhysics_World *world)
3525 3533
3526 edje_object_file_set(edje_obj, ed->path, pface->source); 3534 edje_object_file_set(edje_obj, ed->path, pface->source);
3527 evas_object_resize(edje_obj, 1, 1); 3535 evas_object_resize(edje_obj, 1, 1);
3528 ephysics_body_face_evas_object_set(rp->body, pface->type, 3536 EPH_CALL(ephysics_body_face_evas_object_set)(rp->body, pface->type,
3529 edje_obj, EINA_FALSE); 3537 edje_obj, EINA_FALSE);
3530 rp->body_faces = eina_list_append(rp->body_faces, edje_obj); 3538 rp->body_faces = eina_list_append(rp->body_faces, edje_obj);
3531 } 3539 }
3532 3540
3533 ephysics_body_evas_object_set(rp->body, rp->object, resize); 3541 EPH_CALL(ephysics_body_evas_object_set)(rp->body, rp->object, resize);
3534 ephysics_body_event_callback_add(rp->body, EPHYSICS_CALLBACK_BODY_UPDATE, 3542 EPH_CALL(ephysics_body_event_callback_add)(rp->body, EPHYSICS_CALLBACK_BODY_UPDATE,
3535 _edje_physics_body_update_cb, rp); 3543 _edje_physics_body_update_cb, rp);
3536 ephysics_body_data_set(rp->body, ed); 3544 EPH_CALL(ephysics_body_data_set)(rp->body, ed);
3537} 3545}
3538 3546
3539#endif 3547#endif
diff --git a/src/lib/edje/edje_embryo.c b/src/lib/edje/edje_embryo.c
index a246499..f7eeab6 100644
--- a/src/lib/edje/edje_embryo.c
+++ b/src/lib/edje/edje_embryo.c
@@ -4197,32 +4197,36 @@ _edje_embryo_fn_physics_components_get(Embryo_Program *ep, Embryo_Cell *params,
4197static Embryo_Cell 4197static Embryo_Cell
4198_edje_embryo_fn_physics_impulse(Embryo_Program *ep, Embryo_Cell *params) 4198_edje_embryo_fn_physics_impulse(Embryo_Program *ep, Embryo_Cell *params)
4199{ 4199{
4200 if (!EPH_LOAD()) return 0;
4200 return _edje_embryo_fn_physics_components_set( 4201 return _edje_embryo_fn_physics_components_set(
4201 ep, params, ephysics_body_central_impulse_apply); 4202 ep, params, EPH_CALL(ephysics_body_central_impulse_apply));
4202} 4203}
4203 4204
4204/* physics_torque_impulse(part_id, Float:x, Float:y, Float:z) */ 4205/* physics_torque_impulse(part_id, Float:x, Float:y, Float:z) */
4205static Embryo_Cell 4206static Embryo_Cell
4206_edje_embryo_fn_physics_torque_impulse(Embryo_Program *ep, Embryo_Cell *params) 4207_edje_embryo_fn_physics_torque_impulse(Embryo_Program *ep, Embryo_Cell *params)
4207{ 4208{
4209 if (!EPH_LOAD()) return 0;
4208 return _edje_embryo_fn_physics_components_set( 4210 return _edje_embryo_fn_physics_components_set(
4209 ep, params, ephysics_body_torque_impulse_apply); 4211 ep, params, EPH_CALL(ephysics_body_torque_impulse_apply));
4210} 4212}
4211 4213
4212/* physics_force(part_id, Float:x, Float:y, Float:z) */ 4214/* physics_force(part_id, Float:x, Float:y, Float:z) */
4213static Embryo_Cell 4215static Embryo_Cell
4214_edje_embryo_fn_physics_force(Embryo_Program *ep, Embryo_Cell *params) 4216_edje_embryo_fn_physics_force(Embryo_Program *ep, Embryo_Cell *params)
4215{ 4217{
4218 if (!EPH_LOAD()) return 0;
4216 return _edje_embryo_fn_physics_components_set( 4219 return _edje_embryo_fn_physics_components_set(
4217 ep, params, ephysics_body_central_force_apply); 4220 ep, params, EPH_CALL(ephysics_body_central_force_apply));
4218} 4221}
4219 4222
4220/* physics_torque(part_id, Float:x, Float:y, Float:z) */ 4223/* physics_torque(part_id, Float:x, Float:y, Float:z) */
4221static Embryo_Cell 4224static Embryo_Cell
4222_edje_embryo_fn_physics_torque(Embryo_Program *ep, Embryo_Cell *params) 4225_edje_embryo_fn_physics_torque(Embryo_Program *ep, Embryo_Cell *params)
4223{ 4226{
4227 if (!EPH_LOAD()) return 0;
4224 return _edje_embryo_fn_physics_components_set( 4228 return _edje_embryo_fn_physics_components_set(
4225 ep, params, ephysics_body_torque_apply); 4229 ep, params, EPH_CALL(ephysics_body_torque_apply));
4226} 4230}
4227 4231
4228/* physics_clear_forces(part_id) */ 4232/* physics_clear_forces(part_id) */
@@ -4235,13 +4239,14 @@ _edje_embryo_fn_physics_clear_forces(Embryo_Program *ep, Embryo_Cell *params)
4235 4239
4236 CHKPARAM(1); 4240 CHKPARAM(1);
4237 4241
4242 if (!EPH_LOAD()) return 0;
4238 ed = embryo_program_data_get(ep); 4243 ed = embryo_program_data_get(ep);
4239 part_id = params[1]; 4244 part_id = params[1];
4240 if (part_id < 0) return 0; 4245 if (part_id < 0) return 0;
4241 4246
4242 rp = ed->table_parts[part_id % ed->table_parts_size]; 4247 rp = ed->table_parts[part_id % ed->table_parts_size];
4243 if ((rp) && (rp->body)) 4248 if ((rp) && (rp->body))
4244 ephysics_body_forces_clear(rp->body); 4249 EPH_CALL(ephysics_body_forces_clear)(rp->body);
4245 4250
4246 return 0; 4251 return 0;
4247} 4252}
@@ -4250,48 +4255,54 @@ _edje_embryo_fn_physics_clear_forces(Embryo_Program *ep, Embryo_Cell *params)
4250static Embryo_Cell 4255static Embryo_Cell
4251_edje_embryo_fn_physics_get_forces(Embryo_Program *ep, Embryo_Cell *params) 4256_edje_embryo_fn_physics_get_forces(Embryo_Program *ep, Embryo_Cell *params)
4252{ 4257{
4258 if (!EPH_LOAD()) return 0;
4253 return _edje_embryo_fn_physics_components_get( 4259 return _edje_embryo_fn_physics_components_get(
4254 ep, params, ephysics_body_forces_get); 4260 ep, params, EPH_CALL(ephysics_body_forces_get));
4255} 4261}
4256 4262
4257/* physics_get_torques(part_id, &Float:x, &Float:y, &Float:z) */ 4263/* physics_get_torques(part_id, &Float:x, &Float:y, &Float:z) */
4258static Embryo_Cell 4264static Embryo_Cell
4259_edje_embryo_fn_physics_get_torques(Embryo_Program *ep, Embryo_Cell *params) 4265_edje_embryo_fn_physics_get_torques(Embryo_Program *ep, Embryo_Cell *params)
4260{ 4266{
4267 if (!EPH_LOAD()) return 0;
4261 return _edje_embryo_fn_physics_components_get( 4268 return _edje_embryo_fn_physics_components_get(
4262 ep, params, ephysics_body_torques_get); 4269 ep, params, EPH_CALL(ephysics_body_torques_get));
4263} 4270}
4264 4271
4265/* physics_set_velocity(part_id, Float:x, Float:y, Float:z) */ 4272/* physics_set_velocity(part_id, Float:x, Float:y, Float:z) */
4266static Embryo_Cell 4273static Embryo_Cell
4267_edje_embryo_fn_physics_set_velocity(Embryo_Program *ep, Embryo_Cell *params) 4274_edje_embryo_fn_physics_set_velocity(Embryo_Program *ep, Embryo_Cell *params)
4268{ 4275{
4276 if (!EPH_LOAD()) return 0;
4269 return _edje_embryo_fn_physics_components_set( 4277 return _edje_embryo_fn_physics_components_set(
4270 ep, params, ephysics_body_linear_velocity_set); 4278 ep, params, EPH_CALL(ephysics_body_linear_velocity_set));
4271} 4279}
4272 4280
4273/* physics_get_velocity(part_id, &Float:x, &Float:y, &Float:z) */ 4281/* physics_get_velocity(part_id, &Float:x, &Float:y, &Float:z) */
4274static Embryo_Cell 4282static Embryo_Cell
4275_edje_embryo_fn_physics_get_velocity(Embryo_Program *ep, Embryo_Cell *params) 4283_edje_embryo_fn_physics_get_velocity(Embryo_Program *ep, Embryo_Cell *params)
4276{ 4284{
4285 if (!EPH_LOAD()) return 0;
4277 return _edje_embryo_fn_physics_components_get( 4286 return _edje_embryo_fn_physics_components_get(
4278 ep, params, ephysics_body_linear_velocity_get); 4287 ep, params, EPH_CALL(ephysics_body_linear_velocity_get));
4279} 4288}
4280 4289
4281/* physics_set_ang_velocity(part_id, Float:x, Float:y, Float:z) */ 4290/* physics_set_ang_velocity(part_id, Float:x, Float:y, Float:z) */
4282static Embryo_Cell 4291static Embryo_Cell
4283_edje_embryo_fn_physics_set_ang_velocity(Embryo_Program *ep, Embryo_Cell *params) 4292_edje_embryo_fn_physics_set_ang_velocity(Embryo_Program *ep, Embryo_Cell *params)
4284{ 4293{
4294 if (!EPH_LOAD()) return 0;
4285 return _edje_embryo_fn_physics_components_set( 4295 return _edje_embryo_fn_physics_components_set(
4286 ep, params, ephysics_body_angular_velocity_set); 4296 ep, params, EPH_CALL(ephysics_body_angular_velocity_set));
4287} 4297}
4288 4298
4289/* physics_get_ang_velocity(part_id, &Float:x, &Float:y, &Float:z) */ 4299/* physics_get_ang_velocity(part_id, &Float:x, &Float:y, &Float:z) */
4290static Embryo_Cell 4300static Embryo_Cell
4291_edje_embryo_fn_physics_get_ang_velocity(Embryo_Program *ep, Embryo_Cell *params) 4301_edje_embryo_fn_physics_get_ang_velocity(Embryo_Program *ep, Embryo_Cell *params)
4292{ 4302{
4303 if (!EPH_LOAD()) return 0;
4293 return _edje_embryo_fn_physics_components_get( 4304 return _edje_embryo_fn_physics_components_get(
4294 ep, params, ephysics_body_angular_velocity_get); 4305 ep, params, EPH_CALL(ephysics_body_angular_velocity_get));
4295} 4306}
4296 4307
4297/* physics_stop(part_id) */ 4308/* physics_stop(part_id) */
@@ -4304,13 +4315,14 @@ _edje_embryo_fn_physics_stop(Embryo_Program *ep, Embryo_Cell *params)
4304 4315
4305 CHKPARAM(1); 4316 CHKPARAM(1);
4306 4317
4318 if (!EPH_LOAD()) return 0;
4307 ed = embryo_program_data_get(ep); 4319 ed = embryo_program_data_get(ep);
4308 part_id = params[1]; 4320 part_id = params[1];
4309 if (part_id < 0) return 0; 4321 if (part_id < 0) return 0;
4310 4322
4311 rp = ed->table_parts[part_id % ed->table_parts_size]; 4323 rp = ed->table_parts[part_id % ed->table_parts_size];
4312 if ((rp) && (rp->body)) 4324 if ((rp) && (rp->body))
4313 ephysics_body_stop(rp->body); 4325 EPH_CALL(ephysics_body_stop)(rp->body);
4314 4326
4315 return 0; 4327 return 0;
4316} 4328}
@@ -4325,6 +4337,7 @@ _edje_embryo_fn_physics_set_rotation(Embryo_Program *ep, Embryo_Cell *params)
4325 4337
4326 CHKPARAM(5); 4338 CHKPARAM(5);
4327 4339
4340 if (!EPH_LOAD()) return 0;
4328 ed = embryo_program_data_get(ep); 4341 ed = embryo_program_data_get(ep);
4329 part_id = params[1]; 4342 part_id = params[1];
4330 if (part_id < 0) return 0; 4343 if (part_id < 0) return 0;
@@ -4340,9 +4353,9 @@ _edje_embryo_fn_physics_set_rotation(Embryo_Program *ep, Embryo_Cell *params)
4340 y = (double)EMBRYO_CELL_TO_FLOAT(params[4]); 4353 y = (double)EMBRYO_CELL_TO_FLOAT(params[4]);
4341 z = (double)EMBRYO_CELL_TO_FLOAT(params[5]); 4354 z = (double)EMBRYO_CELL_TO_FLOAT(params[5]);
4342 4355
4343 ephysics_quaternion_set(&quat, x, y, z, w); 4356 EPH_CALL(ephysics_quaternion_set)(&quat, x, y, z, w);
4344 ephysics_quaternion_normalize(&quat); 4357 EPH_CALL(ephysics_quaternion_normalize)(&quat);
4345 ephysics_body_rotation_set(rp->body, &quat); 4358 EPH_CALL(ephysics_body_rotation_set)(rp->body, &quat);
4346 } 4359 }
4347 4360
4348 return 0; 4361 return 0;
@@ -4358,6 +4371,7 @@ _edje_embryo_fn_physics_get_rotation(Embryo_Program *ep, Embryo_Cell *params)
4358 4371
4359 CHKPARAM(5); 4372 CHKPARAM(5);
4360 4373
4374 if (!EPH_LOAD()) return 0;
4361 ed = embryo_program_data_get(ep); 4375 ed = embryo_program_data_get(ep);
4362 part_id = params[1]; 4376 part_id = params[1];
4363 if (part_id < 0) return 0; 4377 if (part_id < 0) return 0;
@@ -4368,8 +4382,8 @@ _edje_embryo_fn_physics_get_rotation(Embryo_Program *ep, Embryo_Cell *params)
4368 EPhysics_Quaternion quat; 4382 EPhysics_Quaternion quat;
4369 double w, x, y, z; 4383 double w, x, y, z;
4370 4384
4371 ephysics_body_rotation_get(rp->body, &quat); 4385 EPH_CALL(ephysics_body_rotation_get)(rp->body, &quat);
4372 ephysics_quaternion_get(&quat, &x, &y, &z, &w); 4386 EPH_CALL(ephysics_quaternion_get)(&quat, &x, &y, &z, &w);
4373 4387
4374 SETFLOAT(w, params[2]); 4388 SETFLOAT(w, params[2]);
4375 SETFLOAT(x, params[3]); 4389 SETFLOAT(x, params[3]);
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 89683a5..0d43704 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -503,9 +503,8 @@ static void
503_edje_physics_world_update_cb(void *data, EPhysics_World *world EINA_UNUSED, void *event_info EINA_UNUSED) 503_edje_physics_world_update_cb(void *data, EPhysics_World *world EINA_UNUSED, void *event_info EINA_UNUSED)
504{ 504{
505 Edje *edje = data; 505 Edje *edje = data;
506 _edje_recalc_do(edje); 506 if (EPH_LOAD()) _edje_recalc_do(edje);
507} 507}
508
509#endif 508#endif
510 509
511int 510int
@@ -546,10 +545,13 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
546 545
547#ifdef HAVE_EPHYSICS 546#ifdef HAVE_EPHYSICS
548 /* clear physics world / shutdown ephysics */ 547 /* clear physics world / shutdown ephysics */
549 if ((ed->collection) && (ed->collection->physics_enabled)) 548 if ((ed->collection) && (ed->collection->physics_enabled) && (ed->world))
550 { 549 {
551 ephysics_world_del(ed->world); 550 if (EPH_LOAD())
552 ephysics_shutdown(); 551 {
552 EPH_CALL(ephysics_world_del)(ed->world);
553 EPH_CALL(ephysics_shutdown)();
554 }
553 } 555 }
554#endif 556#endif
555 557
@@ -606,17 +608,20 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
606 if (ed->collection->physics_enabled) 608 if (ed->collection->physics_enabled)
607#ifdef HAVE_EPHYSICS 609#ifdef HAVE_EPHYSICS
608 { 610 {
609 ephysics_init(); 611 if (EPH_LOAD())
610 ed->world = ephysics_world_new(); 612 {
611 ephysics_world_event_callback_add( 613 EPH_CALL(ephysics_init)();
612 ed->world, EPHYSICS_CALLBACK_WORLD_UPDATE, 614 ed->world = EPH_CALL(ephysics_world_new)();
613 _edje_physics_world_update_cb, ed); 615 EPH_CALL(ephysics_world_event_callback_add)
614 ephysics_world_rate_set(ed->world, 616 (ed->world, EPHYSICS_CALLBACK_WORLD_UPDATE,
615 ed->collection->physics.world.rate); 617 _edje_physics_world_update_cb, ed);
616 ephysics_world_gravity_set( 618 EPH_CALL(ephysics_world_rate_set)
617 ed->world, ed->collection->physics.world.gravity.x, 619 (ed->world, ed->collection->physics.world.rate);
618 ed->collection->physics.world.gravity.y, 620 EPH_CALL(ephysics_world_gravity_set)
619 ed->collection->physics.world.gravity.z); 621 (ed->world, ed->collection->physics.world.gravity.x,
622 ed->collection->physics.world.gravity.y,
623 ed->collection->physics.world.gravity.z);
624 }
620 } 625 }
621#else 626#else
622 ERR("Edje compiled without support to physics."); 627 ERR("Edje compiled without support to physics.");
diff --git a/src/lib/edje/edje_main.c b/src/lib/edje/edje_main.c
index 13809e6..ee7ecd2 100644
--- a/src/lib/edje/edje_main.c
+++ b/src/lib/edje/edje_main.c
@@ -21,6 +21,11 @@ static const Edje_Calc_Params_Physics default_calc_physics = {
21 0.0, 0.0, 0.0, 0.0, 0.0, { 0.0, 0.0 }, { 0.0, 0.0 }, 0, 0, { { 0, 0, 0 }, { 0, 0, 0 } }, 0, 0, 0, 0 21 0.0, 0.0, 0.0, 0.0, 0.0, { 0.0, 0.0 }, { 0.0, 0.0 }, 0, 0, { { 0, 0, 0 }, { 0, 0, 0 } }, 0, 0, 0, 0
22}; 22};
23 23
24#ifdef HAVE_EPHYSICS
25static void _edje_ephysics_clear(void);
26#endif
27
28
24/*============================================================================* 29/*============================================================================*
25* API * 30* API *
26*============================================================================*/ 31*============================================================================*/
@@ -199,6 +204,10 @@ _edje_shutdown_core(void)
199 ecore_imf_shutdown(); 204 ecore_imf_shutdown();
200#endif 205#endif
201 206
207#ifdef HAVE_EPHYSICS
208 _edje_ephysics_clear();
209#endif
210
202 efreet_shutdown(); 211 efreet_shutdown();
203 evas_shutdown(); 212 evas_shutdown();
204 eet_shutdown(); 213 eet_shutdown();
@@ -315,3 +324,131 @@ _edje_need_imf(void)
315#endif 324#endif
316} 325}
317 326
327#ifdef HAVE_EPHYSICS
328Edje_Ephysics *_edje_ephysics = NULL;
329
330Eina_Bool
331_edje_ephysics_load(void)
332{
333 if (_edje_ephysics)
334 {
335 if (!_edje_ephysics->mod)
336 {
337 ERR("Cannot find libpulse!");
338 return EINA_FALSE;
339 }
340 return EINA_TRUE;
341 }
342 ERR("PHYYYYYYYYYYYYYYZIKS");
343 _edje_ephysics = calloc(1, sizeof(Edje_Ephysics));
344 if (!_edje_ephysics) return EINA_FALSE;
345# define LOAD(x) \
346 if (!_edje_ephysics->mod) { \
347 if ((_edje_ephysics->mod = eina_module_new(x))) { \
348 if (!eina_module_load(_edje_ephysics->mod)) { \
349 eina_module_free(_edje_ephysics->mod); \
350 _edje_ephysics->mod = NULL; \
351 } \
352 } \
353 }
354# if defined(_WIN32) || defined(__CYGWIN__)
355 LOAD("libephysics-1.dll");
356 LOAD("libephysics.dll");
357# elif defined(__APPLE__) && defined(__MACH__)
358 LOAD("libephysics.1.dylib");
359 LOAD("libephysics.1.so");
360 LOAD("libephysics.so.1");
361# else
362 LOAD("libephysics.so.1");
363# endif
364# undef LOAD
365 if (!_edje_ephysics->mod) return EINA_FALSE;
366# define SYM(x) \
367 if (!(_edje_ephysics->x = eina_module_symbol_get(_edje_ephysics->mod, #x))) { \
368 ERR("libpulse - cannot find %s", #x); \
369 goto err; \
370 }
371 SYM(ephysics_init);
372 SYM(ephysics_shutdown);
373 SYM(ephysics_world_new);
374 SYM(ephysics_world_del);
375 SYM(ephysics_world_event_callback_add)
376 SYM(ephysics_world_rate_set)
377 SYM(ephysics_world_gravity_set)
378 SYM(ephysics_world_render_geometry_set);
379 SYM(ephysics_world_render_geometry_get);
380 SYM(ephysics_quaternion_set)
381 SYM(ephysics_quaternion_get)
382 SYM(ephysics_quaternion_normalize)
383 SYM(ephysics_body_box_add)
384 SYM(ephysics_body_sphere_add)
385 SYM(ephysics_body_cylinder_add)
386 SYM(ephysics_body_soft_box_add)
387 SYM(ephysics_body_soft_sphere_add)
388 SYM(ephysics_body_soft_cylinder_add)
389 SYM(ephysics_body_cloth_add)
390 SYM(ephysics_body_top_boundary_add)
391 SYM(ephysics_body_bottom_boundary_add)
392 SYM(ephysics_body_right_boundary_add)
393 SYM(ephysics_body_left_boundary_add)
394 SYM(ephysics_body_front_boundary_add)
395 SYM(ephysics_body_back_boundary_add)
396 SYM(ephysics_body_central_impulse_apply)
397 SYM(ephysics_body_torque_impulse_apply)
398 SYM(ephysics_body_central_force_apply)
399 SYM(ephysics_body_torque_apply)
400 SYM(ephysics_body_forces_clear)
401 SYM(ephysics_body_linear_velocity_set)
402 SYM(ephysics_body_angular_velocity_set)
403 SYM(ephysics_body_stop)
404 SYM(ephysics_body_rotation_set)
405 SYM(ephysics_body_forces_get)
406 SYM(ephysics_body_torques_get)
407 SYM(ephysics_body_linear_velocity_get)
408 SYM(ephysics_body_angular_velocity_get)
409 SYM(ephysics_body_linear_movement_enable_set)
410 SYM(ephysics_body_angular_movement_enable_set)
411 SYM(ephysics_body_move)
412 SYM(ephysics_body_geometry_get)
413 SYM(ephysics_body_resize)
414 SYM(ephysics_body_material_set)
415 SYM(ephysics_body_density_set)
416 SYM(ephysics_body_mass_set)
417 SYM(ephysics_body_soft_body_hardness_set)
418 SYM(ephysics_body_restitution_set)
419 SYM(ephysics_body_friction_set)
420 SYM(ephysics_body_damping_set)
421 SYM(ephysics_body_sleeping_threshold_set)
422 SYM(ephysics_body_light_set)
423 SYM(ephysics_body_back_face_culling_set)
424 SYM(ephysics_body_evas_object_update)
425 SYM(ephysics_body_face_evas_object_set)
426 SYM(ephysics_body_evas_object_set)
427 SYM(ephysics_body_event_callback_add)
428 SYM(ephysics_body_data_set)
429 SYM(ephysics_body_data_get)
430 SYM(ephysics_body_rotation_get)
431#undef SYM
432 return EINA_TRUE;
433err:
434 if (_edje_ephysics->mod)
435 {
436 eina_module_free(_edje_ephysics->mod);
437 _edje_ephysics->mod = NULL;
438 }
439 return EINA_FALSE;
440}
441
442static void
443_edje_ephysics_clear(void)
444{
445 if (_edje_ephysics)
446 {
447 if (_edje_ephysics->mod)
448 eina_module_free(_edje_ephysics->mod);
449 free(_edje_ephysics);
450 _edje_ephysics = NULL;
451 }
452}
453#endif
454
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index fd53254..daf3041 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -3279,6 +3279,85 @@ Edje_Vector_Data * _edje_ref_vector_data(Edje *ed, int svg_id);
3279 3279
3280EAPI void _edje_svg_node_free(Svg_Node *node); 3280EAPI void _edje_svg_node_free(Svg_Node *node);
3281 3281
3282#ifdef HAVE_EPHYSICS
3283Eina_Bool _edje_ephysics_load(void);
3284
3285typedef struct _Edje_Ephysics Edje_Ephysics;
3286
3287struct _Edje_Ephysics
3288{
3289 Eina_Module *mod;
3290
3291 int (*ephysics_init) (void);
3292 int (*ephysics_shutdown) (void);
3293 EPhysics_World *(*ephysics_world_new) (void);
3294 void (*ephysics_world_del) (EPhysics_World *world);
3295 void (*ephysics_world_event_callback_add) (EPhysics_World *world, EPhysics_Callback_World_Type type, EPhysics_World_Event_Cb func, const void *data);
3296 void (*ephysics_world_rate_set) (EPhysics_World *world, double rate);
3297 void (*ephysics_world_gravity_set) (EPhysics_World *world, double gx, double gy, double gz);
3298 void (*ephysics_world_render_geometry_set) (EPhysics_World *world, Evas_Coord x, Evas_Coord y, Evas_Coord z, Evas_Coord w, Evas_Coord h, Evas_Coord d);
3299 void (*ephysics_world_render_geometry_get) (const EPhysics_World *world, Evas_Coord *x, Evas_Coord *y, Evas_Coord *z, Evas_Coord *w, Evas_Coord *h, Evas_Coord *d);
3300 void (*ephysics_quaternion_set) (EPhysics_Quaternion *quat, double x, double y, double z, double w);
3301 void (*ephysics_quaternion_get) (const EPhysics_Quaternion *quat, double *x, double *y, double *z, double *w);
3302 void (*ephysics_quaternion_normalize) (EPhysics_Quaternion *quat);
3303 EPhysics_Body *(*ephysics_body_box_add) (EPhysics_World *world);
3304 EPhysics_Body *(*ephysics_body_sphere_add) (EPhysics_World *world);
3305 EPhysics_Body *(*ephysics_body_cylinder_add) (EPhysics_World *world);
3306 EPhysics_Body *(*ephysics_body_soft_box_add) (EPhysics_World *world);
3307 EPhysics_Body *(*ephysics_body_soft_sphere_add) (EPhysics_World *world, int granularity);
3308 EPhysics_Body *(*ephysics_body_soft_cylinder_add) (EPhysics_World *world);
3309 EPhysics_Body *(*ephysics_body_cloth_add) (EPhysics_World *world, unsigned short rows, unsigned short columns);
3310 EPhysics_Body *(*ephysics_body_top_boundary_add) (EPhysics_World *world);
3311 EPhysics_Body *(*ephysics_body_bottom_boundary_add) (EPhysics_World *world);
3312 EPhysics_Body *(*ephysics_body_right_boundary_add) (EPhysics_World *world);
3313 EPhysics_Body *(*ephysics_body_left_boundary_add) (EPhysics_World *world);
3314 EPhysics_Body *(*ephysics_body_front_boundary_add) (EPhysics_World *world);
3315 EPhysics_Body *(*ephysics_body_back_boundary_add) (EPhysics_World *world);
3316 void (*ephysics_body_central_impulse_apply) (EPhysics_Body *body, double x, double y, double z);
3317 void (*ephysics_body_torque_impulse_apply) (EPhysics_Body *body, double pitch, double yaw, double roll);
3318 void (*ephysics_body_central_force_apply) (EPhysics_Body *body, double x, double y, double z);
3319 void (*ephysics_body_torque_apply) (EPhysics_Body *body, double torque_x, double torque_y, double torque_z);
3320 void (*ephysics_body_forces_clear) (EPhysics_Body *body);
3321 void (*ephysics_body_linear_velocity_set) (EPhysics_Body *body, double x, double y, double z);
3322 void (*ephysics_body_angular_velocity_set) (EPhysics_Body *body, double x, double y, double z);
3323 void (*ephysics_body_stop) (EPhysics_Body *body);
3324 void (*ephysics_body_rotation_set) (EPhysics_Body *body, EPhysics_Quaternion *quat);
3325 void (*ephysics_body_forces_get) (const EPhysics_Body *body, double *x, double *y, double *z);
3326 void (*ephysics_body_torques_get) (const EPhysics_Body *body, double *x, double *y, double *z);
3327 void (*ephysics_body_linear_velocity_get) (const EPhysics_Body *body, double *x, double *y, double *z);
3328 void (*ephysics_body_angular_velocity_get) (const EPhysics_Body *body, double *x, double *y, double *z);
3329 void (*ephysics_body_linear_movement_enable_set) (EPhysics_Body *body, Eina_Bool enable_x, Eina_Bool enable_y, Eina_Bool enable_z);
3330 void (*ephysics_body_angular_movement_enable_set) (EPhysics_Body *body, Eina_Bool enable_x, Eina_Bool enable_y, Eina_Bool enable_z);
3331 void (*ephysics_body_move) (EPhysics_Body *body, Evas_Coord x, Evas_Coord y, Evas_Coord z);
3332 void (*ephysics_body_geometry_get) (const EPhysics_Body *body, Evas_Coord *x, Evas_Coord *y, Evas_Coord *z, Evas_Coord *w, Evas_Coord *h, Evas_Coord *d);
3333 void (*ephysics_body_resize) (EPhysics_Body *body, Evas_Coord w, Evas_Coord h, Evas_Coord d);
3334 void (*ephysics_body_material_set) (EPhysics_Body *body, EPhysics_Body_Material material);
3335 void (*ephysics_body_density_set) (EPhysics_Body *body, double density);
3336 void (*ephysics_body_mass_set) (EPhysics_Body *body, double mass);
3337 void (*ephysics_body_soft_body_hardness_set) (EPhysics_Body *body, double hardness);
3338 void (*ephysics_body_restitution_set) (EPhysics_Body *body, double restitution);
3339 void (*ephysics_body_friction_set) (EPhysics_Body *body, double friction);
3340 void (*ephysics_body_damping_set) (EPhysics_Body *body, double linear_damping, double angular_damping);
3341 void (*ephysics_body_sleeping_threshold_set) (EPhysics_Body *body, double linear_threshold, double angular_threshold);
3342 void (*ephysics_body_light_set) (EPhysics_Body *body, Eina_Bool enable);
3343 void (*ephysics_body_back_face_culling_set) (EPhysics_Body *body, Eina_Bool enable);
3344 void (*ephysics_body_evas_object_update) (EPhysics_Body *body);
3345 void (*ephysics_body_face_evas_object_set) (EPhysics_Body *body, EPhysics_Body_Face face, Evas_Object *evas_obj, Eina_Bool use_obj_pos);
3346 void (*ephysics_body_evas_object_set) (EPhysics_Body *body, Evas_Object *evas_obj, Eina_Bool use_obj_pos);
3347 void (*ephysics_body_event_callback_add) (EPhysics_Body *body, EPhysics_Callback_Body_Type type, EPhysics_Body_Event_Cb func, const void *data);
3348 void (*ephysics_body_data_set) (EPhysics_Body *body, void *data);
3349 void *(*ephysics_body_data_get) (const EPhysics_Body *body);
3350 EPhysics_Quaternion *(*ephysics_body_rotation_get) (const EPhysics_Body *body, EPhysics_Quaternion *rotation);
3351};
3352
3353extern Edje_Ephysics *_edje_ephysics;
3354#define EPH_LOAD() _edje_ephysics_load()
3355#define EPH_CALL(x) _edje_ephysics->x
3356
3357#endif
3358
3359
3360
3282#ifdef HAVE_LIBREMIX 3361#ifdef HAVE_LIBREMIX
3283#include <remix/remix.h> 3362#include <remix/remix.h>
3284#endif 3363#endif
diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c
index 99ac484..3aa1a76 100644
--- a/src/lib/edje/edje_program.c
+++ b/src/lib/edje/edje_program.c
@@ -1074,79 +1074,106 @@ low_mem_current:
1074 1074
1075#ifdef HAVE_EPHYSICS 1075#ifdef HAVE_EPHYSICS
1076 case EDJE_ACTION_TYPE_PHYSICS_IMPULSE: 1076 case EDJE_ACTION_TYPE_PHYSICS_IMPULSE:
1077 if (!_edje_physics_action_set(ed, pr, ephysics_body_central_impulse_apply)) 1077 if (EPH_LOAD())
1078 goto break_prog; 1078 {
1079 if (!_edje_physics_action_set(ed, pr, EPH_CALL(ephysics_body_central_impulse_apply)))
1080 goto break_prog;
1081 }
1079 break; 1082 break;
1080 1083
1081 case EDJE_ACTION_TYPE_PHYSICS_TORQUE_IMPULSE: 1084 case EDJE_ACTION_TYPE_PHYSICS_TORQUE_IMPULSE:
1082 if (!_edje_physics_action_set(ed, pr, ephysics_body_torque_impulse_apply)) 1085 if (EPH_LOAD())
1083 goto break_prog; 1086 {
1087 if (!_edje_physics_action_set(ed, pr, EPH_CALL(ephysics_body_torque_impulse_apply)))
1088 goto break_prog;
1089 }
1084 break; 1090 break;
1085 1091
1086 case EDJE_ACTION_TYPE_PHYSICS_FORCE: 1092 case EDJE_ACTION_TYPE_PHYSICS_FORCE:
1087 if (!_edje_physics_action_set(ed, pr, ephysics_body_central_force_apply)) 1093 if (EPH_LOAD())
1088 goto break_prog; 1094 {
1095 if (!_edje_physics_action_set(ed, pr, EPH_CALL(ephysics_body_central_force_apply)))
1096 goto break_prog;
1097 }
1089 break; 1098 break;
1090 1099
1091 case EDJE_ACTION_TYPE_PHYSICS_TORQUE: 1100 case EDJE_ACTION_TYPE_PHYSICS_TORQUE:
1092 if (!_edje_physics_action_set(ed, pr, ephysics_body_torque_apply)) 1101 if (EPH_LOAD())
1093 goto break_prog; 1102 {
1103 if (!_edje_physics_action_set(ed, pr, EPH_CALL(ephysics_body_torque_apply)))
1104 goto break_prog;
1105 }
1094 break; 1106 break;
1095 1107
1096 case EDJE_ACTION_TYPE_PHYSICS_FORCES_CLEAR: 1108 case EDJE_ACTION_TYPE_PHYSICS_FORCES_CLEAR:
1097 if (_edje_block_break(ed)) 1109 if (EPH_LOAD())
1098 goto break_prog;
1099 EINA_LIST_FOREACH(pr->targets, l, pt)
1100 { 1110 {
1101 if (pt->id >= 0) 1111 if (_edje_block_break(ed))
1112 goto break_prog;
1113 EINA_LIST_FOREACH(pr->targets, l, pt)
1102 { 1114 {
1103 rp = ed->table_parts[pt->id % ed->table_parts_size]; 1115 if (pt->id >= 0)
1104 if ((rp) && (rp->body)) 1116 {
1105 ephysics_body_forces_clear(rp->body); 1117 rp = ed->table_parts[pt->id % ed->table_parts_size];
1118 if ((rp) && (rp->body))
1119 EPH_CALL(ephysics_body_forces_clear)(rp->body);
1120 }
1106 } 1121 }
1107 } 1122 }
1108 break; 1123 break;
1109 1124
1110 case EDJE_ACTION_TYPE_PHYSICS_VEL_SET: 1125 case EDJE_ACTION_TYPE_PHYSICS_VEL_SET:
1111 if (!_edje_physics_action_set(ed, pr, ephysics_body_linear_velocity_set)) 1126 if (EPH_LOAD())
1112 goto break_prog; 1127 {
1128 if (!_edje_physics_action_set(ed, pr, EPH_CALL(ephysics_body_linear_velocity_set)))
1129 goto break_prog;
1130 }
1113 break; 1131 break;
1114 1132
1115 case EDJE_ACTION_TYPE_PHYSICS_ANG_VEL_SET: 1133 case EDJE_ACTION_TYPE_PHYSICS_ANG_VEL_SET:
1116 if (!_edje_physics_action_set(ed, pr, ephysics_body_angular_velocity_set)) 1134 if (EPH_LOAD())
1117 goto break_prog; 1135 {
1136 if (!_edje_physics_action_set(ed, pr, EPH_CALL(ephysics_body_angular_velocity_set)))
1137 goto break_prog;
1138 }
1118 break; 1139 break;
1119 1140
1120 case EDJE_ACTION_TYPE_PHYSICS_STOP: 1141 case EDJE_ACTION_TYPE_PHYSICS_STOP:
1121 if (_edje_block_break(ed)) 1142 if (EPH_LOAD())
1122 goto break_prog;
1123 EINA_LIST_FOREACH(pr->targets, l, pt)
1124 { 1143 {
1125 if (pt->id >= 0) 1144 if (_edje_block_break(ed))
1145 goto break_prog;
1146 EINA_LIST_FOREACH(pr->targets, l, pt)
1126 { 1147 {
1127 rp = ed->table_parts[pt->id % ed->table_parts_size]; 1148 if (pt->id >= 0)
1128 if ((rp) && (rp->body)) 1149 {
1129 ephysics_body_stop(rp->body); 1150 rp = ed->table_parts[pt->id % ed->table_parts_size];
1151 if ((rp) && (rp->body))
1152 EPH_CALL(ephysics_body_stop)(rp->body);
1153 }
1130 } 1154 }
1131 } 1155 }
1132 break; 1156 break;
1133 1157
1134 case EDJE_ACTION_TYPE_PHYSICS_ROT_SET: 1158 case EDJE_ACTION_TYPE_PHYSICS_ROT_SET:
1135 if (_edje_block_break(ed)) 1159 if (EPH_LOAD())
1136 goto break_prog;
1137 EINA_LIST_FOREACH(pr->targets, l, pt)
1138 { 1160 {
1139 if (pt->id >= 0) 1161 if (_edje_block_break(ed))
1162 goto break_prog;
1163 EINA_LIST_FOREACH(pr->targets, l, pt)
1140 { 1164 {
1141 rp = ed->table_parts[pt->id % ed->table_parts_size]; 1165 if (pt->id >= 0)
1142 if ((rp) && (rp->body))
1143 { 1166 {
1144 EPhysics_Quaternion quat; 1167 rp = ed->table_parts[pt->id % ed->table_parts_size];
1145 ephysics_quaternion_set(&quat, pr->physics.x, 1168 if ((rp) && (rp->body))
1146 pr->physics.y, pr->physics.z, 1169 {
1147 pr->physics.w); 1170 EPhysics_Quaternion quat;
1148 ephysics_quaternion_normalize(&quat); 1171 EPH_CALL(ephysics_quaternion_set)(&quat, pr->physics.x,
1149 ephysics_body_rotation_set(rp->body, &quat); 1172 pr->physics.y, pr->physics.z,
1173 pr->physics.w);
1174 EPH_CALL(ephysics_quaternion_normalize)(&quat);
1175 EPH_CALL(ephysics_body_rotation_set)(rp->body, &quat);
1176 }
1150 } 1177 }
1151 } 1178 }
1152 } 1179 }
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index dff5823..03fda4c 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -156,10 +156,13 @@ _edje_object_efl_canvas_group_group_del(Eo *obj, Edje *ed)
156 if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed); 156 if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed);
157#ifdef HAVE_EPHYSICS 157#ifdef HAVE_EPHYSICS
158 /* clear physics world / shutdown ephysics */ 158 /* clear physics world / shutdown ephysics */
159 if ((ed->collection) && (ed->collection->physics_enabled)) 159 if ((ed->collection) && (ed->collection->physics_enabled) && (ed->world))
160 { 160 {
161 ephysics_world_del(ed->world); 161 if (EPH_LOAD())
162 ephysics_shutdown(); 162 {
163 EPH_CALL(ephysics_world_del)(ed->world);
164 EPH_CALL(ephysics_shutdown)();
165 }
163 } 166 }
164#endif 167#endif
165 if (ed->persp) edje_object_perspective_set(obj, NULL); 168 if (ed->persp) edje_object_perspective_set(obj, NULL);
@@ -272,9 +275,12 @@ _edje_object_efl_canvas_group_group_resize(Eo *obj EINA_UNUSED, Edje *ed, Evas_C
272 ed->h = h; 275 ed->h = h;
273#ifdef HAVE_EPHYSICS 276#ifdef HAVE_EPHYSICS
274 if ((ed->collection) && (ed->world)) 277 if ((ed->collection) && (ed->world))
275 ephysics_world_render_geometry_set( 278 {
276 ed->world, ed->x, ed->y, ed->collection->physics.world.z, 279 if (EPH_LOAD())
277 ed->w, ed->h, ed->collection->physics.world.depth); 280 EPH_CALL(ephysics_world_render_geometry_set)
281 (ed->world, ed->x, ed->y, ed->collection->physics.world.z,
282 ed->w, ed->h, ed->collection->physics.world.depth);
283 }
278#endif 284#endif
279#ifdef EDJE_CALC_CACHE 285#ifdef EDJE_CALC_CACHE
280 ed->all_part_change = EINA_TRUE; 286 ed->all_part_change = EINA_TRUE;