OLD | NEW |
1 /* | 1 /* |
2 * ***** BEGIN GPL LICENSE BLOCK ***** | 2 * ***** BEGIN GPL LICENSE BLOCK ***** |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or | 4 * This program is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU General Public License | 5 * modify it under the terms of the GNU General Public License |
6 * as published by the Free Software Foundation; either version 2 | 6 * as published by the Free Software Foundation; either version 2 |
7 * of the License, or (at your option) any later version. | 7 * of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 * It also allows to activate/deactivate constraints during the game. | 46 * It also allows to activate/deactivate constraints during the game. |
47 * Later it will also be possible to create constraint on the fly | 47 * Later it will also be possible to create constraint on the fly |
48 */ | 48 */ |
49 | 49 |
50 BL_ArmatureActuator::BL_ArmatureActuator(SCA_IObject* obj, | 50 BL_ArmatureActuator::BL_ArmatureActuator(SCA_IObject* obj, |
51 int type, | 51 int type, |
52 const char *posechannel, | 52 const char *posechannel, |
53 const char *constraintname, | 53 const char *constraintname, |
54 KX_GameObject* targetobj, | 54 KX_GameObject* targetobj, |
55 KX_GameObject* subtargetobj, | 55 KX_GameObject* subtargetobj, |
56 » » » » » » float weight) : | 56 » » » » » » float weight, |
| 57 » » » » » » float influence) : |
57 SCA_IActuator(obj, KX_ACT_ARMATURE), | 58 SCA_IActuator(obj, KX_ACT_ARMATURE), |
58 m_constraint(NULL), | 59 m_constraint(NULL), |
59 m_gametarget(targetobj), | 60 m_gametarget(targetobj), |
60 m_gamesubtarget(subtargetobj), | 61 m_gamesubtarget(subtargetobj), |
61 m_posechannel(posechannel), | 62 m_posechannel(posechannel), |
62 m_constraintname(constraintname), | 63 m_constraintname(constraintname), |
63 m_weight(weight), | 64 m_weight(weight), |
| 65 m_influence(influence), |
64 m_type(type) | 66 m_type(type) |
65 { | 67 { |
66 if (m_gametarget) | 68 if (m_gametarget) |
67 m_gametarget->RegisterActuator(this); | 69 m_gametarget->RegisterActuator(this); |
68 if (m_gamesubtarget) | 70 if (m_gamesubtarget) |
69 m_gamesubtarget->RegisterActuator(this); | 71 m_gamesubtarget->RegisterActuator(this); |
70 FindConstraint(); | 72 FindConstraint(); |
71 } | 73 } |
72 | 74 |
73 BL_ArmatureActuator::~BL_ArmatureActuator() | 75 BL_ArmatureActuator::~BL_ArmatureActuator() |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 case ACT_ARM_SETTARGET: | 168 case ACT_ARM_SETTARGET: |
167 if (m_constraint) { | 169 if (m_constraint) { |
168 m_constraint->SetTarget(m_gametarget); | 170 m_constraint->SetTarget(m_gametarget); |
169 m_constraint->SetSubtarget(m_gamesubtarget); | 171 m_constraint->SetSubtarget(m_gamesubtarget); |
170 } | 172 } |
171 break; | 173 break; |
172 case ACT_ARM_SETWEIGHT: | 174 case ACT_ARM_SETWEIGHT: |
173 if (m_constraint) | 175 if (m_constraint) |
174 m_constraint->SetWeight(m_weight); | 176 m_constraint->SetWeight(m_weight); |
175 break; | 177 break; |
| 178 case ACT_ARM_SETINFLUENCE: |
| 179 if (m_constraint) |
| 180 m_constraint->SetInfluence(m_influence); |
| 181 break; |
176 } | 182 } |
177 } | 183 } |
178 return result; | 184 return result; |
179 } | 185 } |
180 | 186 |
181 #ifdef WITH_PYTHON | 187 #ifdef WITH_PYTHON |
182 | 188 |
183 /* ------------------------------------------------------------------------- */ | 189 /* ------------------------------------------------------------------------- */ |
184 /* Python Integration Hooks
*/ | 190 /* Python Integration Hooks
*/ |
185 /* ------------------------------------------------------------------------- */ | 191 /* ------------------------------------------------------------------------- */ |
(...skipping 23 matching lines...) Expand all Loading... |
209 | 215 |
210 PyMethodDef BL_ArmatureActuator::Methods[] = { | 216 PyMethodDef BL_ArmatureActuator::Methods[] = { |
211 {NULL,NULL} //Sentinel | 217 {NULL,NULL} //Sentinel |
212 }; | 218 }; |
213 | 219 |
214 PyAttributeDef BL_ArmatureActuator::Attributes[] = { | 220 PyAttributeDef BL_ArmatureActuator::Attributes[] = { |
215 KX_PYATTRIBUTE_RO_FUNCTION("constraint", BL_ArmatureActuator, pyattr_get
_constraint), | 221 KX_PYATTRIBUTE_RO_FUNCTION("constraint", BL_ArmatureActuator, pyattr_get
_constraint), |
216 KX_PYATTRIBUTE_RW_FUNCTION("target", BL_ArmatureActuator, pyattr_get_obj
ect, pyattr_set_object), | 222 KX_PYATTRIBUTE_RW_FUNCTION("target", BL_ArmatureActuator, pyattr_get_obj
ect, pyattr_set_object), |
217 KX_PYATTRIBUTE_RW_FUNCTION("subtarget", BL_ArmatureActuator, pyattr_get_
object, pyattr_set_object), | 223 KX_PYATTRIBUTE_RW_FUNCTION("subtarget", BL_ArmatureActuator, pyattr_get_
object, pyattr_set_object), |
218 KX_PYATTRIBUTE_FLOAT_RW("weight",0.0f,1.0f,BL_ArmatureActuator,m_weight)
, | 224 KX_PYATTRIBUTE_FLOAT_RW("weight",0.0f,1.0f,BL_ArmatureActuator,m_weight)
, |
| 225 KX_PYATTRIBUTE_FLOAT_RW("influence",0.0f,1.0f,BL_ArmatureActuator,m_infl
uence), |
219 KX_PYATTRIBUTE_INT_RW("type",0,ACT_ARM_MAXTYPE,false,BL_ArmatureActuator
,m_type), | 226 KX_PYATTRIBUTE_INT_RW("type",0,ACT_ARM_MAXTYPE,false,BL_ArmatureActuator
,m_type), |
220 { NULL } //Sentinel | 227 { NULL } //Sentinel |
221 }; | 228 }; |
222 | 229 |
223 PyObject* BL_ArmatureActuator::pyattr_get_object(void *self, const struct KX_PYA
TTRIBUTE_DEF *attrdef) | 230 PyObject* BL_ArmatureActuator::pyattr_get_object(void *self, const struct KX_PYA
TTRIBUTE_DEF *attrdef) |
224 { | 231 { |
225 BL_ArmatureActuator* actuator = static_cast<BL_ArmatureActuator*>(self); | 232 BL_ArmatureActuator* actuator = static_cast<BL_ArmatureActuator*>(self); |
226 KX_GameObject *target = (!strcmp(attrdef->m_name, "target")) ? actuator-
>m_gametarget : actuator->m_gamesubtarget; | 233 KX_GameObject *target = (!strcmp(attrdef->m_name, "target")) ? actuator-
>m_gametarget : actuator->m_gamesubtarget; |
227 if (!target)···· | 234 if (!target)···· |
228 Py_RETURN_NONE; | 235 Py_RETURN_NONE; |
(...skipping 26 matching lines...) Expand all Loading... |
255 BL_ArmatureActuator* actuator = static_cast<BL_ArmatureActuator*>(self); | 262 BL_ArmatureActuator* actuator = static_cast<BL_ArmatureActuator*>(self); |
256 BL_ArmatureConstraint* constraint = actuator->m_constraint; | 263 BL_ArmatureConstraint* constraint = actuator->m_constraint; |
257 if (!constraint)········ | 264 if (!constraint)········ |
258 Py_RETURN_NONE; | 265 Py_RETURN_NONE; |
259 else | 266 else |
260 return constraint->GetProxy(); | 267 return constraint->GetProxy(); |
261 } | 268 } |
262 | 269 |
263 #endif // WITH_PYTHON | 270 #endif // WITH_PYTHON |
264 | 271 |
OLD | NEW |