本文整理汇总了C++中Animatable::GetParamBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ Animatable::GetParamBlock方法的具体用法?C++ Animatable::GetParamBlock怎么用?C++ Animatable::GetParamBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animatable
的用法示例。
在下文中一共展示了Animatable::GetParamBlock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateParameters
bool HoudiniEngineMesh::UpdateParameters(TimeValue t)
{
bool need_cook = false;
if ( assetId >= 0 )
{
hapi::Asset asset(assetId);
if (asset.isValid())
{
INode* node = this->GetINode();
if (node)
{
MSTR pname;
int subs = node->NumSubs();
for (int i = 0; i < subs; ++i)
{
pname = node->SubAnimName(i);
Animatable* anim = node->SubAnim(i);
if (anim)
{
int blocks = anim->NumParamBlocks();
for (int block = 0; block < blocks; ++block)
{
IParamBlock2 *pblock = anim->GetParamBlock(block);
if (pblock) {
TSTR pbname = pblock->GetLocalName();
int nNumParams = pblock->NumParams();
ParamID id;
std::map<std::string, hapi::Parm> params = asset.parmMap();
for (int i = 0; i < nNumParams; i++)
{
id = pblock->IndextoID(i);
MSTR pname = pblock->GetLocalName(id);
std::string hname = CStr::FromMSTR(pblock->GetLocalName(id)).data();
int index = (int)(hname[hname.size() - 1] - '0');
hname.pop_back();
if (std::string("__he_input") == hname)
{
// input node
INode* inputnode = pblock->GetINode(id, t);
if (inputnode)
{
need_cook = SetInputNode(index, inputnode) || need_cook;
}
}
else
{
// parameters
if (params.find(hname) != params.end())
{
hapi::Parm parm = params[hname];
if (HAPI_ParmInfo_IsInt(&parm.info()))
{
int value = pblock->GetInt(id, t);
if (value != parm.getIntValue(index))
{
parm.setIntValue(index, value);
need_cook = true;
}
}
else if (HAPI_ParmInfo_IsFloat(&parm.info()))
{
float value = pblock->GetFloat(id, t);
if (value != parm.getFloatValue(index))
{
parm.setFloatValue(index, value);
need_cook = true;
}
}
else if (HAPI_ParmInfo_IsString(&parm.info()))
{
std::string value = CStr::FromMSTR(pblock->GetStr(id, t));
if (value != parm.getStringValue(index))
{
parm.setStringValue(index, value.c_str());
need_cook = true;
}
}
}
}
}
}
}
}
}
}
}
}
return need_cook;
}