STATE_PHYSICS_DAMPING = 46,
STATE_PHYSICS_SLEEP = 47,
STATE_PHYSICS_MATERIAL = 48,
- STATE_PHYSICS_DENSITY = 49
+ STATE_PHYSICS_DENSITY = 49,
+ STATE_PHYSICS_IGNORE_PART_POS = 50,
+ STATE_PHYSICS_LIGHT_ON = 51
};
native set_state_val(part_id, State_Param:p, ...);
static void st_collections_group_parts_part_description_physics_sleep(void);
static void st_collections_group_parts_part_description_physics_material(void);
static void st_collections_group_parts_part_description_physics_density(void);
-static void st_collections_group_parts_part_description_physics_ignore_part_position(void);
+static void st_collections_group_parts_part_description_physics_ignore_part_pos(void);
+static void st_collections_group_parts_part_description_physics_light_on(void);
#endif
static void st_collections_group_parts_part_description_map_perspective(void);
static void st_collections_group_parts_part_description_map_light(void);
{"collections.group.parts.part.description.physics.sleep", st_collections_group_parts_part_description_physics_sleep},
{"collections.group.parts.part.description.physics.material", st_collections_group_parts_part_description_physics_material},
{"collections.group.parts.part.description.physics.density", st_collections_group_parts_part_description_physics_density},
- {"collections.group.parts.part.description.physics.ignore_part_position", st_collections_group_parts_part_description_physics_ignore_part_position},
+ {"collections.group.parts.part.description.physics.ignore_part_pos", st_collections_group_parts_part_description_physics_ignore_part_pos},
+ {"collections.group.parts.part.description.physics.light_on", st_collections_group_parts_part_description_physics_light_on},
#endif
{"collections.group.parts.part.description.map.perspective", st_collections_group_parts_part_description_map_perspective},
{"collections.group.parts.part.description.map.light", st_collections_group_parts_part_description_map_light},
result->physics.friction = FROM_DOUBLE(0.5);
result->physics.sleep.linear = FROM_DOUBLE(24);
result->physics.sleep.angular = FROM_DOUBLE(57.29);
- result->physics.ignore_part_position = 1;
+ result->physics.ignore_part_pos = 1;
#endif
return result;
description {
..
physics {
- ignore_part_position: 1;
+ ignore_part_pos: 1;
mass: 5.31;
friction: 0.5;
restitution: 0.82;
sleep: 32 18.9;
material: IRON;
density: 3.2;
+ light_on: 1;
}
..
}
/**
@page edcref
@property
- ignore_part_position
+ ignore_part_pos
@parameters
[1 or 0]
@effect
*/
#ifdef HAVE_EPHYSICS
static void
-st_collections_group_parts_part_description_physics_ignore_part_position(void)
+st_collections_group_parts_part_description_physics_ignore_part_pos(void)
{
check_arg_count(1);
- current_desc->physics.ignore_part_position = parse_bool(0);
+ current_desc->physics.ignore_part_pos = parse_bool(0);
}
#endif
#endif
/**
+ @page edcref
+ @property
+ light_on
+ @parameters
+ [1 or 0]
+ @effect
+ Set body to be affected by world's light or not.
+ It won't be respected if world's property "all_bodies" is enabled.
+ Disabled by default (0).
+ @endproperty
+ @since 1.8.0
+*/
+#ifdef HAVE_EPHYSICS
+static void
+st_collections_group_parts_part_description_physics_light_on(void)
+{
+ check_arg_count(1);
+
+ current_desc->physics.light_on = parse_bool(0);
+}
+#endif
+
+
+/**
@edcsubsection{collections_group_parts_description_map,Map}
*/
script {
new Float: mass, Float:rest, Float:fric;
new Float: linear, Float:angular;
+ new val;
custom_state(PART:"red_circle", "default", 0.0);
set_state_val(PART:"red_circle", STATE_COLOR, 0, 0, 0, 255);
0.1);
set_state_val(PART:"red_circle", STATE_PHYSICS_SLEEP, 34.1,
12.83);
+ set_state_val(PART:"red_circle", STATE_PHYSICS_LIGHT_ON, 1);
+ set_state_val(PART:"red_circle",
+ STATE_PHYSICS_IGNORE_PART_POS, 1);
set_state(PART:"red_circle", "custom", 0.0);
get_state_val(PART:"red_circle", STATE_PHYSICS_MASS, mass);
linear, angular);
send_message(MSG_STRING_FLOAT_SET, 1, "Sleep", linear,
angular);
+
+ get_state_val(PART:"red_circle", STATE_PHYSICS_LIGHT_ON, val);
+ send_message(MSG_STRING_INT, 1, "Light On", val);
+
+ get_state_val(PART:"red_circle",
+ STATE_PHYSICS_IGNORE_PART_POS, val);
+ send_message(MSG_STRING_INT, 1, "Ignore Part Pos", val);
}
}
mass: 10.8;
restitution: 0.85;
friction: 1.0;
+ light_on: 1;
}
}
description {
normal: "bubble-blue.png";
}
physics {
- ignore_part_position: 0;
+ ignore_part_pos: 0;
material: IRON;
}
}
params->physics.sleep.angular = desc->physics.sleep.angular;
params->physics.material = desc->physics.material;
params->physics.density = desc->physics.density;
- params->ignore_part_position = desc->physics.ignore_part_position;
+ params->physics.ignore_part_pos = desc->physics.ignore_part_pos;
+ params->physics.light_on = desc->physics.light_on;
#endif
_edje_part_recalc_single_map(ed, ep, center, light, persp, desc, chosen_desc, params);
}
pf->physics.damping.angular);
ephysics_body_sleeping_threshold_set(ep->body, pf->physics.sleep.linear,
pf->physics.sleep.angular);
+ ephysics_body_light_set(ep->body, pf->physics.light_on);
}
static void
p3->physics.sleep.angular = TO_DOUBLE(FINTP(
p1->physics.sleep.angular, p2->physics.sleep.angular, pos));
- if ((p1->ignore_part_position) && (p2->ignore_part_position))
- p3->ignore_part_position = 1;
+ if ((p1->physics.ignore_part_pos) && (p2->physics.ignore_part_pos))
+ p3->physics.ignore_part_pos = 1;
else
- p3->ignore_part_position = 0;
+ p3->physics.ignore_part_pos = 0;
if ((p1->physics.material) && (p2->physics.material))
p3->physics.material = p1->physics.material;
else
p3->physics.material = EPHYSICS_BODY_MATERIAL_CUSTOM;
+
+ p3->physics.light_on = p1->physics.light_on || p2->physics.light_on;
#endif
switch (part_type)
if (((ep->prev_description) &&
(chosen_desc != ep->prev_description)) ||
(pf != p1))
- _edje_physics_body_props_update(ep, pf,
- !pf->ignore_part_position);
+ _edje_physics_body_props_update(
+ ep, pf, !pf->physics.ignore_part_pos);
}
else
#endif
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.sleep.angular", physics.sleep.angular, EET_T_DOUBLE); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.material", physics.material, EET_T_UCHAR); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.density", physics.density, EET_T_DOUBLE); \
- EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.ignore_part_position", physics.ignore_part_position, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.ignore_part_pos", physics.ignore_part_pos, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.light_on", physics.light_on, EET_T_UCHAR); \
}
#else
#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(Edd, Type) \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.sleep.angular", Dec.physics.sleep.angular, EET_T_DOUBLE); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.material", Dec.physics.material, EET_T_UCHAR); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.density", Dec.physics.density, EET_T_DOUBLE); \
- EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.ignore_part_position", Dec.physics.ignore_part_position, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.ignore_part_pos", Dec.physics.ignore_part_pos, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.light_on", Dec.physics.light_on, EET_T_UCHAR); \
}
#else
#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(Edd, Type, Dec) \
GETFLOAT_T(rp->custom->description->physics.density, params[3]);
break;
+ case EDJE_STATE_PARAM_PHYSICS_IGNORE_PART_POS:
+ CHKPARAM(3);
+
+ GETINT(rp->custom->description->physics.ignore_part_pos, params[3]);
+ break;
+ case EDJE_STATE_PARAM_PHYSICS_LIGHT_ON:
+ CHKPARAM(3);
+
+ GETINT(rp->custom->description->physics.light_on, params[3]);
+ break;
#endif
default:
break;
SETFLOAT_T(rp->custom->description->physics.density, params[3]);
break;
+ case EDJE_STATE_PARAM_PHYSICS_IGNORE_PART_POS:
+ CHKPARAM(3);
+
+ SETINT(rp->custom->description->physics.ignore_part_pos, params[3]);
+ break;
+ case EDJE_STATE_PARAM_PHYSICS_LIGHT_ON:
+ CHKPARAM(3);
+
+ SETINT(rp->custom->description->physics.light_on, params[3]);
+ break;
#endif
default:
break;
#define EDJE_STATE_PARAM_PHYSICS_SLEEP 47
#define EDJE_STATE_PARAM_PHYSICS_MATERIAL 48
#define EDJE_STATE_PARAM_PHYSICS_DENSITY 49
-#define EDJE_STATE_PARAM_LAST 50
+#define EDJE_STATE_PARAM_PHYSICS_IGNORE_PART_POS 50
+#define EDJE_STATE_PARAM_PHYSICS_LIGHT_ON 51
+#define EDJE_STATE_PARAM_LAST 52
#define EDJE_ENTRY_EDIT_MODE_NONE 0
#define EDJE_ENTRY_EDIT_MODE_SELECTABLE 1
double angular;
} sleep;
unsigned char material; /* (custom, iron, wood, ...) */
- unsigned char ignore_part_position;
+ unsigned char light_on;
+ unsigned char ignore_part_pos;
} physics;
#endif
double angular; //8
} sleep; // 16
unsigned char material; // 1
- } physics; // 65
- unsigned char ignore_part_position : 1; //1
+ unsigned char light_on; // 1
+ unsigned char ignore_part_pos; //1
+ } physics; // 67
#endif
unsigned char persp_on : 1;
unsigned char lighted : 1;