void FFoliageTypePaintingCustomization::CustomizeDetails(IDetailLayoutBuilder& DetailLayoutBuilder)
{
    // Hide categories we are not going to customize
    FFoliageTypeCustomizationHelpers::HideFoliageCategory(DetailLayoutBuilder, "Procedural");
    FFoliageTypeCustomizationHelpers::HideFoliageCategory(DetailLayoutBuilder, "Reapply");

    // Show all the properties with a reapply condition or that depend on another variable to be relevant
    TMap<const FName, IDetailPropertyRow*> PropertyRowsByName;
    ShowFoliagePropertiesForCategory(DetailLayoutBuilder, "Painting", PropertyRowsByName);
    ShowFoliagePropertiesForCategory(DetailLayoutBuilder, "Placement", PropertyRowsByName);
    ShowFoliagePropertiesForCategory(DetailLayoutBuilder, "InstanceSettings", PropertyRowsByName);

    // Density adjustment factor should only be visible when reapplying
    FFoliageTypeCustomizationHelpers::ModifyFoliagePropertyRow(*PropertyRowsByName.Find(GET_MEMBER_NAME_CHECKED(UFoliageType, DensityAdjustmentFactor)),
            TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FFoliageTypePaintingCustomization::GetReapplyModeVisibility)),
            TAttribute<bool>());

    // Set the scale visibility attribute for each axis
    Scaling = DetailLayoutBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(UFoliageType, Scaling));
    ReapplyScaling = DetailLayoutBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(UFoliageType, ReapplyScaling));
    FFoliageTypeCustomizationHelpers::ModifyFoliagePropertyRow(*PropertyRowsByName.Find(GET_MEMBER_NAME_CHECKED(UFoliageType, ScaleX)),
            TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FFoliageTypePaintingCustomization::GetScaleVisibility, EAxis::X)),
            TAttribute<bool>());

    FFoliageTypeCustomizationHelpers::ModifyFoliagePropertyRow(*PropertyRowsByName.Find(GET_MEMBER_NAME_CHECKED(UFoliageType, ScaleY)),
            TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FFoliageTypePaintingCustomization::GetScaleVisibility, EAxis::Y)),
            TAttribute<bool>());

    FFoliageTypeCustomizationHelpers::ModifyFoliagePropertyRow(*PropertyRowsByName.Find(GET_MEMBER_NAME_CHECKED(UFoliageType, ScaleZ)),
            TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FFoliageTypePaintingCustomization::GetScaleVisibility, EAxis::Z)),
            TAttribute<bool>());
}
void UBlendSpaceBase::ReplaceReferredAnimations(const TMap<UAnimationAsset*, UAnimationAsset*>& ReplacementMap)
{
	Super::ReplaceReferredAnimations(ReplacementMap);

	TArray<FBlendSample> NewSamples;
	for (auto Iter = SampleData.CreateIterator(); Iter; ++Iter)
	{
		FBlendSample& Sample = (*Iter);
		UAnimSequence* Anim = Sample.Animation;

		if ( Anim )
		{
			UAnimSequence* const* ReplacementAsset = (UAnimSequence*const*)ReplacementMap.Find(Anim);
			if(ReplacementAsset)
			{
				Sample.Animation = *ReplacementAsset;
				Sample.Animation->ReplaceReferredAnimations(ReplacementMap);
				NewSamples.Add(Sample);
			}
		}
	}

	if (PreviewBasePose)
	{
		UAnimSequence* const* ReplacementAsset = (UAnimSequence*const*)ReplacementMap.Find(PreviewBasePose);
		if(ReplacementAsset)
		{
			PreviewBasePose = *ReplacementAsset;
			PreviewBasePose->ReplaceReferredAnimations(ReplacementMap);
		}
	}
	
	SampleData = NewSamples;
}
Ejemplo n.º 3
0
UFunction* FindNetServiceFunctionById(int16 RPCId)
{
	UFunction** Function = RPCFunctionMap.Find(RPCId);
	if (!Function)
	{
		for (TObjectIterator<UClass> ClassIt; ClassIt; ++ClassIt)
		{
			UClass* Class = *ClassIt;
			if (Class->IsChildOf(AActor::StaticClass())
				&& !(Class->HasAnyClassFlags(CLASS_Abstract | CLASS_Deprecated)))
			{
				for (TFieldIterator<UFunction> FuncIt(Class); FuncIt; ++FuncIt) 
				{
					UFunction* CurFunc = *FuncIt;
					if (CurFunc->RPCId > 0)
					{
						RPCFunctionMap.Add(CurFunc->RPCId, CurFunc);
					}
				}
			}
		}
		
		Function = RPCFunctionMap.Find(RPCId);
	}

	return *Function;
}
	/** 
	 * Called twice typically. Once when a log category is constructed, and then once after we have processed the command line.
	 * The second call is needed to make sure the default is set correctly when it is changed on the command line or config file.
	 **/
	void SetupSuppress(FLogCategoryBase* Destination, FName NameFName)
	{
		// now maybe this was set at boot, in which case we override what it had
		uint8* Boot = BootAssociations.Find(NameFName);
		if (Boot)
		{
			Destination->DefaultVerbosity = *Boot;
			Destination->ResetFromDefault();
		}
		else
		{
			// see if we had a boot global override
			static FName NAME_BootGlobal(TEXT("BootGlobal"));
			Boot = BootAssociations.Find(NAME_BootGlobal);
			if (Boot)
			{
				Destination->DefaultVerbosity = *Boot;
				Destination->ResetFromDefault();
			}
		}
		// store off the last non-zero one for toggle
		checkSlow(!(Destination->Verbosity & ELogVerbosity::BreakOnLog)); // this bit is factored out of this variable, always
		if (Destination->Verbosity)
		{
			// currently on, store this in the pending and clear it
			ToggleAssociations.Add(NameFName, Destination->Verbosity);
		}
	}
Ejemplo n.º 5
0
bool FCollection::LoadHeaderPairs(const TMap<FString,FString>& InHeaderPairs)
{
	// These pairs will appeared at the top of the file being loaded
	// First find all the known pairs
	const FString* Version = InHeaderPairs.Find(TEXT("FileVersion"));
	if ( !Version )
	{
		// FileVersion is required
		return false;
	}

	const FString* Type = InHeaderPairs.Find(TEXT("Type"));
	if ( !Type )
	{
		// Type is required
		return false;
	}

	FileVersion = FCString::Atoi(**Version);

	if ( *Type == TEXT("Dynamic") )
	{
		// @todo Set this file up to be dynamic
	}

	return FileVersion > 0;
}
Ejemplo n.º 6
0
	/**
	 * Create a pool to hold a given function's message buffers
	 * Creates the message prototype and holds it in the never released head of the list
	 * 
	 * @return head of a new linked list for the given function
	 */
	PoolMapping* CreatePool(class UFunction* OwnerFunc)
	{
		TWeakObjectPtr<UFunction> FuncPtr(OwnerFunc);
		PoolMapping* FuncPool = Pool.Find(FuncPtr);
		check(!FuncPool);

		PoolMapping NewPool;
		NewPool.Prototype.OwnerFunc = OwnerFunc;
		NewPool.Prototype.Msg = const_cast<google::protobuf::Message*>(CreateRPCPrototype(OwnerFunc)); 
		Pool.Add(OwnerFunc, NewPool);
		return Pool.Find(OwnerFunc);
	}
void SortTriangles_MergeContiguous( int32 NumTriangles, int32 NumVertices, const FSoftSkinVertex* Vertices, uint32* Indices )
{
	// Build the list of triangle sets
	TArray<uint32> TriSet;
	GetConnectedTriangleSets( NumTriangles, Indices, TriSet );

	// Mapping from triangle set number to the array of indices that make up the contiguous strip.
	TMap<uint32, TArray<uint32> > Strips;

	int32 Index=0;
	for( int32 s=0;s<TriSet.Num();s++ )
	{
		// Store the indices for this triangle in the appropriate contiguous set.
		TArray<uint32>* ThisStrip = Strips.Find(TriSet[s]);
		if( !ThisStrip )
		{
			ThisStrip = &Strips.Add(TriSet[s],TArray<uint32>());
		}

		// Add the three indices for this triangle.
		ThisStrip->Add(Indices[Index++]);
		ThisStrip->Add(Indices[Index++]);
		ThisStrip->Add(Indices[Index++]);
	}

	// Export the indices in the same order.
	Index = 0;
	int32 PrevSet = INDEX_NONE;
	for( int32 s=0;s<TriSet.Num();s++ )
	{
		// The first time we see a triangle in a new set, export all the indices from that set.
		if( TriSet[s] != PrevSet )
		{
			TArray<uint32>* ThisStrip = Strips.Find(TriSet[s]);
			check(ThisStrip);

			if( ThisStrip->Num() > 0 )
			{
				check(Index < NumTriangles*3);
				FMemory::Memcpy( &Indices[Index], &(*ThisStrip)[0], ThisStrip->Num() * sizeof(uint32) );
				Index += ThisStrip->Num();

				// We want to export the whole strip contiguously, so we empty it so we don't export the
				// indices again when we see the same TriSet later.
				ThisStrip->Empty();
			}
		}
		PrevSet = TriSet[s];
	}
	check(Index == NumTriangles*3);
}
// DEPRECATED
void ADEPRECATED_VolumeAdaptiveBuilder::ExpandFrontierTowardsTarget(UDoNNavigationVolumeComponent* current, UDoNNavigationVolumeComponent* neighbor, DoNNavigation::PriorityQueue<UDoNNavigationVolumeComponent*> &frontier, TMap<UDoNNavigationVolumeComponent*, FVector> &entryPointMap, bool &goalFound, UDoNNavigationVolumeComponent* start, UDoNNavigationVolumeComponent* goal, FVector origin, FVector destination, TMap<UDoNNavigationVolumeComponent*, int>& VolumeVsCostMap, bool DrawDebug, TMap<UDoNNavigationVolumeComponent*, TArray<UDoNNavigationVolumeComponent*>> &PathVolumeSolutionMap)
{		
	if (DrawDebug)
	{		
		DisplayDebugVolume(current, FColor::Red);
		DisplayDebugVolume(neighbor, FColor::Blue);
	}
	float SegmentDist = 0;
	FVector nextEntryPoint;

	TArray<UDoNNavigationVolumeComponent*> PathSolutionSoFar = PathVolumeSolutionMap.FindOrAdd(current);
	
	nextEntryPoint = NavEntryPointsForTraversal(*entryPointMap.Find(current), current, neighbor, SegmentDist, DrawDebug);

	entryPointMap.Add(neighbor, nextEntryPoint);

	if (nextEntryPoint == *entryPointMap.Find(current)) // i.e. no traversal solution exists
	{
		if (DrawDebug)
		{
			DisplayDebugVolume(current, FColor::Red);
			DisplayDebugVolume(neighbor, FColor::Blue);
		}

		UE_LOG(LogTemp, Log, TEXT("Skipping neighbor due to lack of traversal solution"));
		return;
	}

	//int new_cost = *VolumeVsCostMap.Find(current) + graph.cost(current, next);
	int new_cost = *VolumeVsCostMap.Find(current) + SegmentDist;

	if (!VolumeVsCostMap.Contains(neighbor) || new_cost < *VolumeVsCostMap.Find(neighbor))
	{	
		PathSolutionSoFar.Add(neighbor);
		PathVolumeSolutionMap.Add(neighbor, PathSolutionSoFar);
		VolumeVsCostMap.Add(neighbor, new_cost);

		float heuristic = FVector::Dist(nextEntryPoint, destination);
		int priority = new_cost + heuristic;

		if (DrawDebug)
		{
			DrawDebugLine(GetWorld(), nextEntryPoint, destination, FColor::Red, true, -1.f, 0, 10.f);
			FString priorityText = FString::Printf(TEXT("Priority: %d"), priority);
			UE_LOG(LogTemp, Log, TEXT("%s"), *priorityText);
		}			

		frontier.put(neighbor, priority);		
	}
}
	bool Browse(HWND hWnd)
	{
		// Get the currently bound engine directory for the project
		const FString *RootDir = Installations.Find(Identifier);
		FString EngineRootDir = (RootDir != NULL)? *RootDir : FString();

		// Browse for a new directory
		FString NewEngineRootDir;
		if (!FDesktopPlatformModule::Get()->OpenDirectoryDialog(hWnd, TEXT("Select the Unreal Engine installation to use for this project"), EngineRootDir, NewEngineRootDir))
		{
			return false;
		}

		// Check it's a valid directory
		if (!FPlatformInstallation::NormalizeEngineRootDir(NewEngineRootDir))
		{
			FPlatformMisc::MessageBoxExt(EAppMsgType::Ok, TEXT("The selected directory is not a valid engine installation."), TEXT("Error"));
			return false;
		}

		// Check that it's a registered engine directory
		FString NewIdentifier;
		if (!FDesktopPlatformModule::Get()->GetEngineIdentifierFromRootDir(NewEngineRootDir, NewIdentifier))
		{
			FPlatformMisc::MessageBoxExt(EAppMsgType::Ok, TEXT("Couldn't register engine installation."), TEXT("Error"));
			return false;
		}

		// Update the identifier and return
		Identifier = NewIdentifier;
		return true;
	}
FVertexDeclarationRHIRef FOpenGLDynamicRHI::RHICreateVertexDeclaration(const FVertexDeclarationElementList& Elements)
{
	// Construct a key from the elements.
	FOpenGLVertexDeclarationKey Key(Elements);

	// Check for a cached vertex declaration.
	FVertexDeclarationRHIRef* VertexDeclarationRefPtr = GOpenGLVertexDeclarationCache.Find(Key);
	if (VertexDeclarationRefPtr == NULL)
	{
		// Create and add to the cache if it doesn't exist.
		VertexDeclarationRefPtr = &GOpenGLVertexDeclarationCache.Add(Key,new FOpenGLVertexDeclaration(Key.VertexElements));
		
		check(VertexDeclarationRefPtr);
		check(IsValidRef(*VertexDeclarationRefPtr));
		FShaderCache::LogVertexDeclaration(Elements, *VertexDeclarationRefPtr);
	}

	// The cached declaration must match the input declaration!
	check(VertexDeclarationRefPtr);
	check(IsValidRef(*VertexDeclarationRefPtr));
	FOpenGLVertexDeclaration* OpenGLVertexDeclaration = (FOpenGLVertexDeclaration*)VertexDeclarationRefPtr->GetReference();
	checkSlow(OpenGLVertexDeclaration->VertexElements == Key.VertexElements);

	return *VertexDeclarationRefPtr;
}
Ejemplo n.º 11
0
void AddStateWeight(TMap<int32, float>& StateWeightMap, int32 StateIndex, float Weight)
{
	if (!StateWeightMap.Find(StateIndex))
	{
		StateWeightMap.Add(StateIndex) = Weight;
	}
}
bool SAnimCurveListRow::GetActiveWeight(float& OutWeight) const
{
	bool bFoundActive = false;

	// If anim viewer
	TSharedPtr<SAnimCurveViewer> AnimCurveViewer = AnimCurveViewerPtr.Pin();
	if (AnimCurveViewer.IsValid())
	{
		// If anim instance
		UAnimInstance* AnimInstance = PreviewScenePtr.Pin()->GetPreviewMeshComponent()->GetAnimInstance();
		if (AnimInstance)
		{
			// See if curve is in active set, attribute curve should have everything
			TMap<FName, float> CurveList;
			AnimInstance->GetAnimationCurveList(EAnimCurveType::AttributeCurve, CurveList);

			float* CurrentValue = CurveList.Find(Item->SmartName.DisplayName);
			if (CurrentValue)
			{
				OutWeight = *CurrentValue;
				// Remember we found it
				bFoundActive = true;
			}
		}
	}

	return bFoundActive;
}
Ejemplo n.º 13
0
/** Recursively generates a histogram of nodes and stores their timing in TimingResult. */
static void GatherStatsEventNode(FGPUProfilerEventNode* Node, int32 Depth, TMap<FString, FGPUProfilerEventNodeStats>& EventHistogram)
{
	if (Node->NumDraws > 0 || Node->Children.Num() > 0)
	{
		Node->TimingResult = Node->GetTiming() * 1000.0f;

		FGPUProfilerEventNodeStats* FoundHistogramBucket = EventHistogram.Find(Node->Name);
		if (FoundHistogramBucket)
		{
			FoundHistogramBucket->NumDraws += Node->NumDraws;
			FoundHistogramBucket->NumPrimitives += Node->NumPrimitives;
			FoundHistogramBucket->NumVertices += Node->NumVertices;
			FoundHistogramBucket->TimingResult += Node->TimingResult;
			FoundHistogramBucket->NumEvents++;
		}
		else
		{
			FGPUProfilerEventNodeStats NewNodeStats;
			NewNodeStats.NumDraws = Node->NumDraws;
			NewNodeStats.NumPrimitives = Node->NumPrimitives;
			NewNodeStats.NumVertices = Node->NumVertices;
			NewNodeStats.TimingResult = Node->TimingResult;
			NewNodeStats.NumEvents = 1;
			EventHistogram.Add(Node->Name, NewNodeStats);
		}

		for (int32 ChildIndex = 0; ChildIndex < Node->Children.Num(); ChildIndex++)
		{
			// Traverse children
			GatherStatsEventNode(Node->Children[ChildIndex], Depth + 1, EventHistogram);
		}
	}
}
FBlueprintNativeCodeGenManifest& FBlueprintNativeCodeGenModule::GetManifest(const TCHAR* PlatformName)
{
	FString PlatformNameStr(PlatformName);
	TUniquePtr<FBlueprintNativeCodeGenManifest>* Result = Manifests.Find(PlatformNameStr);
	check(Result->IsValid());
	return **Result;
}
int32 URuntimeMeshLibrary::GetNewIndexForOldVertIndex(const FPositionVertexBuffer* PosBuffer, const FStaticMeshVertexBuffer* VertBuffer, const FColorVertexBuffer* ColorBuffer,
	TMap<int32, int32>& MeshToSectionVertMap, int32 VertexIndex, int32 NumUVChannels, TFunction<int32(FVector Position, FVector TangentX, FVector TangentY, FVector TangentZ)> VertexCreator,
	TFunction<void(int32 VertexIndex, int32 UVIndex, FVector2D UV)> UVSetter, TFunction<void(int32 VertexIndex, FColor Color)> ColorSetter)
{
	int32* FoundIndex = MeshToSectionVertMap.Find(VertexIndex);
	if (FoundIndex != nullptr)
	{
		return *FoundIndex;
	}
	else
	{
		int32 NewVertexIndex = VertexCreator(
			PosBuffer->VertexPosition(VertexIndex),
			VertBuffer->VertexTangentX(VertexIndex),
			VertBuffer->VertexTangentY(VertexIndex),
			VertBuffer->VertexTangentZ(VertexIndex));

		if (ColorBuffer && ColorBuffer->GetNumVertices() > (uint32)NewVertexIndex)
		{
			ColorSetter(NewVertexIndex, ColorBuffer->VertexColor(VertexIndex));
		}

		int32 NumTexCoordsToCopy = FMath::Min(NumUVChannels, (int32)VertBuffer->GetNumTexCoords());
		for (int32 Index = 0; Index < NumTexCoordsToCopy; Index++)
		{
			UVSetter(NewVertexIndex, Index, VertBuffer->GetVertexUV(VertexIndex, Index));
		}

		MeshToSectionVertMap.Add(VertexIndex, NewVertexIndex);
		return NewVertexIndex;
	}
}
	virtual void AssociateSuppress(FLogCategoryBase* Destination)
	{
		FName NameFName(Destination->CategoryFName);
		check(Destination);
		check(!Associations.Find(Destination)); // should not have this address already registered
		Associations.Add(Destination, NameFName);
		bool bFoundExisting = false;
		for (TMultiMap<FName, FLogCategoryBase*>::TKeyIterator It(ReverseAssociations, NameFName); It; ++It)
		{
			if (It.Value() == Destination)
			{
				UE_LOG(LogHAL, Fatal,TEXT("Log suppression category %s was somehow declared twice with the same data."), *NameFName.ToString());
			}
			// if it is registered, it better be the same
			if (It.Value()->CompileTimeVerbosity != Destination->CompileTimeVerbosity)
			{
				UE_LOG(LogHAL, Fatal,TEXT("Log suppression category %s is defined multiple times with different compile time verbosity."), *NameFName.ToString());
			}
			// we take whatever the existing one has to keep them in sync always
			checkSlow(!(It.Value()->Verbosity & ELogVerbosity::BreakOnLog)); // this bit is factored out of this variable, always
			Destination->Verbosity = It.Value()->Verbosity;
			Destination->DebugBreakOnLog = It.Value()->DebugBreakOnLog;
			Destination->DefaultVerbosity = It.Value()->DefaultVerbosity;
			bFoundExisting = true;
		}
		ReverseAssociations.Add(NameFName, Destination);
		if (bFoundExisting)
		{
			return; // in no case is there anything more to do...we want to match the other ones
		}
		SetupSuppress(Destination, NameFName); // this might be done again later if this is being set up before appInit is called
	}
Ejemplo n.º 17
0
	/**
	 * Get an allocated message buffer from the free pool.  The ownership of the buffer
	 * is the responsibility of the caller until they are finished and call ReturnToPool.
	 * @param Function function signature that defines the kind of buffer to return
	 * 
	 * @return allocated buffer ready to be filled with data
	 */
	MessagePoolElem* GetNextFree(UFunction* Function)
	{
		// Create or allocate the appropriate pool to get a buffer from
		MessagePoolElem* NextMsg = NULL;
		TWeakObjectPtr<UFunction> FuncPtr(Function);
		PoolMapping* FuncPool = Pool.Find(FuncPtr);
		if (!FuncPool)
		{
			FuncPool = CreatePool(Function);
		}

		if (FuncPool)
		{
			if (FuncPool->FreeList)
			{
				// Retrieve and clear an existing allocation
				NextMsg = FuncPool->FreeList;
				FuncPool->FreeList = NextMsg->Next();

				NextMsg->Unlink();
				(**NextMsg).Msg->Clear();
			}
			else
			{
				// Create a new allocation from the head prototype
				NextMsg = new MessagePoolElem();
				(**NextMsg).OwnerFunc = FuncPtr;
				(**NextMsg).Msg = FuncPool->Prototype.Msg->New();
			}
		}

		return NextMsg;
	}
MatchmakerModels::Region PlayFab::MatchmakerModels::readRegionFromValue(const TSharedPtr<FJsonValue>& value)
{
    static TMap<FString, Region> _RegionMap;
    if (_RegionMap.Num() == 0)
    {
        // Auto-generate the map on the first use
        _RegionMap.Add(TEXT("USCentral"), RegionUSCentral);
        _RegionMap.Add(TEXT("USEast"), RegionUSEast);
        _RegionMap.Add(TEXT("EUWest"), RegionEUWest);
        _RegionMap.Add(TEXT("Singapore"), RegionSingapore);
        _RegionMap.Add(TEXT("Japan"), RegionJapan);
        _RegionMap.Add(TEXT("Brazil"), RegionBrazil);
        _RegionMap.Add(TEXT("Australia"), RegionAustralia);

    } 

	if(value.IsValid())
	{
	    auto output = _RegionMap.Find(value->AsString());
		if (output != nullptr)
			return *output;
	}


    return RegionUSCentral; // Basically critical fail
}
Ejemplo n.º 19
0
UK2Node::ERedirectType UK2Node_MakeStruct::DoPinsMatchForReconstruction(const UEdGraphPin* NewPin, int32 NewPinIndex, const UEdGraphPin* OldPin, int32 OldPinIndex)  const
{
	ERedirectType Result = UK2Node::DoPinsMatchForReconstruction(NewPin, NewPinIndex, OldPin, OldPinIndex);
	if ((ERedirectType_None == Result) && DoRenamedPinsMatch(NewPin, OldPin, false))
	{
		Result = ERedirectType_Custom;
	}
	else if ((ERedirectType_None == Result) && NewPin && OldPin)
	{
		if ((EGPD_Output == NewPin->Direction) && (EGPD_Output == OldPin->Direction))
		{
			const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>();
			if (K2Schema->ArePinTypesCompatible(NewPin->PinType, OldPin->PinType))
			{
				Result = ERedirectType_Custom;
			}
		}
		else if ((EGPD_Input == NewPin->Direction) && (EGPD_Input == OldPin->Direction))
		{
			TMap<FName, FName>* StructRedirects = UStruct::TaggedPropertyRedirects.Find(StructType->GetFName());
			if (StructRedirects)
			{
				FName* PropertyRedirect = StructRedirects->Find(FName(*OldPin->PinName));
				if (PropertyRedirect)
				{
					Result = ((FCString::Stricmp(*PropertyRedirect->ToString(), *NewPin->PinName) != 0) ? ERedirectType_None : ERedirectType_Name);
				}
			}
		}
	}
	return Result;
}
Ejemplo n.º 20
0
void FBaseParser::InsertMetaDataPair(TMap<FName, FString>& MetaData, const FString& InKey, const FString& InValue)
{
	FString Key = InKey;
	FString Value = InValue;

	// trim extra white space and quotes
	Key = Key.Trim().TrimTrailing();
	Value = Value.Trim().TrimTrailing();
	Value = Value.TrimQuotes();

	// make sure the key is valid
	if (InKey.Len() == 0)
	{
		FError::Throwf(TEXT("Invalid metadata"));
	}

	FName KeyName(*Key);

	FString* ExistingValue = MetaData.Find(KeyName);
	if (ExistingValue && Value != *ExistingValue)
	{
		FError::Throwf(TEXT("Metadata key '%s' first seen with value '%s' then '%s'"), *Key, **ExistingValue, *Value);
	}

	// finally we have enough to put it into our metadata
	MetaData.Add(FName(*Key), *Value);
}
Ejemplo n.º 21
0
void FGAGameEffectContainer::InternalCheckPeriodicEffectStacking(const FGAGameEffectHandle& HandleIn)
{
	UGAGameEffectSpec* Spec = HandleIn.GetEffectSpec();
	//sEGAEffectStacking Stacking = Spec->EffectStacking;
	EGAEffectAggregation Aggregation = Spec->EffectAggregation;
	EGAEffectStacking Stacking = HandleIn.GetEffectSpec()->EffectStacking;
	UE_LOG(GameAttributes, Log, TEXT("Stacking Type: %s"), *EnumToString::GetStatckingAsString(Stacking));
	FGAGameEffectHandle* Handle = nullptr;
	switch (Aggregation)
	{
		case EGAEffectAggregation::AggregateByInstigator:
		{
			TMap<FName, TSet<FGAGameEffectHandle>>* EffectHandle = InstigatorEffectHandles.Find(HandleIn.GetContextRef().Instigator.Get());
			TSet<FGAGameEffectHandle>* HandleSet = nullptr;
			if (EffectHandle)
			{
				HandleSet = EffectHandle->Find(HandleIn.GetEffectSpec()->GetFName());
				if (HandleSet)
				{
					Handle = HandleSet->Find(HandleIn);
				}
			}
		}
		case EGAEffectAggregation::AggregateByTarget:
		{
			TSet<FGAGameEffectHandle>* HandleSet = TargetEffectByType.Find(HandleIn.GetEffectSpec()->GetFName());
			if (HandleSet)
			{
				Handle = HandleSet->Find(HandleIn);
			}
			break;
		}
	}
	switch (Stacking)
	{
		case EGAEffectStacking::Add:
		{
			break;
		}
		case EGAEffectStacking::Duration:
		{
			break;
		}
		case EGAEffectStacking::Intensity:
		{
			break;
		}
		case EGAEffectStacking::Override:
		{
			break;
		}
		case EGAEffectStacking::StrongerOverride:
		{
			InternalApplyPeriodic(HandleIn);
			break;
		}
	}
	InternalApplyEffectByAggregation(HandleIn);
}
Ejemplo n.º 22
0
void FWidgetTemplateClass::OnObjectsReplaced(const TMap<UObject*, UObject*>& ReplacementMap)
{
	UObject* const* NewObject = ReplacementMap.Find(WidgetClass.Get());
	if (NewObject)
	{
		WidgetClass = CastChecked<UClass>(*NewObject);
	}
}
void FStateMachineConnectionDrawingPolicy::DetermineLinkGeometry(
	TMap<TSharedRef<SWidget>, FArrangedWidget>& PinGeometries,
	FArrangedChildren& ArrangedNodes, 
	TSharedRef<SWidget>& OutputPinWidget,
	UEdGraphPin* OutputPin,
	UEdGraphPin* InputPin,
	/*out*/ FArrangedWidget*& StartWidgetGeometry,
	/*out*/ FArrangedWidget*& EndWidgetGeometry
	)
{
	if (UAnimStateEntryNode* EntryNode = Cast<UAnimStateEntryNode>(OutputPin->GetOwningNode()))
	{
		//FConnectionDrawingPolicy::DetermineLinkGeometry(PinGeometries, ArrangedNodes, OutputPinWidget, OutputPin, InputPin, StartWidgetGeometry, EndWidgetGeometry);

		StartWidgetGeometry = PinGeometries.Find(OutputPinWidget);

		UAnimStateNodeBase* State = CastChecked<UAnimStateNodeBase>(InputPin->GetOwningNode());
		int32 StateIndex = NodeWidgetMap.FindChecked(State);
		EndWidgetGeometry = &(ArrangedNodes(StateIndex));
	}
	else if (UAnimStateTransitionNode* TransNode = Cast<UAnimStateTransitionNode>(InputPin->GetOwningNode()))
	{
		UAnimStateNodeBase* PrevState = TransNode->GetPreviousState();
		UAnimStateNodeBase* NextState = TransNode->GetNextState();
		if ((PrevState != NULL) && (NextState != NULL))
		{
			int32* PrevNodeIndex = NodeWidgetMap.Find(PrevState);
			int32* NextNodeIndex = NodeWidgetMap.Find(NextState);
			if ((PrevNodeIndex != NULL) && (NextNodeIndex != NULL))
			{
				StartWidgetGeometry = &(ArrangedNodes(*PrevNodeIndex));
				EndWidgetGeometry = &(ArrangedNodes(*NextNodeIndex));
			}
		}
	}
	else
	{
		StartWidgetGeometry = PinGeometries.Find(OutputPinWidget);

		if (TSharedRef<SGraphPin>* pTargetWidget = PinToPinWidgetMap.Find(InputPin))
		{
			TSharedRef<SGraphPin> InputWidget = *pTargetWidget;
			EndWidgetGeometry = PinGeometries.Find(InputWidget);
		}
	}
}
	virtual void DisassociateSuppress(FLogCategoryBase* Destination)
	{
		FName* Name = Associations.Find(Destination);
		if (Name)
		{
			verify(ReverseAssociations.Remove(*Name, Destination)==1);
			verify(Associations.Remove(Destination) == 1);
		}
	}
Ejemplo n.º 25
0
TSharedRef<FObjectBindingNode> FSequencerNodeTree::AddObjectBinding(const FString& ObjectName, const FGuid& ObjectBinding, TMap<FGuid, const FMovieSceneBinding*>& GuidToBindingMap, TArray< TSharedRef<FSequencerDisplayNode> >& OutNodeList)
{
	TSharedPtr<FObjectBindingNode> ObjectNode;
	TSharedPtr<FObjectBindingNode>* FoundObjectNode = ObjectBindingMap.Find(ObjectBinding);
	if (FoundObjectNode != nullptr)
	{
		ObjectNode = *FoundObjectNode;
	}
	else
	{
		// The node name is the object guid
		FName ObjectNodeName = *ObjectBinding.ToString();

		// Try to get the parent object node if there is one.
		TSharedPtr<FObjectBindingNode> ParentNode;
		TArray<UObject*> RuntimeObjects;
		UMovieSceneSequence* Animation = Sequencer.GetFocusedMovieSceneSequence();
		UObject* RuntimeObject = Animation->FindObject(ObjectBinding);
		if ( RuntimeObject != nullptr)
		{
			UObject* ParentObject = Animation->GetParentObject(RuntimeObject);
			if (ParentObject != nullptr)
			{
				FGuid ParentBinding = Animation->FindObjectId(*ParentObject);
				TSharedPtr<FObjectBindingNode>* FoundParentNode = ObjectBindingMap.Find( ParentBinding );
				if ( FoundParentNode != nullptr )
				{
					ParentNode = *FoundParentNode;
				}
				else
				{
					const FMovieSceneBinding** FoundParentMovieSceneBinding = GuidToBindingMap.Find( ParentBinding );
					if ( FoundParentMovieSceneBinding != nullptr )
					{
						ParentNode = AddObjectBinding( (*FoundParentMovieSceneBinding)->GetName(), ParentBinding, GuidToBindingMap, OutNodeList );
					}
				}
			}
		}

		// Create the node.
		ObjectNode = MakeShareable( new FObjectBindingNode( ObjectNodeName, ObjectName, ObjectBinding, ParentNode, *this ) );
		if (ParentNode.IsValid())
		{
			ParentNode->AddObjectBindingNode(ObjectNode.ToSharedRef());
		}
		else
		{
			OutNodeList.Add( ObjectNode.ToSharedRef() );
		}

		// Map the guid to the object binding node for fast lookup later
		ObjectBindingMap.Add( ObjectBinding, ObjectNode );
	}

	return ObjectNode.ToSharedRef();
}
Ejemplo n.º 26
0
int CMarkovWordGenerator::GenerateUnique (int iCount, TArray<CString> *retArray)

//	GenerateUnique
//
//	Generates an array of unique words

	{
	int i;
	TMap<CString, DWORD> Generated;

	for (i = 0; i < iCount; i++)
		{
		int iTriesLeft = 500;

		while (iTriesLeft > 0)
			{
			//	Generate a random word

			CString sWord = Generate();

			//	Lookup the word in our map. If we found it,
			//	try again.

			if (Generated.Find(sWord))
				{
				iTriesLeft--;
				continue;
				}

			//	If it is unique, add it

			Generated.Insert(sWord, 1);
			break;
			}

		//	If we couldn't find a unique word, then quit

		if (iTriesLeft == 0)
			break;
		}

	//	Add the entries that we generated to the output array

	CMapIterator j;
	Generated.Reset(j);
	int iGeneratedCount = 0;
	while (Generated.HasMore(j))
		{
		DWORD *pDummy;
		CString sWord = Generated.GetNext(j, &pDummy);
		retArray->Insert(sWord);
		iGeneratedCount++;
		}

	return iGeneratedCount;
	}
Ejemplo n.º 27
0
bool FCollection::LoadHeaderPairs(const TMap<FString,FString>& InHeaderPairs)
{
	// These pairs will appeared at the top of the file being loaded
	// First find all the known pairs
	const FString* Version = InHeaderPairs.Find(TEXT("FileVersion"));
	if ( !Version )
	{
		// FileVersion is required
		return false;
	}

	const FString* Type = InHeaderPairs.Find(TEXT("Type"));
	if ( !Type )
	{
		// Type is required
		return false;
	}

	FileVersion = (ECollectionVersion::Type)FCString::Atoi(**Version);

	if (FileVersion >= ECollectionVersion::AddedCollectionGuid)
	{
		const FString* GuidStr = InHeaderPairs.Find(TEXT("Guid"));
		if ( !GuidStr || !FGuid::Parse(*GuidStr, CollectionGuid) )
		{
			// Guid is required
			return false;
		}

		const FString* ParentGuidStr = InHeaderPairs.Find(TEXT("ParentGuid"));
		if ( !ParentGuidStr || !FGuid::Parse(*ParentGuidStr, ParentCollectionGuid) )
		{
			ParentCollectionGuid = FGuid();
		}
	}

	if ( *Type == TEXT("Dynamic") )
	{
		// @todo Set this file up to be dynamic
	}

	return FileVersion > 0 && FileVersion <= ECollectionVersion::CurrentVersion;
}
Ejemplo n.º 28
0
PxScene* GetPhysXSceneFromIndex(int32 InSceneIndex)
{
	apex::Scene** ScenePtr = GPhysXSceneMap.Find(InSceneIndex);
	if(ScenePtr != NULL)
	{
		return (*ScenePtr)->getPhysXScene();
	}

	return NULL;
}
Ejemplo n.º 29
0
PxScene* GetPhysXSceneFromIndex(int32 InSceneIndex)
{
	PxScene** ScenePtr = GPhysXSceneMap.Find(InSceneIndex);
	if(ScenePtr != NULL)
	{
		return *ScenePtr;
	}

	return NULL;
}
void FConnectionDrawingPolicy::DetermineLinkGeometry(
	TMap<TSharedRef<SWidget>,
	FArrangedWidget>& PinGeometries,
	FArrangedChildren& ArrangedNodes, 
	TSharedRef<SWidget>& OutputPinWidget,
	UEdGraphPin* OutputPin,
	UEdGraphPin* InputPin,
	/*out*/ FArrangedWidget*& StartWidgetGeometry,
	/*out*/ FArrangedWidget*& EndWidgetGeometry
	)
{
	StartWidgetGeometry = PinGeometries.Find(OutputPinWidget);
	
	if (TSharedRef<SGraphPin>* pTargetWidget = PinToPinWidgetMap.Find(InputPin))
	{
		TSharedRef<SGraphPin> InputWidget = *pTargetWidget;
		EndWidgetGeometry = PinGeometries.Find(InputWidget);
	}
}