Just remove the unused attribute m_bSuspendDynamics.
Details
Diff Detail
- Repository
- rB Blender
Event Timeline
maybe, it should be better to create a new function "isSuspendDynamics()" to know the dynamics state using that unused variable.
Insert of method bool IsSuspendDynamics() and from python the attribute KX_GameObject.isSuspendDynamics
I'm not sure I like the name, it sounds rather clunky. IsDynamicsSuspended() or IsSuspended() might be better. Also, we have a dummy physics implementation that probably needs to be updated if PHY_IPhysicsController.h is being changed.
I think that having so many syllables in a name (and of such length) is not the best direction.
isSuspended seems inline with the actuators currently exposed for this feature.
For these particular attributes, I'd be inclined to add an error message if the object does not have a controller using PyErr_SetString(PyExc_RuntimeError, "This object has no physics controller") as we do for the collision margin and apply impulse. This should probably be added to existing attributes elsewhere, but at least we can be consistent from this point onwards.
Apart from inline comment, the rst documentation is missing. When you fix these two things I will commit the patch.
| source/gameengine/Ketsji/KX_GameObject.cpp | ||
|---|---|---|
| 2367 | As per Agoose's comment to add: // Only objects with a physics controller can be suspended
if (!self->GetPhysicsController()) {
PyErr_SetString(PyExc_AttributeError, "This object has not Physics Controller");
return NULL;
} | |
I spoke with Moguri and it is better to use isDynamicsSuspended as name for the attribute.
I will change it during the commiting process to avoid more noise :-).