Пример #1
0
	/** 
	 * Given a UObject index fetch the block and subindex for the serial number
	 * @param Index - UObject Index
	 * @param OutBlock - Serial Number Block
	 * @param OutSubIndex - Serial Number SubIndex
	 */
	void GetBlock(const int32& InIndex, int32& OutBlock, int32& OutSubIndex) const
	{
		OutBlock = InIndex / FSerialNumberBlock::SERIAL_NUMBER_BLOCK_SIZE;
		OutSubIndex = InIndex - OutBlock * FSerialNumberBlock::SERIAL_NUMBER_BLOCK_SIZE;
		checkfSlow(InIndex >= 0 && OutSubIndex >= 0 && OutSubIndex < FSerialNumberBlock::SERIAL_NUMBER_BLOCK_SIZE, TEXT("[Index:%d] [SubIndex:%d] invalid index or subindex"), InIndex, OutSubIndex);
		if (OutBlock >= FSerialNumberBlock::MAX_SERIAL_NUMBER_BLOCKS)
		{
			UE_LOG(LogWeakObjectPtr, Fatal, TEXT("[Index:%d] exceeds maximum number of UObjects, [Block:%d] increase MAX_SERIAL_NUMBER_BLOCKS"), InIndex, OutBlock);
		}
	}
Пример #2
0
/**
 * Finds the most-derived class which is a parent of both TestClass and this object's class.
 *
 * @param	TestClass	the class to find the common base for
 */
const UClass* UObjectBaseUtility::FindNearestCommonBaseClass( const UClass* TestClass ) const
{
	const UClass* Result = NULL;

	if ( TestClass != NULL )
	{
		const UClass* CurrentClass = GetClass();

		// early out if it's the same class or one is the parent of the other
		// (the check for TestClass->IsChildOf(CurrentClass) returns true if TestClass == CurrentClass
		if ( TestClass->IsChildOf(CurrentClass) )
		{
			Result = CurrentClass;
		}
		else if ( CurrentClass->IsChildOf(TestClass) )
		{
			Result = TestClass;
		}
		else
		{
			// find the nearest parent of TestClass which is also a parent of CurrentClass
			for ( UClass* Cls = TestClass->GetSuperClass(); Cls; Cls = Cls->GetSuperClass() )
			{
				if ( CurrentClass->IsChildOf(Cls) )
				{
					Result = Cls;
					break;
				}
			}
		}
	}

	// at this point, Result should only be NULL if TestClass is NULL
	checkfSlow(Result != NULL || TestClass == NULL, TEXT("No common base class found for object '%s' with TestClass '%s'"), *GetFullName(), *TestClass->GetFullName());
	return Result;
}
FORCEINLINE_DEBUGGABLE bool IsInvalidFaceIndex(PxU32 faceIndex)
{
	checkfSlow(InvalidQueryHit.faceIndex == 0xFFFFffff, TEXT("Engine code needs fixing: PhysX invalid face index sentinel has changed or is not part of default PxQueryHit!"));
	return (faceIndex == 0xFFFFffff);
}