本文整理汇总了C++中BL_ArmatureObject::SetPose方法的典型用法代码示例。如果您正苦于以下问题:C++ BL_ArmatureObject::SetPose方法的具体用法?C++ BL_ArmatureObject::SetPose怎么用?C++ BL_ArmatureObject::SetPose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BL_ArmatureObject
的用法示例。
在下文中一共展示了BL_ArmatureObject::SetPose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void BL_Action::Update(float curtime)
{
// Don't bother if we're done with the animation
if (m_done)
return;
curtime -= KX_KetsjiEngine::GetSuspendedDelta();
// Grab the start time here so we don't end up with a negative m_localtime when
// suspending and resuming scenes.
if (m_starttime < 0)
m_starttime = curtime;
if (m_calc_localtime)
SetLocalTime(curtime);
else
{
ResetStartTime(curtime);
m_calc_localtime = true;
}
// Handle wrap around
if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe)) {
switch (m_playmode) {
case ACT_MODE_PLAY:
// Clamp
m_localtime = m_endframe;
m_done = true;
break;
case ACT_MODE_LOOP:
// Put the time back to the beginning
m_localtime = m_startframe;
m_starttime = curtime;
break;
case ACT_MODE_PING_PONG:
// Swap the start and end frames
float temp = m_startframe;
m_startframe = m_endframe;
m_endframe = temp;
m_starttime = curtime;
break;
}
}
if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE)
{
BL_ArmatureObject *obj = (BL_ArmatureObject*)m_obj;
obj->GetPose(&m_pose);
// Extract the pose from the action
{
Object *arm = obj->GetArmatureObject();
bPose *temp = arm->pose;
arm->pose = m_pose;
animsys_evaluate_action(m_ptrrna, m_action, NULL, m_localtime);
arm->pose = temp;
}
// Handle blending between armature actions
if (m_blendin && m_blendframe<m_blendin)
{
IncrementBlending(curtime);
// Calculate weight
float weight = 1.f - (m_blendframe/m_blendin);
// Blend the poses
game_blend_poses(m_pose, m_blendinpose, weight);
}
// Handle layer blending
if (m_layer_weight >= 0)
{
obj->GetMRDPose(&m_blendpose);
game_blend_poses(m_pose, m_blendpose, m_layer_weight);
}
obj->SetPose(m_pose);
obj->SetActiveAction(NULL, 0, curtime);
}
else
{
BL_DeformableGameObject *obj = (BL_DeformableGameObject*)m_obj;
BL_ShapeDeformer *shape_deformer = dynamic_cast<BL_ShapeDeformer*>(obj->GetDeformer());
// Handle shape actions if we have any
if (shape_deformer && shape_deformer->GetKey())
{
Key *key = shape_deformer->GetKey();
animsys_evaluate_action(m_ptrrna, m_action, NULL, m_localtime);
// Handle blending between shape actions
//.........这里部分代码省略.........
示例2: Update
//.........这里部分代码省略.........
case ACT_ACTION_PLAY:
if (wrap){
m_localtime = m_endframe;
keepgoing = false;
m_flag &= ~ACT_FLAG_LOCKINPUT;
}
break;
default:
keepgoing = false;
break;
}
/* Set the property if its defined */
if (m_framepropname[0] != '\0') {
CValue* propowner = GetParent();
CValue* oldprop = propowner->GetProperty(m_framepropname);
CValue* newval = new CFloatValue(m_localtime);
if (oldprop) {
oldprop->SetValue(newval);
} else {
propowner->SetProperty(m_framepropname, newval);
}
newval->Release();
}
if (bNegativeEvent)
m_blendframe=0.0;
/* Apply the pose if necessary*/
if (apply){
/* Priority test */
if (obj->SetActiveAction(this, priority, curtime)){
/* Get the underlying pose from the armature */
obj->GetPose(&m_pose);
// 2.4x function,
/* Override the necessary channels with ones from the action */
// XXX extract_pose_from_action(m_pose, m_action, m_localtime);
// 2.5x - replacement for extract_pose_from_action(...) above.
{
struct PointerRNA id_ptr;
Object *arm= obj->GetArmatureObject();
bPose *pose_back= arm->pose;
arm->pose= m_pose;
RNA_id_pointer_create((ID *)arm, &id_ptr);
animsys_evaluate_action(&id_ptr, m_action, NULL, m_localtime);
arm->pose= pose_back;
// 2.5x - could also do this but looks too high level, constraints use this, it works ok.
// Object workob; /* evaluate using workob */
// what_does_obaction((Scene *)obj->GetScene(), obj->GetArmatureObject(), &workob, m_pose, m_action, NULL, m_localtime);
}
// done getting the pose from the action
/* Perform the user override (if any) */
if (m_userpose){
extract_pose_from_pose(m_pose, m_userpose);
game_free_pose(m_userpose); //cant use MEM_freeN(m_userpose) because the channels need freeing too.
m_userpose = NULL;
}
#if 1
/* Handle blending */
if (m_blendin && (m_blendframe<m_blendin)){
/* If this is the start of a blending sequence... */
if ((m_blendframe==0.0) || (!m_blendpose)){
obj->GetMRDPose(&m_blendpose);
m_blendstart = curtime;
}
/* Find percentages */
newweight = (m_blendframe/(float)m_blendin);
game_blend_poses(m_pose, m_blendpose, 1.0 - newweight);
/* Increment current blending percentage */
m_blendframe = (curtime - m_blendstart)*KX_KetsjiEngine::GetAnimFrameRate();
if (m_blendframe>m_blendin)
m_blendframe = m_blendin;
}
#endif
m_lastUpdate = m_localtime;
obj->SetPose (m_pose);
}
else{
m_blendframe = 0.0;
}
}
if (!keepgoing){
m_blendframe = 0.0;
}
return keepgoing;
};