FString UK2Node_Tunnel::CreateUniquePinName(FString InSourcePinName) const
{
	if (GetClass() == UK2Node_Tunnel::StaticClass())
	{
		// When dealing with a tunnel node that is not a sub class (macro/collapsed graph entry and result), attempt to find the paired node and find a valid name between the two
		TWeakObjectPtr<UK2Node_EditablePinBase> TunnelEntry;
		TWeakObjectPtr<UK2Node_EditablePinBase> TunnelResult;
		FBlueprintEditorUtils::GetEntryAndResultNodes(GetGraph(), TunnelEntry, TunnelResult);

		if (TunnelEntry.IsValid() && TunnelResult.IsValid())
		{
			FString PinName(InSourcePinName);

			int32 Index = 1;
			while (TunnelEntry.Get()->FindPin(PinName) != nullptr || TunnelResult.Get()->FindPin(PinName) != nullptr)
			{
				++Index;
				PinName = InSourcePinName + FString::FromInt(Index);
			}

			return PinName;
		}
	}

	return Super::CreateUniquePinName(InSourcePinName);
}
	FORCEINLINE bool operator()( const TWeakObjectPtr< UObject >& Lhs, const TWeakObjectPtr< UObject >& Rhs ) const
	{
		const bool LhsObjectValid = Lhs.IsValid();
		if ( !LhsObjectValid )
		{
			return true;
		}

		const bool RhsObjectValid = Rhs.IsValid();
		if ( !RhsObjectValid )
		{
			return false;
		}

		const UStruct* const PropertyTargetType = Property->GetOwnerStruct();
		const UClass* const LhsClass = Lhs->GetClass();

		if ( !LhsClass->IsChildOf( PropertyTargetType ) )
		{
			return true;
		}

		const UClass* const RhsClass = Rhs->GetClass();

		if ( !RhsClass->IsChildOf( PropertyTargetType ) )
		{
			return false;
		}

		typename UPropertyType::TCppType LhsValue = Property->GetPropertyValue_InContainer(Lhs.Get());
		typename UPropertyType::TCppType RhsValue = Property->GetPropertyValue_InContainer(Rhs.Get());

		return ComparePropertyValue( LhsValue, RhsValue );
	}
Exemplo n.º 3
0
void FVertexSnappingImpl::DrawSnappingHelpers(const FSceneView* View,FPrimitiveDrawInterface* PDI)
{
	if( ActorVertsToDraw.IsValid() )
	{
		float PointSize = View->IsPerspectiveProjection() ? 4.0f : 5.0f;
		DrawSnapVertices( ActorVertsToDraw.Get(), PointSize, PDI );
	}

	for( auto It = ActorVertsToFade.CreateIterator(); It; ++It )
	{
		TWeakObjectPtr<AActor> Actor = It.Key();
		double FadeStart = It.Value();

		if( Actor.IsValid() )
		{
			float PointSize = View->IsPerspectiveProjection() ? 4.0f : 5.0f;

			if( FApp::GetCurrentTime()-FadeStart <= VertexSnappingConstants::FadeTime )
			{
				PointSize = FMath::Lerp( PointSize, 0.0f, (FApp::GetCurrentTime()-FadeStart)/VertexSnappingConstants::FadeTime );

				DrawSnapVertices( Actor.Get(), PointSize, PDI );
			}
		}
	
		if( !Actor.IsValid() || FApp::GetCurrentTime()-FadeStart > VertexSnappingConstants::FadeTime )
		{
			It.RemoveCurrent();
		}
	}
}
void FBPProfilerStat::OnNavigateToObject()
{
	switch(ObjectContext.GetType())
	{
		case EScriptInstrumentation::Class:
		{
			break;
		}
		case EScriptInstrumentation::Instance:
		{
			break;
		}
		case EScriptInstrumentation::Event:
		case EScriptInstrumentation::Function:
		case EScriptInstrumentation::Branch:
		case EScriptInstrumentation::Macro:
		default:
		{
			TWeakObjectPtr<const UObject> ObjectPtr = ObjectContext.GetObjectPtr();
			if (ObjectPtr.IsValid())
			{
				FKismetEditorUtilities::BringKismetToFocusAttentionOnObject(ObjectPtr.Get());
			}
			break;
		}
	}
}
void FOneSkyLocalizationServiceProvider::ImportAllCulturesForTargetFromOneSky(TWeakObjectPtr<ULocalizationTarget> LocalizationTarget, bool bIsTargetSet)
{
	check(LocalizationTarget.IsValid());

	if (!bIsTargetSet)
	{
		GWarn->BeginSlowTask(LOCTEXT("ImportingFromLocalizationService", "Importing Latest from Localization Service..."), true);
	}

	FString EngineOrGamePath = LocalizationTarget->IsMemberOfEngineTargetSet() ? "Engine" : "Game";

	for (FCultureStatistics CultureStats : LocalizationTarget->Settings.SupportedCulturesStatistics)
	{
		ILocalizationServiceProvider& Provider = ILocalizationServiceModule::Get().GetProvider();
		TSharedRef<FDownloadLocalizationTargetFile, ESPMode::ThreadSafe> DownloadTargetFileOp = ILocalizationServiceOperation::Create<FDownloadLocalizationTargetFile>();
		DownloadTargetFileOp->SetInTargetGuid(LocalizationTarget->Settings.Guid);
		DownloadTargetFileOp->SetInLocale(CultureStats.CultureName);

		// Put the intermediary .po files in a temporary directory in Saved for now
		FString Path = FPaths::ProjectSavedDir() / "Temp" / EngineOrGamePath / LocalizationTarget->Settings.Name / CultureStats.CultureName / LocalizationTarget->Settings.Name + ".po";
		FPaths::MakePathRelativeTo(Path, *FPaths::ProjectDir());
		DownloadTargetFileOp->SetInRelativeOutputFilePathAndName(Path);

		FilesDownloadingForImportFromOneSky.Add(Path);
		IPlatformFile &PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
		// Delete this file if it exists so we don't accidentally import old data
		PlatformFile.DeleteFile(*Path);

		auto OperationCompleteDelegate = FLocalizationServiceOperationComplete::CreateRaw(this, &FOneSkyLocalizationServiceProvider::ImportCultureForTargetFromOneSky_Callback, bIsTargetSet);

		Provider.Execute(DownloadTargetFileOp, TArray<FLocalizationServiceTranslationIdentifier>(), ELocalizationServiceOperationConcurrency::Asynchronous, OperationCompleteDelegate);
	}
}
Exemplo n.º 6
0
void SDetailsView::RemoveInvalidObjects()
{
	TArray< TWeakObjectPtr< UObject > > ResetArray;

	bool bAllFound = true;
	
	for(const TSharedPtr<FComplexPropertyNode>& ComplexRootNode : RootPropertyNodes)
	{
		FObjectPropertyNode* RootPropertyNode = ComplexRootNode->AsObjectNode();
		if(RootPropertyNode)
		{
			for(TPropObjectIterator Itor(RootPropertyNode->ObjectIterator()); Itor; ++Itor)
			{
				TWeakObjectPtr<UObject> Object = *Itor;

				if(Object.IsValid() && !Object->IsPendingKill())
				{
					ResetArray.Add(Object);
				}
				else
				{
					bAllFound = false;
				}
			}
		}
	}

	if (!bAllFound)
	{
		SetObjectArrayPrivate(ResetArray);
	}
}
Exemplo n.º 7
0
void FLayers::RemoveActorFromStats( const TWeakObjectPtr< ULayer >& Layer, const TWeakObjectPtr< AActor >& Actor )
{
	if( !Actor.IsValid() )
	{
		return;
	}

	UClass* ActorClass = Actor->GetClass();

	bool bFoundClassStats = false;
	for (int StatsIndex = 0; StatsIndex < Layer->ActorStats.Num() ; StatsIndex++)
	{
		FLayerActorStats& Stats = Layer->ActorStats[ StatsIndex ];

		if( Stats.Type == ActorClass )
		{
			bFoundClassStats = true;
			--Stats.Total;

			if( Stats.Total == 0 )
			{
				Layer->ActorStats.RemoveAt( StatsIndex );
			}
			break;
		}
	}

	if( bFoundClassStats )
	{
		LayersChanged.Broadcast( ELayersAction::Modify, Layer, TEXT( "ActorStats" ) );
	}
}
Exemplo n.º 8
0
void FLayers::AddActorToStats( const TWeakObjectPtr< ULayer >& Layer, const TWeakObjectPtr< AActor >& Actor )
{
	if( !Actor.IsValid() )
	{
		return;
	}

	UClass* ActorClass = Actor->GetClass();

	bool bFoundClassStats = false;
	for( auto StatsIt = Layer->ActorStats.CreateIterator(); StatsIt; ++StatsIt )
	{
		FLayerActorStats& Stats = *StatsIt;

		if( Stats.Type == ActorClass )
		{
			Stats.Total++;
			bFoundClassStats = true;
			break;
		}
	}

	if( !bFoundClassStats )
	{
		FLayerActorStats NewActorStats;
		NewActorStats.Total = 1;
		NewActorStats.Type = ActorClass;

		Layer->ActorStats.Add( NewActorStats );
	}

	LayersChanged.Broadcast( ELayersAction::Modify, Layer, TEXT( "ActorStats" ) );
}
Exemplo n.º 9
0
	/** Called to modify the owner of the curve */
	virtual void ModifyOwner()
	{
		if (BaseSequence.IsValid())
		{
			BaseSequence.Get()->Modify(true);
		}
	}
	virtual void TrackingStopped() override 
	{
		if (Widget.IsValid() && Widget->OnTrackingStopped.IsBound())
		{
			Widget->OnTrackingStopped.Execute(Widget.Get());
		}
	}
void FPropertyTableColumn::Tick()
{
	if ( !DataSource->AsPropertyPath().IsValid() )
	{
		const TSharedRef< IPropertyTable > TableRef = GetTable();
		const TWeakObjectPtr< UObject > Object = DataSource->AsUObject();

		if ( !Object.IsValid() )
		{
			TableRef->RemoveColumn( SharedThis( this ) );
		}
		else
		{
			const TSharedRef< FObjectPropertyNode > Node = TableRef->GetObjectPropertyNode( Object );
			EPropertyDataValidationResult Result = Node->EnsureDataIsValid();

			if ( Result == EPropertyDataValidationResult::ObjectInvalid )
			{
				TableRef->RemoveColumn( SharedThis( this ) );
			}
			else if ( Result == EPropertyDataValidationResult::ArraySizeChanged )
			{
				TableRef->RequestRefresh();
			}
		}
	}
}
Exemplo n.º 12
0
FVisualLogEntry::FVisualLogEntry(float InTimeStamp, FVector InLocation, const UObject* Object, TArray<TWeakObjectPtr<UObject> >* Children)
{
	TimeStamp = InTimeStamp;
	Location = InLocation;
	const AActor* AsActor = Cast<AActor>(Object);
	if (AsActor)
	{
		AsActor->GrabDebugSnapshot(this);
	}
	if (Children != NULL)
	{
		TWeakObjectPtr<UObject>* WeakActorPtr = Children->GetData();
		for (int32 Index = 0; Index < Children->Num(); ++Index, ++WeakActorPtr)
		{
			if (WeakActorPtr->IsValid())
			{
				const AActor* ChildActor = Cast<AActor>(WeakActorPtr->Get());
				if (ChildActor)
				{
					ChildActor->GrabDebugSnapshot(this);
				}
			}
		}
	}
}
	virtual void TrackingStarted(const struct FInputEventState& InInputState, bool bIsDraggingWidget, bool bNudge) override
	{
		if (Widget.IsValid() && Widget->OnTrackingStarted.IsBound())
		{
			Widget->OnTrackingStarted.Execute(FJavascriptInputEventState(InInputState), bIsDraggingWidget, bNudge, Widget.Get());
		}
	}
	/** Called to make curve owner transactional */
	virtual void MakeTransactional() override
	{
		if (BaseSequence.IsValid())
		{
			BaseSequence.Get()->SetFlags(BaseSequence.Get()->GetFlags() | RF_Transactional);
		}
	}
	virtual void MouseMove(FViewport* Viewport, int32 x, int32 y) override
	{
		FEditorViewportClient::MouseMove(Viewport, x, y);
		if (Widget.IsValid() && Widget->OnMouseMove.IsBound())
		{
			Widget->OnMouseMove.Execute(x, y, Widget.Get());
		}
	}
	virtual void MouseLeave(FViewport* Viewport) override
	{
		FEditorViewportClient::MouseLeave(Viewport);
		if (Widget.IsValid() && Widget->OnMouseLeave.IsBound())
		{
			Widget->OnMouseLeave.Execute(Widget.Get());
		}
	}
Exemplo n.º 17
0
	FAnimCurveBaseInterface(UAnimSequenceBase * BaseSeq, FAnimCurveBase*	InData)
		: BaseSequence(BaseSeq)
		, CurveData(InData)
	{
		// they should be valid
		check (BaseSequence.IsValid());
		check (CurveData);
	}
Exemplo n.º 18
0
	virtual UObject* GetOwner()
	{
		if (BaseSequence.IsValid())
		{
			return BaseSequence.Get();
		}

		return NULL;
	}
	/** Called to modify the owner of the curve */
	virtual void ModifyOwner() override
	{
		if (BaseSequence.IsValid())
		{
			// need to rebake
			BaseSequence.Get()->bNeedsRebake = true;
			BaseSequence.Get()->Modify(true);
		}
	}
Exemplo n.º 20
0
	FAnimCurveBaseInterface( UAnimSequenceBase * BaseSeq, USkeleton::AnimCurveUID InCurveUID)
		: BaseSequence(BaseSeq)
		, CurveUID(InCurveUID)
	{
		CurveData = BaseSequence.Get()->RawCurveData.GetCurveData( CurveUID );
		// they should be valid
		check (BaseSequence.IsValid());
		check (CurveData);
	}
	virtual void Draw(const FSceneView* View, FPrimitiveDrawInterface* PDI) override
	{
		FEditorViewportClient::Draw(View, PDI);

		if (Widget.IsValid() && Widget->OnDraw.IsBound())
		{
			Widget->OnDraw.Execute(FJavascriptPDI(PDI),Widget.Get());
		}
	}
void SDetailNameArea::BuildObjectNameAreaSelectionLabel( TSharedRef< SHorizontalBox > SelectionLabelBox, const TWeakObjectPtr<UObject> ObjectWeakPtr, const int32 NumSelectedObjects ) 
{
	check( NumSelectedObjects > 1 || ObjectWeakPtr.IsValid() );

	if( NumSelectedObjects == 1 )
	{
		UClass* ObjectClass = ObjectWeakPtr.Get()->GetClass();
		if( ObjectClass != nullptr )
		{
			SelectionLabelBox->AddSlot()
				.AutoWidth()
				.VAlign( VAlign_Center )
				.HAlign( HAlign_Left )
				.Padding( 1.0f, 1.0f, 0.0f, 0.0f )
				[
					FEditorClassUtils::GetDocumentationLinkWidget(ObjectClass)
				];


			if( ObjectClass && ObjectClass->ClassGeneratedBy == nullptr && ObjectClass->GetOutermost() )
			{
				const FString ModuleName = FPackageName::GetShortName(ObjectClass->GetOutermost()->GetFName());

				FModuleStatus PackageModuleStatus;
				if(FModuleManager::Get().QueryModule(*ModuleName, PackageModuleStatus))
				{
					if( PackageModuleStatus.bIsGameModule ) 
					{
						SelectionLabelBox->AddSlot()
						.AutoWidth()
						.VAlign(VAlign_Center)
						.HAlign(HAlign_Left)
						.Padding(6.0f, 1.0f, 0.0f, 0.0f)
						[
							FEditorClassUtils::GetSourceLink(ObjectClass, ObjectWeakPtr)
						];
					}
				}
			}
		
		}
	}
	else
	{
		const FText SelectionText = FText::Format( LOCTEXT("MultipleObjectsSelectedFmt", "{0} objects"), FText::AsNumber(NumSelectedObjects) );
		SelectionLabelBox->AddSlot()
		.VAlign(VAlign_Center)
		.HAlign( HAlign_Left )
		.FillWidth( 1.0f )
		[
			SNew(STextBlock)
			.Text( SelectionText )
		];

	}
}
Exemplo n.º 23
0
bool FPropertyEditor::GetEditConditionPropertyAddress( UBoolProperty*& ConditionProperty, FPropertyNode& InPropertyNode, TArray<FPropertyConditionInfo>& ConditionPropertyAddresses )
{
	bool bResult = false;
	bool bNegate = false;
	UBoolProperty* EditConditionProperty = PropertyCustomizationHelpers::GetEditConditionProperty(InPropertyNode.GetProperty(), bNegate);
	if ( EditConditionProperty != NULL )
	{
		FPropertyNode* ParentNode = InPropertyNode.GetParentNode();
		check(ParentNode);

		UProperty* Property = InPropertyNode.GetProperty();
		if (Property)
		{
			bool bStaticArray = (Property->ArrayDim > 1) && (InPropertyNode.GetArrayIndex() != INDEX_NONE);
			if (bStaticArray)
			{
				//in the case of conditional static arrays, we have to go up one more level to get the proper parent struct.
				ParentNode = ParentNode->GetParentNode();
				check(ParentNode);
			}
		}

		auto ComplexParentNode = ParentNode->FindComplexParent();
		if (ComplexParentNode)
		{
			for (int32 Index = 0; Index < ComplexParentNode->GetInstancesNum(); ++Index)
			{
				TWeakObjectPtr<UObject> Object = ComplexParentNode->GetInstanceAsUObject(Index);

			if( Object.IsValid() )
			{
				UObject* Obj = Object.Get();

				// Get the address corresponding to the base of this property (i.e. if a struct property, set BaseOffset to the address of value for the whole struct)
				uint8* BaseOffset = ParentNode->GetValueAddress((uint8*)Obj);
				check(BaseOffset != NULL);

				FPropertyConditionInfo NewCondition;
				// now calculate the address of the property value being used as the condition and add it to the array.
				NewCondition.Address = EditConditionProperty->ContainerPtrToValuePtr<uint8>(BaseOffset);
				NewCondition.bNegateValue = bNegate;
				ConditionPropertyAddresses.Add(NewCondition);
				bResult = true;
			}
		}
	}
	}

	if ( bResult )
	{
		// set the output variable
		ConditionProperty = EditConditionProperty;
	}

	return bResult;
}
	FORCEINLINE bool operator()(const TWeakObjectPtr<AActor>& A) const
	{
		if (A.IsValid())
		{
			bool IsChild = A->GetClass()->IsChildOf(ClassFilter);
			return Negate ? !IsChild : IsChild;
		}
		
		return true; // Default to removal
	}
	FAnimTrackCurveBaseInterface(UAnimSequence * BaseSeq, USkeleton::AnimCurveUID InCurveUID, ETransformCurve::Type InCurveType)
		: BaseSequence(BaseSeq)
		, CurveUID(InCurveUID)
		, CurveType(InCurveType)
	{
		CurveData = GetCurveDataFromSequence();
		// they should be valid
		check (BaseSequence.IsValid());
		check (CurveData);
	}
	virtual void ProcessClick(class FSceneView& View, class HHitProxy* HitProxy, FKey Key, EInputEvent Event, uint32 HitX, uint32 HitY) override
	{
		if (Widget.IsValid() && Widget->OnClick.IsBound())
		{
			FJavascriptHitProxy Proxy;
			Proxy.HitProxy = HitProxy;
			FViewportClick Click(&View, this, Key, Event, HitX, HitY);
			Widget->OnClick.Execute(FJavascriptViewportClick(&Click), Proxy, Widget.Get());
		}
	}
Exemplo n.º 27
0
TArray<AActor*> URPGEffectBase::SpreadEffect(URPGEffectBase* EffectIn, FVector FromLoc, float Radius, int32 MaxTargets)
{
	TArray<AActor*> ActorHits;
	if ((!GetWorld()))
		return ActorHits;

	TWeakObjectPtr<URPGEffectPeriodic> PeriodicEffect = Cast<URPGEffectPeriodic>(EffectIn);

	float TargetCounter = 0;
	//EffectSpec.SetEffect();

	FCollisionQueryParams SphereParams(this->GetFName(), false, CausedBy);
	//make sure we have world

	TArray<FOverlapResult> Overlaps;
	GetWorld()->OverlapMulti(Overlaps, FromLoc, FQuat::Identity, FCollisionShape::MakeSphere(Radius), SphereParams, FCollisionObjectQueryParams(FCollisionObjectQueryParams::InitType::AllDynamicObjects));


	for (FOverlapResult& overlap : Overlaps)
	{
		ActorHits.AddUnique(overlap.GetActor());
	}

	if (ActorHits.Num() > 0)
	{
		int32 TargetCounter = 0;
		if (MaxTargets > TargetCounter)
		{
			TargetCounter++;
			for (AActor* ActorHit : ActorHits)
			{
				URPGAttributeComponent* HitActorAttribute = ActorHit->FindComponentByClass<URPGAttributeComponent>();

				if (HitActorAttribute)
				{
					if (PeriodicEffect.IsValid())
					{
						PeriodicEffect->SetTarget(ActorHit);
						PeriodicEffect->PreInitialize();
						PeriodicEffect->Initialize();
						HitActorAttribute->ApplyPeriodicEffect(PeriodicEffect.Get());
						continue;
					}
					EffectIn->SetTarget(ActorHit);

					EffectIn->PreInitialize();
					EffectIn->Initialize();
				}
			}

		}
	}

	return ActorHits;
}
Exemplo n.º 28
0
//------------------------------------------------------------------------------
void FBlueprintActionDatabase::Tick(float DeltaTime)
{
	const double DurationThreshold = FMath::Min(0.003, DeltaTime * 0.01);

	// entries that were removed from the database, in preparation for a delete
	// (but the user ended up not deleting the object)
	for (UObject* AssetObj : BlueprintActionDatabaseImpl::PendingDelete)
	{
		if (IsValid(AssetObj))
		{
			RefreshAssetActions(AssetObj);
		}
	}
	BlueprintActionDatabaseImpl::PendingDelete.Empty();

	
	// priming every database entry at once would cause a hitch, so we spread it 
	// out over several frames
	static int32 const PrimingMaxPerFrame = 16;
	int32 PrimedCount = 0;

	while ((ActionPrimingQueue.Num() > 0) && (PrimedCount < PrimingMaxPerFrame))
	{
		auto ActionIndex = ActionPrimingQueue.CreateIterator();	
			
		TWeakObjectPtr<UObject> ActionsKey = ActionIndex.Key();
		if (ActionsKey.IsValid())
		{
			// make sure this class is still listed in the database
			if (FActionList* ClassActionList = ActionRegistry.Find(ActionsKey.Get()))
			{
				int32& ActionListIndex = ActionIndex.Value();
				for (; (ActionListIndex < ClassActionList->Num()) && (PrimedCount < PrimingMaxPerFrame); ++ActionListIndex)
				{
					UBlueprintNodeSpawner* Action = (*ClassActionList)[ActionListIndex];
					Action->Prime();
					++PrimedCount;
				}

				if (ActionListIndex >= ClassActionList->Num())
				{
					ActionPrimingQueue.Remove(ActionsKey);
				}
			}
			else
			{
				ActionPrimingQueue.Remove(ActionsKey);
			}
		}
		else
		{
			ActionPrimingQueue.Remove(ActionsKey);
		}
	}
}
	virtual FMatrix GetWidgetCoordSystem() const override
	{
		if (Widget.IsValid() && Widget->OnGetWidgetRotation.IsBound())
		{
			return FRotationMatrix(Widget->OnGetWidgetRotation.Execute(Widget.Get()));
		}
		else
		{
			return FEditorViewportClient::GetWidgetCoordSystem();
		}
	}
	virtual FVector GetWidgetLocation() const override
	{
		if (Widget.IsValid() && Widget->OnGetWidgetLocation.IsBound())
		{
			return Widget->OnGetWidgetLocation.Execute(Widget.Get());
		}
		else
		{
			return FEditorViewportClient::GetWidgetLocation();
		}
	}