本文整理汇总了C++中CInstance::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ CInstance::getParent方法的具体用法?C++ CInstance::getParent怎么用?C++ CInstance::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CInstance
的用法示例。
在下文中一共展示了CInstance::getParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDisplayedInstance
//*********************************************************************************************************
CDisplayerVisual *CDisplayerVisualActivitySequence::getParentDV() const
{
//H_AUTO(R2_CDisplayerVisualActivitySequence_getParentDV)
CInstance *currParent = getDisplayedInstance()->getParent();
CDisplayerVisual *prevDV = NULL;
while (currParent)
{
prevDV = currParent->getDisplayerVisual();
if (prevDV) break;
currParent = currParent->getParent();
}
return prevDV;
}
示例2: getDisplayedInstance
// ***************************************************************
CDisplayerVisual *CDisplayerVisual::getParent()
{
if (_LastParentOk) return _LastParent;
CDisplayerVisual *result = NULL;
//H_AUTO(R2_CDisplayerVisual_getParent)
CInstance *inst = getDisplayedInstance();
nlassert(inst);
CInstance *parentInstance = inst->getParent();
if (parentInstance)
{
result = parentInstance->getDisplayerVisual();
}
_LastParent = result;
_LastParentOk = true;
return result;
}
示例3:
//*********************************************************************************************************
CDisplayerVisual *CDisplayerVisualActivitySequence::getPossibleGroupDV(CDisplayerVisual *entityDV)
{
//H_AUTO(R2_CDisplayerVisualActivitySequence_getPossibleGroupDV)
if (!entityDV) return NULL;
CInstance *parentGroup = entityDV->getDisplayedInstance()->getParent();
while (parentGroup)
{
if (dynamic_cast<CDisplayerVisualGroup *>(parentGroup->getDisplayerVisual()))
{
return parentGroup->getDisplayerVisual();
break;
}
parentGroup = parentGroup->getParent();
}
return entityDV;
}
示例4: getNameInParent
// ************************************************************************
void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray) const
{
//H_AUTO(R2_CObjectRefIdClient_getNameInParent)
if (_IndexInParent != -1 && _ParentInstance)
{
CObjectTable *parentInstanceTable = _ParentInstance->getObjectTable();
// check that index is still valid (true most of the case unless instance has been moved)
if (_IndexInParent <= (sint32) parentInstanceTable->getSize())
{
if (_IndexInParentArray == -1)
{
if (parentInstanceTable->getValue(_IndexInParent) == static_cast<const CObject *>(this))
{
name = parentInstanceTable->getKey(_IndexInParent);
indexInArray = -1;
return;
}
}
else
{
CObject *subObject = parentInstanceTable->getValue(_IndexInParent);
if (subObject->isTable())
{
CObjectTable *subTable = (CObjectTable *) subObject;
if (_IndexInParentArray < (sint32) subTable->getSize())
{
if (subTable->getValue(_IndexInParentArray) == static_cast<const CObject *>(this))
{
name = parentInstanceTable->getKey(_IndexInParent);
indexInArray = _IndexInParentArray;
}
}
}
}
}
}
// must search name in parent (on init or when object is moved)
updateParentInstancePtr();
if (!_ParentInstance)
{
_IndexInParent = -1;
_IndexInParentArray = -1;
name.clear();
indexInArray = -1;
return;
}
CObjectTable *parentInstanceTable = _ParentInstance->getObjectTable();
const CObject *ptrInParent = (parentInstanceTable == this->getParent()) ? static_cast<const CObject *>(this) : this->getParent();
// if instance is the direct parent (e.g object is not in an array of the parent)
for (uint k = 0; k < parentInstanceTable->getSize(); ++k)
{
if (parentInstanceTable->getValue(k) == ptrInParent)
{
_IndexInParent = k;
if (ptrInParent == this)
{
_IndexInParentArray = -1;
indexInArray = -1;
name = parentInstanceTable->getKey(_IndexInParent);
return;
}
else
{
// I'm in an array in my parent, retrieve the index
for (uint l = 0; l < getParent()->getSize(); ++l)
{
if (getParent()->getValue(l) == static_cast<const CObject *>(this))
{
name = parentInstanceTable->getKey(_IndexInParent);
_IndexInParentArray = l;
return;
}
}
}
}
}
// TMP TMP
nlwarning("=========================================");
CLuaIHMRyzom::dumpCallStack();
nlwarning("=========================================");
nlwarning("ObservedObject = %s", getValue().c_str());
CInstance *obsInstance = getEditor().getInstanceFromId(getValue().c_str());
nlwarning("ObservedObject instance ptr = %p", obsInstance);
nlwarning("=========================================");
if (obsInstance)
{
obsInstance->getLuaProjection().dump();
CInstance *parent = obsInstance->getParent();
nlwarning("ObservedObject parent instance ptr = %p", parent);
parent->getLuaProjection().dump();
}
nlassert(0); // not found in parent
}