edje: update physics to handle ephysics API breakage
authorBruno Dilly <bdilly@profusion.mobi>
Tue, 11 Dec 2012 21:30:38 +0000 (21:30 +0000)
committerBruno Dilly <bdilly@profusion.mobi>
Tue, 11 Dec 2012 21:30:38 +0000 (21:30 +0000)
SVN revision: 80725

legacy/edje/data/edc.vim
legacy/edje/src/bin/edje_cc_handlers.c
legacy/edje/src/examples/physics_actions.edc
legacy/edje/src/examples/physics_basic.edc
legacy/edje/src/examples/physics_complex.edc
legacy/edje/src/examples/physics_soft_bodies.edc
legacy/edje/src/lib/edje_calc.c
legacy/edje/src/lib/edje_private.h

index 121fed7..6041dcf 100644 (file)
@@ -67,7 +67,8 @@ syn keyword   cConstant       VERTICAL HORIZONTAL ON_HOLD BOTH EDITABLE EXPLICIT
 syn keyword    cConstant       FOCUS_SET "default" NEITHER
 syn keyword    cConstant       DYNAMIC STATIC PASSWORD
 
-syn keyword    cConstant       RIGID_BOX RIGID_CIRCLE SOFT_BOX SOFT_CIRCLE
+syn keyword    cConstant       RIGID_BOX RIGID_SPHERE SOFT_BOX SOFT_SPHERE
+syn keyword    cConstant       RIGID_CYLINDER SOFT_CYLINDER
 syn keyword    cConstant       CLOTH BOUNDARY_TOP BOUNDARY_BOTTOM BOUNDARY_LEFT
 syn keyword    cConstant       BOUNDARY_RIGHT BOUNDARY_FRONT BOUNDARY_BACK
 syn keyword    cConstant       PHYSICS_IMPULSE PHYSICS_TORQUE_IMPULSE
@@ -78,12 +79,7 @@ syn keyword  cConstant       BOX_MIDDLE_BACK BOX_FRONT BOX_BACK BOX_LEFT
 syn keyword    cConstant       BOX_RIGHT BOX_TOP BOX_BOTTOM
 syn keyword    cConstant       CYLINDER_MIDDLE_FRONT CYLINDER_MIDDLE_BACK
 syn keyword    cConstant       CYLINDER_FRONT CYLINDER_BACK CYLINDER_CURVED
-syn keyword    cConstant       CLOTH_FRONT CLOTH_BACK SOFT_BOX_MIDDLE_FRONT
-syn keyword    cConstant       SOFT_BOX_MIDDLE_BACK SOFT_BOX_FRONT
-syn keyword    cConstant       SOFT_BOX_BACK SOFT_BOX_LEFT SOFT_BOX_RIGHT
-syn keyword    cConstant       SOFT_BOX_TOP SOFT_BOX_BOTTOM SOFT_CIRCLE_BACK
-syn keyword    cConstant       SOFT_CIRCLE_MIDDLE_FRONT SOFT_CIRCLE_FRONT
-syn keyword    cConstant       SOFT_CIRCLE_MIDDLE_BACK SOFT_CIRCLE_CURVED
+syn keyword    cConstant       CLOTH_FRONT CLOTH_BACK SPHERE_FRONT SPHERE_BACK
 
 syn keyword    cTodo           contained TODO FIXME XXX
 
index da54fd7..80a5063 100644 (file)
@@ -3445,9 +3445,11 @@ st_collections_group_parts_part_type(void)
         Valid types:
             @li NONE
             @li RIGID_BOX
-            @li RIGID_CIRCLE
+            @li RIGID_SPHERE
+            @li RIGID_CYLINDER
             @li SOFT_BOX
-            @li SOFT_CIRCLE
+            @li SOFT_SPHERE
+            @li SOFT_CYLINDER
             @li CLOTH
             @li BOUNDARY_TOP
             @li BOUNDARY_BOTTOM
@@ -3469,9 +3471,11 @@ st_collections_group_parts_part_physics_body(void)
    body = parse_enum(0,
                      "NONE", EDJE_PART_PHYSICS_BODY_NONE,
                      "RIGID_BOX", EDJE_PART_PHYSICS_BODY_RIGID_BOX,
-                     "RIGID_CIRCLE", EDJE_PART_PHYSICS_BODY_RIGID_CIRCLE,
+                     "RIGID_SPHERE", EDJE_PART_PHYSICS_BODY_RIGID_SPHERE,
+                     "RIGID_CYLINDER", EDJE_PART_PHYSICS_BODY_RIGID_CYLINDER,
                      "SOFT_BOX", EDJE_PART_PHYSICS_BODY_SOFT_BOX,
-                     "SOFT_CIRCLE", EDJE_PART_PHYSICS_BODY_SOFT_CIRCLE,
+                     "SOFT_SPHERE", EDJE_PART_PHYSICS_BODY_SOFT_SPHERE,
+                     "SOFT_CYLINDER", EDJE_PART_PHYSICS_BODY_SOFT_CYLINDER,
                      "CLOTH", EDJE_PART_PHYSICS_BODY_CLOTH,
                      "BOUNDARY_TOP", EDJE_PART_PHYSICS_BODY_BOUNDARY_TOP,
                      "BOUNDARY_BOTTOM", EDJE_PART_PHYSICS_BODY_BOUNDARY_BOTTOM,
@@ -7762,34 +7766,23 @@ st_collections_group_parts_part_description_physics_face(void)
     @effect
         Set the face (all caps) from among the available body's shape faces.
         Valid faces:
-            * BOX_MIDDLE_FRONT,
-            * BOX_MIDDLE_BACK,
-            * BOX_FRONT,
-            * BOX_BACK,
-            * BOX_LEFT,
-            * BOX_RIGHT,
-            * BOX_TOP,
-            * BOX_BOTTOM,
-            * CYLINDER_MIDDLE_FRONT,
-            * CYLINDER_MIDDLE_BACK,
-            * CYLINDER_FRONT,
-            * CYLINDER_BACK,
-            * CYLINDER_CURVED,
-            * CLOTH_FRONT,
+            * BOX_MIDDLE_FRONT
+            * BOX_MIDDLE_BACK
+            * BOX_FRONT
+            * BOX_BACK
+            * BOX_LEFT
+            * BOX_RIGHT
+            * BOX_TOP
+            * BOX_BOTTOM
+            * CLOTH_FRONT
             * CLOTH_BACK
-            * SOFT_BOX_MIDDLE_FRONT,
-            * SOFT_BOX_MIDDLE_BACK,
-            * SOFT_BOX_FRONT,
-            * SOFT_BOX_BACK,
-            * SOFT_BOX_LEFT,
-            * SOFT_BOX_RIGHT,
-            * SOFT_BOX_TOP,
-            * SOFT_BOX_BOTTOM,
-            * SOFT_CIRCLE_MIDDLE_FRONT,
-            * SOFT_CIRCLE_MIDDLE_BACK,
-            * SOFT_CIRCLE_FRONT,
-            * SOFT_CIRCLE_BACK,
-            * SOFT_CIRCLE_CURVED,
+            * CYLINDER_MIDDLE_FRONT
+            * CYLINDER_MIDDLE_BACK
+            * CYLINDER_FRONT
+            * CYLINDER_BACK
+            * CYLINDER_CURVED
+            * SPHERE_FRONT
+            * SPHERE_BACK
     @endproperty
 */
 #ifdef HAVE_EPHYSICS
@@ -7809,28 +7802,15 @@ st_collections_group_parts_part_description_physics_face_type(void)
       "BOX_RIGHT", EPHYSICS_BODY_BOX_FACE_RIGHT,
       "BOX_TOP", EPHYSICS_BODY_BOX_FACE_TOP,
       "BOX_BOTTOM", EPHYSICS_BODY_BOX_FACE_BOTTOM,
+      "CLOTH_FRONT", EPHYSICS_BODY_CLOTH_FACE_FRONT,
+      "CLOTH_BACK", EPHYSICS_BODY_CLOTH_FACE_BACK,
       "CYLINDER_MIDDLE_FRONT", EPHYSICS_BODY_CYLINDER_FACE_MIDDLE_FRONT,
       "CYLINDER_MIDDLE_BACK", EPHYSICS_BODY_CYLINDER_FACE_MIDDLE_BACK,
       "CYLINDER_FRONT", EPHYSICS_BODY_CYLINDER_FACE_FRONT,
       "CYLINDER_BACK", EPHYSICS_BODY_CYLINDER_FACE_BACK,
       "CYLINDER_CURVED", EPHYSICS_BODY_CYLINDER_FACE_CURVED,
-      "CLOTH_FRONT", EPHYSICS_BODY_CLOTH_FACE_FRONT,
-      "CLOTH_BACK", EPHYSICS_BODY_CLOTH_FACE_BACK,
-      "SOFT_ELLIPSOID_FRONT", EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_FRONT,
-      "SOFT_ELLIPSOID_BACK", EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_BACK,
-      "SOFT_BOX_MIDDLE_FRONT", EPHYSICS_BODY_SOFT_BOX_FACE_MIDDLE_FRONT,
-      "SOFT_BOX_MIDDLE_BACK", EPHYSICS_BODY_SOFT_BOX_FACE_MIDDLE_BACK,
-      "SOFT_BOX_FRONT", EPHYSICS_BODY_SOFT_BOX_FACE_FRONT,
-      "SOFT_BOX_BACK", EPHYSICS_BODY_SOFT_BOX_FACE_BACK,
-      "SOFT_BOX_LEFT", EPHYSICS_BODY_SOFT_BOX_FACE_LEFT,
-      "SOFT_BOX_RIGHT", EPHYSICS_BODY_SOFT_BOX_FACE_RIGHT,
-      "SOFT_BOX_TOP", EPHYSICS_BODY_SOFT_BOX_FACE_TOP,
-      "SOFT_BOX_BOTTOM", EPHYSICS_BODY_SOFT_BOX_FACE_BOTTOM,
-      "SOFT_CIRCLE_MIDDLE_FRONT", EPHYSICS_BODY_SOFT_CIRCLE_FACE_MIDDLE_FRONT,
-      "SOFT_CIRCLE_MIDDLE_BACK", EPHYSICS_BODY_SOFT_CIRCLE_FACE_MIDDLE_BACK,
-      "SOFT_CIRCLE_FRONT", EPHYSICS_BODY_SOFT_CIRCLE_FACE_FRONT,
-      "SOFT_CIRCLE_BACK", EPHYSICS_BODY_SOFT_CIRCLE_FACE_BACK,
-      "SOFT_CIRCLE_CURVES", EPHYSICS_BODY_SOFT_CIRCLE_FACE_CURVED,
+      "SPHERE_FRONT", EPHYSICS_BODY_SPHERE_FACE_FRONT,
+      "SPHERE_BACK", EPHYSICS_BODY_SPHERE_FACE_BACK,
       NULL);
 
    EINA_LIST_FOREACH(current_desc->physics.faces, l, pface2)
index 5863478..abcf5f5 100644 (file)
@@ -239,7 +239,7 @@ collections {
          part {
             name: "blue_circle";
             type: IMAGE;
-            physics_body: RIGID_CIRCLE;
+            physics_body: RIGID_SPHERE;
             description {
                state: "default" 0.0;
                rel1.relative: 0.35 0.1;
@@ -258,7 +258,7 @@ collections {
          part {
             name: "red_circle";
             type: IMAGE;
-            physics_body: RIGID_CIRCLE;
+            physics_body: RIGID_SPHERE;
             description {
                state: "default" 0.0;
                color: 255 0 0 255; /* light red */
index 86b065e..0003b4c 100644 (file)
@@ -55,7 +55,7 @@ collections {
          part {
             name: "blue_circle";
             type: IMAGE;
-            physics_body: RIGID_CIRCLE;
+            physics_body: RIGID_SPHERE;
             description {
                state: "default" 0.0;
                rel1.relative: 0.25 0.1;
index 2116e99..c09edea 100644 (file)
@@ -70,7 +70,7 @@ collections {
          part {
             name: "blue_circle";
             type: IMAGE;
-            physics_body: RIGID_CIRCLE;
+            physics_body: RIGID_SPHERE;
             description {
                state: "default" 0.0;
                rel1.relative: 0.75 0.1;
index 41819e3..fa9e053 100644 (file)
@@ -56,14 +56,14 @@ collections {
                state: "soft" 0.0;
                inherit: "default" 0.0;
                physics {
-                  hardness: 0.5;
+                  hardness: 0.8;
                }
             }
             description {
                state: "very_soft" 0.0;
                inherit: "default" 0.0;
                physics {
-                  hardness: 0.2;
+                  hardness: 0.4;
                }
             }
          }
@@ -71,7 +71,7 @@ collections {
          part {
             name: "blue_circle";
             type: IMAGE;
-            physics_body: SOFT_CIRCLE;
+            physics_body: SOFT_CYLINDER;
             description {
                state: "default" 0.0;
                rel1.relative: 0.25 0.1;
@@ -89,12 +89,12 @@ collections {
             description {
                state: "soft" 0.0;
                inherit: "default" 0.0;
-               physics.hardness: 0.5;
+               physics.hardness: 0.8;
             }
             description {
                state: "very_soft" 0.0;
                inherit: "default" 0.0;
-               physics.hardness: 0.2;
+               physics.hardness: 0.4;
             }
          }
 
index 86c8a74..97833da 100644 (file)
@@ -2512,7 +2512,8 @@ _edje_physics_body_props_update(Edje_Real_Part *ep, Edje_Calc_Params *pf, Eina_B
           }
 
         if ((ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_BOX) ||
-            (ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_CIRCLE) ||
+            (ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_SPHERE) ||
+            (ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_CYLINDER) ||
             (ep->part->physics_body == EDJE_PART_PHYSICS_BODY_CLOTH))
           ephysics_body_soft_body_hardness_set(ep->body,
                                                pf->physics.hardness * 100);
@@ -2554,14 +2555,20 @@ _edje_physics_body_add(Edje_Real_Part *rp, EPhysics_World *world)
       case EDJE_PART_PHYSICS_BODY_RIGID_BOX:
          rp->body = ephysics_body_box_add(world);
          break;
-      case EDJE_PART_PHYSICS_BODY_RIGID_CIRCLE:
-         rp->body = ephysics_body_circle_add(world);
+      case EDJE_PART_PHYSICS_BODY_RIGID_SPHERE:
+         rp->body = ephysics_body_sphere_add(world);
+         break;
+      case EDJE_PART_PHYSICS_BODY_RIGID_CYLINDER:
+         rp->body = ephysics_body_cylinder_add(world);
          break;
       case EDJE_PART_PHYSICS_BODY_SOFT_BOX:
          rp->body = ephysics_body_soft_box_add(world);
          break;
-      case EDJE_PART_PHYSICS_BODY_SOFT_CIRCLE:
-         rp->body = ephysics_body_soft_circle_add(world);
+      case EDJE_PART_PHYSICS_BODY_SOFT_SPHERE:
+         rp->body = ephysics_body_soft_sphere_add(world, 0);
+         break;
+      case EDJE_PART_PHYSICS_BODY_SOFT_CYLINDER:
+         rp->body = ephysics_body_soft_cylinder_add(world);
          break;
       case EDJE_PART_PHYSICS_BODY_CLOTH:
          rp->body = ephysics_body_cloth_add(world, 0, 0);
index e20fe0d..27082f1 100644 (file)
@@ -771,9 +771,11 @@ typedef enum {
 typedef enum {
   EDJE_PART_PHYSICS_BODY_NONE= 0,
   EDJE_PART_PHYSICS_BODY_RIGID_BOX,
-  EDJE_PART_PHYSICS_BODY_RIGID_CIRCLE,
+  EDJE_PART_PHYSICS_BODY_RIGID_SPHERE,
+  EDJE_PART_PHYSICS_BODY_RIGID_CYLINDER,
   EDJE_PART_PHYSICS_BODY_SOFT_BOX,
-  EDJE_PART_PHYSICS_BODY_SOFT_CIRCLE,
+  EDJE_PART_PHYSICS_BODY_SOFT_SPHERE,
+  EDJE_PART_PHYSICS_BODY_SOFT_CYLINDER,
   EDJE_PART_PHYSICS_BODY_CLOTH,
   EDJE_PART_PHYSICS_BODY_BOUNDARY_TOP,
   EDJE_PART_PHYSICS_BODY_BOUNDARY_BOTTOM,