// Updates the position of the document based on the style properties. void ElementDocument::UpdatePosition() { // We are only positioned relative to our parent, so if we're not parented we may as well bail now. if (GetParentNode() == NULL) return; Vector2f position; // Work out our containing block; relative offsets are calculated against it. Vector2f containing_block = GetParentNode()->GetBox().GetSize(Box::CONTENT); const Property *left = GetLocalProperty(LEFT); const Property *right = GetLocalProperty(RIGHT); if (left != NULL && left->unit != Property::KEYWORD) position.x = ResolveProperty(LEFT, containing_block.x); else if (right != NULL && right->unit != Property::KEYWORD) position.x = (containing_block.x - GetBox().GetSize(Box::MARGIN).x) - ResolveProperty(RIGHT, containing_block.x); else position.x = GetBox().GetEdge(Box::MARGIN, Box::LEFT); const Property *top = GetLocalProperty(TOP); const Property *bottom = GetLocalProperty(BOTTOM); if (top != NULL && top->unit != Property::KEYWORD) position.y = ResolveProperty(TOP, containing_block.y); else if (bottom != NULL && bottom->unit != Property::KEYWORD) position.y = (containing_block.y - GetBox().GetSize(Box::MARGIN).y) - ResolveProperty(BOTTOM, containing_block.y); else position.y = GetBox().GetEdge(Box::MARGIN, Box::TOP); SetOffset(position, NULL); }
void UBTDecorator::ValidateFlowAbortMode() { #if WITH_EDITOR if (GetParentNode() == NULL) { FlowAbortMode = EBTFlowAbortMode::None; return; } if (GetParentNode()->CanAbortLowerPriority() == false) { if (FlowAbortMode == EBTFlowAbortMode::Both) { FlowAbortMode = GetParentNode()->CanAbortSelf() ? EBTFlowAbortMode::Self : EBTFlowAbortMode::None; } else if (FlowAbortMode == EBTFlowAbortMode::LowerPriority) { FlowAbortMode = EBTFlowAbortMode::None; } } if (GetParentNode()->CanAbortSelf() == false) { if (FlowAbortMode == EBTFlowAbortMode::Both) { FlowAbortMode = GetParentNode()->CanAbortLowerPriority() ? EBTFlowAbortMode::LowerPriority : EBTFlowAbortMode::None; } else if (FlowAbortMode == EBTFlowAbortMode::Self) { FlowAbortMode = EBTFlowAbortMode::None; } } #endif }
bool JoinNodeTransaction::CanDoIt() const { if (NS_WARN_IF(!mLeftNode) || NS_WARN_IF(!mRightNode) || NS_WARN_IF(!mEditorBase) || !mLeftNode->GetParentNode()) { return false; } return mEditorBase->IsModifiableNode(*mLeftNode->GetParentNode()); }
void UBTDecorator_Loop::OnNodeActivation(FBehaviorTreeSearchData& SearchData) { FBTLoopDecoratorMemory* DecoratorMemory = GetNodeMemory<FBTLoopDecoratorMemory>(SearchData); FBTCompositeMemory* ParentMemory = GetParentNode()->GetNodeMemory<FBTCompositeMemory>(SearchData); if (ParentMemory->CurrentChild != ChildIndex) { // initialize counter if it's first activation DecoratorMemory->RemainingExecutions = NumLoops; } bool bShouldLoop = false; if (bInfiniteLoop) { // protect from truly infinite loop within single search bShouldLoop = SearchData.SearchId != DecoratorMemory->SearchId; DecoratorMemory->SearchId = SearchData.SearchId; } else { DecoratorMemory->RemainingExecutions--; bShouldLoop = DecoratorMemory->RemainingExecutions > 0; } // set child selection overrides if (bShouldLoop) { GetParentNode()->SetChildOverride(SearchData, ChildIndex); } }
//************************************ // 函数名称: GetNodeIndex // 返回类型: int // 函数说明: 取得相对于兄弟节点的当前索引 //************************************ int CTreeNodeUI::GetNodeIndex() { if(!GetParentNode() && !pTreeView) return -1; if(!GetParentNode() && pTreeView) return GetTreeIndex(); return GetParentNode()->GetTreeNodes().Find(this); }
// Updates the layout if necessary. void ElementDocument::_UpdateLayout() { layout_dirty = false; lock_layout++; Vector2f containing_block(0, 0); if (GetParentNode() != NULL) containing_block = GetParentNode()->GetBox().GetSize(); LayoutEngine layout_engine; layout_engine.FormatElement(this, containing_block); lock_layout--; }
Matrix3 plMaxNodeBase::GetVertToLocal(TimeValue t) { Matrix3 objectTM; // // If animated or we want forced into local space // still return OTM to fold into vertices // if( GetForceLocal() ) { return GetOTM(t); } // otherwise flatten our local to parent into the verts // note that our parent may have flattened their l2p into // their v2l as well. // so // objectTM = v2l * l2p * parentL2W // objectTM * Inverse(parentL2W) = v2l * l2p // objectTM * parentW2L = v2l (w/ l2p folded in) // // Objects transformation ObjectTM = OTM * nodeTM objectTM = GetObjectTM(t); Matrix3 w2p(true); if( !GetParentNode()->IsRootNode() ) w2p = GetWorldToParent(t); Matrix3 v2l = objectTM * w2p; return v2l; }
//// IsMovable /////////////////////////////////////////////////////////////// // Returns whether this node is "animated" (i.e. could move at runtime) hsBool plMaxNodeBase::IsMovable() { const char* dbgNodeName = GetName(); hsBool shouldBe = false; if( !CanConvert() ) return false; if( GetMovable() ) return true; if( GetItinerant() ) shouldBe = true; else if( FindSkinModifier() ) shouldBe = true; // Moved this to plAnimComponent (so GetMovable() will reveal it) /* else if( IsTMAnimated() ) shouldBe = true; */ if( shouldBe ) { SetMovable( true ); return true; } return ((plMaxNodeBase*)GetParentNode())->IsMovable(); }
// protected method nsresult nsHTMLTableRowElement::GetTable(nsIDOMHTMLTableElement** aTable) { NS_ENSURE_ARG_POINTER(aTable); *aTable = nsnull; nsCOMPtr<nsIDOMNode> sectionNode; nsresult rv = GetParentNode(getter_AddRefs(sectionNode)); if (!sectionNode) { return rv; } // We may not be in a section rv = CallQueryInterface(sectionNode, aTable); if (NS_SUCCEEDED(rv)) { return rv; } nsCOMPtr<nsIDOMNode> tableNode; rv = sectionNode->GetParentNode(getter_AddRefs(tableNode)); if (!tableNode) { return rv; } return CallQueryInterface(tableNode, aTable); }
void ElementDataGridExpandButton::ProcessEvent(Core::Event& event) { Core::Element::ProcessEvent(event); if (event == "click" && event.GetCurrentElement() == this) { // Look for the first data grid row above us, and toggle their on/off // state. Core::Element* parent = GetParentNode(); ElementDataGridRow* parent_row; do { parent_row = dynamic_cast< ElementDataGridRow* >(parent); parent = parent->GetParentNode(); } while (parent && !parent_row); if (parent_row) { parent_row->ToggleRow(); if (parent_row->IsRowExpanded()) { SetClass("collapsed", false); SetClass("expanded", true); } else { SetClass("collapsed", true); SetClass("expanded", false); } } } }
// Updates the configuration this element uses for its font. bool ElementTextDefault::UpdateFontConfiguration() { if (GetFontFaceHandle() == NULL) return false; font_dirty = false; // Build up a list of all applicable font effects set by our parent nodes. FontEffectMap font_effects; Element* element = GetParentNode(); while (element != NULL) { const ElementDefinition* element_definition = element->GetDefinition(); if (element_definition != NULL) element_definition->GetFontEffects(font_effects, element->GetStyle()->GetActivePseudoClasses()); element = element->GetParentNode(); } // Request a font layer configuration to match this set of effects. If this is different from // our old configuration, then return true to indicate we'll need to regenerate geometry. int new_configuration = GetFontFaceHandle()->GenerateLayerConfiguration(font_effects); if (new_configuration != font_configuration) { font_configuration = new_configuration; return true; } return false; }
void CControl::Initialize() { super::Initialize(); m_bUninitialize = false; if ( strcmp( m_strName.c_str(), DEFAULT_CONTROL_NAME ) == 0) { SetName( GetDefaultName() ); } else { CWindowManager::GetInstance()->RegisterControl( this ); } CalcInheritColor(); CRenderTarget* pMainRenderTarget = CRenderManager::GetInstance()->GetCurrentRenderTarget(); BEATS_ASSERT( pMainRenderTarget ); CNode* pParentNode = GetParentNode(); if ( nullptr == pParentNode) { CWindowManager::GetInstance()->AddToRoot( this ); } if (nullptr == pParentNode || pParentNode->GetType() != eNT_NodeGUI ) { //update control vertex by render target OnParentSizeChange( (float)pMainRenderTarget->GetWidth(), (float)pMainRenderTarget->GetHeight()); } }
void CFileHandle::SetUpLoadOrDownLoadCancel() { vector<STTASKINFO>::iterator iter = m_vecAllTaskInfo.begin(); for (iter; iter != m_vecAllTaskInfo.end(); iter++) { if ((iter->nTaskType == 0 || iter->nTaskType == 1) && (iter->nTaskState == 1) && (iter->IsNeedHandle)) { iter->nTaskState = 3; if (GetFileType() == 1) //如果是文件取消的话,要依次向上减少该任务ID处理的文件数 { CFileHandle *pParent = static_cast<CFileHandle*>(GetParentNode()); while(pParent != NULL) { pParent->AutoDecreaseHandleFileNum(iter->nTaskID); if ((pParent->GetAllTaskChildFileCount() == 0) && (!pParent->IsNeedHandle(iter->nTaskID))) { pParent->DeleteTask(iter->nTaskID); } pParent = static_cast<CFileHandle*>(pParent->GetParentNode()); } } } } }
void UBTNode::InitializeInSubtree(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, int32& NextInstancedIndex, EBTMemoryInit::Type InitType) const { if (bCreateNodeInstance) { // composite nodes can't be instanced! check(IsA(UBTCompositeNode::StaticClass()) == false); UBTNode* NodeInstance = OwnerComp.NodeInstances.IsValidIndex(NextInstancedIndex) ? OwnerComp.NodeInstances[NextInstancedIndex] : NULL; if (NodeInstance == NULL) { NodeInstance = NewObject<UBTNode>(&OwnerComp, GetClass(), GetFName(), RF_NoFlags, (UObject*)(this)); NodeInstance->InitializeNode(GetParentNode(), GetExecutionIndex(), GetMemoryOffset(), GetTreeDepth()); NodeInstance->bIsInstanced = true; OwnerComp.NodeInstances.Add(NodeInstance); } check(NodeInstance); NodeInstance->SetOwner(OwnerComp.GetOwner()); FBTInstancedNodeMemory* MyMemory = GetSpecialNodeMemory<FBTInstancedNodeMemory>(NodeMemory); MyMemory->NodeIdx = NextInstancedIndex; NodeInstance->OnInstanceCreated(OwnerComp); NextInstancedIndex++; } else { InitializeMemory(OwnerComp, NodeMemory, InitType); } }
unsigned int CTreeNode::GetDepth() const { CTreeNode * parent = GetParentNode(); if (parent) return parent->GetDepth() + 1; return 0; }
void CControl::WorldToLocal(float &x, float &y) { CNode* pParent = GetParentNode(); if( pParent && pParent->GetType() == eNT_NodeGUI ) { down_cast<CControl*>(pParent)->WorldToLocal(x, y); } ParentToLocal(x, y); }
void UBTTask_WaitAnswer::SaveDefaultCameraData(UCameraComponent* Camera) { if (DefaultCameraLocation.IsZero() || DefaultCameraRotation.IsZero()) { DefaultCameraLocation = Camera->GetComponentLocation(); DefaultCameraRotation = Camera->GetComponentRotation(); UBTCompositeNode* Parent = GetParentNode(); SaveDefaultCameraDataForAll(Parent); } }
int PcpNodeRef::GetDepthBelowIntroduction() const { const PcpNodeRef parent = GetParentNode(); if (not parent) return 0; return _GetNonVariantPathElementCount(parent.GetPath()) - GetNamespaceDepth(); }
void CControl::LocalToWorld(float &x, float &y) { LocalToParent(x, y); CNode* pParent = GetParentNode(); if( pParent && pParent->GetType() == eNT_NodeGUI ) { down_cast<CControl*>(pParent)->LocalToWorld(x, y); } }
//// IsTMAnimatedRecur - test recursively up the chain /////////////////////////////////////////////////////////////// hsBool plMaxNodeBase::IsTMAnimatedRecur() { const char* dbgNodeName = GetName(); hsBool shouldBe = false; if( !CanConvert() ) return false; if( IsTMAnimated() ) return true; return ((plMaxNodeBase*)GetParentNode())->IsTMAnimatedRecur(); }
void TabbedFolderNodeConfig::CheckRestrictions() { Enable(CNFN_Liquid, control.IsLiquid()); Enable(CNFN_Gas, control.IsGas()); Enable(CNFN_Matrix, control.IsLiquid() && control.IsDual()); Enable(CNFN_CurveFiles, control.UseCurveFiles()); Invalidate(); UpdateWindow(); GetParentNode()->CheckRestrictions(); }
bool CControl::HandleTouchEvent( CTouchEvent* event ) { bool bRet = false; if ( m_bResiveTouchEvent ) { const CVec2& pos = event->GetTouchPoint(); if ( event->GetType() == eET_EVENT_TOUCH_MOVED ) { m_bTouchInRect = HitTest(pos.x, pos.y); if ( m_bTouchInRect ) { OnTouchMove( pos.x, pos.y ); bRet = true; } else { if ( m_bClick ) { StopClickAnimation(); } } } else { if( event->GetType() == eET_EVENT_TOUCH_ENDED && m_bClick ) { OnTouchEnded( pos.x, pos.y ); } else { bRet = HitTest(pos.x, pos.y); if(bRet) { if ( m_bDispatchEventToParent ) { CNode* pParent = GetParentNode(); bRet = pParent && pParent->GetType() == eNT_NodeGUI; if (bRet) { down_cast<CControl*>(pParent)->DispatchEvent( event->GetType(), pos.x, pos.y, event->GetDelta() ); } } else { DispatchEvent( event->GetType(), pos.x, pos.y, event->GetDelta() ); } } } } } return bRet; }
Matrix3 plMaxNodeBase::GetLocalToParent(TimeValue t) { // l2w = l2p * parentL2W // l2w * Inverse(parentL2W) = l2p // l2w * parentW2L = l2p Matrix3 l2w = GetLocalToWorld(t); Matrix3 w2p(true); if( !GetParentNode()->IsRootNode() ) w2p = GetWorldToParent(t); Matrix3 l2p = l2w * w2p; return l2p; }
nuiTreeNodePtr nuiPopupMenu::GetParentNode(nuiTreeNodePtr pParent, nuiTreeNodePtr pNode) { for (uint32 i = 0; i < pParent->GetChildrenCount(); i++) { nuiTreeNodePtr pChild = dynamic_cast<nuiTreeNodePtr>(pParent->GetChild(i)); if (pChild == pNode) return pParent; pChild = GetParentNode(pChild, pNode); if (pChild) return pChild; } return NULL; }
bool UBTDecorator::IsFlowAbortModeValid() const { #if WITH_EDITOR if (GetParentNode() == NULL || (GetParentNode()->CanAbortLowerPriority() == false && GetParentNode()->CanAbortSelf() == false)) { return (FlowAbortMode == EBTFlowAbortMode::None); } if (GetParentNode()->CanAbortLowerPriority() == false) { return (FlowAbortMode == EBTFlowAbortMode::None || FlowAbortMode == EBTFlowAbortMode::Self); } if (GetParentNode()->CanAbortSelf() == false) { return (FlowAbortMode == EBTFlowAbortMode::None || FlowAbortMode == EBTFlowAbortMode::LowerPriority); } #endif return true; }
void OutlookBar2::CheckRestrictions() { OutlookPane* pOutlookPane = static_cast<OutlookPane*>(GetParentNode()); pOutlookPane->EnableItem(0, MN_Layers, control.IsLayered()); pOutlookPane->EnableItem(0, MN_FitSpecification, control.IsOptimization() || control.IsRange()); pOutlookPane->EnableItem(0, MN_Optimization, control.IsOptimization()); pOutlookPane->EnableItem(0, MN_Sampling, control.IsSampleSim()); pOutlookPane->EnableItem(0, MN_Vary, !control.IsSampleSim()); pOutlookPane->Invalidate(); pOutlookPane->UpdateWindow(); }
// Updates the layout if necessary. void ElementDocument::UpdateLayout() { if (layout_dirty) { if (lock_layout) return; lock_layout = true; GetStyle()->UpdateDefinition(); Vector2f containing_block(0, 0); if (GetParentNode() != NULL) containing_block = GetParentNode()->GetBox().GetSize(); LayoutEngine layout_engine; layout_engine.FormatElement(this, containing_block); layout_dirty = false; lock_layout = false; } }
// protected method nsresult nsHTMLTableRowElement::GetSection(nsIDOMHTMLTableSectionElement** aSection) { NS_ENSURE_ARG_POINTER(aSection); *aSection = nsnull; nsCOMPtr<nsIDOMNode> sectionNode; nsresult rv = GetParentNode(getter_AddRefs(sectionNode)); if (NS_SUCCEEDED(rv) && sectionNode) { rv = CallQueryInterface(sectionNode, aSection); } return rv; }
void UBTDecorator_ConditionalLoop::OnNodeDeactivation(struct FBehaviorTreeSearchData& SearchData, EBTNodeResult::Type NodeResult) { if (NodeResult != EBTNodeResult::Aborted && SearchData.OwnerComp) { const bool bEvalResult = EvaluateOnBlackboard(SearchData.OwnerComp->GetBlackboardComponent()); UE_VLOG(SearchData.OwnerComp->GetOwner(), LogBehaviorTree, Verbose, TEXT("Loop condition: %s -> %s"), bEvalResult ? TEXT("true") : TEXT("false"), (bEvalResult != IsInversed()) ? TEXT("run again!") : TEXT("break")); if (bEvalResult != IsInversed()) { GetParentNode()->SetChildOverride(SearchData, GetChildIndex()); } } }
// After DoTransaction() and RedoTransaction(), the left node is removed from // the content tree and right node remains. NS_IMETHODIMP JoinNodeTransaction::DoTransaction() { if (NS_WARN_IF(!mEditorBase) || NS_WARN_IF(!mLeftNode) || NS_WARN_IF(!mRightNode)) { return NS_ERROR_NOT_INITIALIZED; } // Get the parent node nsCOMPtr<nsINode> leftParent = mLeftNode->GetParentNode(); NS_ENSURE_TRUE(leftParent, NS_ERROR_NULL_POINTER); // Verify that mLeftNode and mRightNode have the same parent if (leftParent != mRightNode->GetParentNode()) { NS_ASSERTION(false, "Nodes do not have same parent"); return NS_ERROR_INVALID_ARG; } // Set this instance's mParent. Other methods will see a non-null mParent // and know all is well mParent = leftParent; mOffset = mLeftNode->Length(); return mEditorBase->DoJoinNodes(mRightNode, mLeftNode, mParent); }