void USoundCueGraphNode_Base::AllocateDefaultPins() { check(Pins.Num() == 0); CreateInputPins(); if (!IsRootNode()) { CreatePin(EGPD_Output, TEXT("SoundNode"), TEXT(""), NULL, /*bIsArray=*/ false, /*bIsReference=*/ false, TEXT("Output")); } }
//------------------------------------------------------------------------------ bool FGraphActionNode::IsGroupDividerNode() const { return (!IsActionNode() && !IsCategoryNode() && !IsRootNode() && (SectionID == INVALID_SECTION_ID)); }
//------------------------------------------------------------------------------ bool FGraphActionNode::IsSectionHeadingNode() const { return (!IsActionNode() && !IsCategoryNode() && !IsRootNode() && (SectionID != INVALID_SECTION_ID)); }
void BuddyMemoryAllocator::Free (void *ptr) { if (ptr == nullptr) { return; } unsigned long freeMemPtrValue = (unsigned long)(ptr); unsigned long beginAddrValue = (unsigned long)(m_MemAlloc); unsigned long endAddrValue = (unsigned long)(m_MemAlloc + AllocSize); // Test if this ptr is valid. if (freeMemPtrValue < beginAddrValue || freeMemPtrValue > endAddrValue) { // This Ptr is not belongs to this Memory Area. assert (false); } else { unsigned long offset = freeMemPtrValue - beginAddrValue; unsigned int beginSearchDepth = 0; unsigned int beginSearchIndex = 0; // The Following code used to find the search beginning level in the // tree by the offset // At first the offset must be divided exactly to the AllocUnit assert (offset % AllocUnit == 0); // Try to search up to find the highest Tree Level unsigned int exp = 0; unsigned int levelUnitSize = GetPowof2 (exp); for (exp = AllocUnitExp; exp <= AllocSizeExp; ++exp) { levelUnitSize = GetPowof2 (exp); if (offset % levelUnitSize == 0) { } else { --exp; break; } } levelUnitSize = GetPowof2 (exp); beginSearchDepth = TreeDepth - (exp - AllocUnitExp); auto levelBeginIndex = GetPowof2 (beginSearchDepth) - 1; beginSearchIndex = levelBeginIndex + offset / levelUnitSize; // auto tB = beginAddrValue; // auto tE = endAddrValue; // auto tP = freeMemPtrValue; // while (true) // { // if (tB == tP) // { // break; // } // else // { // if (tE - tB == AllocUnit) // { // if (tP != tB) // { // // This Ptr is not belongs to this Memory Area. // // It points to the Mid Part of AllocUnit. // assert (false); // } // else // { // break; // } // } // else // { // ++beginSearchDepth; // auto tMid = (tB + tE) / 2; // if (tP < tMid) // { // // Go To Left Tree To search // beginSearchIndex = GetLeftNodeIndex (beginSearchIndex); // tE = tMid; // } // else // { // beginSearchIndex = GetRightNodeIndex (beginSearchIndex); // tB = tMid; // } // } // } // } // Release if (IsLeaf (beginSearchIndex, m_TreeLength)) { assert (m_NodeTree [beginSearchIndex] == NodeState::eNODE_USED); m_NodeTree [beginSearchIndex] = NodeState::eNODE_UNUSE; } else { if (m_NodeTree [beginSearchIndex] == NodeState::eNODE_USED) { MarkTree (beginSearchIndex, NodeState::eNODE_UNUSE); } else if (m_NodeTree [beginSearchIndex] == NodeState::eNODE_OCCUPIED_TO_CHILD) { // Go left Tree to find NodeState::eNODE_USED while (true) { beginSearchIndex = GetLeftNodeIndex (beginSearchIndex); if (IsLeaf (beginSearchIndex, m_TreeLength)) { assert (m_NodeTree [beginSearchIndex] == NodeState::eNODE_USED); break; } else { if (m_NodeTree [beginSearchIndex] == NodeState::eNODE_USED) { break; } assert (m_NodeTree [beginSearchIndex] == NodeState::eNODE_OCCUPIED_TO_CHILD); } } MarkTree (beginSearchIndex, NodeState::eNODE_UNUSE); } else { // Data Structure Error. assert (false); } } // Try Combine. unsigned int nodeIndex = beginSearchIndex; while (true) { if (IsRootNode (nodeIndex)) { break; } else { unsigned int siblingNodeIndex = GetSiblingNode (nodeIndex); unsigned int parentIndex = GetParentNodeIndex (nodeIndex); if (m_NodeTree [siblingNodeIndex] == NodeState::eNODE_UNUSE && m_NodeTree [parentIndex] == NodeState::eNODE_OCCUPIED_TO_CHILD) { m_NodeTree [parentIndex] = NodeState::eNODE_UNUSE; nodeIndex = parentIndex; } else { break; } } } } }