Page MenuHome

BGE : Remove unused attribute m_bSuspendDynamics and new game object python attribute
ClosedPublic

Authored by Porteries Tristan (panzergame) on Feb 10 2015, 10:42 AM.

Diff Detail

Repository
rB Blender

Event Timeline

Porteries Tristan (panzergame) retitled this revision from to BGE : Remove unused attribute m_bSuspendDynamics.
Porteries Tristan (panzergame) updated this object.

maybe, it should be better to create a new function "isSuspendDynamics()" to know the dynamics state using that unused variable.

Porteries Tristan (panzergame) retitled this revision from BGE : Remove unused attribute m_bSuspendDynamics to BGE : Remove unused attribute m_bSuspendDynamics and new game object python attribute.

Insert of method bool IsSuspendDynamics() and from python the attribute KX_GameObject.isSuspendDynamics

This revision is now accepted and ready to land.Feb 10 2015, 10:55 PM
Mitchell Stokes (moguri) requested changes to this revision.Feb 10 2015, 11:59 PM
Mitchell Stokes (moguri) edited edge metadata.

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.

This revision now requires changes to proceed.Feb 10 2015, 11:59 PM

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.

Porteries Tristan (panzergame) edited edge metadata.

Rename isDynamicsSuspended to dynamicsSuspended.

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;
	}
Jorge Bernal (lordloki) requested changes to this revision.Mar 24 2015, 11:49 PM
Jorge Bernal (lordloki) edited edge metadata.
This revision now requires changes to proceed.Mar 24 2015, 11:49 PM
Porteries Tristan (panzergame) edited edge metadata.

Fix documentation and warning message.

Jorge Bernal (lordloki) edited edge metadata.

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 :-).

This revision was automatically updated to reflect the committed changes.