本文整理汇总了C++中CInstance::getParentAct方法的典型用法代码示例。如果您正苦于以下问题:C++ CInstance::getParentAct方法的具体用法?C++ CInstance::getParentAct怎么用?C++ CInstance::getParentAct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CInstance
的用法示例。
在下文中一共展示了CInstance::getParentAct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: group
//***************************************************************
void CAutoGroup::group(CObject *newEntityDesc, const NLMISC::CVectorD &createPosition)
{
//H_AUTO(R2_CAutoGroup_group)
CInstance *destGroup = getGroupingCandidate();
if (!destGroup || !_AutoGroupEnabled) return;
_AutoGroupEnabled = false; // force user to call 'update' again
clear();
// remove any activity, dialog, or event in the copy
CObject *behav = newEntityDesc->findAttr("Behavior");
if (behav)
{
behav->setObject("Actions", new CObjectTable());
behav->setObject("Activities", new CObjectTable());
behav->setObject("ChatSequences", new CObjectTable());
newEntityDesc->setObject("ActivitiesId", new CObjectTable());
}
nlassert(newEntityDesc);
nlassert(destGroup);
std::string targetGroupId;
if (destGroup->isKindOf("NpcGrpFeature"))
{
// make relative to newgroup and insert
CVectorD relPos = createPosition;
CDisplayerVisual *vd = destGroup->getDisplayerVisual();
if (vd)
{
relPos = relPos - vd->getWorldPos();
}
newEntityDesc->setObject("Position", buildVector(relPos));
targetGroupId = destGroup->getId();
}
else
{
// other is a standalone entity -> create a new group
std::auto_ptr<CObject> newGroup(getEditor().getDMC().newComponent("NpcGrpFeature"));
if (!newGroup.get())
{
nlwarning("Syntax error in r2_features_npc_group.lua.");
getEditor().getDMC().getActionHistoric().endAction();
getEditor().getDMC().flushActions();
return;
}
ucstring readableName;
CLuaState &ls = getEditor().getLua();
R2::getEditor().getEnv()["PaletteIdToGroupTranslation"][newEntityDesc->getAttr("Base")->toString()].push();
if (ls.isString(-1))
readableName.fromUtf8(ls.toString(-1));
ucstring ucGroupName = ucstring(readableName + " " + CI18N::get("uiR2EDNameGroup").toUtf8());
newGroup->set("Name", getEditor().genInstanceName(ucGroupName).toUtf8());
getEditor().getDMC().requestInsertNode(destGroup->getParentAct()->getId(),
"Features",
-1,
"",
newGroup.get());
targetGroupId = getString(newGroup.get(), "InstanceId");
// move target instance in that group (becomes the leader)
getEditor().getDMC().requestMoveNode(destGroup->getId(), "", -1, targetGroupId, "Components", -1);
}
// move newly created entity into target group
getEditor().getDMC().requestInsertNode(targetGroupId,
"Components",
-1,
"",
newEntityDesc);
getEditor().getDMC().getActionHistoric().endAction();
getEditor().getDMC().flushActions();
}