Commit 97407752 authored by frankie's avatar frankie 💬

properties added to bind methods

parent 0b126a17
......@@ -184,8 +184,12 @@ void SoftskinDot::operator=(const SoftskinDot& src) {
const Vector3& SoftskinDot::update(const float& delta_time) {
if (_kicks < 2) {
_kicks = 2;
// if (_kicks < 2) {
// _kicks = 2;
// };
if (_kicks < 1) {
_kicks = 1;
};
if ( _nkicks > 0 ) {
......@@ -195,9 +199,10 @@ const Vector3& SoftskinDot::update(const float& delta_time) {
_force.ref() += _normal * _pressure;
}
_force.ref() *= delta_time;
Vector3 consumed = _force.ref() * _reactivity / sqrt(_kicks - 1);
// _force.ref() *= delta_time;
// Vector3 consumed = _force.ref() * _reactivity / sqrt(_kicks - 1);
Vector3 consumed = _force.ref() * _reactivity / _kicks;
_force -= consumed;
_vert += consumed;
_vert += (_vert_origin - _vert.ref()) * _stickiness * delta_time;
......
......@@ -38,8 +38,13 @@ void SoftskinGroup::set_std_name(std::string s) {
}
void SoftskinGroup::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_name", "name"), &SoftskinGroup::set_name);
ClassDB::bind_method(D_METHOD("get_name"), &SoftskinGroup::get_name);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "name"),
"set_name",
"get_name");
}
//******************
......@@ -88,10 +93,25 @@ void SoftskinGroupDot::set_pressure(const float& f) {
void SoftskinGroupDot::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_damping"), &SoftskinGroupDot::get_reactivity);
ClassDB::bind_method(D_METHOD("set_stickiness"), &SoftskinGroupDot::set_stickiness);
ClassDB::bind_method(D_METHOD("get_stickiness"), &SoftskinGroupDot::get_stickiness);
ClassDB::bind_method(D_METHOD("set_damping"), &SoftskinGroupDot::set_reactivity);
ClassDB::bind_method(D_METHOD("get_pressure"), &SoftskinGroupDot::get_pressure);
ClassDB::bind_method(D_METHOD("get_damping"), &SoftskinGroupDot::get_reactivity);
ClassDB::bind_method(D_METHOD("set_pressure"), &SoftskinGroupDot::set_pressure);
ClassDB::bind_method(D_METHOD("get_pressure"), &SoftskinGroupDot::get_pressure);
ADD_PROPERTY(PropertyInfo(Variant::REAL,
"stickiness", PROPERTY_HINT_RANGE, "0,1,or_greater,or_lesser"),
"set_stickiness",
"get_stickiness");
ADD_PROPERTY(PropertyInfo(Variant::REAL,
"damping", PROPERTY_HINT_RANGE, "0,1,or_greater,or_lesser"),
"set_damping",
"get_damping");
ADD_PROPERTY(PropertyInfo(Variant::REAL,
"pressure", PROPERTY_HINT_RANGE, "-1,1,or_greater,or_lesser"),
"set_pressure",
"get_pressure");
}
......@@ -143,15 +163,23 @@ void SoftskinGroupEdge::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_stiffness"), &SoftskinGroupEdge::get_stiffness);
ClassDB::bind_method(D_METHOD("set_shrink", "shrink"), &SoftskinGroupEdge::set_rest_len_multiplier);
ClassDB::bind_method(D_METHOD("get_shrink"), &SoftskinGroupEdge::get_rest_len_multiplier);
ClassDB::bind_method(D_METHOD("set_muscle_frequency", "muscle_frequency"), &SoftskinGroupEdge::set_muscle_frequency);
ClassDB::bind_method(D_METHOD("get_muscle_frequency"), &SoftskinGroupEdge::get_muscle_frequency);
ClassDB::bind_method(D_METHOD("set_muscle_min", "muscle_min"), &SoftskinGroupEdge::set_muscle_min);
ClassDB::bind_method(D_METHOD("get_muscle_min"), &SoftskinGroupEdge::get_muscle_min);
ClassDB::bind_method(D_METHOD("set_muscle_max", "muscle_max"), &SoftskinGroupEdge::set_muscle_max);
ClassDB::bind_method(D_METHOD("get_muscle_max"), &SoftskinGroupEdge::get_muscle_max);
// ClassDB::bind_method(D_METHOD("set_muscle_frequency", "muscle_frequency"), &SoftskinGroupEdge::set_muscle_frequency);
// ClassDB::bind_method(D_METHOD("get_muscle_frequency"), &SoftskinGroupEdge::get_muscle_frequency);
// ClassDB::bind_method(D_METHOD("set_muscle_min", "muscle_min"), &SoftskinGroupEdge::set_muscle_min);
// ClassDB::bind_method(D_METHOD("get_muscle_min"), &SoftskinGroupEdge::get_muscle_min);
// ClassDB::bind_method(D_METHOD("set_muscle_max", "muscle_max"), &SoftskinGroupEdge::set_muscle_max);
// ClassDB::bind_method(D_METHOD("get_muscle_max"), &SoftskinGroupEdge::get_muscle_max);
ClassDB::bind_method(D_METHOD("get_barycenter"), &SoftskinGroupEdge::get_barycenter);
ADD_PROPERTY(PropertyInfo(Variant::REAL,
"stiffness", PROPERTY_HINT_RANGE, "0,1,or_greater,or_lesser"),
"set_stiffness",
"get_stiffness");
ADD_PROPERTY(PropertyInfo(Variant::REAL,
"shrink", PROPERTY_HINT_RANGE, "0,1,or_greater,or_lesser"),
"set_shrink",
"get_shrink");
}
//********************
......@@ -211,15 +239,23 @@ void SoftskinGroupFiber::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_stiffness"), &SoftskinGroupFiber::get_stiffness);
ClassDB::bind_method(D_METHOD("set_shrink", "shrink"), &SoftskinGroupFiber::set_rest_len_multiplier);
ClassDB::bind_method(D_METHOD("get_shrink"), &SoftskinGroupFiber::get_rest_len_multiplier);
ClassDB::bind_method(D_METHOD("set_muscle_frequency", "muscle_frequency"), &SoftskinGroupFiber::set_muscle_frequency);
ClassDB::bind_method(D_METHOD("get_muscle_frequency"), &SoftskinGroupFiber::get_muscle_frequency);
ClassDB::bind_method(D_METHOD("set_muscle_min", "muscle_min"), &SoftskinGroupFiber::set_muscle_min);
ClassDB::bind_method(D_METHOD("get_muscle_min"), &SoftskinGroupFiber::get_muscle_min);
ClassDB::bind_method(D_METHOD("set_muscle_max", "muscle_max"), &SoftskinGroupFiber::set_muscle_max);
ClassDB::bind_method(D_METHOD("get_muscle_max"), &SoftskinGroupFiber::get_muscle_max);
// ClassDB::bind_method(D_METHOD("set_muscle_frequency", "muscle_frequency"), &SoftskinGroupFiber::set_muscle_frequency);
// ClassDB::bind_method(D_METHOD("get_muscle_frequency"), &SoftskinGroupFiber::get_muscle_frequency);
// ClassDB::bind_method(D_METHOD("set_muscle_min", "muscle_min"), &SoftskinGroupFiber::set_muscle_min);
// ClassDB::bind_method(D_METHOD("get_muscle_min"), &SoftskinGroupFiber::get_muscle_min);
// ClassDB::bind_method(D_METHOD("set_muscle_max", "muscle_max"), &SoftskinGroupFiber::set_muscle_max);
// ClassDB::bind_method(D_METHOD("get_muscle_max"), &SoftskinGroupFiber::get_muscle_max);
ClassDB::bind_method(D_METHOD("get_barycenter"), &SoftskinGroupFiber::get_barycenter);
ADD_PROPERTY(PropertyInfo(Variant::REAL,
"stiffness", PROPERTY_HINT_RANGE, "0,1,or_greater,or_lesser"),
"set_stiffness",
"get_stiffness");
ADD_PROPERTY(PropertyInfo(Variant::REAL,
"shrink", PROPERTY_HINT_RANGE, "0,1,or_greater,or_lesser"),
"set_shrink",
"get_shrink");
}
//***********************
......@@ -295,25 +331,32 @@ void SoftskinGroupLigament::_bind_methods() {
ClassDB::bind_method(D_METHOD("size"), &SoftskinGroupLigament::size);
ClassDB::bind_method(D_METHOD("empty"), &SoftskinGroupLigament::empty);
ClassDB::bind_method(D_METHOD("set_parent", "parent"), &SoftskinGroupLigament::set_parent, DEFVAL(0));
ClassDB::bind_method(D_METHOD("get_parent"), &SoftskinGroupLigament::get_parent);
ClassDB::bind_method(D_METHOD("set_stiffness", "stiffness"), &SoftskinGroupLigament::set_stiffness);
ClassDB::bind_method(D_METHOD("get_stiffness"), &SoftskinGroupLigament::get_stiffness);
ClassDB::bind_method(D_METHOD("set_shrink", "shrink"), &SoftskinGroupLigament::set_rest_len_multiplier);
ClassDB::bind_method(D_METHOD("get_shrink"), &SoftskinGroupLigament::get_rest_len_multiplier);
ClassDB::bind_method(D_METHOD("set_muscle_frequency", "muscle_frequency"), &SoftskinGroupLigament::set_muscle_frequency);
ClassDB::bind_method(D_METHOD("get_muscle_frequency"), &SoftskinGroupLigament::get_muscle_frequency);
ClassDB::bind_method(D_METHOD("set_muscle_min", "muscle_min"), &SoftskinGroupLigament::set_muscle_min);
ClassDB::bind_method(D_METHOD("get_muscle_min"), &SoftskinGroupLigament::get_muscle_min);
ClassDB::bind_method(D_METHOD("set_muscle_max", "muscle_max"), &SoftskinGroupLigament::set_muscle_max);
ClassDB::bind_method(D_METHOD("get_muscle_max"), &SoftskinGroupLigament::get_muscle_max);
// ClassDB::bind_method(D_METHOD("set_muscle_frequency", "muscle_frequency"), &SoftskinGroupLigament::set_muscle_frequency);
// ClassDB::bind_method(D_METHOD("get_muscle_frequency"), &SoftskinGroupLigament::get_muscle_frequency);
// ClassDB::bind_method(D_METHOD("set_muscle_min", "muscle_min"), &SoftskinGroupLigament::set_muscle_min);
// ClassDB::bind_method(D_METHOD("get_muscle_min"), &SoftskinGroupLigament::get_muscle_min);
// ClassDB::bind_method(D_METHOD("set_muscle_max", "muscle_max"), &SoftskinGroupLigament::set_muscle_max);
// ClassDB::bind_method(D_METHOD("get_muscle_max"), &SoftskinGroupLigament::get_muscle_max);
ClassDB::bind_method(D_METHOD("get_barycenter"), &SoftskinGroupLigament::get_barycenter);
ClassDB::bind_method(D_METHOD("set_parent", "parent"), &SoftskinGroupLigament::set_parent, DEFVAL(0));
ClassDB::bind_method(D_METHOD("get_parent"), &SoftskinGroupLigament::get_parent);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,
"parent", PROPERTY_HINT_RESOURCE_TYPE,
"Spatial"),
"set_parent",
"get_parent");
ADD_PROPERTY(PropertyInfo(Variant::REAL,
"stiffness", PROPERTY_HINT_RANGE, "0,1,or_greater,or_lesser"),
"set_stiffness",
"get_stiffness");
ADD_PROPERTY(PropertyInfo(Variant::REAL,
"shrink", PROPERTY_HINT_RANGE, "0,1,or_greater,or_lesser"),
"set_shrink",
"get_shrink");
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment