1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 11:19:10 +00:00

Add animation loop functions to Python

This commit is contained in:
Florian Meißner
2011-11-30 15:20:12 +01:00
parent f35df2053c
commit b6a371f49f
3 changed files with 84 additions and 0 deletions

View File

@ -1761,6 +1761,44 @@ bool cyAvatar::ExitPBMode()
return IExitTopmostGenericMode(); return IExitTopmostGenericMode();
} }
/////////////////////////////////////////////////////////////////////////////
//
// Function : EnterAnimMode
// PARAMETERS : animName - string
//
// PURPOSE : Makes the avatar enter a custom anim loop.
//
void cyAvatar::EnterAnimMode(plString animName)
{
plArmatureMod *fAvMod = plAvatarMgr::GetInstance()->GetLocalAvatar();
if (!fAvMod->FindAnimInstance(animName)) {
plKey avKey = fAvMod->GetKey();
plAvAnimTask *animTask = new plAvAnimTask(animName, 0.0, 1.0, 1.0, 0.0, true, true, true);
plAvTaskMsg *taskMsg = new plAvTaskMsg(avKey, avKey, animTask);
taskMsg->SetBCastFlag(plMessage::kNetPropagate);
taskMsg->Send();
}
}
/////////////////////////////////////////////////////////////////////////////
//
// Function : ExitAnimMode
// PARAMETERS : animName - string
//
// PURPOSE : Makes the avatar stop the custom anim loop.
//
void cyAvatar::ExitAnimMode(plString animName)
{
plArmatureMod *fAvMod = plAvatarMgr::GetInstance()->GetLocalAvatar();
if (fAvMod->FindAnimInstance(animName)) {
plKey avKey = fAvMod->GetKey();
plAvAnimTask *animTask = new plAvAnimTask(animName, -1.0);
plAvTaskMsg *taskMsg = new plAvTaskMsg(avKey, avKey, animTask);
taskMsg->SetBCastFlag(plMessage::kNetPropagate);
taskMsg->Send();
}
}
int cyAvatar::GetCurrentMode() int cyAvatar::GetCurrentMode()
{ {

View File

@ -511,6 +511,24 @@ public:
// : more specific in future version // : more specific in future version
// //
static bool ExitPBMode(); static bool ExitPBMode();
/////////////////////////////////////////////////////////////////////////////
//
// Function : EnterAnimMode
// PARAMETERS : animName - string
//
// PURPOSE : Makes the avatar enter a custom anim loop.
//
static void EnterAnimMode(plString animName);
/////////////////////////////////////////////////////////////////////////////
//
// Function : ExitAnimMode
// PARAMETERS : animName - string
//
// PURPOSE : Makes the avatar stop the custom anim loop.
//
static void ExitAnimMode(plString animName);
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //

View File

@ -777,6 +777,32 @@ PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtAvatarExitAFK, "Tells the local avatar
PYTHON_RETURN_BOOL(cyAvatar::ExitAFKMode()); PYTHON_RETURN_BOOL(cyAvatar::ExitAFKMode());
} }
PYTHON_GLOBAL_METHOD_DEFINITION(PtAvatarEnterAnimMode, args, "Params: animName\nEnter a custom anim loop (netpropagated)")
{
char* animName;
if (!PyArg_ParseTuple(args, "s", &animName))
{
PyErr_SetString(PyExc_TypeError, "PtAvatarEnterAnimMode expects a string");
PYTHON_RETURN_ERROR;
}
cyAvatar::EnterAnimMode(animName);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtAvatarExitAnimMode, args, "Params: animName\nExit a custom anim loop (netpropagated)")
{
char* animName;
if (!PyArg_ParseTuple(args, "s", &animName))
{
PyErr_SetString(PyExc_TypeError, "PtAvatarExitAnimMode expects a string");
PYTHON_RETURN_ERROR;
}
cyAvatar::ExitAnimMode(animName);
PYTHON_RETURN_NONE;
}
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtDisableMovementKeys, cyAvatar::DisableMovementControls, "Disable avatar movement input") PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtDisableMovementKeys, cyAvatar::DisableMovementControls, "Disable avatar movement input")
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtEnableMovementKeys, cyAvatar::EnableMovementControls, "Enable avatar movement input") PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtEnableMovementKeys, cyAvatar::EnableMovementControls, "Enable avatar movement input")
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtDisableMouseMovement, cyAvatar::DisableMouseMovement, "Disable avatar mouse movement input") PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtDisableMouseMovement, cyAvatar::DisableMouseMovement, "Disable avatar mouse movement input")
@ -870,6 +896,8 @@ void cyAvatar::AddPlasmaMethods(std::vector<PyMethodDef> &methods)
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtAvatarExitUsePersBook); PYTHON_GLOBAL_METHOD_NOARGS(methods, PtAvatarExitUsePersBook);
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtAvatarEnterAFK); PYTHON_GLOBAL_METHOD_NOARGS(methods, PtAvatarEnterAFK);
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtAvatarExitAFK); PYTHON_GLOBAL_METHOD_NOARGS(methods, PtAvatarExitAFK);
PYTHON_GLOBAL_METHOD(methods, PtAvatarEnterAnimMode);
PYTHON_GLOBAL_METHOD(methods, PtAvatarExitAnimMode);
// Suspend avatar input // Suspend avatar input
PYTHON_BASIC_GLOBAL_METHOD(methods, PtDisableMovementKeys); PYTHON_BASIC_GLOBAL_METHOD(methods, PtDisableMovementKeys);